Stripped-down standalone build that runs w/ normal GYP
2
.gitignore
vendored
@@ -1,2 +1,4 @@
|
||||
.DS_Store
|
||||
.svn
|
||||
*.xcodeproj
|
||||
build
|
||||
|
||||
26
AUTHORS.txt
@@ -1,26 +0,0 @@
|
||||
# This file is an addendum to the Chromium AUTHORS file.
|
||||
# Names should be added to this file like so:
|
||||
# Name or Organization <email address>
|
||||
|
||||
Marshall Greenblatt <magreenblatt@gmail.com>
|
||||
Jamie Kirkpatrick <jkp@spotify.com>
|
||||
Johan Lindström <johanl@spotify.com>
|
||||
Igor Pavlov <igor.arabesc.pavlov@gmail.com>
|
||||
Yanko Yankov <yyankov@gmail.com>
|
||||
Emerick Rogul <emerick@gmail.com>
|
||||
Valve Corporation <mac@valvesoftware.com>
|
||||
Anthony Taranto <anthony.taranto@gmail.com>
|
||||
Joe Andrieu <joe@joeandrieu.com>
|
||||
Keith Poole <platima@gmail.com>
|
||||
Aviv Rind <avivrind@gmail.com>
|
||||
Michael Kaminski <mikeyk730@gmail.com>
|
||||
ADInstruments Ltd. <dev.team@adinstruments.com>
|
||||
Gus Verdun <gusverdun@gmail.com>
|
||||
Joinerysoft Ltd. <cpinfold@joinerysoft.com>
|
||||
Johan Björk <phb@spotify.com>
|
||||
Dmitry Azaraev <dmitry.azaraev@gmail.com>
|
||||
David Xue <ddxue27@gmail.com>
|
||||
Russell (Rusty) Richards <fe3o4y@gmail.com>
|
||||
Brian Power <powerbf.it@gmail.com>
|
||||
Corey Lucier <clucier@adobe.com>
|
||||
Mihai Tica <mitica@adobe.com>
|
||||
@@ -1,20 +0,0 @@
|
||||
# The Chromium Embedded Framework (CEF) project is built on top of the Chromium
|
||||
# project source tree. Chromium should be updated to the URL and revision listed
|
||||
# below before building CEF. Chromium compatibility information for older CEF
|
||||
# revisions is available by viewing this file's change history.
|
||||
#
|
||||
# To configure a specific Chromium URL:
|
||||
# gclient config chromium_url
|
||||
#
|
||||
# To update to a specific Chromium revision:
|
||||
# gclient sync --revision src@chromium_revision --jobs 8 --force
|
||||
#
|
||||
# This file is integrated with the CEF Automation Tool. See the
|
||||
# tools/automate/automate.README.txt file for more information.
|
||||
#
|
||||
# For general gclient usage information visit:
|
||||
# http://dev.chromium.org/developers/how-tos/get-the-code
|
||||
|
||||
{
|
||||
'release_url': 'http://src.chromium.org/svn/releases/21.0.1180.18',
|
||||
}
|
||||
7
DEPS
@@ -1,7 +0,0 @@
|
||||
hooks = [
|
||||
{
|
||||
# A change to a .gyp, .gypi, or to GYP itself should run the generator.
|
||||
"pattern": ".",
|
||||
"action": ["python", "src/cef/tools/gclient_hook.py"],
|
||||
},
|
||||
]
|
||||
29
LICENSE.txt
@@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2008-2012 Marshall A. Greenblatt. Portions Copyright (c)
|
||||
// 2006-2009 Google Inc. All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without
|
||||
// modification, are permitted provided that the following conditions are
|
||||
// met:
|
||||
//
|
||||
// * Redistributions of source code must retain the above copyright
|
||||
// notice, this list of conditions and the following disclaimer.
|
||||
// * Redistributions in binary form must reproduce the above
|
||||
// copyright notice, this list of conditions and the following disclaimer
|
||||
// in the documentation and/or other materials provided with the
|
||||
// distribution.
|
||||
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
||||
// Framework nor the names of its contributors may be used to endorse
|
||||
// or promote products derived from this software without specific prior
|
||||
// written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -1,57 +0,0 @@
|
||||
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
||||
# Use of this source code is governed by a BSD-style license that can be
|
||||
# found in the LICENSE file.
|
||||
|
||||
# This file is meant to be included into a target to provide a rule
|
||||
# to build APK based test suites.
|
||||
#
|
||||
# To use this, create a gyp target with the following form:
|
||||
# {
|
||||
# 'target_name': 'test_suite_name_apk',
|
||||
# 'type': 'none',
|
||||
# 'variables': {
|
||||
# 'test_suite_name': 'test_suite_name', # string
|
||||
# 'input_shlib_path' : '/path/to/test_suite.so', # string
|
||||
# 'input_jars_paths': ['/path/to/test_suite.jar', ... ], # list
|
||||
# },
|
||||
# 'includes': ['path/to/this/gypi/file'],
|
||||
# }
|
||||
#
|
||||
|
||||
{
|
||||
'target_conditions': [
|
||||
['_toolset == "target"', {
|
||||
'conditions': [
|
||||
['OS == "android" and gtest_target_type == "shared_library"', {
|
||||
'actions': [{
|
||||
'action_name': 'apk_<(test_suite_name)',
|
||||
'message': 'Building <(test_suite_name) test apk.',
|
||||
'inputs': [
|
||||
'<(DEPTH)/testing/android/AndroidManifest.xml',
|
||||
'<(DEPTH)/testing/android/generate_native_test.py',
|
||||
'<(input_shlib_path)',
|
||||
'<@(input_jars_paths)',
|
||||
],
|
||||
'outputs': [
|
||||
'<(PRODUCT_DIR)/<(test_suite_name)_apk/<(test_suite_name)-debug.apk',
|
||||
],
|
||||
'action': [
|
||||
'<(DEPTH)/testing/android/generate_native_test.py',
|
||||
'--native_library',
|
||||
'<(input_shlib_path)',
|
||||
'--jars',
|
||||
'"<@(input_jars_paths)"',
|
||||
'--output',
|
||||
'<(PRODUCT_DIR)/<(test_suite_name)_apk',
|
||||
'--app_abi',
|
||||
'<(android_app_abi)',
|
||||
'--ant-args',
|
||||
'-DPRODUCT_DIR=<(ant_build_out)',
|
||||
'--ant-compile'
|
||||
],
|
||||
}],
|
||||
}], # 'OS == "android" and gtest_target_type == "shared_library"
|
||||
], # conditions
|
||||
}],
|
||||
], # target_conditions
|
||||
}
|
||||
204
atom.gyp
@@ -6,9 +6,22 @@
|
||||
'variables': {
|
||||
'pkg-config': 'pkg-config',
|
||||
'chromium_code': 1,
|
||||
'use_aura%': 0,
|
||||
'conditions': [
|
||||
['OS=="win"', {
|
||||
'os_posix': 0,
|
||||
}, {
|
||||
'os_posix': 1,
|
||||
}],
|
||||
# Set toolkit_uses_gtk for the Chromium browser on Linux.
|
||||
['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0', {
|
||||
'toolkit_uses_gtk%': 1,
|
||||
}, {
|
||||
'toolkit_uses_gtk%': 0,
|
||||
}],
|
||||
],
|
||||
},
|
||||
'includes': [
|
||||
# Bring in the source file lists.
|
||||
'cef_paths2.gypi',
|
||||
],
|
||||
'targets': [
|
||||
@@ -25,59 +38,62 @@
|
||||
],
|
||||
'include_dirs': [
|
||||
'.',
|
||||
# cefclient includes are relative to the tests directory to make
|
||||
# creation of binary releases easier.
|
||||
'tests',
|
||||
'atom',
|
||||
],
|
||||
'sources': [
|
||||
'<@(includes_common)',
|
||||
'<@(includes_wrapper)',
|
||||
'atom/cefclient/cefclient.cpp',
|
||||
'atom/cefclient/cefclient.h',
|
||||
'atom/cefclient/binding_test.cpp',
|
||||
'atom/cefclient/binding_test.h',
|
||||
'atom/cefclient/client_app.cpp',
|
||||
'atom/cefclient/client_app.h',
|
||||
'atom/cefclient/client_app_delegates.cpp',
|
||||
'atom/cefclient/client_handler.cpp',
|
||||
'atom/cefclient/client_handler.h',
|
||||
'atom/cefclient/client_renderer.cpp',
|
||||
'atom/cefclient/client_renderer.h',
|
||||
'atom/cefclient/client_switches.cpp',
|
||||
'atom/cefclient/client_switches.h',
|
||||
'atom/cefclient/dom_test.cpp',
|
||||
'atom/cefclient/dom_test.h',
|
||||
'atom/cefclient/res/binding.html',
|
||||
'atom/cefclient/res/dialogs.html',
|
||||
'atom/cefclient/res/domaccess.html',
|
||||
'atom/cefclient/res/localstorage.html',
|
||||
'atom/cefclient/res/logo.png',
|
||||
'atom/cefclient/res/xmlhttprequest.html',
|
||||
'atom/cefclient/resource_util.h',
|
||||
'atom/cefclient/scheme_test.cpp',
|
||||
'atom/cefclient/scheme_test.h',
|
||||
'atom/cefclient/string_util.cpp',
|
||||
'atom/cefclient/string_util.h',
|
||||
'atom/cefclient/util.h',
|
||||
'tests/cefclient/cefclient.cpp',
|
||||
'tests/cefclient/cefclient.h',
|
||||
'tests/cefclient/binding_test.cpp',
|
||||
'tests/cefclient/binding_test.h',
|
||||
'tests/cefclient/client_app.cpp',
|
||||
'tests/cefclient/client_app.h',
|
||||
'tests/cefclient/client_app_delegates.cpp',
|
||||
'tests/cefclient/client_handler.cpp',
|
||||
'tests/cefclient/client_handler.h',
|
||||
'tests/cefclient/client_renderer.cpp',
|
||||
'tests/cefclient/client_renderer.h',
|
||||
'tests/cefclient/client_switches.cpp',
|
||||
'tests/cefclient/client_switches.h',
|
||||
'tests/cefclient/dom_test.cpp',
|
||||
'tests/cefclient/dom_test.h',
|
||||
'tests/cefclient/res/binding.html',
|
||||
'tests/cefclient/res/dialogs.html',
|
||||
'tests/cefclient/res/domaccess.html',
|
||||
'tests/cefclient/res/localstorage.html',
|
||||
'tests/cefclient/res/logo.png',
|
||||
'tests/cefclient/res/xmlhttprequest.html',
|
||||
'tests/cefclient/resource_util.h',
|
||||
'tests/cefclient/scheme_test.cpp',
|
||||
'tests/cefclient/scheme_test.h',
|
||||
'tests/cefclient/string_util.cpp',
|
||||
'tests/cefclient/string_util.h',
|
||||
'tests/cefclient/util.h',
|
||||
],
|
||||
'mac_bundle_resources': [
|
||||
'atom/cefclient/mac/Atom.icns',
|
||||
'atom/cefclient/mac/English.lproj/InfoPlist.strings',
|
||||
'atom/cefclient/mac/English.lproj/MainMenu.xib',
|
||||
'atom/cefclient/mac/Info.plist',
|
||||
'atom/cefclient/res/binding.html',
|
||||
'atom/cefclient/res/dialogs.html',
|
||||
'atom/cefclient/res/domaccess.html',
|
||||
'atom/cefclient/res/localstorage.html',
|
||||
'atom/cefclient/res/logo.png',
|
||||
'atom/cefclient/res/xmlhttprequest.html',
|
||||
'tests/cefclient/mac/cefclient.icns',
|
||||
'tests/cefclient/mac/English.lproj/InfoPlist.strings',
|
||||
'tests/cefclient/mac/English.lproj/MainMenu.xib',
|
||||
'tests/cefclient/mac/Info.plist',
|
||||
'tests/cefclient/res/binding.html',
|
||||
'tests/cefclient/res/dialogs.html',
|
||||
'tests/cefclient/res/domaccess.html',
|
||||
'tests/cefclient/res/localstorage.html',
|
||||
'tests/cefclient/res/logo.png',
|
||||
'tests/cefclient/res/xmlhttprequest.html',
|
||||
],
|
||||
'mac_bundle_resources!': [
|
||||
# TODO(mark): Come up with a fancier way to do this (mac_info_plist?)
|
||||
# that automatically sets the correct INFOPLIST_FILE setting and adds
|
||||
# the file to a source group.
|
||||
'atom/cefclient/mac/Info.plist',
|
||||
'tests/cefclient/mac/Info.plist',
|
||||
],
|
||||
'xcode_settings': {
|
||||
'INFOPLIST_FILE': 'atom/cefclient/mac/Info.plist',
|
||||
'INFOPLIST_FILE': 'tests/cefclient/mac/Info.plist',
|
||||
# Necessary to avoid an "install_name_tool: changing install names or
|
||||
# rpaths can't be redone" error.
|
||||
'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'],
|
||||
@@ -161,37 +177,14 @@
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Create Resources Directory In Bundle',
|
||||
'action': [
|
||||
'mkdir',
|
||||
'-p',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources'
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Copy Pack File',
|
||||
'postbuild_name': 'Copy Framework Resources Directory',
|
||||
'action': [
|
||||
'cp',
|
||||
'-f',
|
||||
'cef/cef.pak',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/cef.pak'
|
||||
'-r',
|
||||
'cef/Resources',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/'
|
||||
],
|
||||
},
|
||||
{
|
||||
'postbuild_name': 'Copy WebCore Resources',
|
||||
'action': [
|
||||
'cp',
|
||||
'-Rf',
|
||||
'${BUILT_PRODUCTS_DIR}/../../third_party/WebKit/Source/WebCore/Resources/',
|
||||
'${BUILT_PRODUCTS_DIR}/Atom.app/Contents/Frameworks/Chromium Embedded Framework.framework/Resources/'
|
||||
],
|
||||
},
|
||||
{
|
||||
# Modify the Info.plist as needed.
|
||||
'postbuild_name': 'Tweak Info.plist',
|
||||
'action': ['../build/mac/tweak_info_plist.py',
|
||||
'--svn=1'],
|
||||
},
|
||||
{
|
||||
# This postbuid step is responsible for creating the following
|
||||
# helpers:
|
||||
@@ -203,7 +196,7 @@
|
||||
# is marked for no PIE (ASLR).
|
||||
'postbuild_name': 'Make More Helpers',
|
||||
'action': [
|
||||
'../build/mac/make_more_helpers.sh',
|
||||
'cef/mac/make_more_helpers.sh',
|
||||
'Frameworks',
|
||||
'Atom',
|
||||
],
|
||||
@@ -218,9 +211,9 @@
|
||||
'include/cef_application_mac.h',
|
||||
'include/internal/cef_mac.h',
|
||||
'include/internal/cef_types_mac.h',
|
||||
'atom/cefclient/cefclient_mac.mm',
|
||||
'atom/cefclient/client_handler_mac.mm',
|
||||
'atom/cefclient/resource_util_mac.mm',
|
||||
'tests/cefclient/cefclient_mac.mm',
|
||||
'tests/cefclient/client_handler_mac.mm',
|
||||
'tests/cefclient/resource_util_mac.mm',
|
||||
],
|
||||
}],
|
||||
[ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
|
||||
@@ -243,7 +236,8 @@
|
||||
'target_name': 'libcef_dll_wrapper',
|
||||
'type': 'static_library',
|
||||
'msvs_guid': 'A9D6DC71-C0DC-4549-AEA0-3B15B44E86A9',
|
||||
'dependencies': [ ],
|
||||
'dependencies': [
|
||||
],
|
||||
'defines': [
|
||||
'USING_CEF_SHARED',
|
||||
],
|
||||
@@ -260,7 +254,7 @@
|
||||
'libraries': [
|
||||
'cef/libcef.dylib',
|
||||
],
|
||||
},
|
||||
}
|
||||
},
|
||||
],
|
||||
'conditions': [
|
||||
@@ -287,7 +281,9 @@
|
||||
],
|
||||
'include_dirs': [
|
||||
'.',
|
||||
'atom'
|
||||
# cefclient includes are relative to the tests directory to make
|
||||
# creation of binary releases easier.
|
||||
'tests'
|
||||
],
|
||||
'link_settings': {
|
||||
'libraries': [
|
||||
@@ -295,34 +291,34 @@
|
||||
],
|
||||
},
|
||||
'sources': [
|
||||
'atom/cefclient/binding_test.cpp',
|
||||
'atom/cefclient/binding_test.h',
|
||||
'atom/cefclient/client_app.cpp',
|
||||
'atom/cefclient/client_app.h',
|
||||
'atom/cefclient/client_app_delegates.cpp',
|
||||
'atom/cefclient/client_handler.cpp',
|
||||
'atom/cefclient/client_handler.h',
|
||||
'atom/cefclient/client_handler_mac.mm',
|
||||
'atom/cefclient/client_renderer.cpp',
|
||||
'atom/cefclient/client_renderer.h',
|
||||
'atom/cefclient/client_switches.cpp',
|
||||
'atom/cefclient/client_switches.h',
|
||||
'atom/cefclient/dom_test.cpp',
|
||||
'atom/cefclient/dom_test.h',
|
||||
'atom/cefclient/process_helper_mac.cpp',
|
||||
'atom/cefclient/resource_util.h',
|
||||
'atom/cefclient/resource_util_mac.mm',
|
||||
'atom/cefclient/scheme_test.cpp',
|
||||
'atom/cefclient/scheme_test.h',
|
||||
'atom/cefclient/string_util.cpp',
|
||||
'atom/cefclient/string_util.h',
|
||||
'atom/cefclient/util.h',
|
||||
'tests/cefclient/binding_test.cpp',
|
||||
'tests/cefclient/binding_test.h',
|
||||
'tests/cefclient/client_app.cpp',
|
||||
'tests/cefclient/client_app.h',
|
||||
'tests/cefclient/client_app_delegates.cpp',
|
||||
'tests/cefclient/client_handler.cpp',
|
||||
'tests/cefclient/client_handler.h',
|
||||
'tests/cefclient/client_handler_mac.mm',
|
||||
'tests/cefclient/client_renderer.cpp',
|
||||
'tests/cefclient/client_renderer.h',
|
||||
'tests/cefclient/client_switches.cpp',
|
||||
'tests/cefclient/client_switches.h',
|
||||
'tests/cefclient/dom_test.cpp',
|
||||
'tests/cefclient/dom_test.h',
|
||||
'tests/cefclient/process_helper_mac.cpp',
|
||||
'tests/cefclient/resource_util.h',
|
||||
'tests/cefclient/resource_util_mac.mm',
|
||||
'tests/cefclient/scheme_test.cpp',
|
||||
'tests/cefclient/scheme_test.h',
|
||||
'tests/cefclient/string_util.cpp',
|
||||
'tests/cefclient/string_util.h',
|
||||
'tests/cefclient/util.h',
|
||||
],
|
||||
# TODO(mark): Come up with a fancier way to do this. It should only
|
||||
# be necessary to list helper-Info.plist once, not the three times it
|
||||
# is listed here.
|
||||
'mac_bundle_resources!': [
|
||||
'atom/cefclient/mac/helper-Info.plist',
|
||||
'tests/cefclient/mac/helper-Info.plist',
|
||||
],
|
||||
# TODO(mark): For now, don't put any resources into this app. Its
|
||||
# resources directory will be a symbolic link to the browser app's
|
||||
@@ -331,7 +327,7 @@
|
||||
['exclude', '.*'],
|
||||
],
|
||||
'xcode_settings': {
|
||||
'INFOPLIST_FILE': 'atom/cefclient/mac/helper-Info.plist',
|
||||
'INFOPLIST_FILE': 'tests/cefclient/mac/helper-Info.plist',
|
||||
# Necessary to avoid an "install_name_tool: changing install names or
|
||||
# rpaths can't be redone" error.
|
||||
'OTHER_LDFLAGS': ['-Wl,-headerpad_max_install_names'],
|
||||
@@ -351,18 +347,6 @@
|
||||
'${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}'
|
||||
],
|
||||
},
|
||||
{
|
||||
# Modify the Info.plist as needed. The script explains why this
|
||||
# is needed. This is also done in the chrome and chrome_dll
|
||||
# targets. In this case, --breakpad=0, --keystone=0, and --svn=0
|
||||
# are used because Breakpad, Keystone, and Subversion keys are
|
||||
# never placed into the helper.
|
||||
'postbuild_name': 'Tweak Info.plist',
|
||||
'action': ['./chromium/build/mac/tweak_info_plist.py',
|
||||
'--breakpad=0',
|
||||
'--keystone=0',
|
||||
'--svn=0'],
|
||||
},
|
||||
],
|
||||
}, # target cefclient_helper_app
|
||||
],
|
||||
|
||||
@@ -19,19 +19,64 @@
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
<key>cef_locales.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>69</integer>
|
||||
</dict>
|
||||
<key>cef_pak.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>205</integer>
|
||||
</dict>
|
||||
<key>cef_resources.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>169</integer>
|
||||
</dict>
|
||||
<key>cef_strings.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>385</integer>
|
||||
</dict>
|
||||
<key>libcef.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>315</integer>
|
||||
</dict>
|
||||
<key>libcef_dll_wrapper.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>libcef_static.xcscheme</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>198</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>SuppressBuildableAutocreation</key>
|
||||
<dict>
|
||||
<key>25F476607D9077B40DBE5F3E</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>3049F5DBF2E857E3D2CA729A</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>3CC3640C42727188246F6C25</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>42BFDBA927D226AA7A34C15C</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>440934281E3BAF0A1212AEAE</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
@@ -47,6 +92,21 @@
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>8FBD8DFB47D41B1B0E71281A</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>A671A7000975F90FDFE4BA1D</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<key>FD25F65598E25BB48DC2FA7F</key>
|
||||
<dict>
|
||||
<key>primary</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/binding_test.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
||||
#include "include/wrapper/cef_stream_resource_handler.h"
|
||||
#include "cefclient/resource_util.h"
|
||||
|
||||
namespace binding_test {
|
||||
|
||||
namespace {
|
||||
|
||||
const char* kTestUrl = "http://tests/binding";
|
||||
const char* kMessageName = "binding_test";
|
||||
|
||||
// Handle messages in the browser process.
|
||||
class ProcessMessageDelegate : public ClientHandler::ProcessMessageDelegate {
|
||||
public:
|
||||
ProcessMessageDelegate() {
|
||||
}
|
||||
|
||||
// From ClientHandler::ProcessMessageDelegate.
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<ClientHandler> handler,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE {
|
||||
std::string message_name = message->GetName();
|
||||
if (message_name == kMessageName) {
|
||||
// Handle the message.
|
||||
std::string result;
|
||||
|
||||
CefRefPtr<CefListValue> args = message->GetArgumentList();
|
||||
if (args->GetSize() > 0 && args->GetType(0) == VTYPE_STRING) {
|
||||
// Our result is a reverse of the original message.
|
||||
result = args->GetString(0);
|
||||
std::reverse(result.begin(), result.end());
|
||||
} else {
|
||||
result = "Invalid request";
|
||||
}
|
||||
|
||||
// Send the result back to the render process.
|
||||
CefRefPtr<CefProcessMessage> response =
|
||||
CefProcessMessage::Create(kMessageName);
|
||||
response->GetArgumentList()->SetString(0, result);
|
||||
browser->SendProcessMessage(PID_RENDERER, response);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ProcessMessageDelegate);
|
||||
};
|
||||
|
||||
// Handle resource loading in the browser process.
|
||||
class RequestDelegate: public ClientHandler::RequestDelegate {
|
||||
public:
|
||||
RequestDelegate() {
|
||||
}
|
||||
|
||||
// From ClientHandler::RequestDelegate.
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
|
||||
CefRefPtr<ClientHandler> handler,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) OVERRIDE {
|
||||
std::string url = request->GetURL();
|
||||
if (url == kTestUrl) {
|
||||
// Show the binding contents
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
GetBinaryResourceReader("binding.html");
|
||||
ASSERT(stream.get());
|
||||
return new CefStreamResourceHandler("text/html", stream);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IMPLEMENT_REFCOUNTING(RequestDelegate);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void CreateProcessMessageDelegates(
|
||||
ClientHandler::ProcessMessageDelegateSet& delegates) {
|
||||
delegates.insert(new ProcessMessageDelegate);
|
||||
}
|
||||
|
||||
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates) {
|
||||
delegates.insert(new RequestDelegate);
|
||||
}
|
||||
|
||||
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||
// Load the test URL.
|
||||
browser->GetMainFrame()->LoadURL(kTestUrl);
|
||||
}
|
||||
|
||||
} // namespace binding_test
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_BINDING_TEST_H_
|
||||
#define CEF_TESTS_CEFCLIENT_BINDING_TEST_H_
|
||||
#pragma once
|
||||
|
||||
#include "cefclient/client_app.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
|
||||
namespace binding_test {
|
||||
|
||||
// Delegate creation. Called from ClientApp and ClientHandler.
|
||||
void CreateProcessMessageDelegates(
|
||||
ClientHandler::ProcessMessageDelegateSet& delegates);
|
||||
void CreateRequestDelegates(ClientHandler::RequestDelegateSet& delegates);
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
} // namespace binding_test
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_BINDING_TEST_H_
|
||||
@@ -1,336 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/cefclient.h"
|
||||
#include <stdio.h>
|
||||
#include <cstdlib>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "include/cef_app.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_command_line.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "include/cef_web_plugin.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/client_switches.h"
|
||||
#include "cefclient/string_util.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
// Return the int representation of the specified string.
|
||||
int GetIntValue(const CefString& str) {
|
||||
if (str.empty())
|
||||
return 0;
|
||||
|
||||
std::string stdStr = str;
|
||||
return atoi(stdStr.c_str());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
CefRefPtr<ClientHandler> g_handler;
|
||||
CefRefPtr<CefCommandLine> g_command_line;
|
||||
|
||||
CefRefPtr<CefBrowser> AppGetBrowser() {
|
||||
if (!g_handler.get())
|
||||
return NULL;
|
||||
return g_handler->GetBrowser();
|
||||
}
|
||||
|
||||
CefWindowHandle AppGetMainHwnd() {
|
||||
if (!g_handler.get())
|
||||
return NULL;
|
||||
return g_handler->GetMainHwnd();
|
||||
}
|
||||
|
||||
void AppInitCommandLine(int argc, const char* const* argv) {
|
||||
g_command_line = CefCommandLine::CreateCommandLine();
|
||||
#if defined(OS_WIN)
|
||||
g_command_line->InitFromString(::GetCommandLineW());
|
||||
#else
|
||||
g_command_line->InitFromArgv(argc, argv);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Returns the application command line object.
|
||||
CefRefPtr<CefCommandLine> AppGetCommandLine() {
|
||||
return g_command_line;
|
||||
}
|
||||
|
||||
// Returns the application settings based on command line arguments.
|
||||
void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app) {
|
||||
ASSERT(app.get());
|
||||
ASSERT(g_command_line.get());
|
||||
if (!g_command_line.get())
|
||||
return;
|
||||
|
||||
CefString str;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
settings.multi_threaded_message_loop =
|
||||
g_command_line->HasSwitch(cefclient::kMultiThreadedMessageLoop);
|
||||
#endif
|
||||
|
||||
CefString(&settings.cache_path) =
|
||||
g_command_line->GetSwitchValue(cefclient::kCachePath);
|
||||
|
||||
// Retrieve command-line proxy configuration, if any.
|
||||
bool has_proxy = false;
|
||||
cef_proxy_type_t proxy_type = PROXY_TYPE_DIRECT;
|
||||
CefString proxy_config;
|
||||
|
||||
if (g_command_line->HasSwitch(cefclient::kProxyType)) {
|
||||
std::string str = g_command_line->GetSwitchValue(cefclient::kProxyType);
|
||||
if (str == cefclient::kProxyType_Direct) {
|
||||
has_proxy = true;
|
||||
proxy_type = PROXY_TYPE_DIRECT;
|
||||
} else if (str == cefclient::kProxyType_Named ||
|
||||
str == cefclient::kProxyType_Pac) {
|
||||
proxy_config = g_command_line->GetSwitchValue(cefclient::kProxyConfig);
|
||||
if (!proxy_config.empty()) {
|
||||
has_proxy = true;
|
||||
proxy_type = (str == cefclient::kProxyType_Named?
|
||||
PROXY_TYPE_NAMED:PROXY_TYPE_PAC_STRING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (has_proxy) {
|
||||
// Provide a ClientApp instance to handle proxy resolution.
|
||||
app->SetProxyConfig(proxy_type, proxy_config);
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the application browser settings based on command line arguments.
|
||||
void AppGetBrowserSettings(CefBrowserSettings& settings) {
|
||||
ASSERT(g_command_line.get());
|
||||
if (!g_command_line.get())
|
||||
return;
|
||||
|
||||
settings.remote_fonts_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kRemoteFontsDisabled);
|
||||
|
||||
CefString(&settings.default_encoding) =
|
||||
g_command_line->GetSwitchValue(cefclient::kDefaultEncoding);
|
||||
|
||||
settings.encoding_detector_enabled =
|
||||
g_command_line->HasSwitch(cefclient::kEncodingDetectorEnabled);
|
||||
settings.javascript_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kJavascriptDisabled);
|
||||
settings.javascript_open_windows_disallowed =
|
||||
g_command_line->HasSwitch(cefclient::kJavascriptOpenWindowsDisallowed);
|
||||
settings.javascript_close_windows_disallowed =
|
||||
g_command_line->HasSwitch(cefclient::kJavascriptCloseWindowsDisallowed);
|
||||
settings.javascript_access_clipboard_disallowed =
|
||||
g_command_line->HasSwitch(
|
||||
cefclient::kJavascriptAccessClipboardDisallowed);
|
||||
settings.dom_paste_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kDomPasteDisabled);
|
||||
settings.caret_browsing_enabled =
|
||||
g_command_line->HasSwitch(cefclient::kCaretBrowsingDisabled);
|
||||
settings.java_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kJavaDisabled);
|
||||
settings.plugins_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kPluginsDisabled);
|
||||
settings.universal_access_from_file_urls_allowed =
|
||||
g_command_line->HasSwitch(cefclient::kUniversalAccessFromFileUrlsAllowed);
|
||||
settings.file_access_from_file_urls_allowed =
|
||||
g_command_line->HasSwitch(cefclient::kFileAccessFromFileUrlsAllowed);
|
||||
settings.web_security_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kWebSecurityDisabled);
|
||||
settings.xss_auditor_enabled =
|
||||
g_command_line->HasSwitch(cefclient::kXssAuditorEnabled);
|
||||
settings.image_load_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kImageLoadingDisabled);
|
||||
settings.shrink_standalone_images_to_fit =
|
||||
g_command_line->HasSwitch(cefclient::kShrinkStandaloneImagesToFit);
|
||||
settings.site_specific_quirks_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kSiteSpecificQuirksDisabled);
|
||||
settings.text_area_resize_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kTextAreaResizeDisabled);
|
||||
settings.page_cache_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kPageCacheDisabled);
|
||||
settings.tab_to_links_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kTabToLinksDisabled);
|
||||
settings.hyperlink_auditing_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kHyperlinkAuditingDisabled);
|
||||
settings.user_style_sheet_enabled =
|
||||
g_command_line->HasSwitch(cefclient::kUserStyleSheetEnabled);
|
||||
|
||||
CefString(&settings.user_style_sheet_location) =
|
||||
g_command_line->GetSwitchValue(cefclient::kUserStyleSheetLocation);
|
||||
|
||||
settings.author_and_user_styles_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kAuthorAndUserStylesDisabled);
|
||||
settings.local_storage_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kLocalStorageDisabled);
|
||||
settings.databases_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kDatabasesDisabled);
|
||||
settings.application_cache_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kApplicationCacheDisabled);
|
||||
settings.webgl_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kWebglDisabled);
|
||||
settings.accelerated_compositing_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kAcceleratedCompositingDisabled);
|
||||
settings.accelerated_layers_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kAcceleratedLayersDisabled);
|
||||
settings.accelerated_video_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kAcceleratedVideoDisabled);
|
||||
settings.accelerated_2d_canvas_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kAcceledated2dCanvasDisabled);
|
||||
settings.accelerated_painting_enabled =
|
||||
g_command_line->HasSwitch(cefclient::kAcceleratedPaintingEnabled);
|
||||
settings.accelerated_filters_enabled =
|
||||
g_command_line->HasSwitch(cefclient::kAcceleratedFiltersEnabled);
|
||||
settings.accelerated_plugins_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kAcceleratedPluginsDisabled);
|
||||
settings.developer_tools_disabled =
|
||||
g_command_line->HasSwitch(cefclient::kDeveloperToolsDisabled);
|
||||
settings.fullscreen_enabled =
|
||||
g_command_line->HasSwitch(cefclient::kFullscreenEnabled);
|
||||
}
|
||||
|
||||
void RunGetSourceTest(CefRefPtr<CefBrowser> browser) {
|
||||
class Visitor : public CefStringVisitor {
|
||||
public:
|
||||
explicit Visitor(CefRefPtr<CefBrowser> browser) : browser_(browser) {}
|
||||
virtual void Visit(const CefString& string) OVERRIDE {
|
||||
std::string source = StringReplace(string, "<", "<");
|
||||
source = StringReplace(source, ">", ">");
|
||||
std::stringstream ss;
|
||||
ss << "<html><body>Source:<pre>" << source << "</pre></body></html>";
|
||||
browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/getsource");
|
||||
}
|
||||
private:
|
||||
CefRefPtr<CefBrowser> browser_;
|
||||
IMPLEMENT_REFCOUNTING(Visitor);
|
||||
};
|
||||
|
||||
browser->GetMainFrame()->GetSource(new Visitor(browser));
|
||||
}
|
||||
|
||||
void RunGetTextTest(CefRefPtr<CefBrowser> browser) {
|
||||
class Visitor : public CefStringVisitor {
|
||||
public:
|
||||
explicit Visitor(CefRefPtr<CefBrowser> browser) : browser_(browser) {}
|
||||
virtual void Visit(const CefString& string) OVERRIDE {
|
||||
std::string text = StringReplace(string, "<", "<");
|
||||
text = StringReplace(text, ">", ">");
|
||||
std::stringstream ss;
|
||||
ss << "<html><body>Text:<pre>" << text << "</pre></body></html>";
|
||||
browser_->GetMainFrame()->LoadString(ss.str(), "http://tests/gettext");
|
||||
}
|
||||
private:
|
||||
CefRefPtr<CefBrowser> browser_;
|
||||
IMPLEMENT_REFCOUNTING(Visitor);
|
||||
};
|
||||
|
||||
browser->GetMainFrame()->GetText(new Visitor(browser));
|
||||
}
|
||||
|
||||
void RunRequestTest(CefRefPtr<CefBrowser> browser) {
|
||||
// Create a new request
|
||||
CefRefPtr<CefRequest> request(CefRequest::Create());
|
||||
|
||||
// Set the request URL
|
||||
request->SetURL("http://tests/request");
|
||||
|
||||
// Add post data to the request. The correct method and content-
|
||||
// type headers will be set by CEF.
|
||||
CefRefPtr<CefPostDataElement> postDataElement(CefPostDataElement::Create());
|
||||
std::string data = "arg1=val1&arg2=val2";
|
||||
postDataElement->SetToBytes(data.length(), data.c_str());
|
||||
CefRefPtr<CefPostData> postData(CefPostData::Create());
|
||||
postData->AddElement(postDataElement);
|
||||
request->SetPostData(postData);
|
||||
|
||||
// Add a custom header
|
||||
CefRequest::HeaderMap headerMap;
|
||||
headerMap.insert(
|
||||
std::make_pair("X-My-Header", "My Header Value"));
|
||||
request->SetHeaderMap(headerMap);
|
||||
|
||||
// Load the request
|
||||
browser->GetMainFrame()->LoadRequest(request);
|
||||
}
|
||||
|
||||
void RunPopupTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->ExecuteJavaScript(
|
||||
"window.open('http://www.google.com');", "about:blank", 0);
|
||||
}
|
||||
|
||||
void RunDialogTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL("http://tests/dialogs");
|
||||
}
|
||||
|
||||
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser) {
|
||||
class Visitor : public CefWebPluginInfoVisitor {
|
||||
public:
|
||||
explicit Visitor(CefRefPtr<CefBrowser> browser)
|
||||
: browser_(browser) {
|
||||
html_ = "<html><head><title>Plugin Info Test</title></head><body>"
|
||||
"\n<b>Installed plugins:</b>";
|
||||
}
|
||||
~Visitor() {
|
||||
html_ += "\n</body></html>";
|
||||
|
||||
// Load the html in the browser.
|
||||
browser_->GetMainFrame()->LoadString(html_, "http://tests/plugin_info");
|
||||
}
|
||||
|
||||
virtual bool Visit(CefRefPtr<CefWebPluginInfo> info, int count, int total)
|
||||
OVERRIDE {
|
||||
html_ += "\n<br/><br/>Name: " + info->GetName().ToString() +
|
||||
"\n<br/>Description: " + info->GetDescription().ToString() +
|
||||
"\n<br/>Version: " + info->GetVersion().ToString() +
|
||||
"\n<br/>Path: " + info->GetPath().ToString();
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string html_;
|
||||
CefRefPtr<CefBrowser> browser_;
|
||||
IMPLEMENT_REFCOUNTING(Visitor);
|
||||
};
|
||||
|
||||
CefVisitWebPluginInfo(new Visitor(browser));
|
||||
}
|
||||
|
||||
void RunLocalStorageTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL("http://tests/localstorage");
|
||||
}
|
||||
|
||||
void RunAccelerated2DCanvasTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL(
|
||||
"http://mudcu.be/labs/JS1k/BreathingGalaxies.html");
|
||||
}
|
||||
|
||||
void RunAcceleratedLayersTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL(
|
||||
"http://webkit.org/blog-files/3d-transforms/poster-circle.html");
|
||||
}
|
||||
|
||||
void RunWebGLTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL(
|
||||
"http://webglsamples.googlecode.com/hg/field/field.html");
|
||||
}
|
||||
|
||||
void RunHTML5VideoTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL(
|
||||
"http://www.youtube.com/watch?v=siOHh0uzcuY&html5=True");
|
||||
}
|
||||
|
||||
void RunXMLHTTPRequestTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL("http://tests/xmlhttprequest");
|
||||
}
|
||||
|
||||
void RunDragDropTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL("http://html5demos.com/drag");
|
||||
}
|
||||
|
||||
void RunGeolocationTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL("http://html5demos.com/geo");
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_H_
|
||||
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_H_
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "include/cef_base.h"
|
||||
#include "cefclient/client_app.h"
|
||||
|
||||
class CefApp;
|
||||
class CefBrowser;
|
||||
class CefCommandLine;
|
||||
|
||||
// Returns the main browser window instance.
|
||||
CefRefPtr<CefBrowser> AppGetBrowser();
|
||||
|
||||
// Returns the main application window handle.
|
||||
CefWindowHandle AppGetMainHwnd();
|
||||
|
||||
// Returns the application working directory.
|
||||
std::string AppGetWorkingDirectory();
|
||||
|
||||
// Initialize the application command line.
|
||||
void AppInitCommandLine(int argc, const char* const* argv);
|
||||
|
||||
// Returns the application command line object.
|
||||
CefRefPtr<CefCommandLine> AppGetCommandLine();
|
||||
|
||||
// Returns the application settings based on command line arguments.
|
||||
void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> app);
|
||||
|
||||
// Returns the application browser settings based on command line arguments.
|
||||
void AppGetBrowserSettings(CefBrowserSettings& settings);
|
||||
|
||||
// Implementations for various tests.
|
||||
void RunGetSourceTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunGetTextTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunRequestTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunPopupTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunDialogTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunPluginInfoTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunLocalStorageTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunAccelerated2DCanvasTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunAcceleratedLayersTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunWebGLTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunHTML5VideoTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunXMLHTTPRequestTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunDragDropTest(CefRefPtr<CefBrowser> browser);
|
||||
void RunGeolocationTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
#if defined(OS_WIN)
|
||||
void RunTransparentPopupTest(CefRefPtr<CefBrowser> browser);
|
||||
#endif
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_H_
|
||||
@@ -1,172 +0,0 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "windows.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Binary
|
||||
//
|
||||
|
||||
IDS_BINDING BINARY "res\\binding.html"
|
||||
IDS_DIALOGS BINARY "res\\dialogs.html"
|
||||
IDS_LOGO BINARY "res\\logo.png"
|
||||
IDS_LOGOBALL BINARY "res\\logoball.png"
|
||||
IDS_LOCALSTORAGE BINARY "res\\localstorage.html"
|
||||
IDS_XMLHTTPREQUEST BINARY "res\\xmlhttprequest.html"
|
||||
IDS_DOMACCESS BINARY "res\\domaccess.html"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDI_CEFCLIENT ICON "res\cefclient.ico"
|
||||
IDI_SMALL ICON "res\small.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDC_CEFCLIENT MENU
|
||||
BEGIN
|
||||
POPUP "&File"
|
||||
BEGIN
|
||||
MENUITEM "E&xit", IDM_EXIT
|
||||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
MENUITEM "&About ...", IDM_ABOUT
|
||||
END
|
||||
POPUP "Tests"
|
||||
BEGIN
|
||||
MENUITEM "Get Source", ID_TESTS_GETSOURCE
|
||||
MENUITEM "Get Text", ID_TESTS_GETTEXT
|
||||
MENUITEM "Popup Window", ID_TESTS_POPUP
|
||||
MENUITEM "Request", ID_TESTS_REQUEST
|
||||
MENUITEM "Scheme Handler", ID_TESTS_SCHEME_HANDLER
|
||||
MENUITEM "JavaScript Binding", ID_TESTS_BINDING
|
||||
MENUITEM "JavaScript Dialogs", ID_TESTS_DIALOGS
|
||||
MENUITEM "Plugin Info", ID_TESTS_PLUGIN_INFO
|
||||
MENUITEM "DOM Access", ID_TESTS_DOM_ACCESS
|
||||
MENUITEM "Local Storage", ID_TESTS_LOCALSTORAGE
|
||||
MENUITEM "XMLHttpRequest", ID_TESTS_XMLHTTPREQUEST
|
||||
MENUITEM "Accelerated 2D Canvas", ID_TESTS_ACCELERATED2DCANVAS
|
||||
MENUITEM "Accelerated Layers", ID_TESTS_ACCELERATEDLAYERS
|
||||
MENUITEM "WebGL", ID_TESTS_WEBGL
|
||||
MENUITEM "HTML5 Video", ID_TESTS_HTML5VIDEO
|
||||
MENUITEM "Drag && Drop", ID_TESTS_DRAGDROP
|
||||
MENUITEM "Geolocation", ID_TESTS_GEOLOCATION
|
||||
MENUITEM "Zoom In", ID_TESTS_ZOOM_IN
|
||||
MENUITEM "Zoom Out", ID_TESTS_ZOOM_OUT
|
||||
MENUITEM "Zoom Reset", ID_TESTS_ZOOM_RESET
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDC_CEFCLIENT ACCELERATORS
|
||||
BEGIN
|
||||
"?", IDM_ABOUT, ASCII, ALT
|
||||
"/", IDM_ABOUT, ASCII, ALT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOG 22, 17, 230, 75
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About"
|
||||
FONT 8, "System"
|
||||
BEGIN
|
||||
ICON IDI_CEFCLIENT,IDC_MYICON,14,9,16,16
|
||||
LTEXT "cefclient Version 1.0",IDC_STATIC,49,10,119,8,SS_NOPREFIX
|
||||
LTEXT "Copyright (C) 2008",IDC_STATIC,49,20,119,8
|
||||
DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP
|
||||
END
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"#include ""windows.h""\r\n"
|
||||
"#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDS_APP_TITLE "cefclient"
|
||||
IDC_CEFCLIENT "CEFCLIENT"
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -1,408 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <string>
|
||||
#include "cefclient/cefclient.h"
|
||||
#include "include/cef_app.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
|
||||
char szWorkingDir[512]; // The current working directory
|
||||
|
||||
// The global ClientHandler reference.
|
||||
extern CefRefPtr<ClientHandler> g_handler;
|
||||
|
||||
void destroy(void) {
|
||||
CefQuitMessageLoop();
|
||||
}
|
||||
|
||||
void TerminationSignalHandler(int signatl) {
|
||||
destroy();
|
||||
}
|
||||
|
||||
// Callback for Debug > Get Source... menu item.
|
||||
gboolean GetSourceActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunGetSourceTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Get Source... menu item.
|
||||
gboolean GetTextActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunGetTextTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Request... menu item.
|
||||
gboolean RequestActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunRequestTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Local Storage... menu item.
|
||||
gboolean LocalStorageActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunLocalStorageTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > XMLHttpRequest... menu item.
|
||||
gboolean XMLHttpRequestActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunXMLHTTPRequestTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Scheme Handler... menu item.
|
||||
gboolean SchemeHandlerActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
scheme_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > JavaScript Binding... menu item.
|
||||
gboolean BindingActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
binding_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Plugin Info... menu item.
|
||||
gboolean PluginInfoActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunPluginInfoTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > DOM Access... menu item.
|
||||
gboolean DOMAccessActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
dom_test::RunTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Popup Window... menu item.
|
||||
gboolean PopupWindowActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunPopupTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Accelerated 2D Canvas... menu item.
|
||||
gboolean Accelerated2DCanvasActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunAccelerated2DCanvasTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Accelerated Layers... menu item.
|
||||
gboolean AcceleratedLayersActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunAcceleratedLayersTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > WebGL... menu item.
|
||||
gboolean WebGLActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunWebGLTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > HTML5 Video... menu item.
|
||||
gboolean HTML5VideoActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunHTML5VideoTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > HTML5 Drag & Drop... menu item.
|
||||
gboolean HTML5DragDropActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunDragDropTest(g_handler->GetBrowser());
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
|
||||
// Callback for Debug > Zoom In... menu item.
|
||||
gboolean ZoomInActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() + 0.5);
|
||||
}
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Zoom Out... menu item.
|
||||
gboolean ZoomOutActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() - 0.5);
|
||||
}
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for Debug > Zoom Reset... menu item.
|
||||
gboolean ZoomResetActivated(GtkWidget* widget) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(0.0);
|
||||
}
|
||||
|
||||
return FALSE; // Don't stop this message.
|
||||
}
|
||||
|
||||
// Callback for when you click the back button.
|
||||
void BackButtonClicked(GtkButton* button) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->GoBack();
|
||||
}
|
||||
|
||||
// Callback for when you click the forward button.
|
||||
void ForwardButtonClicked(GtkButton* button) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->GoForward();
|
||||
}
|
||||
|
||||
// Callback for when you click the stop button.
|
||||
void StopButtonClicked(GtkButton* button) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->StopLoad();
|
||||
}
|
||||
|
||||
// Callback for when you click the reload button.
|
||||
void ReloadButtonClicked(GtkButton* button) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->Reload();
|
||||
}
|
||||
|
||||
// Callback for when you press enter in the URL box.
|
||||
void URLEntryActivate(GtkEntry* entry) {
|
||||
if (!g_handler.get() || !g_handler->GetBrowserId())
|
||||
return;
|
||||
|
||||
const gchar* url = gtk_entry_get_text(entry);
|
||||
g_handler->GetBrowser()->GetMainFrame()->LoadURL(std::string(url).c_str());
|
||||
}
|
||||
|
||||
// GTK utility functions ----------------------------------------------
|
||||
|
||||
GtkWidget* AddMenuEntry(GtkWidget* menu_widget, const char* text,
|
||||
GCallback callback) {
|
||||
GtkWidget* entry = gtk_menu_item_new_with_label(text);
|
||||
g_signal_connect(entry, "activate", callback, NULL);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu_widget), entry);
|
||||
return entry;
|
||||
}
|
||||
|
||||
GtkWidget* CreateMenu(GtkWidget* menu_bar, const char* text) {
|
||||
GtkWidget* menu_widget = gtk_menu_new();
|
||||
GtkWidget* menu_header = gtk_menu_item_new_with_label(text);
|
||||
gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_header), menu_widget);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), menu_header);
|
||||
return menu_widget;
|
||||
}
|
||||
|
||||
GtkWidget* CreateMenuBar() {
|
||||
GtkWidget* menu_bar = gtk_menu_bar_new();
|
||||
GtkWidget* debug_menu = CreateMenu(menu_bar, "Tests");
|
||||
|
||||
AddMenuEntry(debug_menu, "Get Source",
|
||||
G_CALLBACK(GetSourceActivated));
|
||||
AddMenuEntry(debug_menu, "Get Text",
|
||||
G_CALLBACK(GetTextActivated));
|
||||
AddMenuEntry(debug_menu, "Request",
|
||||
G_CALLBACK(RequestActivated));
|
||||
AddMenuEntry(debug_menu, "Local Storage",
|
||||
G_CALLBACK(LocalStorageActivated));
|
||||
AddMenuEntry(debug_menu, "XMLHttpRequest",
|
||||
G_CALLBACK(XMLHttpRequestActivated));
|
||||
AddMenuEntry(debug_menu, "Scheme Handler",
|
||||
G_CALLBACK(SchemeHandlerActivated));
|
||||
AddMenuEntry(debug_menu, "JavaScript Binding",
|
||||
G_CALLBACK(BindingActivated));
|
||||
AddMenuEntry(debug_menu, "Plugin Info",
|
||||
G_CALLBACK(PluginInfoActivated));
|
||||
AddMenuEntry(debug_menu, "DOM Access",
|
||||
G_CALLBACK(DOMAccessActivated));
|
||||
AddMenuEntry(debug_menu, "Popup Window",
|
||||
G_CALLBACK(PopupWindowActivated));
|
||||
AddMenuEntry(debug_menu, "Accelerated 2D Canvas",
|
||||
G_CALLBACK(Accelerated2DCanvasActivated));
|
||||
AddMenuEntry(debug_menu, "Accelerated Layers",
|
||||
G_CALLBACK(AcceleratedLayersActivated));
|
||||
AddMenuEntry(debug_menu, "WebGL",
|
||||
G_CALLBACK(WebGLActivated));
|
||||
AddMenuEntry(debug_menu, "HTML5 Video",
|
||||
G_CALLBACK(HTML5VideoActivated));
|
||||
AddMenuEntry(debug_menu, "HTML5 Drag & Drop",
|
||||
G_CALLBACK(HTML5DragDropActivated));
|
||||
AddMenuEntry(debug_menu, "Zoom In",
|
||||
G_CALLBACK(ZoomInActivated));
|
||||
AddMenuEntry(debug_menu, "Zoom Out",
|
||||
G_CALLBACK(ZoomOutActivated));
|
||||
AddMenuEntry(debug_menu, "Zoom Reset",
|
||||
G_CALLBACK(ZoomResetActivated));
|
||||
return menu_bar;
|
||||
}
|
||||
|
||||
// WebViewDelegate::TakeFocus in the test webview delegate.
|
||||
static gboolean HandleFocus(GtkWidget* widget,
|
||||
GdkEventFocus* focus) {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
// Give focus to the browser window.
|
||||
g_handler->GetBrowser()->GetHost()->SetFocus(true);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
CefMainArgs main_args(argc, argv);
|
||||
CefRefPtr<ClientApp> app(new ClientApp);
|
||||
|
||||
// Execute the secondary process, if any.
|
||||
int exit_code = CefExecuteProcess(main_args, app.get());
|
||||
if (exit_code >= 0)
|
||||
return exit_code;
|
||||
|
||||
if (!getcwd(szWorkingDir, sizeof (szWorkingDir)))
|
||||
return -1;
|
||||
|
||||
GtkWidget* window;
|
||||
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
// Parse command line arguments.
|
||||
AppInitCommandLine(argc, argv);
|
||||
|
||||
CefSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetSettings(settings, app);
|
||||
|
||||
// Initialize CEF.
|
||||
CefInitialize(main_args, settings, app.get());
|
||||
|
||||
// Register the scheme handler.
|
||||
scheme_test::InitTest();
|
||||
|
||||
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_default_size(GTK_WINDOW(window), 800, 600);
|
||||
|
||||
g_signal_connect(window, "focus", G_CALLBACK(&HandleFocus), NULL);
|
||||
|
||||
GtkWidget* vbox = gtk_vbox_new(FALSE, 0);
|
||||
|
||||
GtkWidget* menu_bar = CreateMenuBar();
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), menu_bar, FALSE, FALSE, 0);
|
||||
|
||||
GtkWidget* toolbar = gtk_toolbar_new();
|
||||
// Turn off the labels on the toolbar buttons.
|
||||
gtk_toolbar_set_style(GTK_TOOLBAR(toolbar), GTK_TOOLBAR_ICONS);
|
||||
|
||||
GtkToolItem* back = gtk_tool_button_new_from_stock(GTK_STOCK_GO_BACK);
|
||||
g_signal_connect(back, "clicked",
|
||||
G_CALLBACK(BackButtonClicked), NULL);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), back, -1 /* append */);
|
||||
|
||||
GtkToolItem* forward = gtk_tool_button_new_from_stock(GTK_STOCK_GO_FORWARD);
|
||||
g_signal_connect(forward, "clicked",
|
||||
G_CALLBACK(ForwardButtonClicked), NULL);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), forward, -1 /* append */);
|
||||
|
||||
GtkToolItem* reload = gtk_tool_button_new_from_stock(GTK_STOCK_REFRESH);
|
||||
g_signal_connect(reload, "clicked",
|
||||
G_CALLBACK(ReloadButtonClicked), NULL);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), reload, -1 /* append */);
|
||||
|
||||
GtkToolItem* stop = gtk_tool_button_new_from_stock(GTK_STOCK_STOP);
|
||||
g_signal_connect(stop, "clicked",
|
||||
G_CALLBACK(StopButtonClicked), NULL);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), stop, -1 /* append */);
|
||||
|
||||
GtkWidget* m_editWnd = gtk_entry_new();
|
||||
g_signal_connect(G_OBJECT(m_editWnd), "activate",
|
||||
G_CALLBACK(URLEntryActivate), NULL);
|
||||
|
||||
GtkToolItem* tool_item = gtk_tool_item_new();
|
||||
gtk_container_add(GTK_CONTAINER(tool_item), m_editWnd);
|
||||
gtk_tool_item_set_expand(tool_item, TRUE);
|
||||
gtk_toolbar_insert(GTK_TOOLBAR(toolbar), tool_item, -1); // append
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(vbox), toolbar, FALSE, FALSE, 0);
|
||||
|
||||
g_signal_connect(G_OBJECT(window), "destroy",
|
||||
G_CALLBACK(gtk_widget_destroyed), &window);
|
||||
g_signal_connect(G_OBJECT(window), "destroy",
|
||||
G_CALLBACK(destroy), NULL);
|
||||
|
||||
// Create the handler.
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(vbox);
|
||||
g_handler->SetEditHwnd(m_editWnd);
|
||||
g_handler->SetButtonHwnds(GTK_WIDGET(back), GTK_WIDGET(forward),
|
||||
GTK_WIDGET(reload), GTK_WIDGET(stop));
|
||||
|
||||
// Create the browser view.
|
||||
CefWindowInfo window_info;
|
||||
CefBrowserSettings browserSettings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetBrowserSettings(browserSettings);
|
||||
|
||||
window_info.SetAsChild(vbox);
|
||||
|
||||
CefBrowserHost::CreateBrowserSync(
|
||||
window_info, g_handler.get(),
|
||||
g_handler->GetStartupURL(), browserSettings);
|
||||
|
||||
gtk_container_add(GTK_CONTAINER(window), vbox);
|
||||
gtk_widget_show_all(GTK_WIDGET(window));
|
||||
|
||||
// Install an signal handler so we clean up after ourselves.
|
||||
signal(SIGINT, TerminationSignalHandler);
|
||||
signal(SIGTERM, TerminationSignalHandler);
|
||||
|
||||
CefRunMessageLoop();
|
||||
|
||||
CefShutdown();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Global functions
|
||||
|
||||
std::string AppGetWorkingDirectory() {
|
||||
return szWorkingDir;
|
||||
}
|
||||
@@ -1,542 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2010 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#include <sstream>
|
||||
#include "cefclient/cefclient.h"
|
||||
#include "include/cef_app.h"
|
||||
#import "include/cef_application_mac.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/resource_util.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
|
||||
// The global ClientHandler reference.
|
||||
extern CefRefPtr<ClientHandler> g_handler;
|
||||
|
||||
char szWorkingDir[512]; // The current working directory
|
||||
|
||||
// Sizes for URL bar layout
|
||||
#define BUTTON_HEIGHT 22
|
||||
#define BUTTON_WIDTH 72
|
||||
#define BUTTON_MARGIN 8
|
||||
#define URLBAR_HEIGHT 32
|
||||
|
||||
// Content area size for newly created windows.
|
||||
const int kWindowWidth = 800;
|
||||
const int kWindowHeight = 600;
|
||||
|
||||
// Memory AutoRelease pool.
|
||||
static NSAutoreleasePool* g_autopool = nil;
|
||||
|
||||
// Provide the CefAppProtocol implementation required by CEF.
|
||||
@interface ClientApplication : NSApplication<CefAppProtocol> {
|
||||
@private
|
||||
BOOL handlingSendEvent_;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation ClientApplication
|
||||
- (BOOL)isHandlingSendEvent {
|
||||
return handlingSendEvent_;
|
||||
}
|
||||
|
||||
- (void)setHandlingSendEvent:(BOOL)handlingSendEvent {
|
||||
handlingSendEvent_ = handlingSendEvent;
|
||||
}
|
||||
|
||||
- (void)sendEvent:(NSEvent*)event {
|
||||
CefScopedSendingEvent sendingEventScoper;
|
||||
[super sendEvent:event];
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
// Receives notifications from controls and the browser window. Will delete
|
||||
// itself when done.
|
||||
@interface ClientWindowDelegate : NSObject <NSWindowDelegate>
|
||||
- (IBAction)goBack:(id)sender;
|
||||
- (IBAction)goForward:(id)sender;
|
||||
- (IBAction)reload:(id)sender;
|
||||
- (IBAction)stopLoading:(id)sender;
|
||||
- (IBAction)takeURLStringValueFrom:(NSTextField *)sender;
|
||||
- (void)alert:(NSString*)title withMessage:(NSString*)message;
|
||||
- (void)notifyConsoleMessage:(id)object;
|
||||
- (void)notifyDownloadComplete:(id)object;
|
||||
- (void)notifyDownloadError:(id)object;
|
||||
@end
|
||||
|
||||
@implementation ClientWindowDelegate
|
||||
|
||||
- (IBAction)goBack:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->GoBack();
|
||||
}
|
||||
|
||||
- (IBAction)goForward:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->GoForward();
|
||||
}
|
||||
|
||||
- (IBAction)reload:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->Reload();
|
||||
}
|
||||
|
||||
- (IBAction)stopLoading:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
g_handler->GetBrowser()->StopLoad();
|
||||
}
|
||||
|
||||
- (IBAction)takeURLStringValueFrom:(NSTextField *)sender {
|
||||
if (!g_handler.get() || !g_handler->GetBrowserId())
|
||||
return;
|
||||
|
||||
NSString *url = [sender stringValue];
|
||||
|
||||
// if it doesn't already have a prefix, add http. If we can't parse it,
|
||||
// just don't bother rather than making things worse.
|
||||
NSURL* tempUrl = [NSURL URLWithString:url];
|
||||
if (tempUrl && ![tempUrl scheme])
|
||||
url = [@"http://" stringByAppendingString:url];
|
||||
|
||||
std::string urlStr = [url UTF8String];
|
||||
g_handler->GetBrowser()->GetMainFrame()->LoadURL(urlStr);
|
||||
}
|
||||
|
||||
- (void)alert:(NSString*)title withMessage:(NSString*)message {
|
||||
NSAlert *alert = [NSAlert alertWithMessageText:title
|
||||
defaultButton:@"OK"
|
||||
alternateButton:nil
|
||||
otherButton:nil
|
||||
informativeTextWithFormat:message];
|
||||
[alert runModal];
|
||||
}
|
||||
|
||||
- (void)notifyConsoleMessage:(id)object {
|
||||
std::stringstream ss;
|
||||
ss << "Console messages will be written to " << g_handler->GetLogFile();
|
||||
NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())];
|
||||
[self alert:@"Console Messages" withMessage:str];
|
||||
}
|
||||
|
||||
- (void)notifyDownloadComplete:(id)object {
|
||||
std::stringstream ss;
|
||||
ss << "File \"" << g_handler->GetLastDownloadFile() <<
|
||||
"\" downloaded successfully.";
|
||||
NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())];
|
||||
[self alert:@"File Download" withMessage:str];
|
||||
}
|
||||
|
||||
- (void)notifyDownloadError:(id)object {
|
||||
std::stringstream ss;
|
||||
ss << "File \"" << g_handler->GetLastDownloadFile() <<
|
||||
"\" failed to download.";
|
||||
NSString* str = [NSString stringWithUTF8String:(ss.str().c_str())];
|
||||
[self alert:@"File Download" withMessage:str];
|
||||
}
|
||||
|
||||
- (void)windowDidBecomeKey:(NSNotification*)notification {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
// Give focus to the browser window.
|
||||
g_handler->GetBrowser()->GetHost()->SetFocus(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Called when the window is about to close. Perform the self-destruction
|
||||
// sequence by getting rid of the window. By returning YES, we allow the window
|
||||
// to be removed from the screen.
|
||||
- (BOOL)windowShouldClose:(id)window {
|
||||
// Try to make the window go away.
|
||||
[window autorelease];
|
||||
|
||||
// Clean ourselves up after clearing the stack of anything that might have the
|
||||
// window on it.
|
||||
[self performSelectorOnMainThread:@selector(cleanup:)
|
||||
withObject:window
|
||||
waitUntilDone:NO];
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
// Deletes itself.
|
||||
- (void)cleanup:(id)window {
|
||||
[self release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
NSButton* MakeButton(NSRect* rect, NSString* title, NSView* parent) {
|
||||
NSButton* button = [[[NSButton alloc] initWithFrame:*rect] autorelease];
|
||||
[button setTitle:title];
|
||||
[button setBezelStyle:NSSmallSquareBezelStyle];
|
||||
[button setAutoresizingMask:(NSViewMaxXMargin | NSViewMinYMargin)];
|
||||
[parent addSubview:button];
|
||||
rect->origin.x += BUTTON_WIDTH;
|
||||
return button;
|
||||
}
|
||||
|
||||
// Receives notifications from the application. Will delete itself when done.
|
||||
@interface ClientAppDelegate : NSObject
|
||||
- (void)createApp:(id)object;
|
||||
- (IBAction)testGetSource:(id)sender;
|
||||
- (IBAction)testGetText:(id)sender;
|
||||
- (IBAction)testRequest:(id)sender;
|
||||
- (IBAction)testLocalStorage:(id)sender;
|
||||
- (IBAction)testXMLHttpRequest:(id)sender;
|
||||
- (IBAction)testSchemeHandler:(id)sender;
|
||||
- (IBAction)testBinding:(id)sender;
|
||||
- (IBAction)testDialogs:(id)sender;
|
||||
- (IBAction)testPluginInfo:(id)sender;
|
||||
- (IBAction)testDOMAccess:(id)sender;
|
||||
- (IBAction)testPopupWindow:(id)sender;
|
||||
- (IBAction)testAccelerated2DCanvas:(id)sender;
|
||||
- (IBAction)testAcceleratedLayers:(id)sender;
|
||||
- (IBAction)testWebGL:(id)sender;
|
||||
- (IBAction)testHTML5Video:(id)sender;
|
||||
- (IBAction)testDragDrop:(id)sender;
|
||||
- (IBAction)testZoomIn:(id)sender;
|
||||
- (IBAction)testZoomOut:(id)sender;
|
||||
- (IBAction)testZoomReset:(id)sender;
|
||||
@end
|
||||
|
||||
@implementation ClientAppDelegate
|
||||
|
||||
// Create the application on the UI thread.
|
||||
- (void)createApp:(id)object {
|
||||
[NSApplication sharedApplication];
|
||||
[NSBundle loadNibNamed:@"MainMenu" owner:NSApp];
|
||||
|
||||
// Set the delegate for application events.
|
||||
[NSApp setDelegate:self];
|
||||
|
||||
// Add the Tests menu.
|
||||
NSMenu* menubar = [NSApp mainMenu];
|
||||
NSMenuItem *testItem = [[[NSMenuItem alloc] initWithTitle:@"Tests"
|
||||
action:nil
|
||||
keyEquivalent:@""] autorelease];
|
||||
NSMenu *testMenu = [[[NSMenu alloc] initWithTitle:@"Tests"] autorelease];
|
||||
[testMenu addItemWithTitle:@"Get Source"
|
||||
action:@selector(testGetSource:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Get Text"
|
||||
action:@selector(testGetText:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Popup Window"
|
||||
action:@selector(testPopupWindow:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Request"
|
||||
action:@selector(testRequest:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Scheme Handler"
|
||||
action:@selector(testSchemeHandler:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"JavaScript Binding"
|
||||
action:@selector(testBinding:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"JavaScript Dialogs"
|
||||
action:@selector(testDialogs:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Plugin Info"
|
||||
action:@selector(testPluginInfo:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"DOM Access"
|
||||
action:@selector(testDOMAccess:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Local Storage"
|
||||
action:@selector(testLocalStorage:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"XMLHttpRequest"
|
||||
action:@selector(testXMLHttpRequest:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Accelerated 2D Canvas"
|
||||
action:@selector(testAccelerated2DCanvas:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Accelerated Layers"
|
||||
action:@selector(testAcceleratedLayers:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"WebGL"
|
||||
action:@selector(testWebGL:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"HTML5 Video"
|
||||
action:@selector(testHTML5Video:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Drag & Drop"
|
||||
action:@selector(testDragDrop:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Zoom In"
|
||||
action:@selector(testZoomIn:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Zoom Out"
|
||||
action:@selector(testZoomOut:)
|
||||
keyEquivalent:@""];
|
||||
[testMenu addItemWithTitle:@"Zoom Reset"
|
||||
action:@selector(testZoomReset:)
|
||||
keyEquivalent:@""];
|
||||
[testItem setSubmenu:testMenu];
|
||||
[menubar addItem:testItem];
|
||||
|
||||
// Create the delegate for control and browser window events.
|
||||
ClientWindowDelegate* delegate = [[ClientWindowDelegate alloc] init];
|
||||
|
||||
// Create the main application window.
|
||||
NSRect screen_rect = [[NSScreen mainScreen] visibleFrame];
|
||||
NSRect window_rect = { {0, screen_rect.size.height - kWindowHeight},
|
||||
{kWindowWidth, kWindowHeight} };
|
||||
NSWindow* mainWnd = [[UnderlayOpenGLHostingWindow alloc]
|
||||
initWithContentRect:window_rect
|
||||
styleMask:(NSTitledWindowMask |
|
||||
NSClosableWindowMask |
|
||||
NSMiniaturizableWindowMask |
|
||||
NSResizableWindowMask )
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
[mainWnd setTitle:@"cefclient"];
|
||||
[mainWnd setDelegate:delegate];
|
||||
|
||||
// Rely on the window delegate to clean us up rather than immediately
|
||||
// releasing when the window gets closed. We use the delegate to do
|
||||
// everything from the autorelease pool so the window isn't on the stack
|
||||
// during cleanup (ie, a window close from javascript).
|
||||
[mainWnd setReleasedWhenClosed:NO];
|
||||
|
||||
NSView* contentView = [mainWnd contentView];
|
||||
|
||||
// Create the buttons.
|
||||
NSRect button_rect = [contentView bounds];
|
||||
button_rect.origin.y = window_rect.size.height - URLBAR_HEIGHT +
|
||||
(URLBAR_HEIGHT - BUTTON_HEIGHT) / 2;
|
||||
button_rect.size.height = BUTTON_HEIGHT;
|
||||
button_rect.origin.x += BUTTON_MARGIN;
|
||||
button_rect.size.width = BUTTON_WIDTH;
|
||||
|
||||
NSButton* button = MakeButton(&button_rect, @"Back", contentView);
|
||||
[button setTarget:delegate];
|
||||
[button setAction:@selector(goBack:)];
|
||||
|
||||
button = MakeButton(&button_rect, @"Forward", contentView);
|
||||
[button setTarget:delegate];
|
||||
[button setAction:@selector(goForward:)];
|
||||
|
||||
button = MakeButton(&button_rect, @"Reload", contentView);
|
||||
[button setTarget:delegate];
|
||||
[button setAction:@selector(reload:)];
|
||||
|
||||
button = MakeButton(&button_rect, @"Stop", contentView);
|
||||
[button setTarget:delegate];
|
||||
[button setAction:@selector(stopLoading:)];
|
||||
|
||||
// Create the URL text field.
|
||||
button_rect.origin.x += BUTTON_MARGIN;
|
||||
button_rect.size.width = [contentView bounds].size.width -
|
||||
button_rect.origin.x - BUTTON_MARGIN;
|
||||
NSTextField* editWnd = [[NSTextField alloc] initWithFrame:button_rect];
|
||||
[contentView addSubview:editWnd];
|
||||
[editWnd setAutoresizingMask:(NSViewWidthSizable | NSViewMinYMargin)];
|
||||
[editWnd setTarget:delegate];
|
||||
[editWnd setAction:@selector(takeURLStringValueFrom:)];
|
||||
[[editWnd cell] setWraps:NO];
|
||||
[[editWnd cell] setScrollable:YES];
|
||||
|
||||
// Create the handler.
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(contentView);
|
||||
g_handler->SetEditHwnd(editWnd);
|
||||
|
||||
// Create the browser view.
|
||||
CefWindowInfo window_info;
|
||||
CefBrowserSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetBrowserSettings(settings);
|
||||
|
||||
window_info.SetAsChild(contentView, 0, 0, kWindowWidth, kWindowHeight);
|
||||
CefBrowserHost::CreateBrowser(window_info, g_handler.get(),
|
||||
g_handler->GetStartupURL(), settings);
|
||||
|
||||
// Show the window.
|
||||
[mainWnd makeKeyAndOrderFront: nil];
|
||||
|
||||
// Size the window.
|
||||
NSRect r = [mainWnd contentRectForFrameRect:[mainWnd frame]];
|
||||
r.size.width = kWindowWidth;
|
||||
r.size.height = kWindowHeight + URLBAR_HEIGHT;
|
||||
[mainWnd setFrame:[mainWnd frameRectForContentRect:r] display:YES];
|
||||
}
|
||||
|
||||
- (IBAction)testGetSource:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunGetSourceTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testGetText:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunGetTextTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testRequest:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunRequestTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testLocalStorage:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunLocalStorageTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testXMLHttpRequest:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunXMLHTTPRequestTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testSchemeHandler:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
scheme_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testBinding:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
binding_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testDialogs:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunDialogTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testPluginInfo:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunPluginInfoTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testDOMAccess:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
dom_test::RunTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testPopupWindow:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunPopupTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testAccelerated2DCanvas:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunAccelerated2DCanvasTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testAcceleratedLayers:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunAcceleratedLayersTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testWebGL:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunWebGLTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testHTML5Video:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunHTML5VideoTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testDragDrop:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId())
|
||||
RunDragDropTest(g_handler->GetBrowser());
|
||||
}
|
||||
|
||||
- (IBAction)testZoomIn:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)testZoomOut:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(browser->GetHost()->GetZoomLevel() - 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)testZoomReset:(id)sender {
|
||||
if (g_handler.get() && g_handler->GetBrowserId()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
browser->GetHost()->SetZoomLevel(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sent by the default notification center immediately before the application
|
||||
// terminates.
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification {
|
||||
// Shut down CEF.
|
||||
g_handler = NULL;
|
||||
CefShutdown();
|
||||
|
||||
[self release];
|
||||
|
||||
// Release the AutoRelease pool.
|
||||
[g_autopool release];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
CefMainArgs main_args(argc, argv);
|
||||
CefRefPtr<ClientApp> app(new ClientApp);
|
||||
|
||||
// Execute the secondary process, if any.
|
||||
int exit_code = CefExecuteProcess(main_args, app.get());
|
||||
if (exit_code >= 0)
|
||||
return exit_code;
|
||||
|
||||
// Retrieve the current working directory.
|
||||
getcwd(szWorkingDir, sizeof(szWorkingDir));
|
||||
|
||||
// Initialize the AutoRelease pool.
|
||||
g_autopool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
// Initialize the ClientApplication instance.
|
||||
[ClientApplication sharedApplication];
|
||||
|
||||
// Parse command line arguments.
|
||||
AppInitCommandLine(argc, argv);
|
||||
|
||||
CefSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetSettings(settings, app);
|
||||
|
||||
// Initialize CEF.
|
||||
CefInitialize(main_args, settings, app.get());
|
||||
|
||||
// Register the scheme handler.
|
||||
scheme_test::InitTest();
|
||||
|
||||
// Create the application delegate and window.
|
||||
NSObject* delegate = [[ClientAppDelegate alloc] init];
|
||||
[delegate performSelectorOnMainThread:@selector(createApp:) withObject:nil
|
||||
waitUntilDone:NO];
|
||||
|
||||
// Run the application message loop.
|
||||
CefRunMessageLoop();
|
||||
|
||||
// Don't put anything below this line because it won't be executed.
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// Global functions
|
||||
|
||||
std::string AppGetWorkingDirectory() {
|
||||
return szWorkingDir;
|
||||
}
|
||||
@@ -1,546 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/cefclient.h"
|
||||
#include <windows.h>
|
||||
#include <commdlg.h>
|
||||
#include <shellapi.h>
|
||||
#include <direct.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "include/cef_app.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/resource.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include "cefclient/string_util.h"
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
#define MAX_URL_LENGTH 255
|
||||
#define BUTTON_WIDTH 72
|
||||
#define URLBAR_HEIGHT 24
|
||||
|
||||
// Global Variables:
|
||||
HINSTANCE hInst; // current instance
|
||||
TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
|
||||
TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name
|
||||
char szWorkingDir[MAX_PATH]; // The current working directory
|
||||
|
||||
// Forward declarations of functions included in this code module:
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance);
|
||||
BOOL InitInstance(HINSTANCE, int);
|
||||
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
// The global ClientHandler reference.
|
||||
extern CefRefPtr<ClientHandler> g_handler;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Add Common Controls to the application manifest because it's required to
|
||||
// support the default tooltip implementation.
|
||||
#pragma comment(linker, "/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") // NOLINT(whitespace/line_length)
|
||||
#endif
|
||||
|
||||
// Program entry point function.
|
||||
int APIENTRY wWinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow) {
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
CefMainArgs main_args(hInstance);
|
||||
CefRefPtr<ClientApp> app(new ClientApp);
|
||||
|
||||
// Execute the secondary process, if any.
|
||||
int exit_code = CefExecuteProcess(main_args, app.get());
|
||||
if (exit_code >= 0)
|
||||
return exit_code;
|
||||
|
||||
// Retrieve the current working directory.
|
||||
if (_getcwd(szWorkingDir, MAX_PATH) == NULL)
|
||||
szWorkingDir[0] = 0;
|
||||
|
||||
// Parse command line arguments. The passed in values are ignored on Windows.
|
||||
AppInitCommandLine(0, NULL);
|
||||
|
||||
CefSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetSettings(settings, app);
|
||||
|
||||
// Initialize CEF.
|
||||
CefInitialize(main_args, settings, app.get());
|
||||
|
||||
// Register the scheme handler.
|
||||
scheme_test::InitTest();
|
||||
|
||||
HACCEL hAccelTable;
|
||||
|
||||
// Initialize global strings
|
||||
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
|
||||
LoadString(hInstance, IDC_CEFCLIENT, szWindowClass, MAX_LOADSTRING);
|
||||
MyRegisterClass(hInstance);
|
||||
|
||||
// Perform application initialization
|
||||
if (!InitInstance (hInstance, nCmdShow))
|
||||
return FALSE;
|
||||
|
||||
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_CEFCLIENT));
|
||||
|
||||
int result = 0;
|
||||
|
||||
if (!settings.multi_threaded_message_loop) {
|
||||
// Run the CEF message loop. This function will block until the application
|
||||
// recieves a WM_QUIT message.
|
||||
CefRunMessageLoop();
|
||||
} else {
|
||||
MSG msg;
|
||||
|
||||
// Run the application message loop.
|
||||
while (GetMessage(&msg, NULL, 0, 0)) {
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
result = static_cast<int>(msg.wParam);
|
||||
}
|
||||
|
||||
// Shut down CEF.
|
||||
CefShutdown();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: MyRegisterClass()
|
||||
//
|
||||
// PURPOSE: Registers the window class.
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// This function and its usage are only necessary if you want this code
|
||||
// to be compatible with Win32 systems prior to the 'RegisterClassEx'
|
||||
// function that was added to Windows 95. It is important to call this
|
||||
// function so that the application will get 'well formed' small icons
|
||||
// associated with it.
|
||||
//
|
||||
ATOM MyRegisterClass(HINSTANCE hInstance) {
|
||||
WNDCLASSEX wcex;
|
||||
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = WndProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = hInstance;
|
||||
wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_CEFCLIENT));
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = MAKEINTRESOURCE(IDC_CEFCLIENT);
|
||||
wcex.lpszClassName = szWindowClass;
|
||||
wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL));
|
||||
|
||||
return RegisterClassEx(&wcex);
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: InitInstance(HINSTANCE, int)
|
||||
//
|
||||
// PURPOSE: Saves instance handle and creates main window
|
||||
//
|
||||
// COMMENTS:
|
||||
//
|
||||
// In this function, we save the instance handle in a global variable and
|
||||
// create and display the main program window.
|
||||
//
|
||||
BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) {
|
||||
HWND hWnd;
|
||||
|
||||
hInst = hInstance; // Store instance handle in our global variable
|
||||
|
||||
hWnd = CreateWindow(szWindowClass, szTitle,
|
||||
WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, CW_USEDEFAULT, 0,
|
||||
CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
|
||||
|
||||
if (!hWnd)
|
||||
return FALSE;
|
||||
|
||||
ShowWindow(hWnd, nCmdShow);
|
||||
UpdateWindow(hWnd);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Change the zoom factor on the UI thread.
|
||||
static void ModifyZoom(CefRefPtr<CefBrowser> browser, double delta) {
|
||||
if (CefCurrentlyOn(TID_UI)) {
|
||||
browser->GetHost()->SetZoomLevel(
|
||||
browser->GetHost()->GetZoomLevel() + delta);
|
||||
} else {
|
||||
CefPostTask(TID_UI, NewCefRunnableFunction(ModifyZoom, browser, delta));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
|
||||
//
|
||||
// PURPOSE: Processes messages for the main window.
|
||||
//
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam,
|
||||
LPARAM lParam) {
|
||||
static HWND backWnd = NULL, forwardWnd = NULL, reloadWnd = NULL,
|
||||
stopWnd = NULL, editWnd = NULL;
|
||||
static WNDPROC editWndOldProc = NULL;
|
||||
|
||||
// Static members used for the find dialog.
|
||||
static FINDREPLACE fr;
|
||||
static WCHAR szFindWhat[80] = {0};
|
||||
static WCHAR szLastFindWhat[80] = {0};
|
||||
static bool findNext = false;
|
||||
static bool lastMatchCase = false;
|
||||
|
||||
int wmId, wmEvent;
|
||||
PAINTSTRUCT ps;
|
||||
HDC hdc;
|
||||
|
||||
if (hWnd == editWnd) {
|
||||
// Callback for the edit window
|
||||
switch (message) {
|
||||
case WM_CHAR:
|
||||
if (wParam == VK_RETURN && g_handler.get()) {
|
||||
// When the user hits the enter key load the URL
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
wchar_t strPtr[MAX_URL_LENGTH+1] = {0};
|
||||
*((LPWORD)strPtr) = MAX_URL_LENGTH;
|
||||
LRESULT strLen = SendMessage(hWnd, EM_GETLINE, 0, (LPARAM)strPtr);
|
||||
if (strLen > 0) {
|
||||
strPtr[strLen] = 0;
|
||||
browser->GetMainFrame()->LoadURL(strPtr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return (LRESULT)CallWindowProc(editWndOldProc, hWnd, message, wParam,
|
||||
lParam);
|
||||
} else {
|
||||
// Callback for the main window
|
||||
switch (message) {
|
||||
case WM_CREATE: {
|
||||
// Create the single static handler class instance
|
||||
g_handler = new ClientHandler();
|
||||
g_handler->SetMainHwnd(hWnd);
|
||||
|
||||
// Create the child windows used for navigation
|
||||
RECT rect;
|
||||
int x = 0;
|
||||
|
||||
GetClientRect(hWnd, &rect);
|
||||
|
||||
backWnd = CreateWindow(L"BUTTON", L"Back",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
|
||||
| WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
|
||||
hWnd, (HMENU) IDC_NAV_BACK, hInst, 0);
|
||||
x += BUTTON_WIDTH;
|
||||
|
||||
forwardWnd = CreateWindow(L"BUTTON", L"Forward",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
|
||||
| WS_DISABLED, x, 0, BUTTON_WIDTH,
|
||||
URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_FORWARD,
|
||||
hInst, 0);
|
||||
x += BUTTON_WIDTH;
|
||||
|
||||
reloadWnd = CreateWindow(L"BUTTON", L"Reload",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
|
||||
| WS_DISABLED, x, 0, BUTTON_WIDTH,
|
||||
URLBAR_HEIGHT, hWnd, (HMENU) IDC_NAV_RELOAD,
|
||||
hInst, 0);
|
||||
x += BUTTON_WIDTH;
|
||||
|
||||
stopWnd = CreateWindow(L"BUTTON", L"Stop",
|
||||
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON
|
||||
| WS_DISABLED, x, 0, BUTTON_WIDTH, URLBAR_HEIGHT,
|
||||
hWnd, (HMENU) IDC_NAV_STOP, hInst, 0);
|
||||
x += BUTTON_WIDTH;
|
||||
|
||||
editWnd = CreateWindow(L"EDIT", 0,
|
||||
WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT |
|
||||
ES_AUTOVSCROLL | ES_AUTOHSCROLL| WS_DISABLED,
|
||||
x, 0, rect.right - BUTTON_WIDTH * 4,
|
||||
URLBAR_HEIGHT, hWnd, 0, hInst, 0);
|
||||
|
||||
// Assign the edit window's WNDPROC to this function so that we can
|
||||
// capture the enter key
|
||||
editWndOldProc =
|
||||
reinterpret_cast<WNDPROC>(GetWindowLongPtr(editWnd, GWLP_WNDPROC));
|
||||
SetWindowLongPtr(editWnd, GWLP_WNDPROC,
|
||||
reinterpret_cast<LONG_PTR>(WndProc));
|
||||
g_handler->SetEditHwnd(editWnd);
|
||||
g_handler->SetButtonHwnds(backWnd, forwardWnd, reloadWnd, stopWnd);
|
||||
|
||||
rect.top += URLBAR_HEIGHT;
|
||||
|
||||
CefWindowInfo info;
|
||||
CefBrowserSettings settings;
|
||||
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetBrowserSettings(settings);
|
||||
|
||||
// Initialize window info to the defaults for a child window
|
||||
info.SetAsChild(hWnd, rect);
|
||||
|
||||
// Creat the new child browser window
|
||||
CefBrowserHost::CreateBrowser(info, g_handler.get(),
|
||||
g_handler->GetStartupURL(), settings);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_COMMAND: {
|
||||
CefRefPtr<CefBrowser> browser;
|
||||
if (g_handler.get())
|
||||
browser = g_handler->GetBrowser();
|
||||
|
||||
wmId = LOWORD(wParam);
|
||||
wmEvent = HIWORD(wParam);
|
||||
// Parse the menu selections:
|
||||
switch (wmId) {
|
||||
case IDM_ABOUT:
|
||||
DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About);
|
||||
return 0;
|
||||
case IDM_EXIT:
|
||||
DestroyWindow(hWnd);
|
||||
return 0;
|
||||
case ID_WARN_CONSOLEMESSAGE:
|
||||
if (g_handler.get()) {
|
||||
std::wstringstream ss;
|
||||
ss << L"Console messages will be written to "
|
||||
<< std::wstring(CefString(g_handler->GetLogFile()));
|
||||
MessageBox(hWnd, ss.str().c_str(), L"Console Messages",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
return 0;
|
||||
case ID_WARN_DOWNLOADCOMPLETE:
|
||||
case ID_WARN_DOWNLOADERROR:
|
||||
if (g_handler.get()) {
|
||||
std::wstringstream ss;
|
||||
ss << L"File \"" <<
|
||||
std::wstring(CefString(g_handler->GetLastDownloadFile())) <<
|
||||
L"\" ";
|
||||
|
||||
if (wmId == ID_WARN_DOWNLOADCOMPLETE)
|
||||
ss << L"downloaded successfully.";
|
||||
else
|
||||
ss << L"failed to download.";
|
||||
|
||||
MessageBox(hWnd, ss.str().c_str(), L"File Download",
|
||||
MB_OK | MB_ICONINFORMATION);
|
||||
}
|
||||
return 0;
|
||||
case IDC_NAV_BACK: // Back button
|
||||
if (browser.get())
|
||||
browser->GoBack();
|
||||
return 0;
|
||||
case IDC_NAV_FORWARD: // Forward button
|
||||
if (browser.get())
|
||||
browser->GoForward();
|
||||
return 0;
|
||||
case IDC_NAV_RELOAD: // Reload button
|
||||
if (browser.get())
|
||||
browser->Reload();
|
||||
return 0;
|
||||
case IDC_NAV_STOP: // Stop button
|
||||
if (browser.get())
|
||||
browser->StopLoad();
|
||||
return 0;
|
||||
case ID_TESTS_GETSOURCE: // Test the GetSource function
|
||||
if (browser.get())
|
||||
RunGetSourceTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_GETTEXT: // Test the GetText function
|
||||
if (browser.get())
|
||||
RunGetTextTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_POPUP: // Test a popup window
|
||||
if (browser.get())
|
||||
RunPopupTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_REQUEST: // Test a request
|
||||
if (browser.get())
|
||||
RunRequestTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_SCHEME_HANDLER: // Test the scheme handler
|
||||
if (browser.get())
|
||||
scheme_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_BINDING: // Test JavaScript binding
|
||||
if (browser.get())
|
||||
binding_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DIALOGS: // Test JavaScript dialogs
|
||||
if (browser.get())
|
||||
RunDialogTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_PLUGIN_INFO: // Test plugin info
|
||||
if (browser.get())
|
||||
RunPluginInfoTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DOM_ACCESS: // Test DOM access
|
||||
if (browser.get())
|
||||
dom_test::RunTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_LOCALSTORAGE: // Test localStorage
|
||||
if (browser.get())
|
||||
RunLocalStorageTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_ACCELERATED2DCANVAS: // Test accelerated 2d canvas
|
||||
if (browser.get())
|
||||
RunAccelerated2DCanvasTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_ACCELERATEDLAYERS: // Test accelerated layers
|
||||
if (browser.get())
|
||||
RunAcceleratedLayersTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_WEBGL: // Test WebGL
|
||||
if (browser.get())
|
||||
RunWebGLTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_HTML5VIDEO: // Test HTML5 video
|
||||
if (browser.get())
|
||||
RunHTML5VideoTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_XMLHTTPREQUEST: // Test XMLHttpRequest
|
||||
if (browser.get())
|
||||
RunXMLHTTPRequestTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_DRAGDROP: // Test drag & drop
|
||||
if (browser.get())
|
||||
RunDragDropTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_GEOLOCATION: // Test geolocation
|
||||
if (browser.get())
|
||||
RunGeolocationTest(browser);
|
||||
return 0;
|
||||
case ID_TESTS_ZOOM_IN:
|
||||
if (browser.get())
|
||||
ModifyZoom(browser, 0.5);
|
||||
return 0;
|
||||
case ID_TESTS_ZOOM_OUT:
|
||||
if (browser.get())
|
||||
ModifyZoom(browser, -0.5);
|
||||
return 0;
|
||||
case ID_TESTS_ZOOM_RESET:
|
||||
if (browser.get())
|
||||
browser->GetHost()->SetZoomLevel(0.0);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PAINT:
|
||||
hdc = BeginPaint(hWnd, &ps);
|
||||
EndPaint(hWnd, &ps);
|
||||
return 0;
|
||||
|
||||
case WM_SETFOCUS:
|
||||
if (g_handler.get() && g_handler->GetBrowser()) {
|
||||
// Pass focus to the browser window
|
||||
CefWindowHandle hwnd =
|
||||
g_handler->GetBrowser()->GetHost()->GetWindowHandle();
|
||||
if (hwnd)
|
||||
PostMessage(hwnd, WM_SETFOCUS, wParam, NULL);
|
||||
}
|
||||
return 0;
|
||||
|
||||
case WM_SIZE:
|
||||
// Minimizing resizes the window to 0x0 which causes our layout to go all
|
||||
// screwy, so we just ignore it.
|
||||
if (wParam != SIZE_MINIMIZED && g_handler.get() &&
|
||||
g_handler->GetBrowser()) {
|
||||
CefWindowHandle hwnd =
|
||||
g_handler->GetBrowser()->GetHost()->GetWindowHandle();
|
||||
if (hwnd) {
|
||||
// Resize the browser window and address bar to match the new frame
|
||||
// window size
|
||||
RECT rect;
|
||||
GetClientRect(hWnd, &rect);
|
||||
rect.top += URLBAR_HEIGHT;
|
||||
|
||||
int urloffset = rect.left + BUTTON_WIDTH * 4;
|
||||
|
||||
HDWP hdwp = BeginDeferWindowPos(1);
|
||||
hdwp = DeferWindowPos(hdwp, editWnd, NULL, urloffset,
|
||||
0, rect.right - urloffset, URLBAR_HEIGHT, SWP_NOZORDER);
|
||||
hdwp = DeferWindowPos(hdwp, hwnd, NULL,
|
||||
rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top,
|
||||
SWP_NOZORDER);
|
||||
EndDeferWindowPos(hdwp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_ERASEBKGND:
|
||||
if (g_handler.get() && g_handler->GetBrowser()) {
|
||||
CefWindowHandle hwnd =
|
||||
g_handler->GetBrowser()->GetHost()->GetWindowHandle();
|
||||
if (hwnd) {
|
||||
// Dont erase the background if the browser window has been loaded
|
||||
// (this avoids flashing)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_CLOSE:
|
||||
if (g_handler.get()) {
|
||||
CefRefPtr<CefBrowser> browser = g_handler->GetBrowser();
|
||||
if (browser.get()) {
|
||||
// Let the browser window know we are about to destroy it.
|
||||
browser->GetHost()->ParentWindowWillClose();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_DESTROY:
|
||||
// The frame window has exited
|
||||
PostQuitMessage(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
// Message handler for about box.
|
||||
INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) {
|
||||
UNREFERENCED_PARAMETER(lParam);
|
||||
switch (message) {
|
||||
case WM_INITDIALOG:
|
||||
return (INT_PTR)TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) {
|
||||
EndDialog(hDlg, LOWORD(wParam));
|
||||
return (INT_PTR)TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (INT_PTR)FALSE;
|
||||
}
|
||||
|
||||
|
||||
// Global functions
|
||||
|
||||
std::string AppGetWorkingDirectory() {
|
||||
return szWorkingDir;
|
||||
}
|
||||
@@ -1,346 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
// This file is shared by cefclient and cef_unittests so don't include using
|
||||
// a qualified path.
|
||||
#include "client_app.h" // NOLINT(build/include)
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "include/cef_cookie.h"
|
||||
#include "include/cef_process_message.h"
|
||||
#include "include/cef_task.h"
|
||||
#include "include/cef_v8.h"
|
||||
#include "util.h" // NOLINT(build/include)
|
||||
|
||||
namespace {
|
||||
|
||||
// Forward declarations.
|
||||
void SetList(CefRefPtr<CefV8Value> source, CefRefPtr<CefListValue> target);
|
||||
void SetList(CefRefPtr<CefListValue> source, CefRefPtr<CefV8Value> target);
|
||||
|
||||
// Transfer a V8 value to a List index.
|
||||
void SetListValue(CefRefPtr<CefListValue> list, int index,
|
||||
CefRefPtr<CefV8Value> value) {
|
||||
if (value->IsArray()) {
|
||||
CefRefPtr<CefListValue> new_list = CefListValue::Create();
|
||||
SetList(value, new_list);
|
||||
list->SetList(index, new_list);
|
||||
} else if (value->IsString()) {
|
||||
list->SetString(index, value->GetStringValue());
|
||||
} else if (value->IsBool()) {
|
||||
list->SetBool(index, value->GetBoolValue());
|
||||
} else if (value->IsInt()) {
|
||||
list->SetInt(index, value->GetIntValue());
|
||||
} else if (value->IsDouble()) {
|
||||
list->SetDouble(index, value->GetDoubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer a V8 array to a List.
|
||||
void SetList(CefRefPtr<CefV8Value> source, CefRefPtr<CefListValue> target) {
|
||||
ASSERT(source->IsArray());
|
||||
|
||||
int arg_length = source->GetArrayLength();
|
||||
if (arg_length == 0)
|
||||
return;
|
||||
|
||||
// Start with null types in all spaces.
|
||||
target->SetSize(arg_length);
|
||||
|
||||
for (int i = 0; i < arg_length; ++i)
|
||||
SetListValue(target, i, source->GetValue(i));
|
||||
}
|
||||
|
||||
// Transfer a List value to a V8 array index.
|
||||
void SetListValue(CefRefPtr<CefV8Value> list, int index,
|
||||
CefRefPtr<CefListValue> value) {
|
||||
CefRefPtr<CefV8Value> new_value;
|
||||
|
||||
CefValueType type = value->GetType(index);
|
||||
switch (type) {
|
||||
case VTYPE_LIST: {
|
||||
CefRefPtr<CefListValue> list = value->GetList(index);
|
||||
new_value = CefV8Value::CreateArray(list->GetSize());
|
||||
SetList(list, new_value);
|
||||
} break;
|
||||
case VTYPE_BOOL:
|
||||
new_value = CefV8Value::CreateBool(value->GetBool(index));
|
||||
break;
|
||||
case VTYPE_DOUBLE:
|
||||
new_value = CefV8Value::CreateDouble(value->GetDouble(index));
|
||||
break;
|
||||
case VTYPE_INT:
|
||||
new_value = CefV8Value::CreateInt(value->GetInt(index));
|
||||
break;
|
||||
case VTYPE_STRING:
|
||||
new_value = CefV8Value::CreateString(value->GetString(index));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (new_value.get()) {
|
||||
list->SetValue(index, new_value);
|
||||
} else {
|
||||
list->SetValue(index, CefV8Value::CreateNull());
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer a List to a V8 array.
|
||||
void SetList(CefRefPtr<CefListValue> source, CefRefPtr<CefV8Value> target) {
|
||||
ASSERT(target->IsArray());
|
||||
|
||||
int arg_length = source->GetSize();
|
||||
if (arg_length == 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < arg_length; ++i)
|
||||
SetListValue(target, i, source);
|
||||
}
|
||||
|
||||
|
||||
// Handles the native implementation for the client_app extension.
|
||||
class ClientAppExtensionHandler : public CefV8Handler {
|
||||
public:
|
||||
explicit ClientAppExtensionHandler(CefRefPtr<ClientApp> client_app)
|
||||
: client_app_(client_app) {
|
||||
}
|
||||
|
||||
virtual bool Execute(const CefString& name,
|
||||
CefRefPtr<CefV8Value> object,
|
||||
const CefV8ValueList& arguments,
|
||||
CefRefPtr<CefV8Value>& retval,
|
||||
CefString& exception) {
|
||||
bool handled = false;
|
||||
|
||||
if (name == "sendMessage") {
|
||||
// Send a message to the browser process.
|
||||
if ((arguments.size() == 1 || arguments.size() == 2) &&
|
||||
arguments[0]->IsString()) {
|
||||
CefRefPtr<CefBrowser> browser =
|
||||
CefV8Context::GetCurrentContext()->GetBrowser();
|
||||
ASSERT(browser.get());
|
||||
|
||||
CefString name = arguments[0]->GetStringValue();
|
||||
if (!name.empty()) {
|
||||
CefRefPtr<CefProcessMessage> message =
|
||||
CefProcessMessage::Create(name);
|
||||
|
||||
// Translate the arguments, if any.
|
||||
if (arguments.size() == 2 && arguments[1]->IsArray())
|
||||
SetList(arguments[1], message->GetArgumentList());
|
||||
|
||||
browser->SendProcessMessage(PID_BROWSER, message);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
} else if (name == "setMessageCallback") {
|
||||
// Set a message callback.
|
||||
if (arguments.size() == 2 && arguments[0]->IsString() &&
|
||||
arguments[1]->IsFunction()) {
|
||||
std::string name = arguments[0]->GetStringValue();
|
||||
CefRefPtr<CefV8Context> context = CefV8Context::GetCurrentContext();
|
||||
int browser_id = context->GetBrowser()->GetIdentifier();
|
||||
client_app_->SetMessageCallback(name, browser_id, context,
|
||||
arguments[1]);
|
||||
handled = true;
|
||||
}
|
||||
} else if (name == "removeMessageCallback") {
|
||||
// Remove a message callback.
|
||||
if (arguments.size() == 1 && arguments[0]->IsString()) {
|
||||
std::string name = arguments[0]->GetStringValue();
|
||||
CefRefPtr<CefV8Context> context = CefV8Context::GetCurrentContext();
|
||||
int browser_id = context->GetBrowser()->GetIdentifier();
|
||||
bool removed = client_app_->RemoveMessageCallback(name, browser_id);
|
||||
retval = CefV8Value::CreateBool(removed);
|
||||
handled = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled)
|
||||
exception = "Invalid method arguments";
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
CefRefPtr<ClientApp> client_app_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientAppExtensionHandler);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
|
||||
ClientApp::ClientApp()
|
||||
: proxy_type_(PROXY_TYPE_DIRECT) {
|
||||
CreateRenderDelegates(render_delegates_);
|
||||
|
||||
// Default schemes that support cookies.
|
||||
cookieable_schemes_.push_back("http");
|
||||
cookieable_schemes_.push_back("https");
|
||||
}
|
||||
|
||||
void ClientApp::SetMessageCallback(const std::string& message_name,
|
||||
int browser_id,
|
||||
CefRefPtr<CefV8Context> context,
|
||||
CefRefPtr<CefV8Value> function) {
|
||||
ASSERT(CefCurrentlyOn(TID_RENDERER));
|
||||
|
||||
callback_map_.insert(
|
||||
std::make_pair(std::make_pair(message_name, browser_id),
|
||||
std::make_pair(context, function)));
|
||||
}
|
||||
|
||||
bool ClientApp::RemoveMessageCallback(const std::string& message_name,
|
||||
int browser_id) {
|
||||
ASSERT(CefCurrentlyOn(TID_RENDERER));
|
||||
|
||||
CallbackMap::iterator it =
|
||||
callback_map_.find(std::make_pair(message_name, browser_id));
|
||||
if (it != callback_map_.end()) {
|
||||
callback_map_.erase(it);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientApp::OnContextInitialized() {
|
||||
// Register cookieable schemes with the global cookie manager.
|
||||
CefRefPtr<CefCookieManager> manager = CefCookieManager::GetGlobalManager();
|
||||
ASSERT(manager.get());
|
||||
manager->SetSupportedSchemes(cookieable_schemes_);
|
||||
}
|
||||
|
||||
void ClientApp::GetProxyForUrl(const CefString& url,
|
||||
CefProxyInfo& proxy_info) {
|
||||
proxy_info.proxyType = proxy_type_;
|
||||
if (!proxy_config_.empty())
|
||||
CefString(&proxy_info.proxyList) = proxy_config_;
|
||||
}
|
||||
|
||||
void ClientApp::OnWebKitInitialized() {
|
||||
// Register the client_app extension.
|
||||
std::string app_code =
|
||||
"var app;"
|
||||
"if (!app)"
|
||||
" app = {};"
|
||||
"(function() {"
|
||||
" app.sendMessage = function(name, arguments) {"
|
||||
" native function sendMessage();"
|
||||
" return sendMessage(name, arguments);"
|
||||
" };"
|
||||
" app.setMessageCallback = function(name, callback) {"
|
||||
" native function setMessageCallback();"
|
||||
" return setMessageCallback(name, callback);"
|
||||
" };"
|
||||
" app.removeMessageCallback = function(name) {"
|
||||
" native function removeMessageCallback();"
|
||||
" return removeMessageCallback(name);"
|
||||
" };"
|
||||
"})();";
|
||||
CefRegisterExtension("v8/app", app_code,
|
||||
new ClientAppExtensionHandler(this));
|
||||
|
||||
// Execute delegate callbacks.
|
||||
RenderDelegateSet::iterator it = render_delegates_.begin();
|
||||
for (; it != render_delegates_.end(); ++it)
|
||||
(*it)->OnWebKitInitialized(this);
|
||||
}
|
||||
|
||||
void ClientApp::OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
// Execute delegate callbacks.
|
||||
RenderDelegateSet::iterator it = render_delegates_.begin();
|
||||
for (; it != render_delegates_.end(); ++it)
|
||||
(*it)->OnContextCreated(this, browser, frame, context);
|
||||
}
|
||||
|
||||
void ClientApp::OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
// Execute delegate callbacks.
|
||||
RenderDelegateSet::iterator it = render_delegates_.begin();
|
||||
for (; it != render_delegates_.end(); ++it)
|
||||
(*it)->OnContextReleased(this, browser, frame, context);
|
||||
|
||||
// Remove any JavaScript callbacks registered for the context that has been
|
||||
// released.
|
||||
if (!callback_map_.empty()) {
|
||||
CallbackMap::iterator it = callback_map_.begin();
|
||||
for (; it != callback_map_.end();) {
|
||||
if (it->second.first->IsSame(context))
|
||||
callback_map_.erase(it++);
|
||||
else
|
||||
++it;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ClientApp::OnFocusedNodeChanged(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefDOMNode> node) {
|
||||
// Execute delegate callbacks.
|
||||
RenderDelegateSet::iterator it = render_delegates_.begin();
|
||||
for (; it != render_delegates_.end(); ++it)
|
||||
(*it)->OnFocusedNodeChanged(this, browser, frame, node);
|
||||
}
|
||||
|
||||
bool ClientApp::OnProcessMessageReceived(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
ASSERT(source_process == PID_BROWSER);
|
||||
|
||||
bool handled = false;
|
||||
|
||||
// Execute delegate callbacks.
|
||||
RenderDelegateSet::iterator it = render_delegates_.begin();
|
||||
for (; it != render_delegates_.end() && !handled; ++it) {
|
||||
handled = (*it)->OnProcessMessageReceived(this, browser, source_process,
|
||||
message);
|
||||
}
|
||||
|
||||
if (handled)
|
||||
return true;
|
||||
|
||||
// Execute the registered JavaScript callback if any.
|
||||
if (!callback_map_.empty()) {
|
||||
CefString message_name = message->GetName();
|
||||
CallbackMap::const_iterator it = callback_map_.find(
|
||||
std::make_pair(message_name.ToString(),
|
||||
browser->GetIdentifier()));
|
||||
if (it != callback_map_.end()) {
|
||||
// Enter the context.
|
||||
it->second.first->Enter();
|
||||
|
||||
CefV8ValueList arguments;
|
||||
|
||||
// First argument is the message name.
|
||||
arguments.push_back(CefV8Value::CreateString(message_name));
|
||||
|
||||
// Second argument is the list of message arguments.
|
||||
CefRefPtr<CefListValue> list = message->GetArgumentList();
|
||||
CefRefPtr<CefV8Value> args = CefV8Value::CreateArray(list->GetSize());
|
||||
SetList(list, args);
|
||||
arguments.push_back(args);
|
||||
|
||||
// Execute the callback.
|
||||
CefRefPtr<CefV8Value> retval =
|
||||
it->second.second->ExecuteFunction(NULL, arguments);
|
||||
if (retval.get()) {
|
||||
if (retval->IsBool())
|
||||
handled = retval->GetBoolValue();
|
||||
}
|
||||
|
||||
// Exit the context.
|
||||
it->second.first->Exit();
|
||||
}
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
@@ -1,157 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_CLIENT_APP_H_
|
||||
#define CEF_TESTS_CEFCLIENT_CLIENT_APP_H_
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include "include/cef_app.h"
|
||||
|
||||
class ClientApp : public CefApp,
|
||||
public CefBrowserProcessHandler,
|
||||
public CefProxyHandler,
|
||||
public CefRenderProcessHandler {
|
||||
public:
|
||||
// Interface for renderer delegates. All RenderDelegates must be returned via
|
||||
// CreateRenderDelegates. Do not perform work in the RenderDelegate
|
||||
// constructor.
|
||||
class RenderDelegate : public virtual CefBase {
|
||||
public:
|
||||
// Called when WebKit is initialized. Used to register V8 extensions.
|
||||
virtual void OnWebKitInitialized(CefRefPtr<ClientApp> app) {
|
||||
};
|
||||
|
||||
// Called when a V8 context is created. Used to create V8 window bindings
|
||||
// and set message callbacks. RenderDelegates should check for unique URLs
|
||||
// to avoid interfering with each other.
|
||||
virtual void OnContextCreated(CefRefPtr<ClientApp> app,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
};
|
||||
|
||||
// Called when a V8 context is released. Used to clean up V8 window
|
||||
// bindings. RenderDelegates should check for unique URLs to avoid
|
||||
// interfering with each other.
|
||||
virtual void OnContextReleased(CefRefPtr<ClientApp> app,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) {
|
||||
};
|
||||
|
||||
// Called when the focused node in a frame has changed.
|
||||
virtual void OnFocusedNodeChanged(CefRefPtr<ClientApp> app,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefDOMNode> node) {
|
||||
}
|
||||
|
||||
// Called when a process message is received. Return true if the message was
|
||||
// handled and should not be passed on to other handlers. RenderDelegates
|
||||
// should check for unique message names to avoid interfering with each
|
||||
// other.
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<ClientApp> app,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<CefRefPtr<RenderDelegate> > RenderDelegateSet;
|
||||
|
||||
ClientApp();
|
||||
|
||||
// Set the proxy configuration. Should only be called during initialization.
|
||||
void SetProxyConfig(cef_proxy_type_t proxy_type,
|
||||
const CefString& proxy_config) {
|
||||
proxy_type_ = proxy_type;
|
||||
proxy_config_ = proxy_config;
|
||||
}
|
||||
|
||||
// Set a JavaScript callback for the specified |message_name| and |browser_id|
|
||||
// combination. Will automatically be removed when the associated context is
|
||||
// released. Callbacks can also be set in JavaScript using the
|
||||
// app.setMessageCallback function.
|
||||
void SetMessageCallback(const std::string& message_name,
|
||||
int browser_id,
|
||||
CefRefPtr<CefV8Context> context,
|
||||
CefRefPtr<CefV8Value> function);
|
||||
|
||||
// Removes the JavaScript callback for the specified |message_name| and
|
||||
// |browser_id| combination. Returns true if a callback was removed. Callbacks
|
||||
// can also be removed in JavaScript using the app.removeMessageCallback
|
||||
// function.
|
||||
bool RemoveMessageCallback(const std::string& message_name,
|
||||
int browser_id);
|
||||
|
||||
private:
|
||||
// Creates all of the RenderDelegate objects. Implemented in
|
||||
// client_app_delegates.
|
||||
static void CreateRenderDelegates(RenderDelegateSet& delegates);
|
||||
|
||||
// Registers custom schemes. Implemented in client_app_delegates.
|
||||
static void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar,
|
||||
std::vector<CefString>& cookiable_schemes);
|
||||
|
||||
// CefApp methods.
|
||||
virtual void OnRegisterCustomSchemes(
|
||||
CefRefPtr<CefSchemeRegistrar> registrar) OVERRIDE {
|
||||
RegisterCustomSchemes(registrar, cookieable_schemes_);
|
||||
}
|
||||
virtual CefRefPtr<CefBrowserProcessHandler> GetBrowserProcessHandler()
|
||||
OVERRIDE { return this; }
|
||||
virtual CefRefPtr<CefRenderProcessHandler> GetRenderProcessHandler()
|
||||
OVERRIDE { return this; }
|
||||
|
||||
// CefBrowserProcessHandler methods.
|
||||
virtual CefRefPtr<CefProxyHandler> GetProxyHandler() OVERRIDE { return this; }
|
||||
virtual void OnContextInitialized();
|
||||
|
||||
// CefProxyHandler methods.
|
||||
virtual void GetProxyForUrl(const CefString& url,
|
||||
CefProxyInfo& proxy_info) OVERRIDE;
|
||||
|
||||
// CefRenderProcessHandler methods.
|
||||
virtual void OnWebKitInitialized() OVERRIDE;
|
||||
virtual void OnContextCreated(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
virtual void OnContextReleased(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefV8Context> context) OVERRIDE;
|
||||
virtual void OnFocusedNodeChanged(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefDOMNode> node) OVERRIDE;
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE;
|
||||
|
||||
// Proxy configuration.
|
||||
cef_proxy_type_t proxy_type_;
|
||||
CefString proxy_config_;
|
||||
|
||||
// Map of message callbacks.
|
||||
typedef std::map<std::pair<std::string, int>,
|
||||
std::pair<CefRefPtr<CefV8Context>, CefRefPtr<CefV8Value> > >
|
||||
CallbackMap;
|
||||
CallbackMap callback_map_;
|
||||
|
||||
// Set of supported RenderDelegates.
|
||||
RenderDelegateSet render_delegates_;
|
||||
|
||||
// Schemes that will be registered with the global cookie manager.
|
||||
std::vector<CefString> cookieable_schemes_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientApp);
|
||||
};
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_CLIENT_APP_H_
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/client_app.h"
|
||||
#include "cefclient/client_renderer.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/scheme_test.h"
|
||||
|
||||
// static
|
||||
void ClientApp::CreateRenderDelegates(RenderDelegateSet& delegates) {
|
||||
client_renderer::CreateRenderDelegates(delegates);
|
||||
dom_test::CreateRenderDelegates(delegates);
|
||||
}
|
||||
|
||||
// static
|
||||
void ClientApp::RegisterCustomSchemes(
|
||||
CefRefPtr<CefSchemeRegistrar> registrar,
|
||||
std::vector<CefString>& cookiable_schemes) {
|
||||
scheme_test::RegisterCustomSchemes(registrar, cookiable_schemes);
|
||||
}
|
||||
@@ -1,526 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/client_handler.h"
|
||||
#include <algorithm>
|
||||
#include <stdio.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_path_util.h"
|
||||
#include "include/cef_process_util.h"
|
||||
#include "include/cef_runnable.h"
|
||||
#include "include/wrapper/cef_stream_resource_handler.h"
|
||||
#include "cefclient/binding_test.h"
|
||||
#include "cefclient/cefclient.h"
|
||||
#include "cefclient/client_renderer.h"
|
||||
#include "cefclient/client_switches.h"
|
||||
#include "cefclient/dom_test.h"
|
||||
#include "cefclient/resource_util.h"
|
||||
#include "cefclient/string_util.h"
|
||||
|
||||
|
||||
// Custom menu command Ids.
|
||||
enum client_menu_ids {
|
||||
CLIENT_ID_SHOW_DEVTOOLS = MENU_ID_USER_FIRST,
|
||||
CLIENT_ID_TESTMENU_SUBMENU,
|
||||
CLIENT_ID_TESTMENU_CHECKITEM,
|
||||
CLIENT_ID_TESTMENU_RADIOITEM1,
|
||||
CLIENT_ID_TESTMENU_RADIOITEM2,
|
||||
CLIENT_ID_TESTMENU_RADIOITEM3,
|
||||
};
|
||||
|
||||
ClientHandler::ClientHandler()
|
||||
: m_MainHwnd(NULL),
|
||||
m_BrowserId(0),
|
||||
m_EditHwnd(NULL),
|
||||
m_BackHwnd(NULL),
|
||||
m_ForwardHwnd(NULL),
|
||||
m_StopHwnd(NULL),
|
||||
m_ReloadHwnd(NULL),
|
||||
m_bFocusOnEditableField(false) {
|
||||
CreateProcessMessageDelegates(process_message_delegates_);
|
||||
CreateRequestDelegates(request_delegates_);
|
||||
|
||||
// Read command line settings.
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
CefCommandLine::GetGlobalCommandLine();
|
||||
|
||||
if (command_line->HasSwitch(cefclient::kUrl))
|
||||
m_StartupURL = command_line->GetSwitchValue(cefclient::kUrl);
|
||||
if (m_StartupURL.empty())
|
||||
m_StartupURL = "http://www.google.com/";
|
||||
|
||||
m_bExternalDevTools = command_line->HasSwitch(cefclient::kExternalDevTools);
|
||||
}
|
||||
|
||||
ClientHandler::~ClientHandler() {
|
||||
}
|
||||
|
||||
bool ClientHandler::OnProcessMessageReceived(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
// Check for messages from the client renderer.
|
||||
std::string message_name = message->GetName();
|
||||
if (message_name == client_renderer::kFocusedNodeChangedMessage) {
|
||||
// A message is sent from ClientRenderDelegate to tell us whether the
|
||||
// currently focused DOM node is editable. Use of |m_bFocusOnEditableField|
|
||||
// is redundant with CefKeyEvent.focus_on_editable_field in OnPreKeyEvent
|
||||
// but is useful for demonstration purposes.
|
||||
m_bFocusOnEditableField = message->GetArgumentList()->GetBool(0);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool handled = false;
|
||||
|
||||
// Execute delegate callbacks.
|
||||
ProcessMessageDelegateSet::iterator it = process_message_delegates_.begin();
|
||||
for (; it != process_message_delegates_.end() && !handled; ++it) {
|
||||
handled = (*it)->OnProcessMessageReceived(this, browser, source_process,
|
||||
message);
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
void ClientHandler::OnBeforeContextMenu(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model) {
|
||||
if ((params->GetTypeFlags() & (CM_TYPEFLAG_PAGE | CM_TYPEFLAG_FRAME)) != 0) {
|
||||
// Add a separator if the menu already has items.
|
||||
if (model->GetCount() > 0)
|
||||
model->AddSeparator();
|
||||
|
||||
// Add a "Show DevTools" item to all context menus.
|
||||
model->AddItem(CLIENT_ID_SHOW_DEVTOOLS, "&Show DevTools");
|
||||
|
||||
CefString devtools_url = browser->GetHost()->GetDevToolsURL(true);
|
||||
if (devtools_url.empty() ||
|
||||
m_OpenDevToolsURLs.find(devtools_url) != m_OpenDevToolsURLs.end()) {
|
||||
// Disable the menu option if DevTools isn't enabled or if a window is
|
||||
// already open for the current URL.
|
||||
model->SetEnabled(CLIENT_ID_SHOW_DEVTOOLS, false);
|
||||
}
|
||||
|
||||
// Test context menu features.
|
||||
BuildTestMenu(model);
|
||||
}
|
||||
}
|
||||
|
||||
bool ClientHandler::OnContextMenuCommand(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
EventFlags event_flags) {
|
||||
switch (command_id) {
|
||||
case CLIENT_ID_SHOW_DEVTOOLS:
|
||||
ShowDevTools(browser);
|
||||
return true;
|
||||
default: // Allow default handling, if any.
|
||||
return ExecuteTestMenu(command_id);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) {
|
||||
REQUIRE_UI_THREAD();
|
||||
SetLoading(isLoading);
|
||||
SetNavState(canGoBack, canGoForward);
|
||||
}
|
||||
|
||||
bool ClientHandler::OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
bool first_message;
|
||||
std::string logFile;
|
||||
|
||||
{
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
first_message = m_LogFile.empty();
|
||||
if (first_message) {
|
||||
std::stringstream ss;
|
||||
ss << AppGetWorkingDirectory();
|
||||
#if defined(OS_WIN)
|
||||
ss << "\\";
|
||||
#else
|
||||
ss << "/";
|
||||
#endif
|
||||
ss << "console.log";
|
||||
m_LogFile = ss.str();
|
||||
}
|
||||
logFile = m_LogFile;
|
||||
}
|
||||
|
||||
FILE* file = fopen(logFile.c_str(), "a");
|
||||
if (file) {
|
||||
std::stringstream ss;
|
||||
ss << "Message: " << std::string(message) << "\r\nSource: " <<
|
||||
std::string(source) << "\r\nLine: " << line <<
|
||||
"\r\n-----------------------\r\n";
|
||||
fputs(ss.str().c_str(), file);
|
||||
fclose(file);
|
||||
|
||||
if (first_message)
|
||||
SendNotification(NOTIFY_CONSOLE_MESSAGE);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnBeforeDownload(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) {
|
||||
REQUIRE_UI_THREAD();
|
||||
// Continue the download and show the "Save As" dialog.
|
||||
callback->Continue(GetDownloadPath(suggested_name), true);
|
||||
}
|
||||
|
||||
void ClientHandler::OnDownloadUpdated(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
CefRefPtr<CefDownloadItemCallback> callback) {
|
||||
REQUIRE_UI_THREAD();
|
||||
if (download_item->IsComplete()) {
|
||||
SetLastDownloadFile(download_item->GetFullPath());
|
||||
SendNotification(NOTIFY_DOWNLOAD_COMPLETE);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnRequestGeolocationPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& requesting_url,
|
||||
int request_id,
|
||||
CefRefPtr<CefGeolocationCallback> callback) {
|
||||
// Allow geolocation access from all websites.
|
||||
callback->Continue(true);
|
||||
}
|
||||
|
||||
bool ClientHandler::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefKeyEvent& event,
|
||||
CefEventHandle os_event,
|
||||
bool* is_keyboard_shortcut) {
|
||||
ASSERT(m_bFocusOnEditableField == event.focus_on_editable_field);
|
||||
if (!event.focus_on_editable_field && event.windows_key_code == 0x20) {
|
||||
// Special handling for the space character when an input element does not
|
||||
// have focus. Handling the event in OnPreKeyEvent() keeps the event from
|
||||
// being processed in the renderer. If we instead handled the event in the
|
||||
// OnKeyEvent() method the space key would cause the window to scroll in
|
||||
// addition to showing the alert box.
|
||||
if (event.type == KEYEVENT_RAWKEYDOWN) {
|
||||
browser->GetMainFrame()->ExecuteJavaScript(
|
||||
"alert('You pressed the space bar!');", "", 0);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnAfterCreated(CefRefPtr<CefBrowser> browser) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
AutoLock lock_scope(this);
|
||||
if (!m_Browser.get()) {
|
||||
// We need to keep the main child window, but not popup windows
|
||||
m_Browser = browser;
|
||||
m_BrowserId = browser->GetIdentifier();
|
||||
}
|
||||
}
|
||||
|
||||
bool ClientHandler::DoClose(CefRefPtr<CefBrowser> browser) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier()) {
|
||||
// Since the main window contains the browser window, we need to close
|
||||
// the parent window instead of the browser window.
|
||||
CloseMainWindow();
|
||||
|
||||
// Return true here so that we can skip closing the browser window
|
||||
// in this pass. (It will be destroyed due to the call to close
|
||||
// the parent above.)
|
||||
return true;
|
||||
}
|
||||
|
||||
// A popup browser window is not contained in another window, so we can let
|
||||
// these windows close by themselves.
|
||||
return false;
|
||||
}
|
||||
|
||||
void ClientHandler::OnBeforeClose(CefRefPtr<CefBrowser> browser) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier()) {
|
||||
// Free the browser pointer so that the browser can be destroyed
|
||||
m_Browser = NULL;
|
||||
} else if (browser->IsPopup()) {
|
||||
// Remove the record for DevTools popup windows.
|
||||
std::set<std::string>::iterator it =
|
||||
m_OpenDevToolsURLs.find(browser->GetMainFrame()->GetURL());
|
||||
if (it != m_OpenDevToolsURLs.end())
|
||||
m_OpenDevToolsURLs.erase(it);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// We've just started loading a page
|
||||
SetLoading(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// We've just finished loading a page
|
||||
SetLoading(false);
|
||||
|
||||
// Continue the DOM test.
|
||||
if (frame->GetURL() == dom_test::kTestUrl)
|
||||
dom_test::OnLoadEnd(browser);
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
// Don't display an error for downloaded files.
|
||||
if (errorCode == ERR_ABORTED)
|
||||
return;
|
||||
|
||||
// Don't display an error for external protocols that we allow the OS to
|
||||
// handle. See OnProtocolExecution().
|
||||
if (errorCode == ERR_UNKNOWN_URL_SCHEME) {
|
||||
std::string urlStr = frame->GetURL();
|
||||
if (urlStr.find("spotify:") == 0)
|
||||
return;
|
||||
}
|
||||
|
||||
// Display a load error message.
|
||||
std::stringstream ss;
|
||||
ss << "<html><body><h2>Failed to load URL " << std::string(failedUrl) <<
|
||||
" with error " << std::string(errorText) << " (" << errorCode <<
|
||||
").</h2></body></html>";
|
||||
frame->LoadString(ss.str(), failedUrl);
|
||||
}
|
||||
|
||||
void ClientHandler::OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) {
|
||||
// Load the startup URL if that's not the website that we terminated on.
|
||||
CefRefPtr<CefFrame> frame = browser->GetMainFrame();
|
||||
std::string url = frame->GetURL();
|
||||
std::transform(url.begin(), url.end(), url.begin(), tolower);
|
||||
|
||||
std::string startupURL = GetStartupURL();
|
||||
if (url.find(startupURL) != 0)
|
||||
frame->LoadURL(startupURL);
|
||||
}
|
||||
|
||||
CefRefPtr<CefResourceHandler> ClientHandler::GetResourceHandler(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
std::string url = request->GetURL();
|
||||
if (url == "http://tests/request") {
|
||||
// Show the request contents
|
||||
std::string dump;
|
||||
DumpRequestContents(request, dump);
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
CefStreamReader::CreateForData(
|
||||
static_cast<void*>(const_cast<char*>(dump.c_str())),
|
||||
dump.size());
|
||||
ASSERT(stream.get());
|
||||
return new CefStreamResourceHandler("text/plain", stream);
|
||||
} else if (url == "http://tests/dialogs") {
|
||||
// Show the dialogs contents
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
GetBinaryResourceReader("dialogs.html");
|
||||
ASSERT(stream.get());
|
||||
return new CefStreamResourceHandler("text/html", stream);
|
||||
} else if (url == dom_test::kTestUrl) {
|
||||
// Show the domaccess contents
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
GetBinaryResourceReader("domaccess.html");
|
||||
ASSERT(stream.get());
|
||||
return new CefStreamResourceHandler("text/html", stream);
|
||||
} else if (url == "http://tests/localstorage") {
|
||||
// Show the localstorage contents
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
GetBinaryResourceReader("localstorage.html");
|
||||
ASSERT(stream.get());
|
||||
return new CefStreamResourceHandler("text/html", stream);
|
||||
} else if (url == "http://tests/xmlhttprequest") {
|
||||
// Show the xmlhttprequest contents
|
||||
CefRefPtr<CefStreamReader> stream =
|
||||
GetBinaryResourceReader("xmlhttprequest.html");
|
||||
ASSERT(stream.get());
|
||||
return new CefStreamResourceHandler("text/html", stream);
|
||||
}
|
||||
|
||||
CefRefPtr<CefResourceHandler> handler;
|
||||
|
||||
// Execute delegate callbacks.
|
||||
RequestDelegateSet::iterator it = request_delegates_.begin();
|
||||
for (; it != request_delegates_.end() && !handler.get(); ++it)
|
||||
handler = (*it)->GetResourceHandler(this, browser, frame, request);
|
||||
|
||||
return handler;
|
||||
}
|
||||
|
||||
void ClientHandler::OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
bool& allow_os_execution) {
|
||||
std::string urlStr = url;
|
||||
|
||||
// Allow OS execution of Spotify URIs.
|
||||
if (urlStr.find("spotify:") == 0)
|
||||
allow_os_execution = true;
|
||||
}
|
||||
|
||||
void ClientHandler::SetMainHwnd(CefWindowHandle hwnd) {
|
||||
AutoLock lock_scope(this);
|
||||
m_MainHwnd = hwnd;
|
||||
}
|
||||
|
||||
void ClientHandler::SetEditHwnd(CefWindowHandle hwnd) {
|
||||
AutoLock lock_scope(this);
|
||||
m_EditHwnd = hwnd;
|
||||
}
|
||||
|
||||
void ClientHandler::SetButtonHwnds(CefWindowHandle backHwnd,
|
||||
CefWindowHandle forwardHwnd,
|
||||
CefWindowHandle reloadHwnd,
|
||||
CefWindowHandle stopHwnd) {
|
||||
AutoLock lock_scope(this);
|
||||
m_BackHwnd = backHwnd;
|
||||
m_ForwardHwnd = forwardHwnd;
|
||||
m_ReloadHwnd = reloadHwnd;
|
||||
m_StopHwnd = stopHwnd;
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetLogFile() {
|
||||
AutoLock lock_scope(this);
|
||||
return m_LogFile;
|
||||
}
|
||||
|
||||
void ClientHandler::SetLastDownloadFile(const std::string& fileName) {
|
||||
AutoLock lock_scope(this);
|
||||
m_LastDownloadFile = fileName;
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetLastDownloadFile() {
|
||||
AutoLock lock_scope(this);
|
||||
return m_LastDownloadFile;
|
||||
}
|
||||
|
||||
void ClientHandler::ShowDevTools(CefRefPtr<CefBrowser> browser) {
|
||||
std::string devtools_url = browser->GetHost()->GetDevToolsURL(true);
|
||||
if (!devtools_url.empty()) {
|
||||
if (m_bExternalDevTools) {
|
||||
// Open DevTools in an external browser window.
|
||||
LaunchExternalBrowser(devtools_url);
|
||||
} else if (m_OpenDevToolsURLs.find(devtools_url) ==
|
||||
m_OpenDevToolsURLs.end()) {
|
||||
// Open DevTools in a popup window.
|
||||
m_OpenDevToolsURLs.insert(devtools_url);
|
||||
browser->GetMainFrame()->ExecuteJavaScript(
|
||||
"window.open('" + devtools_url + "');", "about:blank", 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void ClientHandler::LaunchExternalBrowser(const std::string& url) {
|
||||
if (CefCurrentlyOn(TID_PROCESS_LAUNCHER)) {
|
||||
// Retrieve the current executable path.
|
||||
CefString file_exe;
|
||||
if (!CefGetPath(PK_FILE_EXE, file_exe))
|
||||
return;
|
||||
|
||||
// Create the command line.
|
||||
CefRefPtr<CefCommandLine> command_line =
|
||||
CefCommandLine::CreateCommandLine();
|
||||
command_line->SetProgram(file_exe);
|
||||
command_line->AppendSwitchWithValue(cefclient::kUrl, url);
|
||||
|
||||
// Launch the process.
|
||||
CefLaunchProcess(command_line);
|
||||
} else {
|
||||
// Execute on the PROCESS_LAUNCHER thread.
|
||||
CefPostTask(TID_PROCESS_LAUNCHER,
|
||||
NewCefRunnableFunction(&ClientHandler::LaunchExternalBrowser, url));
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void ClientHandler::CreateProcessMessageDelegates(
|
||||
ProcessMessageDelegateSet& delegates) {
|
||||
// Create the binding test delegates.
|
||||
binding_test::CreateProcessMessageDelegates(delegates);
|
||||
}
|
||||
|
||||
// static
|
||||
void ClientHandler::CreateRequestDelegates(RequestDelegateSet& delegates) {
|
||||
// Create the binding test delegates.
|
||||
binding_test::CreateRequestDelegates(delegates);
|
||||
}
|
||||
|
||||
void ClientHandler::BuildTestMenu(CefRefPtr<CefMenuModel> model) {
|
||||
if (model->GetCount() > 0)
|
||||
model->AddSeparator();
|
||||
|
||||
// Build the sub menu.
|
||||
CefRefPtr<CefMenuModel> submenu =
|
||||
model->AddSubMenu(CLIENT_ID_TESTMENU_SUBMENU, "Context Menu Test");
|
||||
submenu->AddCheckItem(CLIENT_ID_TESTMENU_CHECKITEM, "Check Item");
|
||||
submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM1, "Radio Item 1", 0);
|
||||
submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM2, "Radio Item 2", 0);
|
||||
submenu->AddRadioItem(CLIENT_ID_TESTMENU_RADIOITEM3, "Radio Item 3", 0);
|
||||
|
||||
// Check the check item.
|
||||
if (m_TestMenuState.check_item)
|
||||
submenu->SetChecked(CLIENT_ID_TESTMENU_CHECKITEM, true);
|
||||
|
||||
// Check the selected radio item.
|
||||
submenu->SetChecked(
|
||||
CLIENT_ID_TESTMENU_RADIOITEM1 + m_TestMenuState.radio_item, true);
|
||||
}
|
||||
|
||||
bool ClientHandler::ExecuteTestMenu(int command_id) {
|
||||
if (command_id == CLIENT_ID_TESTMENU_CHECKITEM) {
|
||||
// Toggle the check item.
|
||||
m_TestMenuState.check_item ^= 1;
|
||||
return true;
|
||||
} else if (command_id >= CLIENT_ID_TESTMENU_RADIOITEM1 &&
|
||||
command_id <= CLIENT_ID_TESTMENU_RADIOITEM3) {
|
||||
// Store the selected radio item.
|
||||
m_TestMenuState.radio_item = (command_id - CLIENT_ID_TESTMENU_RADIOITEM1);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow default handling to proceed.
|
||||
return false;
|
||||
}
|
||||
@@ -1,283 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_
|
||||
#define CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include "include/cef_client.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
|
||||
// Define this value to redirect all popup URLs to the main application browser
|
||||
// window.
|
||||
// #define TEST_REDIRECT_POPUP_URLS
|
||||
|
||||
|
||||
// ClientHandler implementation.
|
||||
class ClientHandler : public CefClient,
|
||||
public CefContextMenuHandler,
|
||||
public CefDisplayHandler,
|
||||
public CefDownloadHandler,
|
||||
public CefGeolocationHandler,
|
||||
public CefKeyboardHandler,
|
||||
public CefLifeSpanHandler,
|
||||
public CefLoadHandler,
|
||||
public CefRequestHandler {
|
||||
public:
|
||||
// Interface for process message delegates. Do not perform work in the
|
||||
// RenderDelegate constructor.
|
||||
class ProcessMessageDelegate : public virtual CefBase {
|
||||
public:
|
||||
// Called when a process message is received. Return true if the message was
|
||||
// handled and should not be passed on to other handlers.
|
||||
// ProcessMessageDelegates should check for unique message names to avoid
|
||||
// interfering with each other.
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<ClientHandler> handler,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<CefRefPtr<ProcessMessageDelegate> >
|
||||
ProcessMessageDelegateSet;
|
||||
|
||||
// Interface for request handler delegates. Do not perform work in the
|
||||
// RequestDelegate constructor.
|
||||
class RequestDelegate : public virtual CefBase {
|
||||
public:
|
||||
// Called to retrieve a resource handler.
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
|
||||
CefRefPtr<ClientHandler> handler,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) {
|
||||
return NULL;
|
||||
}
|
||||
};
|
||||
|
||||
typedef std::set<CefRefPtr<RequestDelegate> > RequestDelegateSet;
|
||||
|
||||
ClientHandler();
|
||||
virtual ~ClientHandler();
|
||||
|
||||
// CefClient methods
|
||||
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefDownloadHandler> GetDownloadHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefGeolocationHandler> GetGeolocationHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE {
|
||||
return this;
|
||||
}
|
||||
virtual bool OnProcessMessageReceived(CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message)
|
||||
OVERRIDE;
|
||||
|
||||
// CefContextMenuHandler methods
|
||||
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
CefRefPtr<CefMenuModel> model) OVERRIDE;
|
||||
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefContextMenuParams> params,
|
||||
int command_id,
|
||||
EventFlags event_flags) OVERRIDE;
|
||||
|
||||
// CefDisplayHandler methods
|
||||
virtual void OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) OVERRIDE;
|
||||
virtual void OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) OVERRIDE;
|
||||
virtual void OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) OVERRIDE;
|
||||
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& message,
|
||||
const CefString& source,
|
||||
int line) OVERRIDE;
|
||||
|
||||
// CefDownloadHandler methods
|
||||
virtual void OnBeforeDownload(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
const CefString& suggested_name,
|
||||
CefRefPtr<CefBeforeDownloadCallback> callback) OVERRIDE;
|
||||
virtual void OnDownloadUpdated(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefDownloadItem> download_item,
|
||||
CefRefPtr<CefDownloadItemCallback> callback) OVERRIDE;
|
||||
|
||||
// CefGeolocationHandler methods
|
||||
virtual void OnRequestGeolocationPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
const CefString& requesting_url,
|
||||
int request_id,
|
||||
CefRefPtr<CefGeolocationCallback> callback) OVERRIDE;
|
||||
|
||||
// CefKeyboardHandler methods
|
||||
virtual bool OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
|
||||
const CefKeyEvent& event,
|
||||
CefEventHandle os_event,
|
||||
bool* is_keyboard_shortcut) OVERRIDE;
|
||||
|
||||
// CefLifeSpanHandler methods
|
||||
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
virtual bool DoClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
||||
|
||||
// CefLoadHandler methods
|
||||
virtual void OnLoadStart(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame) OVERRIDE;
|
||||
virtual void OnLoadEnd(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) OVERRIDE;
|
||||
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) OVERRIDE;
|
||||
virtual void OnRenderProcessTerminated(CefRefPtr<CefBrowser> browser,
|
||||
TerminationStatus status) OVERRIDE;
|
||||
|
||||
// CefRequestHandler methods
|
||||
virtual CefRefPtr<CefResourceHandler> GetResourceHandler(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefRequest> request) OVERRIDE;
|
||||
virtual void OnProtocolExecution(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& url,
|
||||
bool& allow_os_execution) OVERRIDE;
|
||||
|
||||
void SetMainHwnd(CefWindowHandle hwnd);
|
||||
CefWindowHandle GetMainHwnd() { return m_MainHwnd; }
|
||||
void SetEditHwnd(CefWindowHandle hwnd);
|
||||
void SetButtonHwnds(CefWindowHandle backHwnd,
|
||||
CefWindowHandle forwardHwnd,
|
||||
CefWindowHandle reloadHwnd,
|
||||
CefWindowHandle stopHwnd);
|
||||
|
||||
CefRefPtr<CefBrowser> GetBrowser() { return m_Browser; }
|
||||
int GetBrowserId() { return m_BrowserId; }
|
||||
|
||||
std::string GetLogFile();
|
||||
|
||||
void SetLastDownloadFile(const std::string& fileName);
|
||||
std::string GetLastDownloadFile();
|
||||
|
||||
// Send a notification to the application. Notifications should not block the
|
||||
// caller.
|
||||
enum NotificationType {
|
||||
NOTIFY_CONSOLE_MESSAGE,
|
||||
NOTIFY_DOWNLOAD_COMPLETE,
|
||||
NOTIFY_DOWNLOAD_ERROR,
|
||||
};
|
||||
void SendNotification(NotificationType type);
|
||||
void CloseMainWindow();
|
||||
|
||||
void ShowDevTools(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
// Returns the startup URL.
|
||||
std::string GetStartupURL() { return m_StartupURL; }
|
||||
|
||||
// Create an external browser window that loads the specified URL.
|
||||
static void LaunchExternalBrowser(const std::string& url);
|
||||
|
||||
protected:
|
||||
void SetLoading(bool isLoading);
|
||||
void SetNavState(bool canGoBack, bool canGoForward);
|
||||
|
||||
// Create all of ProcessMessageDelegate objects.
|
||||
static void CreateProcessMessageDelegates(
|
||||
ProcessMessageDelegateSet& delegates);
|
||||
|
||||
// Create all of RequestDelegateSet objects.
|
||||
static void CreateRequestDelegates(RequestDelegateSet& delegates);
|
||||
|
||||
// Test context menu creation.
|
||||
void BuildTestMenu(CefRefPtr<CefMenuModel> model);
|
||||
bool ExecuteTestMenu(int command_id);
|
||||
struct TestMenuState {
|
||||
TestMenuState() : check_item(true), radio_item(0) {}
|
||||
bool check_item;
|
||||
int radio_item;
|
||||
} m_TestMenuState;
|
||||
|
||||
// Returns the full download path for the specified file, or an empty path to
|
||||
// use the default temp directory.
|
||||
std::string GetDownloadPath(const std::string& file_name);
|
||||
|
||||
// The child browser window
|
||||
CefRefPtr<CefBrowser> m_Browser;
|
||||
|
||||
// The main frame window handle
|
||||
CefWindowHandle m_MainHwnd;
|
||||
|
||||
// The child browser id
|
||||
int m_BrowserId;
|
||||
|
||||
// The edit window handle
|
||||
CefWindowHandle m_EditHwnd;
|
||||
|
||||
// The button window handles
|
||||
CefWindowHandle m_BackHwnd;
|
||||
CefWindowHandle m_ForwardHwnd;
|
||||
CefWindowHandle m_StopHwnd;
|
||||
CefWindowHandle m_ReloadHwnd;
|
||||
|
||||
// Support for logging.
|
||||
std::string m_LogFile;
|
||||
|
||||
// Support for downloading files.
|
||||
std::string m_LastDownloadFile;
|
||||
|
||||
// True if an editable field currently has focus.
|
||||
bool m_bFocusOnEditableField;
|
||||
|
||||
// Registered delegates.
|
||||
ProcessMessageDelegateSet process_message_delegates_;
|
||||
RequestDelegateSet request_delegates_;
|
||||
|
||||
// If true DevTools will be opened in an external browser window.
|
||||
bool m_bExternalDevTools;
|
||||
|
||||
// List of open DevTools URLs if not using an external browser window.
|
||||
std::set<std::string> m_OpenDevToolsURLs;
|
||||
|
||||
// The startup URL.
|
||||
std::string m_StartupURL;
|
||||
|
||||
// Include the default reference counting implementation.
|
||||
IMPLEMENT_REFCOUNTING(ClientHandler);
|
||||
// Include the default locking implementation.
|
||||
IMPLEMENT_LOCKING(ClientHandler);
|
||||
};
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_
|
||||
@@ -1,63 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <string>
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// Set the edit window text
|
||||
std::string urlStr(url);
|
||||
gtk_entry_set_text(GTK_ENTRY(m_EditHwnd), urlStr.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
GtkWidget* window = gtk_widget_get_ancestor(
|
||||
GTK_WIDGET(browser->GetHost()->GetWindowHandle()),
|
||||
GTK_TYPE_WINDOW);
|
||||
std::string titleStr(title);
|
||||
gtk_window_set_title(GTK_WINDOW(window), titleStr.c_str());
|
||||
}
|
||||
|
||||
void ClientHandler::SendNotification(NotificationType type) {
|
||||
// TODO(port): Implement this method.
|
||||
}
|
||||
|
||||
void ClientHandler::SetLoading(bool isLoading) {
|
||||
if (isLoading)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_StopHwnd), false);
|
||||
}
|
||||
|
||||
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
||||
if (canGoBack)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_BackHwnd), false);
|
||||
|
||||
if (canGoForward)
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), true);
|
||||
else
|
||||
gtk_widget_set_sensitive(GTK_WIDGET(m_ForwardHwnd), false);
|
||||
}
|
||||
|
||||
void ClientHandler::CloseMainWindow() {
|
||||
// TODO(port): Close main window.
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetDownloadPath(const std::string& file_name) {
|
||||
return std::string();
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "cefclient/client_handler.h"
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "cefclient/cefclient.h"
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// Set the edit window text
|
||||
NSTextField* textField = (NSTextField*)m_EditHwnd;
|
||||
std::string urlStr(url);
|
||||
NSString* str = [NSString stringWithUTF8String:urlStr.c_str()];
|
||||
[textField setStringValue:str];
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
// Set the frame window title bar
|
||||
NSView* view = (NSView*)browser->GetHost()->GetWindowHandle();
|
||||
NSWindow* window = [view window];
|
||||
std::string titleStr(title);
|
||||
NSString* str = [NSString stringWithUTF8String:titleStr.c_str()];
|
||||
[window setTitle:str];
|
||||
}
|
||||
|
||||
void ClientHandler::SendNotification(NotificationType type) {
|
||||
SEL sel = nil;
|
||||
switch(type) {
|
||||
case NOTIFY_CONSOLE_MESSAGE:
|
||||
sel = @selector(notifyConsoleMessage:);
|
||||
break;
|
||||
case NOTIFY_DOWNLOAD_COMPLETE:
|
||||
sel = @selector(notifyDownloadComplete:);
|
||||
break;
|
||||
case NOTIFY_DOWNLOAD_ERROR:
|
||||
sel = @selector(notifyDownloadError:);
|
||||
break;
|
||||
}
|
||||
|
||||
if (sel == nil)
|
||||
return;
|
||||
|
||||
NSWindow* window = [AppGetMainHwnd() window];
|
||||
NSObject* delegate = [window delegate];
|
||||
[delegate performSelectorOnMainThread:sel withObject:nil waitUntilDone:NO];
|
||||
}
|
||||
|
||||
void ClientHandler::SetLoading(bool isLoading) {
|
||||
// TODO(port): Change button status.
|
||||
}
|
||||
|
||||
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
||||
// TODO(port): Change button status.
|
||||
}
|
||||
|
||||
void ClientHandler::CloseMainWindow() {
|
||||
// TODO(port): Close window
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetDownloadPath(const std::string& file_name) {
|
||||
return std::string();
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/client_handler.h"
|
||||
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
#include <shlobj.h>
|
||||
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "cefclient/resource.h"
|
||||
|
||||
void ClientHandler::OnAddressChange(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& url) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
if (m_BrowserId == browser->GetIdentifier() && frame->IsMain()) {
|
||||
// Set the edit window text
|
||||
SetWindowText(m_EditHwnd, std::wstring(url).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ClientHandler::OnTitleChange(CefRefPtr<CefBrowser> browser,
|
||||
const CefString& title) {
|
||||
REQUIRE_UI_THREAD();
|
||||
|
||||
// Set the frame window title bar
|
||||
CefWindowHandle hwnd = browser->GetHost()->GetWindowHandle();
|
||||
if (m_BrowserId == browser->GetIdentifier()) {
|
||||
// The frame window will be the parent of the browser window
|
||||
hwnd = GetParent(hwnd);
|
||||
}
|
||||
SetWindowText(hwnd, std::wstring(title).c_str());
|
||||
}
|
||||
|
||||
void ClientHandler::SendNotification(NotificationType type) {
|
||||
UINT id;
|
||||
switch (type) {
|
||||
case NOTIFY_CONSOLE_MESSAGE:
|
||||
id = ID_WARN_CONSOLEMESSAGE;
|
||||
break;
|
||||
case NOTIFY_DOWNLOAD_COMPLETE:
|
||||
id = ID_WARN_DOWNLOADCOMPLETE;
|
||||
break;
|
||||
case NOTIFY_DOWNLOAD_ERROR:
|
||||
id = ID_WARN_DOWNLOADERROR;
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
PostMessage(m_MainHwnd, WM_COMMAND, id, 0);
|
||||
}
|
||||
|
||||
void ClientHandler::SetLoading(bool isLoading) {
|
||||
ASSERT(m_EditHwnd != NULL && m_ReloadHwnd != NULL && m_StopHwnd != NULL);
|
||||
EnableWindow(m_EditHwnd, TRUE);
|
||||
EnableWindow(m_ReloadHwnd, !isLoading);
|
||||
EnableWindow(m_StopHwnd, isLoading);
|
||||
}
|
||||
|
||||
void ClientHandler::SetNavState(bool canGoBack, bool canGoForward) {
|
||||
ASSERT(m_BackHwnd != NULL && m_ForwardHwnd != NULL);
|
||||
EnableWindow(m_BackHwnd, canGoBack);
|
||||
EnableWindow(m_ForwardHwnd, canGoForward);
|
||||
}
|
||||
|
||||
void ClientHandler::CloseMainWindow() {
|
||||
::PostMessage(m_MainHwnd, WM_CLOSE, 0, 0);
|
||||
}
|
||||
|
||||
std::string ClientHandler::GetDownloadPath(const std::string& file_name) {
|
||||
TCHAR szFolderPath[MAX_PATH];
|
||||
std::string path;
|
||||
|
||||
// Save the file in the user's "My Documents" folder.
|
||||
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE,
|
||||
NULL, 0, szFolderPath))) {
|
||||
path = CefString(szFolderPath);
|
||||
path += "\\" + file_name;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/client_renderer.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "include/cef_dom.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
namespace client_renderer {
|
||||
|
||||
const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged";
|
||||
|
||||
namespace {
|
||||
|
||||
class ClientRenderDelegate : public ClientApp::RenderDelegate {
|
||||
public:
|
||||
ClientRenderDelegate()
|
||||
: last_node_is_editable_(false) {
|
||||
}
|
||||
|
||||
virtual void OnFocusedNodeChanged(CefRefPtr<ClientApp> app,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
CefRefPtr<CefDOMNode> node) OVERRIDE {
|
||||
bool is_editable = (node.get() && node->IsEditable());
|
||||
if (is_editable != last_node_is_editable_) {
|
||||
// Notify the browser of the change in focused element type.
|
||||
last_node_is_editable_ = is_editable;
|
||||
CefRefPtr<CefProcessMessage> message =
|
||||
CefProcessMessage::Create(kFocusedNodeChangedMessage);
|
||||
message->GetArgumentList()->SetBool(0, is_editable);
|
||||
browser->SendProcessMessage(PID_BROWSER, message);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
bool last_node_is_editable_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientRenderDelegate);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) {
|
||||
delegates.insert(new ClientRenderDelegate);
|
||||
}
|
||||
|
||||
} // namespace client_renderer
|
||||
@@ -1,22 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_
|
||||
#define CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "cefclient/client_app.h"
|
||||
|
||||
namespace client_renderer {
|
||||
|
||||
// Message sent when the focused node changes.
|
||||
extern const char kFocusedNodeChangedMessage[];
|
||||
|
||||
// Create the render delegate.
|
||||
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates);
|
||||
|
||||
} // namespace client_renderer
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_CLIENT_RENDERER_H_
|
||||
@@ -1,71 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
// This file is shared by cefclient and cef_unittests so don't include using
|
||||
// a qualified path.
|
||||
#include "client_switches.h" // NOLINT(build/include)
|
||||
|
||||
namespace cefclient {
|
||||
|
||||
const char kUrl[] = "url";
|
||||
const char kExternalDevTools[] = "external-devtools";
|
||||
|
||||
// CefSettings attributes.
|
||||
const char kMultiThreadedMessageLoop[] = "multi-threaded-message-loop";
|
||||
const char kCachePath[] = "cache-path";
|
||||
|
||||
// CefBrowserSettings attributes.
|
||||
const char kRemoteFontsDisabled[] = "remote-fonts-disabled";
|
||||
const char kDefaultEncoding[] = "default-encoding";
|
||||
const char kEncodingDetectorEnabled[] = "encoding-detector-enabled";
|
||||
const char kJavascriptDisabled[] = "javascript-disabled";
|
||||
const char kJavascriptOpenWindowsDisallowed[] =
|
||||
"javascript-open-windows-disallowed";
|
||||
const char kJavascriptCloseWindowsDisallowed[] =
|
||||
"javascript-close-windows-disallowed";
|
||||
const char kJavascriptAccessClipboardDisallowed[] =
|
||||
"javascript-access-clipboard-disallowed";
|
||||
const char kDomPasteDisabled[] = "dom-paste-disabled";
|
||||
const char kCaretBrowsingDisabled[] = "caret-browsing-enabled";
|
||||
const char kJavaDisabled[] = "java-disabled";
|
||||
const char kPluginsDisabled[] = "plugins-disabled";
|
||||
const char kUniversalAccessFromFileUrlsAllowed[] =
|
||||
"universal-access-from-file-urls-allowed";
|
||||
const char kFileAccessFromFileUrlsAllowed[] =
|
||||
"file-access-from-file-urls-allowed";
|
||||
const char kWebSecurityDisabled[] = "web-security-disabled";
|
||||
const char kXssAuditorEnabled[] = "xss-auditor-enabled";
|
||||
const char kImageLoadingDisabled[] = "image-load-disabled";
|
||||
const char kShrinkStandaloneImagesToFit[] = "shrink-standalone-images-to-fit";
|
||||
const char kSiteSpecificQuirksDisabled[] = "site-specific-quirks-disabled";
|
||||
const char kTextAreaResizeDisabled[] = "text-area-resize-disabled";
|
||||
const char kPageCacheDisabled[] = "page-cache-disabled";
|
||||
const char kTabToLinksDisabled[] = "tab-to-links-disabled";
|
||||
const char kHyperlinkAuditingDisabled[] = "hyperlink-auditing-disabled";
|
||||
const char kUserStyleSheetEnabled[] = "user-style-sheet-enabled";
|
||||
const char kUserStyleSheetLocation[] = "user-style-sheet-location";
|
||||
const char kAuthorAndUserStylesDisabled[] = "author-and-user-styles-disabled";
|
||||
const char kLocalStorageDisabled[] = "local-storage-disabled";
|
||||
const char kDatabasesDisabled[] = "databases-disabled";
|
||||
const char kApplicationCacheDisabled[] = "application-cache-disabled";
|
||||
const char kWebglDisabled[] = "webgl-disabled";
|
||||
const char kAcceleratedCompositingDisabled[] =
|
||||
"accelerated-compositing-disabled";
|
||||
const char kAcceleratedLayersDisabled[] = "accelerated-layers-disabled";
|
||||
const char kAcceleratedVideoDisabled[] = "accelerated-video-disabled";
|
||||
const char kAcceledated2dCanvasDisabled[] = "accelerated-2d-canvas-disabled";
|
||||
const char kAcceleratedPaintingEnabled[] = "accelerated-painting-enabled";
|
||||
const char kAcceleratedFiltersEnabled[] = "accelerated-filters-enabled";
|
||||
const char kAcceleratedPluginsDisabled[] = "accelerated-plugins-disabled";
|
||||
const char kDeveloperToolsDisabled[] = "developer-tools-disabled";
|
||||
const char kFullscreenEnabled[] = "fullscreen-enabled";
|
||||
|
||||
// Other attributes.
|
||||
const char kProxyType[] = "proxy-type";
|
||||
const char kProxyType_Direct[] = "direct";
|
||||
const char kProxyType_Named[] = "named";
|
||||
const char kProxyType_Pac[] = "pac";
|
||||
const char kProxyConfig[] = "proxy-config";
|
||||
|
||||
} // namespace cefclient
|
||||
@@ -1,69 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
// Defines all of the command line switches used by cefclient.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_
|
||||
#define CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_
|
||||
#pragma once
|
||||
|
||||
namespace cefclient {
|
||||
|
||||
extern const char kUrl[];
|
||||
extern const char kExternalDevTools[];
|
||||
|
||||
// CefSettings attributes.
|
||||
extern const char kMultiThreadedMessageLoop[];
|
||||
extern const char kCachePath[];
|
||||
|
||||
// CefBrowserSettings attributes.
|
||||
extern const char kRemoteFontsDisabled[];
|
||||
extern const char kDefaultEncoding[];
|
||||
extern const char kEncodingDetectorEnabled[];
|
||||
extern const char kJavascriptDisabled[];
|
||||
extern const char kJavascriptOpenWindowsDisallowed[];
|
||||
extern const char kJavascriptCloseWindowsDisallowed[];
|
||||
extern const char kJavascriptAccessClipboardDisallowed[];
|
||||
extern const char kDomPasteDisabled[];
|
||||
extern const char kCaretBrowsingDisabled[];
|
||||
extern const char kJavaDisabled[];
|
||||
extern const char kPluginsDisabled[];
|
||||
extern const char kUniversalAccessFromFileUrlsAllowed[];
|
||||
extern const char kFileAccessFromFileUrlsAllowed[];
|
||||
extern const char kWebSecurityDisabled[];
|
||||
extern const char kXssAuditorEnabled[];
|
||||
extern const char kImageLoadingDisabled[];
|
||||
extern const char kShrinkStandaloneImagesToFit[];
|
||||
extern const char kSiteSpecificQuirksDisabled[];
|
||||
extern const char kTextAreaResizeDisabled[];
|
||||
extern const char kPageCacheDisabled[];
|
||||
extern const char kTabToLinksDisabled[];
|
||||
extern const char kHyperlinkAuditingDisabled[];
|
||||
extern const char kUserStyleSheetEnabled[];
|
||||
extern const char kUserStyleSheetLocation[];
|
||||
extern const char kAuthorAndUserStylesDisabled[];
|
||||
extern const char kLocalStorageDisabled[];
|
||||
extern const char kDatabasesDisabled[];
|
||||
extern const char kApplicationCacheDisabled[];
|
||||
extern const char kWebglDisabled[];
|
||||
extern const char kAcceleratedCompositingDisabled[];
|
||||
extern const char kAcceleratedLayersDisabled[];
|
||||
extern const char kAcceleratedVideoDisabled[];
|
||||
extern const char kAcceledated2dCanvasDisabled[];
|
||||
extern const char kAcceleratedPaintingEnabled[];
|
||||
extern const char kAcceleratedFiltersEnabled[];
|
||||
extern const char kAcceleratedPluginsDisabled[];
|
||||
extern const char kDeveloperToolsDisabled[];
|
||||
extern const char kFullscreenEnabled[];
|
||||
|
||||
// Other attributes.
|
||||
extern const char kProxyType[];
|
||||
extern const char kProxyType_Direct[];
|
||||
extern const char kProxyType_Named[];
|
||||
extern const char kProxyType_Pac[];
|
||||
extern const char kProxyConfig[];
|
||||
|
||||
} // namespace cefclient
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_
|
||||
@@ -1,139 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/dom_test.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
#include "include/cef_dom.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
namespace dom_test {
|
||||
|
||||
const char kTestUrl[] = "http://tests/domaccess";
|
||||
|
||||
namespace {
|
||||
|
||||
const char* kMessageName = "DOMTest.Message";
|
||||
|
||||
class ClientDOMEventListener : public CefDOMEventListener {
|
||||
public:
|
||||
ClientDOMEventListener() {
|
||||
}
|
||||
|
||||
virtual void HandleEvent(CefRefPtr<CefDOMEvent> event) OVERRIDE {
|
||||
CefRefPtr<CefDOMDocument> document = event->GetDocument();
|
||||
ASSERT(document.get());
|
||||
|
||||
std::stringstream ss;
|
||||
|
||||
CefRefPtr<CefDOMNode> button = event->GetTarget();
|
||||
ASSERT(button.get());
|
||||
std::string buttonValue = button->GetElementAttribute("value");
|
||||
ss << "You clicked the " << buttonValue.c_str() << " button. ";
|
||||
|
||||
if (document->HasSelection()) {
|
||||
std::string startName, endName;
|
||||
|
||||
// Determine the start name by first trying to locate the "id" attribute
|
||||
// and then defaulting to the tag name.
|
||||
{
|
||||
CefRefPtr<CefDOMNode> node = document->GetSelectionStartNode();
|
||||
if (!node->IsElement())
|
||||
node = node->GetParent();
|
||||
if (node->IsElement() && node->HasElementAttribute("id"))
|
||||
startName = node->GetElementAttribute("id");
|
||||
else
|
||||
startName = node->GetName();
|
||||
}
|
||||
|
||||
// Determine the end name by first trying to locate the "id" attribute
|
||||
// and then defaulting to the tag name.
|
||||
{
|
||||
CefRefPtr<CefDOMNode> node = document->GetSelectionEndNode();
|
||||
if (!node->IsElement())
|
||||
node = node->GetParent();
|
||||
if (node->IsElement() && node->HasElementAttribute("id"))
|
||||
endName = node->GetElementAttribute("id");
|
||||
else
|
||||
endName = node->GetName();
|
||||
}
|
||||
|
||||
ss << "The selection is from " <<
|
||||
startName.c_str() << ":" << document->GetSelectionStartOffset() <<
|
||||
" to " <<
|
||||
endName.c_str() << ":" << document->GetSelectionEndOffset();
|
||||
} else {
|
||||
ss << "Nothing is selected.";
|
||||
}
|
||||
|
||||
// Update the description.
|
||||
CefRefPtr<CefDOMNode> desc = document->GetElementById("description");
|
||||
ASSERT(desc.get());
|
||||
CefRefPtr<CefDOMNode> text = desc->GetFirstChild();
|
||||
ASSERT(text.get());
|
||||
ASSERT(text->IsText());
|
||||
text->SetValue(ss.str());
|
||||
}
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientDOMEventListener);
|
||||
};
|
||||
|
||||
class ClientDOMVisitor : public CefDOMVisitor {
|
||||
public:
|
||||
ClientDOMVisitor() {
|
||||
}
|
||||
|
||||
virtual void Visit(CefRefPtr<CefDOMDocument> document) OVERRIDE {
|
||||
// Register a click listener for the button.
|
||||
CefRefPtr<CefDOMNode> button = document->GetElementById("button");
|
||||
ASSERT(button.get());
|
||||
button->AddEventListener("click", new ClientDOMEventListener(), false);
|
||||
}
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientDOMVisitor);
|
||||
};
|
||||
|
||||
class DOMRenderDelegate : public ClientApp::RenderDelegate {
|
||||
public:
|
||||
DOMRenderDelegate() {
|
||||
}
|
||||
|
||||
virtual bool OnProcessMessageReceived(
|
||||
CefRefPtr<ClientApp> app,
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE {
|
||||
if (message->GetName() == kMessageName) {
|
||||
// Visit the DOM to attach the event listener.
|
||||
browser->GetMainFrame()->VisitDOM(new ClientDOMVisitor);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
IMPLEMENT_REFCOUNTING(DOMRenderDelegate);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) {
|
||||
delegates.insert(new DOMRenderDelegate);
|
||||
}
|
||||
|
||||
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||
// Load the test URL.
|
||||
browser->GetMainFrame()->LoadURL(kTestUrl);
|
||||
}
|
||||
|
||||
void OnLoadEnd(CefRefPtr<CefBrowser> browser) {
|
||||
// Send a message to the render process to continue the test setup.
|
||||
browser->SendProcessMessage(PID_RENDERER,
|
||||
CefProcessMessage::Create(kMessageName));
|
||||
}
|
||||
|
||||
} // namespace dom_test
|
||||
@@ -1,28 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_DOM_TEST_H_
|
||||
#define CEF_TESTS_CEFCLIENT_DOM_TEST_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
#include "cefclient/client_app.h"
|
||||
|
||||
namespace dom_test {
|
||||
|
||||
// The DOM test URL.
|
||||
extern const char kTestUrl[];
|
||||
|
||||
// Create the render delegate.
|
||||
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates);
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
// Continue the test after the page has loaded.
|
||||
void OnLoadEnd(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
} // namespace dom_test
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_DOM_TEST_H_
|
||||
@@ -1,3 +0,0 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
NSHumanReadableCopyright = "© Chromium Embedded Framework Authors, 2010";
|
||||
@@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>Atom.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.github.Atom</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.github.Atom.helper</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>LSFileQuarantineEnabled</key>
|
||||
<true/>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.5.0</string>
|
||||
<key>LSUIElement</key>
|
||||
<string>1</string>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,27 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that can
|
||||
// be found in the LICENSE file.
|
||||
|
||||
#include "include/cef_app.h"
|
||||
|
||||
// This file is shared by cefclient and cef_unittests so don't include using
|
||||
// a qualified path.
|
||||
#include "client_app.h" // NOLINT(build/include)
|
||||
|
||||
// Stub implementations.
|
||||
std::string AppGetWorkingDirectory() {
|
||||
return std::string();
|
||||
}
|
||||
CefWindowHandle AppGetMainHwnd() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
// Process entry point.
|
||||
int main(int argc, char* argv[]) {
|
||||
CefMainArgs main_args(argc, argv);
|
||||
|
||||
CefRefPtr<CefApp> app(new ClientApp);
|
||||
|
||||
// Execute the secondary process.
|
||||
return CefExecuteProcess(main_args, app);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Binding Test</title>
|
||||
<script language="JavaScript">
|
||||
|
||||
// Register the callback for messages from the browser process.
|
||||
app.setMessageCallback('binding_test', function(name, args) {
|
||||
document.getElementById('result').value = "Response: "+args[0];
|
||||
});
|
||||
|
||||
// Send a message to the browser process.
|
||||
function sendMessage() {
|
||||
var msg = document.getElementById("message").value;
|
||||
app.sendMessage('binding_test', [msg]);
|
||||
}
|
||||
</script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
Message: <input type="text" id="message" value="My Message">
|
||||
<br/><input type="button" onclick="sendMessage();" value="Send Message">
|
||||
<br/>You should see the reverse of your message below:
|
||||
<br/><textarea rows="10" cols="40" id="result"></textarea>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 23 KiB |
@@ -1,45 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Dialog Test</title>
|
||||
<script>
|
||||
function show_alert() {
|
||||
alert("I am an alert box!");
|
||||
}
|
||||
|
||||
function show_confirm() {
|
||||
var r = confirm("Press a button");
|
||||
var msg = r ? "You pressed OK!" : "You pressed Cancel!";
|
||||
document.getElementById('cm').innerText = msg;
|
||||
}
|
||||
|
||||
function show_prompt() {
|
||||
var name = prompt("Please enter your name" ,"Harry Potter");
|
||||
if (name != null && name != "")
|
||||
document.getElementById('pm').innerText = "Hello " + name + "!";
|
||||
}
|
||||
|
||||
window.onbeforeunload = function() {
|
||||
return 'This is an onbeforeunload message.';
|
||||
}
|
||||
|
||||
function update_time() {
|
||||
document.getElementById('time').innerText = new Date().toLocaleString();
|
||||
}
|
||||
|
||||
function setup() {
|
||||
setInterval(update_time, 1000);
|
||||
}
|
||||
|
||||
window.addEventListener('load', setup, false);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<form>
|
||||
Click a button to show the associated dialog type.
|
||||
<br/><input type="button" onclick="show_alert();" value="Show Alert">
|
||||
<br/><input type="button" onclick="show_confirm();" value="Show Confirm"> <span id="cm"></span>
|
||||
<br/><input type="button" onclick="show_prompt();" value="Show Prompt"> <span id="pm"></span>
|
||||
<p id="time"></p>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,13 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<p id="instructions">Select some portion of the below page content and click the "Describe Selection" button. The selected region will then be described below.</p>
|
||||
<p id="p1">This is p1</p>
|
||||
<p id="p2">This is p2</p>
|
||||
<p id="p3">This is p3</p>
|
||||
<p id="p4">This is p4</p>
|
||||
<form>
|
||||
<input type="button" id="button" value="Describe Selection">
|
||||
<p id="description">The description will appear here.</p>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,24 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<script language="JavaScript">
|
||||
var val = window.localStorage.getItem('val');
|
||||
function addLine() {
|
||||
if(val == null)
|
||||
val = '<br/>One Line.';
|
||||
else
|
||||
val += '<br/>Another Line.';
|
||||
window.localStorage.setItem('val', val);
|
||||
document.getElementById('out').innerHTML = val;
|
||||
}
|
||||
</script>
|
||||
Click the "Add Line" button to add a line or the "Clear" button to clear.<br/>
|
||||
This data will persist across sessions if a cache path was specified.<br/>
|
||||
<input type="button" value="Add Line" onClick="addLine();"/>
|
||||
<input type="button" value="Clear" onClick="window.localStorage.removeItem('val'); window.location.reload();"/>
|
||||
<div id="out"></div>
|
||||
<script language="JavaScript">
|
||||
if(val != null)
|
||||
document.getElementById('out').innerHTML = val;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Before Width: | Height: | Size: 19 KiB |
|
Before Width: | Height: | Size: 7.0 KiB |
|
Before Width: | Height: | Size: 23 KiB |
@@ -1,19 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<script language="JavaScript">
|
||||
function execXMLHttpRequest()
|
||||
{
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open("GET",document.getElementById("url").value,false);
|
||||
xhr.setRequestHeader('My-Custom-Header', 'Some Value');
|
||||
xhr.send();
|
||||
document.getElementById('ta').value = "Status Code: "+xhr.status+"\n\n"+xhr.responseText;
|
||||
}
|
||||
</script>
|
||||
<form>
|
||||
URL: <input type="text" id="url" value="http://tests/request">
|
||||
<br/><input type="button" onclick="execXMLHttpRequest();" value="Execute XMLHttpRequest">
|
||||
<br/><textarea rows="10" cols="40" id="ta"></textarea>
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,69 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by cefclient.rc
|
||||
//
|
||||
#define BINARY 256
|
||||
#define IDC_MYICON 2
|
||||
#define IDD_CEFCLIENT_DIALOG 102
|
||||
#define IDS_APP_TITLE 103
|
||||
#define IDD_ABOUTBOX 103
|
||||
#define IDM_ABOUT 104
|
||||
#define IDM_EXIT 105
|
||||
#define IDI_CEFCLIENT 107
|
||||
#define IDI_SMALL 108
|
||||
#define IDC_CEFCLIENT 109
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDC_NAV_BACK 200
|
||||
#define IDC_NAV_FORWARD 201
|
||||
#define IDC_NAV_RELOAD 202
|
||||
#define IDC_NAV_STOP 203
|
||||
#define ID_WARN_CONSOLEMESSAGE 32000
|
||||
#define ID_WARN_DOWNLOADCOMPLETE 32001
|
||||
#define ID_WARN_DOWNLOADERROR 32002
|
||||
#define ID_TESTS_GETSOURCE 32760
|
||||
#define ID_TESTS_GETTEXT 32761
|
||||
#define ID_TESTS_POPUP 32762
|
||||
#define ID_TESTS_REQUEST 32763
|
||||
#define ID_TESTS_SCHEME_HANDLER 32764
|
||||
#define ID_TESTS_LOCALSTORAGE 32765
|
||||
#define ID_TESTS_ACCELERATED2DCANVAS 32766
|
||||
#define ID_TESTS_ACCELERATEDLAYERS 32767
|
||||
#define ID_TESTS_WEBGL 32768
|
||||
#define ID_TESTS_HTML5VIDEO 32769
|
||||
#define ID_TESTS_XMLHTTPREQUEST 32770
|
||||
#define ID_TESTS_DRAGDROP 32771
|
||||
#define ID_TESTS_GEOLOCATION 32772
|
||||
#define ID_TESTS_BINDING 32773
|
||||
#define ID_TESTS_DIALOGS 32774
|
||||
#define ID_TESTS_PLUGIN_INFO 32775
|
||||
#define ID_TESTS_DOM_ACCESS 32776
|
||||
#define ID_TESTS_ZOOM_IN 32777
|
||||
#define ID_TESTS_ZOOM_OUT 32778
|
||||
#define ID_TESTS_ZOOM_RESET 32779
|
||||
#define IDC_STATIC -1
|
||||
#define IDS_BINDING 1000
|
||||
#define IDS_DIALOGS 1001
|
||||
#define IDS_LOGO 1002
|
||||
#define IDS_LOGOBALL 1003
|
||||
#define IDS_LOCALSTORAGE 1004
|
||||
#define IDS_XMLHTTPREQUEST 1005
|
||||
#define IDS_DOMACCESS 1006
|
||||
|
||||
// Avoid files associated with MacOS
|
||||
#define _X86_
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NO_MFC 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 130
|
||||
#define _APS_NEXT_COMMAND_VALUE 32774
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 110
|
||||
#endif
|
||||
#endif
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_
|
||||
#define CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_base.h"
|
||||
|
||||
class CefStreamReader;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
#include "cefclient/resource.h"
|
||||
|
||||
// Load a resource of type BINARY
|
||||
bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes);
|
||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(int binaryId);
|
||||
|
||||
#elif defined(OS_MACOSX) || defined(OS_POSIX)
|
||||
|
||||
#include <string> // NOLINT(build/include_order)
|
||||
|
||||
// Load the resource with the specified name.
|
||||
bool LoadBinaryResource(const char* resource_name, std::string& resource_data);
|
||||
|
||||
#endif
|
||||
|
||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name);
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_RESOURCE_UTIL_H_
|
||||
@@ -1,67 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "cefclient/resource_util.h"
|
||||
#include <stdio.h>
|
||||
#include <string>
|
||||
#include "include/cef_stream.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
bool GetResourceDir(std::string& dir) {
|
||||
char buff[1024];
|
||||
|
||||
// Retrieve the executable path.
|
||||
ssize_t len = readlink("/proc/self/exe", buff, sizeof(buff)-1);
|
||||
if (len == -1)
|
||||
return false;
|
||||
|
||||
buff[len] = 0;
|
||||
|
||||
// Remove the executable name from the path.
|
||||
char* pos = strrchr(buff, '/');
|
||||
if (!pos)
|
||||
return false;
|
||||
|
||||
// Add "files" to the path.
|
||||
strcpy(pos+1, "files"); // NOLINT(runtime/printf)
|
||||
dir = std::string(buff);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool LoadBinaryResource(const char* resource_name, std::string& resource_data) {
|
||||
std::string path;
|
||||
if (!GetResourceDir(path))
|
||||
return false;
|
||||
|
||||
path.append("/");
|
||||
path.append(resource_name);
|
||||
|
||||
FILE* f = fopen(path.c_str(), "rb");
|
||||
if (!f)
|
||||
return false;
|
||||
|
||||
size_t bytes_read;
|
||||
char buff[1024*8];
|
||||
|
||||
do {
|
||||
bytes_read = fread(buff, 1, sizeof(buff)-1, f);
|
||||
if (bytes_read > 0)
|
||||
resource_data.append(buff, bytes_read);
|
||||
} while (bytes_read > 0);
|
||||
|
||||
fclose(f);
|
||||
return true;
|
||||
}
|
||||
|
||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
||||
std::string path;
|
||||
if (!GetResourceDir(path))
|
||||
return NULL;
|
||||
|
||||
path.append("/");
|
||||
path.append(resource_name);
|
||||
|
||||
return CefStreamReader::CreateForFile(path);
|
||||
}
|
||||
@@ -1,97 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors.
|
||||
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#include <mach-o/dyld.h>
|
||||
#include <stdio.h>
|
||||
#include "cefclient/resource_util.h"
|
||||
#include "include/cef_stream.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
namespace {
|
||||
|
||||
bool AmIBundled() {
|
||||
// Implementation adapted from Chromium's base/mac/foundation_util.mm
|
||||
ProcessSerialNumber psn = {0, kCurrentProcess};
|
||||
|
||||
FSRef fsref;
|
||||
OSStatus pbErr;
|
||||
if ((pbErr = GetProcessBundleLocation(&psn, &fsref)) != noErr) {
|
||||
ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
FSCatalogInfo info;
|
||||
OSErr fsErr;
|
||||
if ((fsErr = FSGetCatalogInfo(&fsref, kFSCatInfoNodeFlags, &info,
|
||||
NULL, NULL, NULL)) != noErr) {
|
||||
ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
return (info.nodeFlags & kFSNodeIsDirectoryMask);
|
||||
}
|
||||
|
||||
bool GetResourceDir(std::string& dir) {
|
||||
// Implementation adapted from Chromium's base/base_path_mac.mm
|
||||
if (AmIBundled()) {
|
||||
// Retrieve the executable directory.
|
||||
uint32_t pathSize = 0;
|
||||
_NSGetExecutablePath(NULL, &pathSize);
|
||||
if (pathSize > 0) {
|
||||
dir.resize(pathSize);
|
||||
_NSGetExecutablePath(const_cast<char*>(dir.c_str()), &pathSize);
|
||||
}
|
||||
|
||||
// Trim executable name up to the last separator
|
||||
std::string::size_type last_separator = dir.find_last_of("/");
|
||||
dir.resize(last_separator);
|
||||
dir.append("/../Resources");
|
||||
return true;
|
||||
} else {
|
||||
// TODO: Provide unbundled path
|
||||
ASSERT(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ReadFileToString(const char* path, std::string& data) {
|
||||
// Implementation adapted from base/file_util.cc
|
||||
FILE* file = fopen(path, "rb");
|
||||
if (!file)
|
||||
return false;
|
||||
|
||||
char buf[1 << 16];
|
||||
size_t len;
|
||||
while ((len = fread(buf, 1, sizeof(buf), file)) > 0)
|
||||
data.append(buf, len);
|
||||
fclose(file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
bool LoadBinaryResource(const char* resource_name, std::string& resource_data) {
|
||||
std::string path;
|
||||
if (!GetResourceDir(path))
|
||||
return false;
|
||||
|
||||
path.append("/");
|
||||
path.append(resource_name);
|
||||
|
||||
return ReadFileToString(path.c_str(), resource_data);
|
||||
}
|
||||
|
||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
||||
std::string path;
|
||||
if (!GetResourceDir(path))
|
||||
return NULL;
|
||||
|
||||
path.append("/");
|
||||
path.append(resource_name);
|
||||
|
||||
return CefStreamReader::CreateForFile(path);
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
// Copyright (c) 2008-2009 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/resource_util.h"
|
||||
#include "include/cef_stream.h"
|
||||
#include "include/wrapper/cef_byte_read_handler.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
bool LoadBinaryResource(int binaryId, DWORD &dwSize, LPBYTE &pBytes) {
|
||||
extern HINSTANCE hInst;
|
||||
HRSRC hRes = FindResource(hInst, MAKEINTRESOURCE(binaryId),
|
||||
MAKEINTRESOURCE(256));
|
||||
if (hRes) {
|
||||
HGLOBAL hGlob = LoadResource(hInst, hRes);
|
||||
if (hGlob) {
|
||||
dwSize = SizeofResource(hInst, hRes);
|
||||
pBytes = (LPBYTE)LockResource(hGlob);
|
||||
if (dwSize > 0 && pBytes)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(int binaryId) {
|
||||
DWORD dwSize;
|
||||
LPBYTE pBytes;
|
||||
|
||||
if (LoadBinaryResource(binaryId, dwSize, pBytes)) {
|
||||
return CefStreamReader::CreateForHandler(
|
||||
new CefByteReadHandler(pBytes, dwSize, NULL));
|
||||
}
|
||||
|
||||
ASSERT(FALSE); // The resource should be found.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CefRefPtr<CefStreamReader> GetBinaryResourceReader(const char* resource_name) {
|
||||
// Map of resource labels to BINARY id values.
|
||||
static struct _resource_map {
|
||||
char* name;
|
||||
int id;
|
||||
} resource_map[] = {
|
||||
{"binding.html", IDS_BINDING},
|
||||
{"dialogs.html", IDS_DIALOGS},
|
||||
{"domaccess.html", IDS_DOMACCESS},
|
||||
{"localstorage.html", IDS_LOCALSTORAGE},
|
||||
{"xmlhttprequest.html", IDS_XMLHTTPREQUEST},
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(resource_map)/sizeof(_resource_map); ++i) {
|
||||
if (!strcmp(resource_map[i].name, resource_name))
|
||||
return GetBinaryResourceReader(resource_map[i].id);
|
||||
}
|
||||
|
||||
ASSERT(FALSE); // The resource should be found.
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#endif // OS_WIN
|
||||
@@ -1,182 +0,0 @@
|
||||
// Copyright (c) 2012 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/scheme_test.h"
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
#include "include/cef_browser.h"
|
||||
#include "include/cef_callback.h"
|
||||
#include "include/cef_frame.h"
|
||||
#include "include/cef_resource_handler.h"
|
||||
#include "include/cef_response.h"
|
||||
#include "include/cef_request.h"
|
||||
#include "include/cef_scheme.h"
|
||||
#include "cefclient/resource_util.h"
|
||||
#include "cefclient/string_util.h"
|
||||
#include "cefclient/util.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
#include "cefclient/resource.h"
|
||||
#endif
|
||||
|
||||
namespace scheme_test {
|
||||
|
||||
namespace {
|
||||
|
||||
// Implementation of the schema handler for client:// requests.
|
||||
class ClientSchemeHandler : public CefResourceHandler {
|
||||
public:
|
||||
ClientSchemeHandler() : offset_(0) {}
|
||||
|
||||
virtual bool ProcessRequest(CefRefPtr<CefRequest> request,
|
||||
CefRefPtr<CefCallback> callback)
|
||||
OVERRIDE {
|
||||
REQUIRE_IO_THREAD();
|
||||
|
||||
bool handled = false;
|
||||
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
std::string url = request->GetURL();
|
||||
if (strstr(url.c_str(), "handler.html") != NULL) {
|
||||
// Build the response html
|
||||
data_ = "<html><head><title>Client Scheme Handler</title></head><body>"
|
||||
"This contents of this page page are served by the "
|
||||
"ClientSchemeHandler class handling the client:// protocol."
|
||||
"<br/>You should see an image:"
|
||||
"<br/><img src=\"client://tests/client.png\"><pre>";
|
||||
|
||||
// Output a string representation of the request
|
||||
std::string dump;
|
||||
DumpRequestContents(request, dump);
|
||||
data_.append(dump);
|
||||
|
||||
data_.append("</pre><br/>Try the test form:"
|
||||
"<form method=\"POST\" action=\"handler.html\">"
|
||||
"<input type=\"text\" name=\"field1\">"
|
||||
"<input type=\"text\" name=\"field2\">"
|
||||
"<input type=\"submit\">"
|
||||
"</form></body></html>");
|
||||
|
||||
handled = true;
|
||||
|
||||
// Set the resulting mime type
|
||||
mime_type_ = "text/html";
|
||||
} else if (strstr(url.c_str(), "client.png") != NULL) {
|
||||
// Load the response image
|
||||
#if defined(OS_WIN)
|
||||
DWORD dwSize;
|
||||
LPBYTE pBytes;
|
||||
if (LoadBinaryResource(IDS_LOGO, dwSize, pBytes)) {
|
||||
data_ = std::string(reinterpret_cast<const char*>(pBytes), dwSize);
|
||||
handled = true;
|
||||
// Set the resulting mime type
|
||||
mime_type_ = "image/jpg";
|
||||
}
|
||||
#elif defined(OS_MACOSX) || defined(OS_LINUX)
|
||||
if (LoadBinaryResource("logo.png", data_)) {
|
||||
handled = true;
|
||||
// Set the resulting mime type
|
||||
mime_type_ = "image/png";
|
||||
}
|
||||
#else
|
||||
#error "Unsupported platform"
|
||||
#endif
|
||||
}
|
||||
|
||||
if (handled) {
|
||||
// Indicate the headers are available.
|
||||
callback->Continue();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual void GetResponseHeaders(CefRefPtr<CefResponse> response,
|
||||
int64& response_length,
|
||||
CefString& redirectUrl) OVERRIDE {
|
||||
REQUIRE_IO_THREAD();
|
||||
|
||||
ASSERT(!data_.empty());
|
||||
|
||||
response->SetMimeType(mime_type_);
|
||||
response->SetStatus(200);
|
||||
|
||||
// Set the resulting response length
|
||||
response_length = data_.length();
|
||||
}
|
||||
|
||||
virtual void Cancel() OVERRIDE {
|
||||
REQUIRE_IO_THREAD();
|
||||
}
|
||||
|
||||
virtual bool ReadResponse(void* data_out,
|
||||
int bytes_to_read,
|
||||
int& bytes_read,
|
||||
CefRefPtr<CefCallback> callback)
|
||||
OVERRIDE {
|
||||
REQUIRE_IO_THREAD();
|
||||
|
||||
bool has_data = false;
|
||||
bytes_read = 0;
|
||||
|
||||
AutoLock lock_scope(this);
|
||||
|
||||
if (offset_ < data_.length()) {
|
||||
// Copy the next block of data into the buffer.
|
||||
int transfer_size =
|
||||
std::min(bytes_to_read, static_cast<int>(data_.length() - offset_));
|
||||
memcpy(data_out, data_.c_str() + offset_, transfer_size);
|
||||
offset_ += transfer_size;
|
||||
|
||||
bytes_read = transfer_size;
|
||||
has_data = true;
|
||||
}
|
||||
|
||||
return has_data;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string data_;
|
||||
std::string mime_type_;
|
||||
size_t offset_;
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientSchemeHandler);
|
||||
IMPLEMENT_LOCKING(ClientSchemeHandler);
|
||||
};
|
||||
|
||||
// Implementation of the factory for for creating schema handlers.
|
||||
class ClientSchemeHandlerFactory : public CefSchemeHandlerFactory {
|
||||
public:
|
||||
// Return a new scheme handler instance to handle the request.
|
||||
virtual CefRefPtr<CefResourceHandler> Create(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
const CefString& scheme_name,
|
||||
CefRefPtr<CefRequest> request)
|
||||
OVERRIDE {
|
||||
REQUIRE_IO_THREAD();
|
||||
return new ClientSchemeHandler();
|
||||
}
|
||||
|
||||
IMPLEMENT_REFCOUNTING(ClientSchemeHandlerFactory);
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar,
|
||||
std::vector<CefString>& cookiable_schemes) {
|
||||
registrar->AddCustomScheme("client", true, false, false);
|
||||
}
|
||||
|
||||
void InitTest() {
|
||||
CefRegisterSchemeHandlerFactory("client", "tests",
|
||||
new ClientSchemeHandlerFactory());
|
||||
}
|
||||
|
||||
void RunTest(CefRefPtr<CefBrowser> browser) {
|
||||
browser->GetMainFrame()->LoadURL("client://tests/handler.html");
|
||||
}
|
||||
|
||||
} // namespace scheme_test
|
||||
@@ -1,29 +0,0 @@
|
||||
// Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
||||
#define CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "include/cef_base.h"
|
||||
|
||||
class CefBrowser;
|
||||
class CefSchemeRegistrar;
|
||||
|
||||
namespace scheme_test {
|
||||
|
||||
// Register the scheme.
|
||||
void RegisterCustomSchemes(CefRefPtr<CefSchemeRegistrar> registrar,
|
||||
std::vector<CefString>& cookiable_schemes);
|
||||
|
||||
// Create the scheme handler.
|
||||
void InitTest();
|
||||
|
||||
// Run the test.
|
||||
void RunTest(CefRefPtr<CefBrowser> browser);
|
||||
|
||||
} // namespace scheme_test
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_SCHEME_TEST_H_
|
||||
@@ -1,74 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#include "cefclient/string_util.h"
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include "include/cef_request.h"
|
||||
|
||||
void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str) {
|
||||
std::stringstream ss;
|
||||
|
||||
ss << "URL: " << std::string(request->GetURL());
|
||||
ss << "\nMethod: " << std::string(request->GetMethod());
|
||||
|
||||
CefRequest::HeaderMap headerMap;
|
||||
request->GetHeaderMap(headerMap);
|
||||
if (headerMap.size() > 0) {
|
||||
ss << "\nHeaders:";
|
||||
CefRequest::HeaderMap::const_iterator it = headerMap.begin();
|
||||
for (; it != headerMap.end(); ++it) {
|
||||
ss << "\n\t" << std::string((*it).first) << ": " <<
|
||||
std::string((*it).second);
|
||||
}
|
||||
}
|
||||
|
||||
CefRefPtr<CefPostData> postData = request->GetPostData();
|
||||
if (postData.get()) {
|
||||
CefPostData::ElementVector elements;
|
||||
postData->GetElements(elements);
|
||||
if (elements.size() > 0) {
|
||||
ss << "\nPost Data:";
|
||||
CefRefPtr<CefPostDataElement> element;
|
||||
CefPostData::ElementVector::const_iterator it = elements.begin();
|
||||
for (; it != elements.end(); ++it) {
|
||||
element = (*it);
|
||||
if (element->GetType() == PDE_TYPE_BYTES) {
|
||||
// the element is composed of bytes
|
||||
ss << "\n\tBytes: ";
|
||||
if (element->GetBytesCount() == 0) {
|
||||
ss << "(empty)";
|
||||
} else {
|
||||
// retrieve the data.
|
||||
size_t size = element->GetBytesCount();
|
||||
char* bytes = new char[size];
|
||||
element->GetBytes(size, bytes);
|
||||
ss << std::string(bytes, size);
|
||||
delete [] bytes;
|
||||
}
|
||||
} else if (element->GetType() == PDE_TYPE_FILE) {
|
||||
ss << "\n\tFile: " << std::string(element->GetFile());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
str = ss.str();
|
||||
}
|
||||
|
||||
std::string StringReplace(const std::string& str, const std::string& from,
|
||||
const std::string& to) {
|
||||
std::string result = str;
|
||||
std::string::size_type pos = 0;
|
||||
std::string::size_type from_len = from.length();
|
||||
std::string::size_type to_len = to.length();
|
||||
do {
|
||||
pos = result.find(from, pos);
|
||||
if (pos != std::string::npos) {
|
||||
result.replace(pos, from_len, to);
|
||||
pos += to_len;
|
||||
}
|
||||
} while (pos != std::string::npos);
|
||||
return result;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
// Copyright (c) 2010 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_STRING_UTIL_H_
|
||||
#define CEF_TESTS_CEFCLIENT_STRING_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include "include/cef_base.h"
|
||||
|
||||
class CefRequest;
|
||||
|
||||
// Dump the contents of the request into a string.
|
||||
void DumpRequestContents(CefRefPtr<CefRequest> request, std::string& str);
|
||||
|
||||
// Replace all instances of |from| with |to| in |str|.
|
||||
std::string StringReplace(const std::string& str, const std::string& from,
|
||||
const std::string& to);
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_STRING_UTIL_H_
|
||||
@@ -1,37 +0,0 @@
|
||||
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
||||
// reserved. Use of this source code is governed by a BSD-style license that
|
||||
// can be found in the LICENSE file.
|
||||
|
||||
#ifndef CEF_TESTS_CEFCLIENT_UTIL_H_
|
||||
#define CEF_TESTS_CEFCLIENT_UTIL_H_
|
||||
#pragma once
|
||||
|
||||
#include "include/cef_task.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
#include <windows.h> // NOLINT(build/include_order)
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ASSERT(condition) if (!(condition)) { DebugBreak(); }
|
||||
#else
|
||||
#define ASSERT(condition) ((void)0)
|
||||
#endif
|
||||
|
||||
#else // !OS_WIN
|
||||
|
||||
#include <assert.h> // NOLINT(build/include_order)
|
||||
|
||||
#ifndef NDEBUG
|
||||
#define ASSERT(condition) if (!(condition)) { assert(false); }
|
||||
#else
|
||||
#define ASSERT(condition) ((void)0)
|
||||
#endif
|
||||
|
||||
#endif // !OS_WIN
|
||||
|
||||
#define REQUIRE_UI_THREAD() ASSERT(CefCurrentlyOn(TID_UI));
|
||||
#define REQUIRE_IO_THREAD() ASSERT(CefCurrentlyOn(TID_IO));
|
||||
#define REQUIRE_FILE_THREAD() ASSERT(CefCurrentlyOn(TID_FILE));
|
||||
|
||||
#endif // CEF_TESTS_CEFCLIENT_UTIL_H_
|
||||
@@ -1,2 +0,0 @@
|
||||
#!/bin/sh
|
||||
python tools/gyp_cef atom.gyp -I cef.gypi --depth=./chromium
|
||||
22
cef.gypi
@@ -1,22 +0,0 @@
|
||||
# Copyright (c) 2009 The Chromium Embedded Framework Authors. All rights
|
||||
# reserved. Use of this source code is governed by a BSD-style license that
|
||||
# can be found in the LICENSE file.
|
||||
|
||||
{
|
||||
'variables': {
|
||||
'conditions': [
|
||||
# Directory for CEF source files.
|
||||
[ 'OS=="win"', {
|
||||
'cef_directory' : '<!(echo %CEF_DIRECTORY%)',
|
||||
# Use SKIA text rendering for transparency support.
|
||||
'enable_skia_text': 1,
|
||||
}, { # OS!="win"
|
||||
'cef_directory' : '<!(echo $CEF_DIRECTORY)',
|
||||
}],
|
||||
[ 'OS=="mac"', {
|
||||
# Don't use the chrome style plugin with CEF.
|
||||
'clang_use_chrome_plugins': 0,
|
||||
}],
|
||||
]
|
||||
},
|
||||
}
|
||||
BIN
cef/Resources/aliasCursor.png
Normal file
|
After Width: | Height: | Size: 752 B |
BIN
cef/Resources/am.lproj/locale.pak
Normal file
BIN
cef/Resources/ar.lproj/locale.pak
Normal file
BIN
cef/Resources/bg.lproj/locale.pak
Normal file
112
cef/Resources/blackberry/popupControlBlackBerry.css
Normal file
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright (C) Research In Motion Limited, 2012. All rights reserved.
|
||||
*/
|
||||
|
||||
html {
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
body {
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: "Myriad Pro", "Arial", "Helvetica", sans-serif;
|
||||
font-size: 40px;
|
||||
|
||||
-webkit-user-select: none;
|
||||
user-select: none;
|
||||
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: vertical;
|
||||
-webkit-box-align: center;
|
||||
-webkit-box-pack: center;
|
||||
|
||||
display: box;
|
||||
box-orient: vertical;
|
||||
box-align: center;
|
||||
box-pack: center;
|
||||
}
|
||||
|
||||
.popup-area {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
display: -webkit-box;
|
||||
display: box;
|
||||
-webkit-box-orient: vertical;
|
||||
box-orient: vertical;
|
||||
}
|
||||
|
||||
.popup-area>:first-child {
|
||||
-webkit-box-flex: 1;
|
||||
box-flex: 1;
|
||||
}
|
||||
|
||||
.popup-buttons {
|
||||
display: -webkit-box;
|
||||
-webkit-box-orient: horizontal;
|
||||
-webkit-box-pack: center;
|
||||
-webkit-box-align: stretch;
|
||||
|
||||
border-image-source: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB8AAAB6CAMAAABwSXjiAAAAvVBMVEXc3Nzd3d3e3t7d3d3c3Nzd3d3f39/e3t7e3t7c3Nzc3Nzd3d3c3Nzc3Nzc3Nze3t7d3d3e3t7e3t7d3d3c3Nzd3d3c3Nzc3Nzd3d3c3Nzd3d3c3Nzd3d3c3Nzd3d3e3t7c3Nzf39/e3t7d3d3l5eXg4ODq6urj4+Pn5+fp6enk5OTm5ubo6Oji4uLh4eH09PT29vb6+vrx8fHw8PDv7+/u7u7t7e3r6+v19fX5+fn4+Pjz8/Py8vL39/fs7OxBzuRYAAAAIHRSTlMAAOqH6qj5xksJP1HJzIcG5JYDEuF+VFd4cud1CeSEk7PB98YAAADeSURBVHhezMlHEYBAAARBHF1OJP+ycDCfra2jv30kZv/Ffv8n2/4P2/6R2X8y+wdm/4vJfzP7ZyZ/YfavTP7G5O9M/pfJP5j6X3fzkYNAEANR1O7JkZxzztz/eDQaIRhB18byhr99KhXtcep+won9ihP7ESf2C07sW5y6n3FiP+DU/YYT+x33977DqfsKp+4h5JDMGmUogh7RAnqLYugxtQ26bxD3Nu6GTNwZO7k5tc6Z0zN+Os8d7HHlHPzkgF/OnmNtvarfXdabDahWMvI/1J8k9FVa5oW1Ii/TNzwAJkil621gpK4AAAAASUVORK5CYII=");
|
||||
border-image-slice: 14 14 14 14 fill;
|
||||
border-width: 14px;
|
||||
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.popup-button-divider {
|
||||
width: 2px;
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
border-width: 14px 0;
|
||||
/* border image takes an image, so use a solid-colour gradient */
|
||||
border-image-source: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.2) 0%);
|
||||
border-image-slice: 1 0 1 0;
|
||||
border-image-outset: 1 0 1 0;
|
||||
}
|
||||
|
||||
.popup-button {
|
||||
color: inherit;
|
||||
font: inherit;
|
||||
text-shadow: rgba(255, 255, 255, 0.5) 0 -2px;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
background: none;
|
||||
line-height: 200%;
|
||||
display: block;
|
||||
|
||||
width: 0;
|
||||
-webkit-box-flex: 1;
|
||||
|
||||
border: 14px solid transparent;
|
||||
}
|
||||
|
||||
.popup-button:active { /* all current popups have at most two buttons, so this is unused atm */
|
||||
border-image-source: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAB4AQMAAAAJ9grDAAAAA1BMVEUAAACnej3aAAAAAXRSTlMz/za5cAAAABVJREFUeF7lwIEAAAAAgKD9qQepMAMA8AABd9vWlQAAAABJRU5ErkJggg==");
|
||||
border-image-slice: 1 0 1 0 fill;
|
||||
padding: 14px;
|
||||
margin: -14px;
|
||||
}
|
||||
|
||||
.popup-button:first-child:active { /* TODO: RTL */
|
||||
border-image-source: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAB4CAMAAADMioJkAAAAPFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQLyYwAAAAFHRSTlMzAC8BGygeDzIuEBoiGBEtAhcNKSH3iKYAAABFSURBVHhe7cy5AYAwEMTA27PN/9N/r0QQqAVW4QSKX+Wcc84NhCQ0QkfoCYUTrYQyAjQRNBO0EFQJ2naAjjNf+LpquyMeT+sA9bsu6t8AAAAASUVORK5CYII=");
|
||||
border-image-slice: 14 0 14 14 fill;
|
||||
border-image-width: 1 0 1 1;
|
||||
padding: 14px;
|
||||
margin: -14px;
|
||||
}
|
||||
|
||||
.popup-button:last-child:active { /* TODO: RTL */
|
||||
border-image-source: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAB3CAMAAAA93DCxAAAAM1BMVEUAAAAAAAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACin91XAAAAEXRSTlMzAAAvLhsCKBgyARAeDyIRFxtQtTsAAAA/SURBVHhe7ci3AYAAEAJA8YM57D+thY2wglx5w5+ZmZktGqExaewah0SsEvPIkS2xgaPAcYKjQJEXvhF3440HSAQAwP9T2mwAAAAASUVORK5CYII=");
|
||||
border-image-slice: 14 14 14 0 fill;
|
||||
border-image-width: 1 1 1 0;
|
||||
padding: 14px;
|
||||
margin: -14px;
|
||||
}
|
||||
|
||||
.popup-button:only-child:active {
|
||||
border-image-source: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAB4CAMAAACkeQBcAAAAPFBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQLyYwAAAAFHRSTlMzAC8bKAEuAjIeDxAXGCIRDSktGtImyaoAAABzSURBVHhe7c5LDsIwEATR6rGdkH+A+9+VRUQUCWx2rPptp0Zq/szMzMzMzMxuv85BU5Bpygw0DYw0jZSgIQpaaFiESkdV1wtpomqSkPSkIukItPLVqnegVPk/A22Pj32broH6ObiIudcBnfaU7wD3nHadXi1ZAc/vLQEmAAAAAElFTkSuQmCC");
|
||||
border-image-slice: 14 14 14 14 fill;
|
||||
border-image-width: 1 1 1 1;
|
||||
padding: 14px;
|
||||
margin: -14px;
|
||||
}
|
||||
63
cef/Resources/blackberry/selectControlBlackBerry.css
Normal file
@@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) Research In Motion Limited 2012. All rights reserved.
|
||||
*/
|
||||
|
||||
.select-area {
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
white-space: nowrap;
|
||||
|
||||
background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAtUAAAANCAYAAABmQZIAAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowODgwMTE3NDA3MjA2ODExOERCQkU3QjZERTFCNzVGNyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxQzIwQ0ZFQTM0ODYxMUUxQkI0RkE0ODBENzFGMEVDRSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxQzIwQ0ZFOTM0ODYxMUUxQkI0RkE0ODBENzFGMEVDRSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjA4ODAxMTc0MDcyMDY4MTE4REJCRTdCNkRFMUI3NUY3IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjA4ODAxMTc0MDcyMDY4MTE4REJCRTdCNkRFMUI3NUY3Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+YZtOWQAAA25JREFUeNrsnetuwyAMhYPH3v+FUzNV2qSpSsAXTCA550eltingC/BBaZpKKRsEQRAEQRAEQXbl90NKCZ6AtCK4AIIgCLqxGC6ApHpvUueJweyOybwaiGJAQV5AEITxGlp3zOYH+H0aGzOSFkC0aH5ggIYgCAJUw9f++QW5Mxk00UWJACCCbfAzBEEQBD13MUOBZQ+Daqo854PXSGgECZ3EHSClhxMJUDQNGEpjwQ/xBxYHEDR4UoWtqnGAJ/I7B9m4Sj5wcB708C93iG0LzF1+yA4ja89J6CRyJGsO7OhXl7tih50FqiW/uo2+5U0yTCx3AOo7QzW+Hr33wml/WGw4cBzU3PmgLArVd2snT9Zu7Y60Bdg5wo6s6KQaAKZGA+hgImbl4NBjcI88M+xpX+qQTLVvBvJA+1jp9zvvIj+tXsAkFhfQ9b7jG9dHwoUSDbBFstt7BnSa+b0sEqNdMO+zsn0S3uGDa3PD5hZ/iv2VlclKjQT5hHDa6kdBtFBNjo6WOnRW6tTZo8obWdaXsKMnZ/0c4AO6sIxRcLYKBCbjhOG9D2hxtvOpKoN8Zq1n9j9e4MH1WHflWAiDI2y1zgGszIujfH1dHF8O+gx3KLNVhoQRekH11oBq+rfoOdpc3H9fJ2GfYi1UHwExVaA6VyCUGkCejFBLgUCsKSM5wKYHeFvgiTpMftT5urPrI6C6ByDNBtW9y70KIkf9HgLHtuJBjwf5cvRObFkgBjNAdQnwjfWcLg+ISxG0m531eICZHTHjDj7dFfFr1cdKYOcKcH9Ct8vO3BjAqALVR5CdK1CdKu9twvdIcM1XI9k8MGg9ApMcIG2dqNNJh/k878sVX7LCxl5wNgJMrtypThPbZC0vdZxUpf7xTtgR596fANWaRU9xxicK3rz5OvuZ1lmOB8x0TrcYy2RhH2jB2CdUF4e9WrCO2iHWxvdbEZddEJfWcY4z7uKTz1MFumscyTUIriUENwDsDFrZCGzWFdneaONrIOhsFbD1DBTWHe6/WLwOfGKJUTK2IxLwJNdqvtJLg9o9G2Svenwkuu/2gvTZoLpc7NtIQJxlQTIKNCPqLpO0cfSOswSqJWW/OvGNNC4WP0o+w4780NSpOZ++V8p8bed3puPKAuqPlf7vrpMgHzi9/1YRgiAIgiAIgiC7fgQYALk6BVm+VKUFAAAAAElFTkSuQmCC") bottom no-repeat rgba(255, 255, 255, 0.5);
|
||||
background-size: 100% auto;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
border-image-source: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAcCAYAAACdz7SqAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wGBw8oKjYFm6wAAAMkSURBVEjHxZbBThtXFIa/MzaejAs2aZKqbnHsSunG6kOwiJF4A4RhA1ElVGXLgteIKhQasUoRD5CmEs6CR/Ciu7YuBksjFZTa4Ho8tmdOF7kzOIi2CZjkSEdjX8093/3/e2bmiqoSReOg4QD3gE8YX/wNHBeKBS8akAh6eHB41wCpVqv2k++f3G0cNKZb7dYkIO8B0ensdKdQLLQef/f4pFwu+2b8+H7x/kkMPWoc5YBpgEffPvqsWq0WVDUC6RXUCYCIaLlcbjzbevanGW/lC3lXDhuHGeDLs7MzeVh++MB13dtACPiABwxGwPp/IHOdABzABqxcLvfXq+qr36amphRoWoLcFoTKUuUL13WzBtICXgMdA+6Z9P8jo3s8M++1qTNwXTdbWarkBEGQTy0RSb/46YVdq9U+BwLgGGibBoiyA5y9Q3YuzGsDJ0BQq9VyL39+mRKRtCUibP2wdccAT83NXbPid1V5mVrP1OmYusHTrad3RISkiFCv1zNA39jRM78Ds7fhFRrJMjk089uAXa/XsyLiJkWEbrebMCvtmmvfNE14je6NoGr+9z3Pm4iVDgaDoWmgCBjB9IovhGjBYuoBDHzfT8RQY+XwmpZeBo5UxvXfQC1hBDi8hqX/FsHIdSiWYBmlo3aOE8iFumFsr4joiKXjhkYRAipyrlRvGBjXH20kvUF736o/qvSDxUeEWh8YGj0yqVTq4jdx3GEBTE5OSmxvPp9H35xbrEuaahwpqqrFYvG8kebn5yOFzg0pdQDK5fK50tXVVQBVVQdIjhmYVNU0oMvLy7HSbqlU6q2vr6cMOauqto4nbFXNArqxsWGXSqWeiHTF87yMiHwVhuHMysrK6e7urmf2oWe+r4MrqJsA0sAtQBYWFpzt7e2MZVlNVf1DVBW/5+cSicQDEck8//F5d21t7dTzvOtvpOOwubmZWaospVW1HQTB7/Yt240P277v30skEt+ISLrZbA53dna8vb09f39/f/i+sNnZ2eTc3Jy9uLjozMzMJFW1GwTBL7ZtH791wgfo9/uOZVlfi0h+bC9d1aMwDH9NpVKxdf8AVVvibOaCYy8AAAAASUVORK5CYII=");
|
||||
border-width: 12px 12px 0 12px;
|
||||
border-image-slice: 12 12 12 12 fill;
|
||||
}
|
||||
|
||||
.select-area:last-child {
|
||||
/* Nothing comes after us? Put the bottom border back and adjust the bottom shadow */
|
||||
border-bottom-width: 12px;
|
||||
background-origin: border-box;
|
||||
}
|
||||
|
||||
.option {
|
||||
overflow: hidden;
|
||||
text-overflow: -blackberry-fade;
|
||||
color: #262626;
|
||||
text-shadow: rgba(0, 0, 0, 0.2) 0 -1px;
|
||||
|
||||
box-sizing: border-box;
|
||||
height: 99px;
|
||||
|
||||
border: 2px solid rgba(0, 0, 0, 0.2);
|
||||
border-bottom-width: 0;
|
||||
|
||||
padding-left: 24px;
|
||||
padding-top: 28px;
|
||||
}
|
||||
|
||||
.option:last-child,
|
||||
.optgroup:last-child {
|
||||
border-bottom-width: 2px;
|
||||
}
|
||||
|
||||
.selected {
|
||||
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAfCAYAAACPvW/2AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA2ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDowOTgwMTE3NDA3MjA2ODExOERCQkU3QjZERTFCNzVGNyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDo4QjlDOEZERjRFOEUxMUUxQTVCNEE5NzUyM0FFRjA5OSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDo4QjlDOEZERTRFOEUxMUUxQTVCNEE5NzUyM0FFRjA5OSIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkUzQUZFRkQwNDMyMDY4MTE5NDU3RDYyQTNCRTFFRDU2IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjA5ODAxMTc0MDcyMDY4MTE4REJCRTdCNkRFMUI3NUY3Ii8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Ei1rtAAAAxlJREFUeNrEl89rGkEUx1dXTWISPajxRzQhGkECIedCDvbQg9BbaQ6BQK8p9A9IDi2l2D8hJ9Eo/khMcmjVHJJLoYcWofaSXpJDyalJhIIUkYI/+n1DVyLurDHRdeHhzDgz++H73rx5q/H7/cIon/Pz846+ZoRANtgj2G/YF4A1aFDbarWEEdi6RqO5MBgMH/R6/Wf0v0MYBwHpRqDMi/Hx8YjZbBYBxQbq9fpypVKJoPlUR8RqwkxMTDAY6kjvFkVRmJqaCqmtEFPGZDKJciIYjcYaA1JJIaYMD4aelZWVExbUasLwJiwsLJTC4fB7NRTaIDchPsRms8mFiUQiW4D+NmwggolNT09z3UQw0WiUYE4pxocZ1BtjY2M9YWKxWAfMsBRiMEpu8nq9pd3d3S6YYWTqDWRfBsObQ8rE43EGMz8/36WGdhhu4k0gZRKJBBdGzmVLsGVYEfazX5jJyUlFN0kwc3Nz3DiRXEYSp7Ra7Q9IvoffC/Tf9uMmglFyUzKZZDAej6d1+z9ZhQDwCql7HRtL42KtVnsNoxLhZS9lsJarjM/nK6VSKQbjdrt7niAGZLFYnuHG7SBGDhFwG29Wq1WBA7UuwfBOKsGk02kGMzs7e6fjzILaZrPV5f7ECwW4YhPNHRmYBLmJtzHBZDKZvmDaMRQMBj+S5HKGAkrAppuYtyMVVxhLYEzkraGYkWBcLldLKQZlFdre3t4LhUJZ3iKKLYLC1BOCkdwkZ3Sa9vf32zD95g4WQ06n8xeed9Q+Pj5ek5tIUAj+JzqdTlCKmWw2y2Cw572ugHYecjgcZ1dXVwyqUCjIQgFI4J2mxcXFNgz2uvd91JEY7Xb72fX1tSIUD+bg4GALrjzFHg+6HLtuewmK2neBIpjDw8OBwHDLj9tQ+Xx+TS0YxfJjZmbm7ObmhrlPDopgjo6OGAzmDqyGUSzQJCicrHoul3veaDT0NB4IBIooId4MGoZ9Slut1p6TyuXy0uXl5eNisejCca6urq5+xfAnZPjmQwGwd/9A/xfSzWuC/QXIn0Ep0gWk8pdrz+efAAMAmYa9FmAD9lUAAAAASUVORK5CYII="),
|
||||
-webkit-linear-gradient(top, #fafafa 0%, #dddddd 100%);
|
||||
background-position: right 20px, 0% 0%; /* TODO: RTL */
|
||||
/* FIXME: the above should put the checkmark 20px from the right of the box, but webkit isn't supporting that part of CSS3 yet. So fake it */
|
||||
background-position: 97% 50%, 0% 0%;
|
||||
background-repeat: no-repeat;
|
||||
padding-right: 56px; /* this gets the overflow and fade to work. 36px for the image, about 20px for the right padding */
|
||||
}
|
||||
|
||||
.optgroup {
|
||||
/* need to do something with this */
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
.optgroup .option {
|
||||
border-left-width: 0; /* TODO: RTL */
|
||||
}
|
||||
92
cef/Resources/blackberry/selectControlBlackBerry.js
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Copyright (C) Research In Motion Limited, 2012. All rights reserved.
|
||||
*/
|
||||
|
||||
// Upon the user making a selection, I will call window.setValueAndClosePopup with a binary string where
|
||||
// the character at index i being '1' means that the option at index i is selected.
|
||||
(function (){
|
||||
|
||||
var selectOption = function (event) {
|
||||
for (var option = document.getElementById('select-area').firstChild; option; option = option.nextSibling) {
|
||||
if (option === event.target) {
|
||||
if (option.className.indexOf('selected') === -1) {
|
||||
option.className += ' selected';
|
||||
}
|
||||
} else {
|
||||
option.className = option.className.replace('selected', '');
|
||||
}
|
||||
}
|
||||
done();
|
||||
};
|
||||
|
||||
var toggleOption = function (event) {
|
||||
if (event.target.className.indexOf('selected') === -1) {
|
||||
event.target.className += ' selected';
|
||||
} else {
|
||||
event.target.className = event.target.className.replace('selected', '');
|
||||
}
|
||||
};
|
||||
|
||||
var done = function () {
|
||||
var result = '';
|
||||
for (var option = document.getElementById('select-area').firstChild; option; option = option.nextSibling) {
|
||||
if (option.className.indexOf('selected') === -1) {
|
||||
result += '0';
|
||||
} else {
|
||||
result += '1';
|
||||
}
|
||||
}
|
||||
window.setValueAndClosePopup(result, window.popUp);
|
||||
};
|
||||
|
||||
/* multiple - a boolean
|
||||
* labels - an array of strings
|
||||
* enableds - an array of booleans.
|
||||
* -I will assume that the HTML "disabled optgroups disable all options in the optgroup" hasn't been applied,
|
||||
* so if the index corresponds to an optgroup, I will render all of its options as disabled
|
||||
* itemTypes - an array of integers, 0 === option, 1 === optgroup, 2 === option in optgroup
|
||||
* selecteds - an array of booleans
|
||||
* buttonText - a string to use for the button presented when multiple is true. Like "OK" or "Done" or something.
|
||||
*/
|
||||
var show = function (multiple, labels, enableds, itemTypes, selecteds, buttonText) {
|
||||
var i,
|
||||
size = labels.length,
|
||||
popup = document.createElement('div'),
|
||||
select = document.createElement('div');
|
||||
|
||||
popup.className = 'popup-area';
|
||||
select.className = 'select-area';
|
||||
select.id = 'select-area';
|
||||
popup.appendChild(select);
|
||||
|
||||
for (i = 0; i < size; i++) {
|
||||
// TODO: handle itemTypes
|
||||
var option = document.createElement('div');
|
||||
option.className = 'option' + (enableds[i] ? '' : ' disabled') + (selecteds[i] ? ' selected' : '');
|
||||
option.appendChild(document.createTextNode(labels[i]));
|
||||
if (!multiple) {
|
||||
option.addEventListener('click', selectOption);
|
||||
} else if (enableds[i]) {
|
||||
option.addEventListener('click', toggleOption);
|
||||
}
|
||||
|
||||
select.appendChild(option);
|
||||
}
|
||||
|
||||
if (multiple) {
|
||||
var okButton = document.createElement('button'),
|
||||
buttons = document.createElement('div');
|
||||
buttons.className = 'popup-buttons';
|
||||
okButton.className = 'popup-button';
|
||||
okButton.addEventListener('click', done);
|
||||
okButton.appendChild(document.createTextNode(buttonText));
|
||||
buttons.appendChild(okButton);
|
||||
popup.appendChild(buttons);
|
||||
}
|
||||
|
||||
document.body.appendChild(popup);
|
||||
};
|
||||
|
||||
window.select = window.select || {};
|
||||
window.select.show = show;
|
||||
}());
|
||||
BIN
cef/Resources/bn.lproj/locale.pak
Normal file
BIN
cef/Resources/ca.lproj/locale.pak
Normal file
177
cef/Resources/calendarPicker.css
Normal file
@@ -0,0 +1,177 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Google Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
body {
|
||||
-webkit-user-select: none;
|
||||
background-color: white;
|
||||
font: -webkit-small-control;
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.no-focus-ring :focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#main {
|
||||
background-color: white;
|
||||
border: solid 1px #8899aa;
|
||||
box-shadow: inset 2px 2px 2px white,
|
||||
inset -2px -2px 1px rgba(0,0,0,0.1);
|
||||
padding: 6px;
|
||||
whitespace: nowrap;
|
||||
/* width and opacity are reset in the JS code. */
|
||||
width: 500px;
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.year-month-area {
|
||||
}
|
||||
|
||||
.year-month-upper {
|
||||
/* display:-webkit-box; is added in the JS code. */
|
||||
}
|
||||
|
||||
.year-selector {
|
||||
text-align: right;
|
||||
width: 6em;
|
||||
}
|
||||
|
||||
.month-selector-box {
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
-webkit-box-flex: 2;
|
||||
}
|
||||
|
||||
.month-selector {
|
||||
background-color: white;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
padding: 3px 6px 3px 6px;
|
||||
}
|
||||
.month-selector:after {
|
||||
content: " ▼";
|
||||
font-size: smaller;
|
||||
}
|
||||
|
||||
.month-selector-popup {
|
||||
display: none;
|
||||
outline: none;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.month-selector-wall {
|
||||
display: none;
|
||||
height: 100%;
|
||||
left: 0px;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.year-month-button-left {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.year-month-button-right {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.days-area-container {
|
||||
background-color: white;
|
||||
border: solid 1px black;
|
||||
margin-bottom: 4px;
|
||||
margin-top: 4px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.days-area { /* <table> */
|
||||
background-color: white;
|
||||
border-collapse: separate;
|
||||
border-spacing: 0px;
|
||||
font: -webkit-small-control;
|
||||
/* table-layout:fixed and width:100% are added in the JS code. */
|
||||
}
|
||||
|
||||
.day-label { /* <th> */
|
||||
-webkit-box-sizing: border-box;
|
||||
background-color: #e3e9ff;
|
||||
border-left-color: #f0f4ff;
|
||||
border-top-color: #f0f4ff;
|
||||
border: solid 1px #d0d4f0;
|
||||
color: #20c;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.day { /* <td> */
|
||||
padding: 1px;
|
||||
text-align: center;
|
||||
background-color: white;
|
||||
border: 1px solid white;
|
||||
-webkit-box-sizing: border-box;
|
||||
}
|
||||
|
||||
.available {
|
||||
cursor: default;
|
||||
font-weight: 700;
|
||||
background-color: white;
|
||||
border: 1px solid white;
|
||||
border-radius: 5px;
|
||||
-webkit-transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.not-this-month {
|
||||
color: graytext;
|
||||
font-weight: 400;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.available.day-selected {
|
||||
background-color: highlight;
|
||||
color: highlighttext;
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.unavailable {
|
||||
cursor: default;
|
||||
color: graytext;
|
||||
background-color: #eee;
|
||||
border: 1px solid #eee;
|
||||
-webkit-transition: border-color 0.2s ease;
|
||||
}
|
||||
|
||||
.unavailable.day-selected {
|
||||
border: 1px solid highlight;
|
||||
}
|
||||
|
||||
.cancel-button {
|
||||
float: right;
|
||||
}
|
||||
1128
cef/Resources/calendarPicker.js
Normal file
49
cef/Resources/calendarPickerMac.css
Normal file
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2012 Google Inc. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
.year-month-button {
|
||||
-webkit-appearance: none;
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#fff), color-stop(0.3, #fff), color-stop(0.35, #f7f7f7), color-stop(0.49, #f7f7f7), color-stop(0.5, #ededed), to(#ededed));
|
||||
border: solid 1px #a6a6a6;
|
||||
border-radius: 4px;
|
||||
box-shadow: inset 1px 1px 1px rgba(255,255,255,0.4), inset -1px -1px 1px rgba(255,255,255,0.4);
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
.year-month-button:active {
|
||||
background: -webkit-gradient(linear, left top, left bottom, from(#a3bfef), color-stop(0.49, #6ba3ef), color-stop(0.5, #4491ef), to(#a3d1ef));
|
||||
border: solid 1px #4d4d50;
|
||||
}
|
||||
|
||||
.year-month-button:disabled {
|
||||
color: #888;
|
||||
border: solid 1px #d1d1d1;
|
||||
}
|
||||
BIN
cef/Resources/cellCursor.png
Normal file
|
After Width: | Height: | Size: 183 B |
BIN
cef/Resources/contextMenuCursor.png
Normal file
|
After Width: | Height: | Size: 523 B |
BIN
cef/Resources/copyCursor.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
cef/Resources/cs.lproj/locale.pak
Normal file
BIN
cef/Resources/da.lproj/locale.pak
Normal file
BIN
cef/Resources/de.lproj/locale.pak
Normal file
BIN
cef/Resources/deleteButton.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
cef/Resources/deleteButton.tiff
Normal file
BIN
cef/Resources/deleteButton@2x.png
Normal file
|
After Width: | Height: | Size: 5.8 KiB |
BIN
cef/Resources/deleteButtonPressed.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
cef/Resources/deleteButtonPressed.tiff
Normal file
BIN
cef/Resources/deleteButtonPressed@2x.png
Normal file
|
After Width: | Height: | Size: 6.0 KiB |
BIN
cef/Resources/eastResizeCursor.png
Normal file
|
After Width: | Height: | Size: 123 B |
BIN
cef/Resources/eastWestResizeCursor.png
Normal file
|
After Width: | Height: | Size: 126 B |
BIN
cef/Resources/el.lproj/locale.pak
Normal file
BIN
cef/Resources/en.lproj/locale.pak
Normal file
BIN
cef/Resources/en_GB.lproj/locale.pak
Normal file
BIN
cef/Resources/es.lproj/locale.pak
Normal file
BIN
cef/Resources/es_419.lproj/locale.pak
Normal file
BIN
cef/Resources/et.lproj/locale.pak
Normal file
BIN
cef/Resources/fa.lproj/locale.pak
Normal file
BIN
cef/Resources/fi.lproj/locale.pak
Normal file
BIN
cef/Resources/fil.lproj/locale.pak
Normal file
BIN
cef/Resources/fr.lproj/locale.pak
Normal file
BIN
cef/Resources/gu.lproj/locale.pak
Normal file
BIN
cef/Resources/he.lproj/locale.pak
Normal file
BIN
cef/Resources/helpCursor.png
Normal file
|
After Width: | Height: | Size: 239 B |