Merge Chromium at r10.0.634.0: Initial merge by git.
Change-Id: Iac2af492818d119bcc2562eb5fdabf5ab0b6df9c
diff --git a/base/at_exit.h b/base/at_exit.h
index fa0f277..35c96b9 100644
--- a/base/at_exit.h
+++ b/base/at_exit.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -28,13 +28,6 @@
// callbacks and singleton destructors will be called.
class AtExitManager {
- protected:
- // This constructor will allow this instance of AtExitManager to be created
- // even if one already exists. This should only be used for testing!
- // AtExitManagers are kept on a global stack, and it will be removed during
- // destruction. This allows you to shadow another AtExitManager.
- explicit AtExitManager(bool shadow);
-
public:
typedef void (*AtExitCallbackType)(void*);
@@ -52,6 +45,13 @@
// is possible to register new callbacks after calling this function.
static void ProcessCallbacksNow();
+ protected:
+ // This constructor will allow this instance of AtExitManager to be created
+ // even if one already exists. This should only be used for testing!
+ // AtExitManagers are kept on a global stack, and it will be removed during
+ // destruction. This allows you to shadow another AtExitManager.
+ explicit AtExitManager(bool shadow);
+
private:
struct CallbackAndParam {
CallbackAndParam(AtExitCallbackType func, void* param)
diff --git a/base/base.gyp b/base/base.gyp
index 075561b..6dc450c 100644
--- a/base/base.gyp
+++ b/base/base.gyp
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.
@@ -65,9 +65,7 @@
'base64_unittest.cc',
'bits_unittest.cc',
'callback_unittest.cc',
- 'cancellation_flag_unittest.cc',
'command_line_unittest.cc',
- 'condition_variable_unittest.cc',
'crypto/encryptor_unittest.cc',
'crypto/rsa_private_key_unittest.cc',
'crypto/rsa_private_key_nss_unittest.cc',
@@ -97,22 +95,18 @@
'lazy_instance_unittest.cc',
'linked_list_unittest.cc',
'linked_ptr_unittest.cc',
- 'lock_unittest.cc',
'logging_unittest.cc',
- 'mac_util_unittest.mm',
+ 'mac/mac_util_unittest.mm',
'message_loop_proxy_impl_unittest.cc',
'message_loop_unittest.cc',
'message_pump_glib_unittest.cc',
'metrics/field_trial_unittest.cc',
'metrics/histogram_unittest.cc',
'metrics/stats_table_unittest.cc',
- 'non_thread_safe_unittest.cc',
- 'object_watcher_unittest.cc',
'observer_list_unittest.cc',
'path_service_unittest.cc',
'pickle_unittest.cc',
'platform_file_unittest.cc',
- 'platform_thread_unittest.cc',
'pr_time_unittest.cc',
'process_util_unittest.cc',
'process_util_unittest_mac.h',
@@ -125,7 +119,6 @@
'sha1_unittest.cc',
'sha2_unittest.cc',
'shared_memory_unittest.cc',
- 'simple_thread_unittest.cc',
'singleton_unittest.cc',
'stack_container_unittest.cc',
'string16_unittest.cc',
@@ -136,16 +129,27 @@
'string_util_unittest.cc',
'stringize_macros_unittest.cc',
'stringprintf_unittest.cc',
+ 'synchronization/cancellation_flag_unittest.cc',
+ 'synchronization/condition_variable_unittest.cc',
+ 'synchronization/lock_unittest.cc',
+ 'synchronization/waitable_event_unittest.cc',
+ 'synchronization/waitable_event_watcher_unittest.cc',
'sys_info_unittest.cc',
'sys_string_conversions_mac_unittest.mm',
'sys_string_conversions_unittest.cc',
'task_queue_unittest.cc',
'task_unittest.cc',
- 'thread_checker_unittest.cc',
- 'thread_collision_warner_unittest.cc',
- 'thread_local_storage_unittest.cc',
- 'thread_local_unittest.cc',
- 'thread_unittest.cc',
+ 'threading/non_thread_safe_unittest.cc',
+ 'threading/platform_thread_unittest.cc',
+ 'threading/simple_thread_unittest.cc',
+ 'threading/thread_checker_unittest.cc',
+ 'threading/thread_collision_warner_unittest.cc',
+ 'threading/thread_local_storage_unittest.cc',
+ 'threading/thread_local_unittest.cc',
+ 'threading/thread_unittest.cc',
+ 'threading/watchdog_unittest.cc',
+ 'threading/worker_pool_posix_unittest.cc',
+ 'threading/worker_pool_unittest.cc',
'time_unittest.cc',
'time_win_unittest.cc',
'timer_unittest.cc',
@@ -157,22 +161,18 @@
'values_unittest.cc',
'version_unittest.cc',
'vlog_unittest.cc',
- 'waitable_event_unittest.cc',
- 'waitable_event_watcher_unittest.cc',
- 'watchdog_unittest.cc',
'weak_ptr_unittest.cc',
- 'win_util_unittest.cc',
'win/event_trace_consumer_unittest.cc',
'win/event_trace_controller_unittest.cc',
'win/event_trace_provider_unittest.cc',
'win/i18n_unittest.cc',
+ 'win/object_watcher_unittest.cc',
'win/pe_image_unittest.cc',
'win/registry_unittest.cc',
'win/scoped_bstr_unittest.cc',
'win/scoped_comptr_unittest.cc',
'win/scoped_variant_unittest.cc',
- 'worker_pool_posix_unittest.cc',
- 'worker_pool_unittest.cc',
+ 'win/win_util_unittest.cc',
],
'dependencies': [
'base',
@@ -217,14 +217,13 @@
'sources!': [
'dir_reader_posix_unittest.cc',
'file_descriptor_shuffle_unittest.cc',
- 'worker_pool_posix_unittest.cc',
+ 'threading/worker_pool_posix_unittest.cc',
],
}, { # OS != "win"
'sources/': [
['exclude', '^win/'],
],
'sources!': [
- 'object_watcher_unittest.cc',
'system_monitor_unittest.cc',
'time_win_unittest.cc',
'trace_event_win_unittest.cc',
diff --git a/base/base.gypi b/base/base.gypi
index 3eaedfa..f241967 100644
--- a/base/base.gypi
+++ b/base/base.gypi
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.
@@ -39,21 +39,13 @@
'bits.h',
'bzip2_error_handler.cc',
'callback.h',
- 'cancellation_flag.cc',
- 'cancellation_flag.h',
'command_line.cc',
'command_line.h',
'compiler_specific.h',
- 'condition_variable.h',
- 'condition_variable_posix.cc',
- 'condition_variable_win.cc',
'cpu.cc',
'cpu.h',
- 'debug_on_start.cc',
- 'debug_on_start.h',
- 'debug_util.cc',
- 'debug_util.h',
- 'debug_util_mac.cc',
+ 'debug/debug_on_start_win.cc',
+ 'debug/debug_on_start_win.h',
'debug/debugger.cc',
'debug/debugger.h',
'debug/debugger_posix.cc',
@@ -106,17 +98,15 @@
'lazy_instance.h',
'linked_list.h',
'linked_ptr.h',
- 'lock.cc',
'lock.h',
- 'lock_impl.h',
- 'lock_impl_posix.cc',
- 'lock_impl_win.cc',
'logging.cc',
'logging.h',
'logging_win.cc',
- 'mac_util.h',
- 'mac_util.mm',
'mac/cocoa_protocols.h',
+ 'mac/mac_util.h',
+ 'mac/mac_util.mm',
+ 'mac/os_crash_dumps.cc',
+ 'mac/os_crash_dumps.h',
'mac/scoped_aedesc.h',
'mac/scoped_cftyperef.h',
'mac/scoped_nsautorelease_pool.h',
@@ -151,24 +141,16 @@
'native_library_linux.cc',
'native_library_mac.mm',
'native_library_win.cc',
- 'non_thread_safe.cc',
- 'non_thread_safe.h',
- 'nullable_string16.h',
- 'object_watcher.cc',
- 'object_watcher.h',
'observer_list.h',
'observer_list_threadsafe.h',
'path_service.cc',
'path_service.h',
'pickle.cc',
'pickle.h',
+ 'platform_file.cc',
'platform_file.h',
'platform_file_posix.cc',
'platform_file_win.cc',
- 'platform_thread.h',
- 'platform_thread_mac.mm',
- 'platform_thread_posix.cc',
- 'platform_thread_win.cc',
'port.h',
'process.h',
'process_linux.cc',
@@ -209,8 +191,6 @@
'shared_memory.h',
'shared_memory_posix.cc',
'shared_memory_win.cc',
- 'simple_thread.cc',
- 'simple_thread.h',
'singleton.h',
'spin_wait.h',
'stack_container.h',
@@ -228,6 +208,22 @@
'stringize_macros.h',
'stringprintf.cc',
'stringprintf.h',
+ 'synchronization/cancellation_flag.cc',
+ 'synchronization/cancellation_flag.h',
+ 'synchronization/condition_variable.h',
+ 'synchronization/condition_variable_posix.cc',
+ 'synchronization/condition_variable_win.cc',
+ 'synchronization/lock.cc',
+ 'synchronization/lock.h',
+ 'synchronization/lock_impl.h',
+ 'synchronization/lock_impl_posix.cc',
+ 'synchronization/lock_impl_win.cc',
+ 'synchronization/waitable_event.h',
+ 'synchronization/waitable_event_posix.cc',
+ 'synchronization/waitable_event_watcher.h',
+ 'synchronization/waitable_event_watcher_posix.cc',
+ 'synchronization/waitable_event_watcher_win.cc',
+ 'synchronization/waitable_event_win.cc',
'sys_info.h',
'sys_info_chromeos.cc',
'sys_info_freebsd.cc',
@@ -245,20 +241,34 @@
'task_queue.cc',
'task_queue.h',
'template_util.h',
- 'thread.cc',
- 'thread.h',
- 'thread_checker.cc',
- 'thread_checker.h',
- 'thread_collision_warner.cc',
- 'thread_collision_warner.h',
- 'thread_local.h',
- 'thread_local_posix.cc',
- 'thread_local_storage.h',
- 'thread_local_storage_posix.cc',
- 'thread_local_storage_win.cc',
- 'thread_local_win.cc',
- 'thread_restrictions.h',
- 'thread_restrictions.cc',
+ 'threading/non_thread_safe.cc',
+ 'threading/non_thread_safe.h',
+ 'threading/platform_thread.h',
+ 'threading/platform_thread_mac.mm',
+ 'threading/platform_thread_posix.cc',
+ 'threading/platform_thread_win.cc',
+ 'threading/simple_thread.cc',
+ 'threading/simple_thread.h',
+ 'threading/thread.cc',
+ 'threading/thread.h',
+ 'threading/thread_checker.cc',
+ 'threading/thread_checker.h',
+ 'threading/thread_collision_warner.cc',
+ 'threading/thread_collision_warner.h',
+ 'threading/thread_local.h',
+ 'threading/thread_local_posix.cc',
+ 'threading/thread_local_storage.h',
+ 'threading/thread_local_storage_posix.cc',
+ 'threading/thread_local_storage_win.cc',
+ 'threading/thread_local_win.cc',
+ 'threading/thread_restrictions.h',
+ 'threading/thread_restrictions.cc',
+ 'threading/watchdog.cc',
+ 'threading/watchdog.h',
+ 'threading/worker_pool.h',
+ 'threading/worker_pool_posix.cc',
+ 'threading/worker_pool_posix.h',
+ 'threading/worker_pool_win.cc',
'time.cc',
'time.h',
'time_win.cc',
@@ -283,18 +293,12 @@
'version.h',
'vlog.cc',
'vlog.h',
- 'waitable_event.h',
- 'waitable_event_posix.cc',
- 'waitable_event_watcher.h',
- 'waitable_event_watcher_posix.cc',
- 'waitable_event_watcher_win.cc',
- 'waitable_event_win.cc',
- 'watchdog.cc',
- 'watchdog.h',
'weak_ptr.cc',
'weak_ptr.h',
'win/i18n.cc',
'win/i18n.h',
+ 'win/object_watcher.cc',
+ 'win/object_watcher.h',
'win/pe_image.cc',
'win/event_trace_consumer.h',
'win/event_trace_controller.cc',
@@ -304,7 +308,6 @@
'win/pe_image.h',
'win/registry.cc',
'win/registry.h',
- 'win/rgs_helper.h',
'win/scoped_bstr.cc',
'win/scoped_bstr.h',
'win/scoped_comptr.h',
@@ -314,14 +317,10 @@
'win/scoped_hglobal.h',
'win/scoped_variant.cc',
'win/scoped_variant.h',
+ 'win/win_util.cc',
+ 'win/win_util.h',
'win/windows_version.cc',
'win/windows_version.h',
- 'win_util.cc',
- 'win_util.h',
- 'worker_pool.h',
- 'worker_pool_posix.cc',
- 'worker_pool_posix.h',
- 'worker_pool_win.cc',
'nix/xdg_util.h',
'nix/xdg_util.cc',
],
@@ -352,8 +351,6 @@
'gtk_util.cc',
'gtk_util.h',
'linux_util.cc',
- 'setproctitle_linux.c',
- 'setproctitle_linux.h',
],
},
],
@@ -515,10 +512,8 @@
'cpu.cc',
'crypto/capi_util.h',
'crypto/capi_util.cc',
- 'debug_on_start.cc',
'event_recorder.cc',
'file_version_info.cc',
- 'object_watcher.cc',
'pe_image.cc',
'registry.cc',
'resource_util.cc',
@@ -634,8 +629,6 @@
'nss_util.h',
'openssl_util.cc',
'openssl_util.h',
- 'setproctitle_linux.c',
- 'setproctitle_linux.h',
'sha2.cc',
'sha2.h',
'sha2_openssl.cc',
diff --git a/base/base_paths_mac.mm b/base/base_paths_mac.mm
index 97413ba..1210834 100644
--- a/base/base_paths_mac.mm
+++ b/base/base_paths_mac.mm
@@ -11,7 +11,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/path_service.h"
#include "base/string_util.h"
@@ -48,15 +48,15 @@
return GetNSExecutablePath(result);
}
case base::DIR_CACHE:
- return mac_util::GetUserDirectory(NSCachesDirectory, result);
+ return base::mac::GetUserDirectory(NSCachesDirectory, result);
case base::DIR_APP_DATA:
- return mac_util::GetUserDirectory(NSApplicationSupportDirectory, result);
+ return base::mac::GetUserDirectory(NSApplicationSupportDirectory, result);
case base::DIR_SOURCE_ROOT: {
// Go through PathService to catch overrides.
if (PathService::Get(base::FILE_EXE, result)) {
// Start with the executable's directory.
*result = result->DirName();
- if (mac_util::AmIBundled()) {
+ if (base::mac::AmIBundled()) {
// The bundled app executables (Chromium, TestShell, etc) live five
// levels down, eg:
// src/xcodebuild/{Debug|Release}/Chromium.app/Contents/MacOS/Chromium
diff --git a/base/base_switches.cc b/base/base_switches.cc
index d907a3a..a1d688a 100644
--- a/base/base_switches.cc
+++ b/base/base_switches.cc
@@ -6,9 +6,10 @@
namespace switches {
-// If the program includes chrome/common/debug_on_start.h, the process will
-// start the JIT system-registered debugger on itself and will wait for 60
-// seconds for the debugger to attach to itself. Then a break point will be hit.
+// If the program includes base/debug/debug_on_start_win.h, the process will
+// (on Windows only) start the JIT system-registered debugger on itself and
+// will wait for 60 seconds for the debugger to attach to itself. Then a break
+// point will be hit.
const char kDebugOnStart[] = "debug-on-start";
// Disables the crash reporting.
@@ -23,7 +24,7 @@
// Suppresses all error dialogs when present.
const char kNoErrorDialogs[] = "noerrdialogs";
-// Disable win_util::MessageBox. This is useful when running as part of
+// Disable app::win::MessageBox. This is useful when running as part of
// scripts that do not have a user interface.
const char kNoMessageBox[] = "no-message-box";
diff --git a/base/command_line.cc b/base/command_line.cc
index 70d6872..66b4437 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -4,18 +4,6 @@
#include "base/command_line.h"
-#if defined(OS_WIN)
-#include <windows.h>
-#include <shellapi.h>
-#elif defined(OS_POSIX)
-#include <limits.h>
-#include <stdlib.h>
-#include <unistd.h>
-#endif
-#if defined(OS_LINUX)
-#include <sys/prctl.h>
-#endif
-
#include <algorithm>
#include "base/file_path.h"
@@ -26,10 +14,15 @@
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
+#include "build/build_config.h"
-#if defined(OS_LINUX)
-// Linux/glibc doesn't natively have setproctitle().
-#include "base/setproctitle_linux.h"
+#if defined(OS_WIN)
+#include <windows.h>
+#include <shellapi.h>
+#elif defined(OS_POSIX)
+#include <limits.h>
+#include <stdlib.h>
+#include <unistd.h>
#endif
CommandLine* CommandLine::current_process_commandline_ = NULL;
@@ -218,55 +211,8 @@
#elif defined(OS_POSIX)
current_process_commandline_->InitFromArgv(argc, argv);
#endif
-
-#if defined(OS_LINUX)
- if (argv)
- setproctitle_init(const_cast<char**>(argv));
-#endif
}
-#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_NACL)
-// static
-void CommandLine::SetProcTitle() {
- // Build a single string which consists of all the arguments separated
- // by spaces. We can't actually keep them separate due to the way the
- // setproctitle() function works.
- std::string title;
- bool have_argv0 = false;
-#if defined(OS_LINUX)
- // In Linux we sometimes exec ourselves from /proc/self/exe, but this makes us
- // show up as "exe" in process listings. Read the symlink /proc/self/exe and
- // use the path it points at for our process title. Note that this is only for
- // display purposes and has no TOCTTOU security implications.
- FilePath target;
- FilePath self_exe("/proc/self/exe");
- if (file_util::ReadSymbolicLink(self_exe, &target)) {
- have_argv0 = true;
- title = target.value();
- // If the binary has since been deleted, Linux appends " (deleted)" to the
- // symlink target. Remove it, since this is not really part of our name.
- const std::string kDeletedSuffix = " (deleted)";
- if (EndsWith(title, kDeletedSuffix, true))
- title.resize(title.size() - kDeletedSuffix.size());
-#if defined(PR_SET_NAME)
- // If PR_SET_NAME is available at compile time, we try using it. We ignore
- // any errors if the kernel does not support it at runtime though. When
- // available, this lets us set the short process name that shows when the
- // full command line is not being displayed in most process listings.
- prctl(PR_SET_NAME, FilePath(title).BaseName().value().c_str());
-#endif
- }
-#endif
- for (size_t i = 1; i < current_process_commandline_->argv_.size(); ++i) {
- if (!title.empty())
- title += " ";
- title += current_process_commandline_->argv_[i];
- }
- // Disable prepending argv[0] with '-' if we prepended it ourselves above.
- setproctitle(have_argv0 ? "-%s" : "%s", title.c_str());
-}
-#endif
-
void CommandLine::Reset() {
DCHECK(current_process_commandline_ != NULL);
delete current_process_commandline_;
diff --git a/base/command_line.h b/base/command_line.h
index df0293c..b8bbba9 100644
--- a/base/command_line.h
+++ b/base/command_line.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -17,62 +17,62 @@
#define BASE_COMMAND_LINE_H_
#pragma once
-#include "build/build_config.h"
-
#include <map>
#include <string>
#include <vector>
#include "base/basictypes.h"
+#include "build/build_config.h"
class FilePath;
class InProcessBrowserTest;
class CommandLine {
public:
+#if defined(OS_WIN)
+ // The type of native command line arguments.
+ typedef std::wstring StringType;
+#elif defined(OS_POSIX)
+ // The type of native command line arguments.
+ typedef std::string StringType;
+#endif
+
+ // The type of map for parsed-out switch key and values.
+ typedef std::map<std::string, StringType> SwitchMap;
+
// A constructor for CommandLines that are used only to carry switches and
// arguments.
enum NoProgram { NO_PROGRAM };
explicit CommandLine(NoProgram no_program);
+
+ // Construct a new, empty command line.
+ // |program| is the name of the program to run (aka argv[0]).
+ explicit CommandLine(const FilePath& program);
+
+#if defined(OS_POSIX)
+ CommandLine(int argc, const char* const* argv);
+ explicit CommandLine(const std::vector<std::string>& argv);
+#endif
+
~CommandLine();
#if defined(OS_WIN)
- // The type of native command line arguments.
- typedef std::wstring StringType;
-
// Initialize by parsing the given command-line string.
// The program name is assumed to be the first item in the string.
void ParseFromString(const std::wstring& command_line);
static CommandLine FromString(const std::wstring& command_line);
#elif defined(OS_POSIX)
- // The type of native command line arguments.
- typedef std::string StringType;
-
// Initialize from an argv vector.
void InitFromArgv(int argc, const char* const* argv);
void InitFromArgv(const std::vector<std::string>& argv);
-
- CommandLine(int argc, const char* const* argv);
- explicit CommandLine(const std::vector<std::string>& argv);
#endif
- // Construct a new, empty command line.
- // |program| is the name of the program to run (aka argv[0]).
- explicit CommandLine(const FilePath& program);
-
// Initialize the current process CommandLine singleton. On Windows,
// ignores its arguments (we instead parse GetCommandLineW()
// directly) because we don't trust the CRT's parsing of the command
// line, but it still must be called to set up the command line.
static void Init(int argc, const char* const* argv);
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
- // Sets the current process' arguments that show in "ps" etc. to those
- // in |current_process_commandline_|. Used by the zygote host so that
- // renderers show up with --type=renderer.
- static void SetProcTitle();
-#endif
-
// Destroys the current process CommandLine singleton. This is necessary if
// you want to reset the base library to its initial state (for example in an
// outer library that needs to be able to terminate, and be re-initialized).
@@ -99,9 +99,6 @@
// Get the number of switches in this process.
size_t GetSwitchCount() const { return switches_.size(); }
- // The type of map for parsed-out switch key and values.
- typedef std::map<std::string, StringType> SwitchMap;
-
// Get a copy of all switches, along with their values
const SwitchMap& GetSwitches() const {
return switches_;
@@ -169,6 +166,12 @@
// Used by InProcessBrowserTest.
static CommandLine* ForCurrentProcessMutable();
+ // Returns true and fills in |switch_string| and |switch_value|
+ // if |parameter_string| represents a switch.
+ static bool IsSwitch(const StringType& parameter_string,
+ std::string* switch_string,
+ StringType* switch_value);
+
// The singleton CommandLine instance representing the current process's
// command line.
static CommandLine* current_process_commandline_;
@@ -186,12 +189,6 @@
std::vector<std::string> argv_;
#endif
- // Returns true and fills in |switch_string| and |switch_value|
- // if |parameter_string| represents a switch.
- static bool IsSwitch(const StringType& parameter_string,
- std::string* switch_string,
- StringType* switch_value);
-
// Parsed-out values.
SwitchMap switches_;
diff --git a/base/compiler_specific.h b/base/compiler_specific.h
index 5917882..017b869 100644
--- a/base/compiler_specific.h
+++ b/base/compiler_specific.h
@@ -84,6 +84,8 @@
// virtual void foo() OVERRIDE;
#if defined(COMPILER_MSVC)
#define OVERRIDE override
+#elif defined(__clang__)
+#define OVERRIDE __attribute__((override))
#else
#define OVERRIDE
#endif
diff --git a/base/crypto/cssm_init.cc b/base/crypto/cssm_init.cc
index 46a6ffe..f588f30 100644
--- a/base/crypto/cssm_init.cc
+++ b/base/crypto/cssm_init.cc
@@ -6,9 +6,9 @@
#include <Security/SecBase.h>
-#include "base/lock.h"
#include "base/logging.h"
#include "base/singleton.h"
+#include "base/synchronization/lock.h"
#include "base/sys_string_conversions.h"
// When writing crypto code for Mac OS X, you may find the following
@@ -92,7 +92,7 @@
~SecurityServicesSingleton() {}
- Lock& lock() { return lock_; }
+ base::Lock& lock() { return lock_; }
private:
friend class Singleton<SecurityServicesSingleton>;
@@ -100,7 +100,7 @@
SecurityServicesSingleton() {}
- Lock lock_;
+ base::Lock lock_;
DISALLOW_COPY_AND_ASSIGN(SecurityServicesSingleton);
};
@@ -154,7 +154,7 @@
}
}
-Lock& GetMacSecurityServicesLock() {
+base::Lock& GetMacSecurityServicesLock() {
return SecurityServicesSingleton::GetInstance()->lock();
}
diff --git a/base/crypto/cssm_init.h b/base/crypto/cssm_init.h
index e457083..5644d7e 100644
--- a/base/crypto/cssm_init.h
+++ b/base/crypto/cssm_init.h
@@ -10,10 +10,10 @@
#include "base/scoped_ptr.h"
-class Lock;
-
namespace base {
+class Lock;
+
// Initialize CSSM if it isn't already initialized. This must be called before
// any other CSSM functions. This function is thread-safe, and CSSM will only
// ever be initialized once. CSSM will be properly shut down on program exit.
diff --git a/base/crypto/rsa_private_key.h b/base/crypto/rsa_private_key.h
index bac4250..9b8b4fd 100644
--- a/base/crypto/rsa_private_key.h
+++ b/base/crypto/rsa_private_key.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -168,6 +168,8 @@
// TODO(hclam): This class should be ref-counted so it can be reused easily.
class RSAPrivateKey {
public:
+ ~RSAPrivateKey();
+
// Create a new random instance. Can return NULL if initialization fails.
static RSAPrivateKey* Create(uint16 num_bits);
@@ -203,8 +205,6 @@
static RSAPrivateKey* FindFromPublicKeyInfo(
const std::vector<uint8>& input);
- ~RSAPrivateKey();
-
#if defined(USE_OPENSSL)
EVP_PKEY* key() { return key_; }
#elif defined(USE_NSS)
diff --git a/base/crypto/signature_creator.h b/base/crypto/signature_creator.h
index c405560..3e3afd2 100644
--- a/base/crypto/signature_creator.h
+++ b/base/crypto/signature_creator.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -33,12 +33,12 @@
// Currently can only sign data using SHA-1 with RSA encryption.
class SignatureCreator {
public:
+ ~SignatureCreator();
+
// Create an instance. The caller must ensure that the provided PrivateKey
// instance outlives the created SignatureCreator.
static SignatureCreator* Create(RSAPrivateKey* key);
- ~SignatureCreator();
-
// Update the signature with more data.
bool Update(const uint8* data_part, int data_part_len);
diff --git a/base/debug_on_start.cc b/base/debug/debug_on_start_win.cc
similarity index 91%
rename from base/debug_on_start.cc
rename to base/debug/debug_on_start_win.cc
index 15dab05..b5c1094 100644
--- a/base/debug_on_start.cc
+++ b/base/debug/debug_on_start_win.cc
@@ -1,15 +1,18 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 <windows.h>
+#include "base/debug/debug_on_start_win.h"
-#include "base/debug_on_start.h"
+#include <windows.h>
#include "base/base_switches.h"
#include "base/basictypes.h"
#include "base/debug/debugger.h"
+namespace base {
+namespace debug {
+
// Minimalist implementation to try to find a command line argument. We can use
// kernel32 exported functions but not the CRT functions because we're too early
// in the process startup.
@@ -66,3 +69,6 @@
}
return 0;
}
+
+} // namespace debug
+} // namespace base
diff --git a/base/debug_on_start.h b/base/debug/debug_on_start_win.h
similarity index 83%
rename from base/debug_on_start.h
rename to base/debug/debug_on_start_win.h
index 1774415..5a1081d 100644
--- a/base/debug_on_start.h
+++ b/base/debug/debug_on_start_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,19 +6,24 @@
// line argument. When the command line argument is detected, it invokes the
// debugger, if no system-wide debugger is registered, a debug break is done.
-#ifndef BASE_DEBUG_ON_START_H_
-#define BASE_DEBUG_ON_START_H_
+#ifndef BASE_DEBUG_DEBUG_ON_START_WIN_H_
+#define BASE_DEBUG_DEBUG_ON_START_WIN_H_
#pragma once
#include "base/basictypes.h"
+#include "build/build_config.h"
-// This only works on Windows.
+// This only works on Windows. It's legal to include on other platforms, but
+// will be a NOP.
#if defined(OS_WIN)
#ifndef DECLSPEC_SELECTANY
#define DECLSPEC_SELECTANY __declspec(selectany)
#endif
+namespace base {
+namespace debug {
+
// Debug on start functions and data.
class DebugOnStart {
public:
@@ -63,6 +68,10 @@
#pragma data_seg(pop)
#endif // _WIN64
+
+} // namespace debug
+} // namespace base
+
#endif // defined(OS_WIN)
-#endif // BASE_DEBUG_ON_START_H_
+#endif // BASE_DEBUG_DEBUG_ON_START_WIN_H_
diff --git a/base/debug/debugger.cc b/base/debug/debugger.cc
index 9ca7e8d..8674f1f 100644
--- a/base/debug/debugger.cc
+++ b/base/debug/debugger.cc
@@ -4,11 +4,13 @@
#include "base/debug/debugger.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
namespace base {
namespace debug {
+static bool is_debug_ui_suppressed = false;
+
bool WaitForDebugger(int wait_seconds, bool silent) {
for (int i = 0; i < wait_seconds * 10; ++i) {
if (BeingDebugged()) {
@@ -21,5 +23,13 @@
return false;
}
+void SetSuppressDebugUI(bool suppress) {
+ is_debug_ui_suppressed = suppress;
+}
+
+bool IsDebugUISuppressed() {
+ return is_debug_ui_suppressed;
+}
+
} // namespace debug
} // namespace base
diff --git a/base/debug/debugger.h b/base/debug/debugger.h
index 008d77d..77bde0d 100644
--- a/base/debug/debugger.h
+++ b/base/debug/debugger.h
@@ -33,6 +33,14 @@
// Break into the debugger, assumes a debugger is present.
void BreakDebugger();
+// Used in test code, this controls whether showing dialogs and breaking into
+// the debugger is suppressed for debug errors, even in debug mode (normally
+// release mode doesn't do this stuff -- this is controlled separately).
+// Normally UI is not suppressed. This is normally used when running automated
+// tests where we want a crash rather than a dialog or a debugger.
+void SetSuppressDebugUI(bool suppress);
+bool IsDebugUISuppressed();
+
} // namespace debug
} // namespace base
diff --git a/base/debug/debugger_posix.cc b/base/debug/debugger_posix.cc
index 1e0c2ba..b865e65 100644
--- a/base/debug/debugger_posix.cc
+++ b/base/debug/debugger_posix.cc
@@ -6,6 +6,7 @@
#include "build/build_config.h"
#include <errno.h>
+#include <execinfo.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -30,7 +31,6 @@
#include <iostream>
#include "base/basictypes.h"
-#include "base/compat_execinfo.h"
#include "base/eintr_wrapper.h"
#include "base/logging.h"
#include "base/safe_strerror_posix.h"
@@ -137,7 +137,7 @@
#elif defined(OS_FREEBSD)
-bool DebugUtil::BeingDebugged() {
+bool BeingDebugged() {
// TODO(benl): can we determine this under FreeBSD?
NOTIMPLEMENTED();
return false;
diff --git a/base/debug/debugger_win.cc b/base/debug/debugger_win.cc
index d1d47cd..3323b61 100644
--- a/base/debug/debugger_win.cc
+++ b/base/debug/debugger_win.cc
@@ -8,7 +8,6 @@
#include <dbghelp.h>
#include "base/basictypes.h"
-#include "base/debug_util.h"
#include "base/logging.h"
namespace base {
@@ -103,7 +102,7 @@
}
void BreakDebugger() {
- if (DebugUtil::AreDialogsSuppressed())
+ if (IsDebugUISuppressed())
_exit(1);
__debugbreak();
}
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index 90e302e..879110d 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -5,6 +5,7 @@
#include "base/debug/stack_trace.h"
#include <errno.h>
+#include <execinfo.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
@@ -27,7 +28,6 @@
#include <iostream>
#include "base/basictypes.h"
-#include "base/compat_execinfo.h"
#include "base/eintr_wrapper.h"
#include "base/logging.h"
#include "base/safe_strerror_posix.h"
diff --git a/base/debug/trace_event.cc b/base/debug/trace_event.cc
index 9b9ed1f..a6fddee 100644
--- a/base/debug/trace_event.cc
+++ b/base/debug/trace_event.cc
@@ -8,9 +8,9 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "base/time.h"
diff --git a/base/debug_util.cc b/base/debug_util.cc
deleted file mode 100644
index 4773de3..0000000
--- a/base/debug_util.cc
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright (c) 2006-2008 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 "base/debug_util.h"
-
-bool DebugUtil::suppress_dialogs_ = false;
diff --git a/base/debug_util.h b/base/debug_util.h
deleted file mode 100644
index a643ccf..0000000
--- a/base/debug_util.h
+++ /dev/null
@@ -1,36 +0,0 @@
-// 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.
-
-#ifndef BASE_DEBUG_UTIL_H_
-#define BASE_DEBUG_UTIL_H_
-#pragma once
-
-#include "build/build_config.h"
-
-class DebugUtil {
- public:
-#if defined(OS_MACOSX)
- // On Mac OS X, it can take a really long time for the OS crash handler to
- // process a Chrome crash when debugging symbols are available. This
- // translates into a long wait until the process actually dies. This call
- // disables Apple Crash Reporter entirely.
- static void DisableOSCrashDumps();
-#endif // defined(OS_MACOSX)
-
- // This should be used only in test code.
- static void SuppressDialogs() {
- suppress_dialogs_ = true;
- }
-
- static bool AreDialogsSuppressed() {
- return suppress_dialogs_;
- }
-
- private:
- // If true, avoid displaying any dialogs that could cause problems
- // in non-interactive environments.
- static bool suppress_dialogs_;
-};
-
-#endif // BASE_DEBUG_UTIL_H_
diff --git a/base/file_path.cc b/base/file_path.cc
index eba9afe..cddb17e 100644
--- a/base/file_path.cc
+++ b/base/file_path.cc
@@ -174,6 +174,23 @@
return *this;
}
+bool FilePath::operator==(const FilePath& that) const {
+#if defined(FILE_PATH_USES_DRIVE_LETTERS)
+ return EqualDriveLetterCaseInsensitive(this->path_, that.path_);
+#else // defined(FILE_PATH_USES_DRIVE_LETTERS)
+ return path_ == that.path_;
+#endif // defined(FILE_PATH_USES_DRIVE_LETTERS)
+}
+
+bool FilePath::operator!=(const FilePath& that) const {
+#if defined(FILE_PATH_USES_DRIVE_LETTERS)
+ return !EqualDriveLetterCaseInsensitive(this->path_, that.path_);
+#else // defined(FILE_PATH_USES_DRIVE_LETTERS)
+ return path_ != that.path_;
+#endif // defined(FILE_PATH_USES_DRIVE_LETTERS)
+}
+
+// static
bool FilePath::IsSeparator(CharType character) {
for (size_t i = 0; i < arraysize(kSeparators) - 1; ++i) {
if (character == kSeparators[i]) {
@@ -219,22 +236,6 @@
*components = std::vector<StringType>(ret_val.rbegin(), ret_val.rend());
}
-bool FilePath::operator==(const FilePath& that) const {
-#if defined(FILE_PATH_USES_DRIVE_LETTERS)
- return EqualDriveLetterCaseInsensitive(this->path_, that.path_);
-#else // defined(FILE_PATH_USES_DRIVE_LETTERS)
- return path_ == that.path_;
-#endif // defined(FILE_PATH_USES_DRIVE_LETTERS)
-}
-
-bool FilePath::operator!=(const FilePath& that) const {
-#if defined(FILE_PATH_USES_DRIVE_LETTERS)
- return !EqualDriveLetterCaseInsensitive(this->path_, that.path_);
-#else // defined(FILE_PATH_USES_DRIVE_LETTERS)
- return path_ != that.path_;
-#endif // defined(FILE_PATH_USES_DRIVE_LETTERS)
-}
-
bool FilePath::IsParent(const FilePath& child) const {
return AppendRelativePath(child, NULL);
}
@@ -489,6 +490,87 @@
return IsPathAbsolute(path_);
}
+FilePath FilePath::StripTrailingSeparators() const {
+ FilePath new_path(path_);
+ new_path.StripTrailingSeparatorsInternal();
+
+ return new_path;
+}
+
+bool FilePath::ReferencesParent() const {
+ std::vector<StringType> components;
+ GetComponents(&components);
+
+ std::vector<StringType>::const_iterator it = components.begin();
+ for (; it != components.end(); ++it) {
+ const StringType& component = *it;
+ if (component == kParentDirectory)
+ return true;
+ }
+ return false;
+}
+
+#if defined(OS_POSIX)
+
+// See file_path.h for a discussion of the encoding of paths on POSIX
+// platforms. These *Hack() functions are not quite correct, but they're
+// only temporary while we fix the remainder of the code.
+// Remember to remove the #includes at the top when you remove these.
+
+// static
+FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
+ return FilePath(base::SysWideToNativeMB(wstring));
+}
+std::wstring FilePath::ToWStringHack() const {
+ return base::SysNativeMBToWide(path_);
+}
+#elif defined(OS_WIN)
+// static
+FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
+ return FilePath(wstring);
+}
+std::wstring FilePath::ToWStringHack() const {
+ return path_;
+}
+#endif
+
+// static.
+void FilePath::WriteStringTypeToPickle(Pickle* pickle,
+ const StringType& path) {
+#if defined(WCHAR_T_IS_UTF16)
+ pickle->WriteWString(path);
+#elif defined(WCHAR_T_IS_UTF32)
+ pickle->WriteString(path);
+#else
+ NOTIMPLEMENTED() << "Impossible encoding situation!";
+#endif
+}
+
+// static.
+bool FilePath::ReadStringTypeFromPickle(Pickle* pickle, void** iter,
+ StringType* path) {
+#if defined(WCHAR_T_IS_UTF16)
+ if (!pickle->ReadWString(iter, path))
+ return false;
+#elif defined(WCHAR_T_IS_UTF32)
+ if (!pickle->ReadString(iter, path))
+ return false;
+#else
+ NOTIMPLEMENTED() << "Impossible encoding situation!";
+ return false;
+#endif
+
+ return true;
+}
+
+void FilePath::WriteToPickle(Pickle* pickle) {
+ WriteStringTypeToPickle(pickle, value());
+}
+
+bool FilePath::ReadFromPickle(Pickle* pickle, void** iter) {
+ return ReadStringTypeFromPickle(pickle, iter, &path_);
+}
+
#if defined(OS_WIN)
// Windows specific implementation of file string comparisons
@@ -1078,73 +1160,6 @@
#endif // OS versions of CompareIgnoreCase()
-#if defined(OS_POSIX)
-
-// See file_path.h for a discussion of the encoding of paths on POSIX
-// platforms. These *Hack() functions are not quite correct, but they're
-// only temporary while we fix the remainder of the code.
-// Remember to remove the #includes at the top when you remove these.
-
-// static
-FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
- return FilePath(base::SysWideToNativeMB(wstring));
-}
-std::wstring FilePath::ToWStringHack() const {
- return base::SysNativeMBToWide(path_);
-}
-#elif defined(OS_WIN)
-// static
-FilePath FilePath::FromWStringHack(const std::wstring& wstring) {
- return FilePath(wstring);
-}
-std::wstring FilePath::ToWStringHack() const {
- return path_;
-}
-#endif
-
-FilePath FilePath::StripTrailingSeparators() const {
- FilePath new_path(path_);
- new_path.StripTrailingSeparatorsInternal();
-
- return new_path;
-}
-
-// static.
-void FilePath::WriteStringTypeToPickle(Pickle* pickle,
- const StringType& path) {
-#if defined(WCHAR_T_IS_UTF16)
- pickle->WriteWString(path);
-#elif defined(WCHAR_T_IS_UTF32)
- pickle->WriteString(path);
-#else
- NOTIMPLEMENTED() << "Impossible encoding situation!";
-#endif
-}
-
-// static.
-bool FilePath::ReadStringTypeFromPickle(Pickle* pickle, void** iter,
- StringType* path) {
-#if defined(WCHAR_T_IS_UTF16)
- if (!pickle->ReadWString(iter, path))
- return false;
-#elif defined(WCHAR_T_IS_UTF32)
- if (!pickle->ReadString(iter, path))
- return false;
-#else
- NOTIMPLEMENTED() << "Impossible encoding situation!";
- return false;
-#endif
-
- return true;
-}
-
-void FilePath::WriteToPickle(Pickle* pickle) {
- WriteStringTypeToPickle(pickle, value());
-}
-
-bool FilePath::ReadFromPickle(Pickle* pickle, void** iter) {
- return ReadStringTypeFromPickle(pickle, iter, &path_);
-}
void FilePath::StripTrailingSeparatorsInternal() {
// If there is no drive letter, start will be 1, which will prevent stripping
@@ -1168,19 +1183,6 @@
}
}
-bool FilePath::ReferencesParent() const {
- std::vector<StringType> components;
- GetComponents(&components);
-
- std::vector<StringType>::const_iterator it = components.begin();
- for (; it != components.end(); ++it) {
- const StringType& component = *it;
- if (component == kParentDirectory)
- return true;
- }
- return false;
-}
-
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
FilePath FilePath::NormalizeWindowsPathSeparators() const {
StringType copy = path_;
diff --git a/base/file_util.cc b/base/file_util.cc
index 2b5dc84..d1a46c9 100644
--- a/base/file_util.cc
+++ b/base/file_util.cc
@@ -386,12 +386,6 @@
GetFileExtensionFromPath(FilePath::FromWStringHack(path));
return extension;
}
-std::wstring GetFilenameFromPath(const std::wstring& path) {
- if (path.empty() || EndsWithSeparator(FilePath::FromWStringHack(path)))
- return std::wstring();
-
- return FilePath::FromWStringHack(path).BaseName().ToWStringHack();
-}
FILE* OpenFile(const std::wstring& filename, const char* mode) {
return OpenFile(FilePath::FromWStringHack(filename), mode);
}
diff --git a/base/file_util.h b/base/file_util.h
index e34d0de..ab6906d 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -462,10 +462,10 @@
WIN32_FIND_DATA find_data_;
HANDLE find_handle_;
#elif defined(OS_POSIX)
- typedef struct {
+ struct DirectoryEntryInfo {
FilePath filename;
struct stat stat;
- } DirectoryEntryInfo;
+ };
// Read the filenames in source into the vector of DirectoryEntryInfo's
static bool ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h
index 9bafb31..dac4b45 100644
--- a/base/file_util_deprecated.h
+++ b/base/file_util_deprecated.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -27,21 +27,6 @@
FILE* OpenFile(const std::string& filename, const char* mode);
FILE* OpenFile(const std::wstring& filename, const char* mode);
-// Use FilePath::BaseName instead.
-std::wstring GetFilenameFromPath(const std::wstring& path);
-
-// Returns the directory component of a path, without the trailing
-// path separator, or an empty string on error. The function does not
-// check for the existence of the path, so if it is passed a directory
-// without the trailing \, it will interpret the last component of the
-// path as a file and chomp it. This does not support relative paths.
-// Examples:
-// path == "C:\pics\jojo.jpg", returns "C:\pics"
-// path == "C:\Windows\system32\", returns "C:\Windows\system32"
-// path == "C:\Windows\system32", returns "C:\Windows"
-// Deprecated. Use FilePath's DirName() instead.
-std::wstring GetDirectoryFromPath(const std::wstring& path);
-
// Appends new_ending to path, adding a separator between the two if necessary.
void AppendToPath(std::wstring* path, const std::wstring& new_ending);
diff --git a/base/file_util_mac.mm b/base/file_util_mac.mm
index ca0284c..95d4f25 100644
--- a/base/file_util_mac.mm
+++ b/base/file_util_mac.mm
@@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
namespace file_util {
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index ac6dabb..475918e 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -38,7 +38,7 @@
#include "base/singleton.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
diff --git a/base/file_util_proxy.h b/base/file_util_proxy.h
index f266562..4181a26 100644
--- a/base/file_util_proxy.h
+++ b/base/file_util_proxy.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -33,14 +33,27 @@
// StatusCallback, in which case the operation will complete silently.
typedef Callback1<PlatformFileError /* error code */>::Type StatusCallback;
+ typedef Callback3<PlatformFileError /* error code */,
+ PassPlatformFile,
+ bool /* created */>::Type CreateOrOpenCallback;
+ typedef Callback3<PlatformFileError /* error code */,
+ PassPlatformFile,
+ FilePath>::Type CreateTemporaryCallback;
+ typedef Callback2<PlatformFileError /* error code */,
+ bool /* created */>::Type EnsureFileExistsCallback;
+ typedef Callback2<PlatformFileError /* error code */,
+ const PlatformFileInfo& /* file_info */
+ >::Type GetFileInfoCallback;
+ typedef Callback2<PlatformFileError /* error code */,
+ const std::vector<Entry>&>::Type ReadDirectoryCallback;
+ typedef Callback2<PlatformFileError /* error code */,
+ int /* bytes read/written */>::Type ReadWriteCallback;
+
// Creates or opens a file with the given flags. It is invalid to pass NULL
// for the callback.
// If PLATFORM_FILE_CREATE is set in |file_flags| it always tries to create
// a new file at the given |file_path| and calls back with
// PLATFORM_FILE_ERROR_FILE_EXISTS if the |file_path| already exists.
- typedef Callback3<PlatformFileError /* error code */,
- PassPlatformFile,
- bool /* created */>::Type CreateOrOpenCallback;
static bool CreateOrOpen(scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
int file_flags,
@@ -48,9 +61,6 @@
// Creates a temporary file for writing. The path and an open file handle
// are returned. It is invalid to pass NULL for the callback.
- typedef Callback3<PlatformFileError /* error code */,
- PassPlatformFile,
- FilePath>::Type CreateTemporaryCallback;
static bool CreateTemporary(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
CreateTemporaryCallback* callback);
@@ -69,8 +79,6 @@
// is set PLATFORM_FILE_OK.
// If the file hasn't existed but it couldn't be created for some other
// reasons, |created| is set false and |error code| indicates the error.
- typedef Callback2<PlatformFileError /* error code */,
- bool /* created */>::Type EnsureFileExistsCallback;
static bool EnsureFileExists(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
@@ -78,9 +86,6 @@
// Retrieves the information about a file. It is invalid to pass NULL for the
// callback.
- typedef Callback2<PlatformFileError /* error code */,
- const PlatformFileInfo& /* file_info */
- >::Type GetFileInfoCallback;
static bool GetFileInfo(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
@@ -91,8 +96,6 @@
PlatformFile file,
GetFileInfoCallback* callback);
- typedef Callback2<PlatformFileError /* error code */,
- const std::vector<Entry>&>::Type ReadDirectoryCallback;
static bool ReadDirectory(scoped_refptr<MessageLoopProxy> message_loop_proxy,
const FilePath& file_path,
ReadDirectoryCallback* callback);
@@ -142,8 +145,6 @@
// Reads from a file. On success, the file pointer is moved to position
// |offset + bytes_to_read| in the file. The callback can be NULL.
- typedef Callback2<PlatformFileError /* error code */,
- int /* bytes read/written */>::Type ReadWriteCallback;
static bool Read(
scoped_refptr<MessageLoopProxy> message_loop_proxy,
PlatformFile file,
diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc
index cb77828..6ea94e4 100644
--- a/base/file_util_unittest.cc
+++ b/base/file_util_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -19,14 +19,17 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
-#include "base/scoped_handle.h"
#include "base/scoped_temp_dir.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
+#if defined(OS_WIN)
+#include "base/win/scoped_handle.h"
+#endif
+
// This macro helps avoid wrapped lines in the test structs.
#define FPL(x) FILE_PATH_LITERAL(x)
@@ -251,17 +254,6 @@
#endif
};
-#if defined(OS_WIN)
-// This function is deprecated on non-Windows.
-TEST_F(FileUtilTest, GetFilenameFromPath) {
- for (unsigned int i = 0; i < arraysize(filename_cases); ++i) {
- const filename_case& value = filename_cases[i];
- std::wstring result = file_util::GetFilenameFromPath(value.path);
- EXPECT_EQ(value.filename, result);
- }
-}
-#endif
-
// Test finding the file type from a path name
static const struct extension_case {
const wchar_t* path;
@@ -326,18 +318,6 @@
#endif
};
-#if defined(OS_WIN)
-// This function is deprecated, and only exists on Windows anymore.
-TEST_F(FileUtilTest, GetDirectoryFromPath) {
- for (unsigned int i = 0; i < arraysize(dir_cases); ++i) {
- const dir_case& dir = dir_cases[i];
- const std::wstring parent =
- file_util::GetDirectoryFromPath(dir.full_path);
- EXPECT_EQ(dir.directory, parent);
- }
-}
-#endif
-
// Flaky, http://crbug.com/46246
TEST_F(FileUtilTest, FLAKY_CountFilesCreatedAfter) {
// Create old file (that we don't want to count)
@@ -347,11 +327,11 @@
// Age to perfection
#if defined(OS_WIN)
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
#elif defined(OS_POSIX)
// We need to wait at least one second here because the precision of
// file creation time is one second.
- PlatformThread::Sleep(1500);
+ base::PlatformThread::Sleep(1500);
#endif
// Establish our cutoff time
@@ -494,7 +474,7 @@
FilePath to_sub_a = base_b.Append(FPL("to_sub_a"));
ASSERT_TRUE(file_util::CreateDirectory(to_sub_a));
- ScopedHandle reparse_to_sub_a(
+ base::win::ScopedHandle reparse_to_sub_a(
::CreateFile(to_sub_a.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -507,7 +487,7 @@
FilePath to_base_b = base_b.Append(FPL("to_base_b"));
ASSERT_TRUE(file_util::CreateDirectory(to_base_b));
- ScopedHandle reparse_to_base_b(
+ base::win::ScopedHandle reparse_to_base_b(
::CreateFile(to_base_b.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
@@ -520,7 +500,7 @@
FilePath to_sub_long = base_b.Append(FPL("to_sub_long"));
ASSERT_TRUE(file_util::CreateDirectory(to_sub_long));
- ScopedHandle reparse_to_sub_long(
+ base::win::ScopedHandle reparse_to_sub_long(
::CreateFile(to_sub_long.value().c_str(),
FILE_ALL_ACCESS,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 3ca52ae..7476b53 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -19,11 +19,11 @@
#include "base/win/scoped_handle.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
-#include "base/win_util.h"
#include "base/win/scoped_comptr.h"
+#include "base/win/win_util.h"
#include "base/win/windows_version.h"
namespace file_util {
@@ -77,19 +77,6 @@
} // namespace
-std::wstring GetDirectoryFromPath(const std::wstring& path) {
- base::ThreadRestrictions::AssertIOAllowed();
- wchar_t path_buffer[MAX_PATH];
- wchar_t* file_ptr = NULL;
- if (GetFullPathName(path.c_str(), MAX_PATH, path_buffer, &file_ptr) == 0)
- return L"";
-
- std::wstring::size_type length =
- file_ptr ? file_ptr - path_buffer : path.length();
- std::wstring directory(path, 0, length);
- return FilePath(directory).StripTrailingSeparators().value();
-}
-
bool AbsolutePath(FilePath* path) {
base::ThreadRestrictions::AssertIOAllowed();
wchar_t file_path_buf[MAX_PATH];
@@ -447,7 +434,7 @@
if (FAILED(property_store.QueryFrom(i_shell_link)))
return false;
- if (!win_util::SetAppIdForPropertyStore(property_store, app_id))
+ if (!base::win::SetAppIdForPropertyStore(property_store, app_id))
return false;
}
@@ -499,7 +486,7 @@
if (FAILED(property_store.QueryFrom(i_shell_link)))
return false;
- if (!win_util::SetAppIdForPropertyStore(property_store, app_id))
+ if (!base::win::SetAppIdForPropertyStore(property_store, app_id))
return false;
}
@@ -757,9 +744,8 @@
0,
NULL));
if (!file) {
- LOG(WARNING) << "CreateFile failed for path " << filename.value() <<
- " error code=" << GetLastError() <<
- " error text=" << win_util::FormatLastWin32Error();
+ LOG(WARNING) << "CreateFile failed for path " << filename.value()
+ << " error code=" << GetLastError();
return -1;
}
@@ -770,9 +756,8 @@
if (!result) {
// WriteFile failed.
- LOG(WARNING) << "writing file " << filename.value() <<
- " failed, error code=" << GetLastError() <<
- " description=" << win_util::FormatLastWin32Error();
+ LOG(WARNING) << "writing file " << filename.value()
+ << " failed, error code=" << GetLastError();
} else {
// Didn't write all the bytes.
LOG(WARNING) << "wrote" << written << " bytes to " <<
diff --git a/base/file_version_info_mac.mm b/base/file_version_info_mac.mm
index fa97df8..f716ccc 100644
--- a/base/file_version_info_mac.mm
+++ b/base/file_version_info_mac.mm
@@ -8,15 +8,15 @@
#include "base/file_path.h"
#include "base/logging.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
-#include "base/mac_util.h"
FileVersionInfoMac::FileVersionInfoMac(NSBundle *bundle) : bundle_(bundle) {
}
// static
FileVersionInfo* FileVersionInfo::CreateFileVersionInfoForCurrentModule() {
- return CreateFileVersionInfo(mac_util::MainAppBundlePath());
+ return CreateFileVersionInfo(base::mac::MainAppBundlePath());
}
// static
@@ -97,7 +97,7 @@
string16 FileVersionInfoMac::GetString16Value(CFStringRef name) {
if (bundle_) {
- NSString *ns_name = mac_util::CFToNSCast(name);
+ NSString *ns_name = base::mac::CFToNSCast(name);
NSString* value = [bundle_ objectForInfoDictionaryKey:ns_name];
if (value) {
return base::SysNSStringToUTF16(value);
diff --git a/base/file_version_info_win.cc b/base/file_version_info_win.cc
index e2bc84b..953caa9 100644
--- a/base/file_version_info_win.cc
+++ b/base/file_version_info_win.cc
@@ -10,7 +10,7 @@
#include "base/file_version_info.h"
#include "base/logging.h"
#include "base/path_service.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
// This has to be last.
#include <strsafe.h>
diff --git a/base/global_descriptors_posix.h b/base/global_descriptors_posix.h
index ab2b86b..0cb5b4f 100644
--- a/base/global_descriptors_posix.h
+++ b/base/global_descriptors_posix.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -37,6 +37,8 @@
class GlobalDescriptors {
public:
typedef uint32_t Key;
+ typedef std::vector<std::pair<Key, int> > Mapping;
+
// Often we want a canonical descriptor for a given Key. In this case, we add
// the following constant to the key value:
static const int kBaseDescriptor = 3; // 0, 1, 2 are already taken.
@@ -46,11 +48,10 @@
// Get a descriptor given a key. It is a fatal error if the key is not known.
int Get(Key key) const;
+
// Get a descriptor give a key. Returns -1 on error.
int MaybeGet(Key key) const;
- typedef std::vector<std::pair<Key, int> > Mapping;
-
// Set the descriptor for the given key.
void Set(Key key, int fd);
@@ -59,9 +60,9 @@
}
private:
+ friend struct DefaultSingletonTraits<GlobalDescriptors>;
GlobalDescriptors();
~GlobalDescriptors();
- friend struct DefaultSingletonTraits<GlobalDescriptors>;
Mapping descriptors_;
};
diff --git a/base/i18n/icu_string_conversions_unittest.cc b/base/i18n/icu_string_conversions_unittest.cc
index 40b0fed..eb9d2cd 100644
--- a/base/i18n/icu_string_conversions_unittest.cc
+++ b/base/i18n/icu_string_conversions_unittest.cc
@@ -9,8 +9,10 @@
#include <sstream>
#include "base/basictypes.h"
+#include "base/format_macros.h"
#include "base/i18n/icu_string_conversions.h"
#include "base/logging.h"
+#include "base/stringprintf.h"
#include "base/string_piece.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -72,6 +74,9 @@
TEST(ICUStringConversionsTest, ConvertCodepageUTF8) {
// Make sure WideToCodepage works like WideToUTF8.
for (size_t i = 0; i < arraysize(kConvertRoundtripCases); ++i) {
+ SCOPED_TRACE(base::StringPrintf("Test[%" PRIuS "]: %ls",
+ i, kConvertRoundtripCases[i]));
+
std::string expected(WideToUTF8(kConvertRoundtripCases[i]));
std::string utf8;
EXPECT_TRUE(WideToCodepage(kConvertRoundtripCases[i], kCodepageUTF8,
@@ -237,6 +242,11 @@
TEST(ICUStringConversionsTest, ConvertBetweenCodepageAndWide) {
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kConvertCodepageCases); ++i) {
+ SCOPED_TRACE(base::StringPrintf(
+ "Test[%" PRIuS "]: <encoded: %s> <codepage: %s>", i,
+ kConvertCodepageCases[i].encoded,
+ kConvertCodepageCases[i].codepage_name));
+
std::wstring wide;
bool success = CodepageToWide(kConvertCodepageCases[i].encoded,
kConvertCodepageCases[i].codepage_name,
@@ -299,6 +309,11 @@
TEST(ICUStringConversionsTest, ConvertBetweenCodepageAndUTF16) {
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kConvertCodepageCases); ++i) {
+ SCOPED_TRACE(base::StringPrintf(
+ "Test[%" PRIuS "]: <encoded: %s> <codepage: %s>", i,
+ kConvertCodepageCases[i].encoded,
+ kConvertCodepageCases[i].codepage_name));
+
string16 utf16;
bool success = CodepageToUTF16(kConvertCodepageCases[i].encoded,
kConvertCodepageCases[i].codepage_name,
@@ -347,6 +362,11 @@
TEST(ICUStringConversionsTest, ConvertToUtf8AndNormalize) {
std::string result;
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kConvertAndNormalizeCases); ++i) {
+ SCOPED_TRACE(base::StringPrintf(
+ "Test[%" PRIuS "]: <encoded: %s> <codepage: %s>", i,
+ kConvertAndNormalizeCases[i].encoded,
+ kConvertAndNormalizeCases[i].codepage_name));
+
bool success = ConvertToUtf8AndNormalize(
kConvertAndNormalizeCases[i].encoded,
kConvertAndNormalizeCases[i].codepage_name, &result);
diff --git a/base/json/json_reader.h b/base/json/json_reader.h
index 33bd8f2..77c4e74 100644
--- a/base/json/json_reader.h
+++ b/base/json/json_reader.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -69,6 +69,11 @@
Token(Type t, const wchar_t* b, int len)
: type(t), begin(b), length(len) {}
+ // Get the character that's one past the end of this token.
+ wchar_t NextChar() {
+ return *(begin + length);
+ }
+
Type type;
// A pointer into JSONReader::json_pos_ that's the beginning of this token.
@@ -76,11 +81,6 @@
// End should be one char past the end of the token.
int length;
-
- // Get the character that's one past the end of this token.
- wchar_t NextChar() {
- return *(begin + length);
- }
};
// Error codes during parsing.
diff --git a/base/lazy_instance.cc b/base/lazy_instance.cc
index eb71061..32bb788 100644
--- a/base/lazy_instance.cc
+++ b/base/lazy_instance.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,7 +7,7 @@
#include "base/at_exit.h"
#include "base/atomicops.h"
#include "base/basictypes.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
namespace base {
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index bdf5ce3..f4cfda0 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -41,7 +41,7 @@
#include "base/atomicops.h"
#include "base/basictypes.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
namespace base {
diff --git a/base/lazy_instance_unittest.cc b/base/lazy_instance_unittest.cc
index 1731381..28bf04e 100644
--- a/base/lazy_instance_unittest.cc
+++ b/base/lazy_instance_unittest.cc
@@ -5,7 +5,7 @@
#include "base/at_exit.h"
#include "base/atomic_sequence_num.h"
#include "base/lazy_instance.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -26,7 +26,8 @@
class SlowConstructor {
public:
SlowConstructor() : some_int_(0) {
- PlatformThread::Sleep(1000); // Sleep for 1 second to try to cause a race.
+ // Sleep for 1 second to try to cause a race.
+ base::PlatformThread::Sleep(1000);
++constructed;
some_int_ = 12;
}
diff --git a/base/linux_util.h b/base/linux_util.h
index 0d2f20e..c1135ce 100644
--- a/base/linux_util.h
+++ b/base/linux_util.h
@@ -19,8 +19,7 @@
// in compromised context without going through the standard library.
extern char g_linux_distro[];
-// Get the Linux Distro if we can, or return "Unknown", similar to
-// GetWinVersion() in base/win_util.h.
+// Get the Linux Distro if we can, or return "Unknown".
std::string GetLinuxDistro();
// Set the Linux Distro string.
diff --git a/base/lock.h b/base/lock.h
index ba34964..7c90d86 100644
--- a/base/lock.h
+++ b/base/lock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,122 +6,13 @@
#define BASE_LOCK_H_
#pragma once
-#include "base/lock_impl.h"
-#include "base/platform_thread.h"
+// This is a temporary forwarding file so not every user of lock needs to
+// be updated at once.
+// TODO(brettw) remove this and fix everybody up to using the new location.
+#include "base/synchronization/lock.h"
-// A convenient wrapper for an OS specific critical section. The only real
-// intelligence in this class is in debug mode for the support for the
-// AssertAcquired() method.
-
-class Lock {
- public:
-#if defined(NDEBUG) // Optimized wrapper implementation
- Lock() : lock_() {}
- ~Lock() {}
- void Acquire() { lock_.Lock(); }
- void Release() { lock_.Unlock(); }
-
- // If the lock is not held, take it and return true. If the lock is already
- // held by another thread, immediately return false. This must not be called
- // by a thread already holding the lock (what happens is undefined and an
- // assertion may fail).
- bool Try() { return lock_.Try(); }
-
- // Null implementation if not debug.
- void AssertAcquired() const {}
-#else
- Lock();
- ~Lock() {}
-
- // NOTE: Although windows critical sections support recursive locks, we do not
- // allow this, and we will commonly fire a DCHECK() if a thread attempts to
- // acquire the lock a second time (while already holding it).
- void Acquire() {
- lock_.Lock();
- CheckUnheldAndMark();
- }
- void Release() {
- CheckHeldAndUnmark();
- lock_.Unlock();
- }
-
- bool Try() {
- bool rv = lock_.Try();
- if (rv) {
- CheckUnheldAndMark();
- }
- return rv;
- }
-
- void AssertAcquired() const;
-#endif // NDEBUG
-
-#if defined(OS_POSIX)
- // The posix implementation of ConditionVariable needs to be able
- // to see our lock and tweak our debugging counters, as it releases
- // and acquires locks inside of pthread_cond_{timed,}wait.
- // Windows doesn't need to do this as it calls the Lock::* methods.
- friend class ConditionVariable;
-#endif
-
- private:
-#if !defined(NDEBUG)
- // Members and routines taking care of locks assertions.
- // Note that this checks for recursive locks and allows them
- // if the variable is set. This is allowed by the underlying implementation
- // on windows but not on Posix, so we're doing unneeded checks on Posix.
- // It's worth it to share the code.
- void CheckHeldAndUnmark();
- void CheckUnheldAndMark();
-
- // All private data is implicitly protected by lock_.
- // Be VERY careful to only access members under that lock.
-
- // Determines validity of owning_thread_id_. Needed as we don't have
- // a null owning_thread_id_ value.
- bool owned_by_thread_;
- PlatformThreadId owning_thread_id_;
-#endif // NDEBUG
-
- LockImpl lock_; // Platform specific underlying lock implementation.
-
- DISALLOW_COPY_AND_ASSIGN(Lock);
-};
-
-// A helper class that acquires the given Lock while the AutoLock is in scope.
-class AutoLock {
- public:
- explicit AutoLock(Lock& lock) : lock_(lock) {
- lock_.Acquire();
- }
-
- ~AutoLock() {
- lock_.AssertAcquired();
- lock_.Release();
- }
-
- private:
- Lock& lock_;
- DISALLOW_COPY_AND_ASSIGN(AutoLock);
-};
-
-// AutoUnlock is a helper that will Release() the |lock| argument in the
-// constructor, and re-Acquire() it in the destructor.
-class AutoUnlock {
- public:
- explicit AutoUnlock(Lock& lock) : lock_(lock) {
- // We require our caller to have the lock.
- lock_.AssertAcquired();
- lock_.Release();
- }
-
- ~AutoUnlock() {
- lock_.Acquire();
- }
-
- private:
- Lock& lock_;
- DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
-};
+using base::AutoLock;
+using base::AutoUnlock;
+using base::Lock;
#endif // BASE_LOCK_H_
diff --git a/base/logging.cc b/base/logging.cc
index 26cc0c5..a736590 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -50,8 +50,8 @@
#include "base/debug/debugger.h"
#include "base/debug/stack_trace.h"
#include "base/eintr_wrapper.h"
-#include "base/lock_impl.h"
#include "base/string_piece.h"
+#include "base/synchronization/lock_impl.h"
#include "base/utf_string_conversions.h"
#include "base/vlog.h"
#if defined(OS_POSIX)
@@ -243,7 +243,7 @@
}
#endif
} else {
- log_lock = new LockImpl();
+ log_lock = new base::internal::LockImpl();
}
initialized = true;
}
@@ -282,7 +282,7 @@
// The lock is used if log file locking is false. It helps us avoid problems
// with multiple threads writing to the log file at the same time. Use
// LockImpl directly instead of using Lock, because Lock makes logging calls.
- static LockImpl* log_lock;
+ static base::internal::LockImpl* log_lock;
// When we don't use a lock, we are using a global mutex. We need to do this
// because LockFileEx is not thread safe.
@@ -299,7 +299,7 @@
// static
bool LoggingLock::initialized = false;
// static
-LockImpl* LoggingLock::log_lock = NULL;
+base::internal::LockImpl* LoggingLock::log_lock = NULL;
// static
LogLockingState LoggingLock::lock_log_file = LOCK_LOG_FILE;
diff --git a/base/logging.h b/base/logging.h
index 6689eec..a097568 100644
--- a/base/logging.h
+++ b/base/logging.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -803,11 +803,11 @@
LogSeverity severity,
SystemErrorCode err);
- std::ostream& stream() { return log_message_.stream(); }
-
// Appends the error message before destructing the encapsulated class.
~Win32ErrorLogMessage();
+ std::ostream& stream() { return log_message_.stream(); }
+
private:
SystemErrorCode err_;
// Optional name of the module defining the error.
@@ -825,11 +825,11 @@
LogSeverity severity,
SystemErrorCode err);
- std::ostream& stream() { return log_message_.stream(); }
-
// Appends the error message before destructing the encapsulated class.
~ErrnoLogMessage();
+ std::ostream& stream() { return log_message_.stream(); }
+
private:
SystemErrorCode err_;
LogMessage log_message_;
diff --git a/base/mac_util.h b/base/mac/mac_util.h
similarity index 98%
rename from base/mac_util.h
rename to base/mac/mac_util.h
index 076865d..7e5dddb 100644
--- a/base/mac_util.h
+++ b/base/mac/mac_util.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_MAC_UTIL_H_
-#define BASE_MAC_UTIL_H_
+#ifndef BASE_MAC_MAC_UTIL_H_
+#define BASE_MAC_MAC_UTIL_H_
#pragma once
#include <Carbon/Carbon.h>
@@ -34,7 +34,8 @@
typedef unsigned int NSSearchPathDomainMask;
#endif
-namespace mac_util {
+namespace base {
+namespace mac {
// Full screen modes, in increasing order of priority. More permissive modes
// take predecence.
@@ -242,6 +243,7 @@
#endif // __OBJC__
-} // namespace mac_util
+} // namespace mac
+} // namespace base
-#endif // BASE_MAC_UTIL_H_
+#endif // BASE_MAC_MAC_UTIL_H_
diff --git a/base/mac_util.mm b/base/mac/mac_util.mm
similarity index 96%
rename from base/mac_util.mm
rename to base/mac/mac_util.mm
index 598f69b..21213ba 100644
--- a/base/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import <Cocoa/Cocoa.h>
@@ -13,13 +13,14 @@
#include "base/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
-using base::mac::ScopedCFTypeRef;
+namespace base {
+namespace mac {
namespace {
// a count of currently outstanding requests for full screen mode from browser
// windows, plugins, etc.
-int g_full_screen_requests[mac_util::kNumFullScreenModes] = { 0, 0, 0};
+int g_full_screen_requests[kNumFullScreenModes] = { 0, 0, 0};
// Sets the appropriate SystemUIMode based on the current full screen requests.
// Since only one SystemUIMode can be active at a given time, full screen
@@ -39,12 +40,12 @@
// HideDock.
SystemUIMode desired_mode = kUIModeNormal;
SystemUIOptions desired_options = 0;
- if (g_full_screen_requests[mac_util::kFullScreenModeAutoHideAll] > 0) {
+ if (g_full_screen_requests[kFullScreenModeAutoHideAll] > 0) {
desired_mode = kUIModeAllHidden;
desired_options = kUIOptionAutoShowMenuBar;
- } else if (g_full_screen_requests[mac_util::kFullScreenModeHideDock] > 0) {
+ } else if (g_full_screen_requests[kFullScreenModeHideDock] > 0) {
desired_mode = kUIModeContentHidden;
- } else if (g_full_screen_requests[mac_util::kFullScreenModeHideAll] > 0) {
+ } else if (g_full_screen_requests[kFullScreenModeHideAll] > 0) {
desired_mode = kUIModeAllHidden;
}
@@ -56,16 +57,16 @@
ProcessSerialNumber psn = { 0, kCurrentProcess };
scoped_nsobject<NSDictionary> process_info(
- mac_util::CFToNSCast(ProcessInformationCopyDictionary(&psn,
- kProcessDictionaryIncludeAllInformationMask)));
+ CFToNSCast(ProcessInformationCopyDictionary(&psn,
+ kProcessDictionaryIncludeAllInformationMask)));
long long temp = [[process_info objectForKey:@"ParentPSN"] longLongValue];
ProcessSerialNumber parent_psn =
{ (temp >> 32) & 0x00000000FFFFFFFFLL, temp & 0x00000000FFFFFFFFLL };
scoped_nsobject<NSDictionary> parent_info(
- mac_util::CFToNSCast(ProcessInformationCopyDictionary(&parent_psn,
- kProcessDictionaryIncludeAllInformationMask)));
+ CFToNSCast(ProcessInformationCopyDictionary(&parent_psn,
+ kProcessDictionaryIncludeAllInformationMask)));
// Check that creator process code is that of loginwindow.
BOOL result =
@@ -87,7 +88,7 @@
}
scoped_nsobject<NSArray> login_items_array(
- mac_util::CFToNSCast(LSSharedFileListCopySnapshot(login_items, NULL)));
+ CFToNSCast(LSSharedFileListCopySnapshot(login_items, NULL)));
NSURL* url = [NSURL fileURLWithPath:[[NSBundle mainBundle] bundlePath]];
@@ -125,9 +126,7 @@
return hidden && hidden == kCFBooleanTrue;
}
-} // end namespace
-
-namespace mac_util {
+} // namespace
std::string PathFromFSRef(const FSRef& ref) {
ScopedCFTypeRef<CFURLRef> url(
@@ -713,4 +712,5 @@
[nsobj release];
}
-} // namespace mac_util
+} // namespace mac
+} // namespace base
diff --git a/base/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm
similarity index 95%
rename from base/mac_util_unittest.mm
rename to base/mac/mac_util_unittest.mm
index 63ea9b2..47ecebf 100644
--- a/base/mac_util_unittest.mm
+++ b/base/mac/mac_util_unittest.mm
@@ -5,7 +5,7 @@
#import <Cocoa/Cocoa.h>
#include <vector>
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/file_path.h"
#include "base/file_util.h"
@@ -16,7 +16,8 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-namespace mac_util {
+namespace base {
+namespace mac {
namespace {
@@ -151,7 +152,7 @@
}
TEST_F(MacUtilTest, TestGetValueFromDictionary) {
- base::mac::ScopedCFTypeRef<CFMutableDictionaryRef> dict(
+ ScopedCFTypeRef<CFMutableDictionaryRef> dict(
CFDictionaryCreateMutable(0, 0,
&kCFTypeDictionaryKeyCallBacks,
&kCFTypeDictionaryValueCallBacks));
@@ -175,8 +176,7 @@
NSRectFill(rect);
[nsImage unlockFocus];
- base::mac::ScopedCFTypeRef<CGImageRef> cgImage(
- mac_util::CopyNSImageToCGImage(nsImage.get()));
+ ScopedCFTypeRef<CGImageRef> cgImage(CopyNSImageToCGImage(nsImage.get()));
EXPECT_TRUE(cgImage.get());
}
@@ -184,13 +184,14 @@
scoped_nsobject<NSArray> array([[NSArray alloc] initWithObjects:@"foo", nil]);
EXPECT_EQ(1U, [array retainCount]);
- mac_util::NSObjectRetain(array);
+ NSObjectRetain(array);
EXPECT_EQ(2U, [array retainCount]);
- mac_util::NSObjectRelease(array);
+ NSObjectRelease(array);
EXPECT_EQ(1U, [array retainCount]);
}
} // namespace
-} // namespace mac_util
+} // namespace mac
+} // namespace base
diff --git a/base/debug_util_mac.cc b/base/mac/os_crash_dumps.cc
similarity index 74%
rename from base/debug_util_mac.cc
rename to base/mac/os_crash_dumps.cc
index a4eed66..e82fd73 100644
--- a/base/debug_util_mac.cc
+++ b/base/mac/os_crash_dumps.cc
@@ -1,23 +1,29 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/debug_util.h"
+#include "base/mac/os_crash_dumps.h"
#include <signal.h>
#include <unistd.h>
#include "base/basictypes.h"
-static void ExitSignalHandler(int sig) {
+namespace base {
+namespace mac {
+
+namespace {
+
+void ExitSignalHandler(int sig) {
// A call to exit() can call atexit() handlers. If we SIGSEGV due
// to a corrupt heap, and if we have an atexit handler that
// allocates or frees memory, we are in trouble if we do not _exit.
_exit(128 + sig);
}
-// static
-void DebugUtil::DisableOSCrashDumps() {
+} // namespace
+
+void DisableOSCrashDumps() {
// These are the POSIX signals corresponding to the Mach exceptions that
// Apple Crash Reporter handles. See ux_exception() in xnu's
// bsd/uxkern/ux_exception.c and machine_exception() in xnu's
@@ -31,7 +37,9 @@
};
// For all these signals, just wire things up so we exit immediately.
- for (size_t i = 0; i < arraysize(signals_to_intercept); ++i) {
+ for (size_t i = 0; i < arraysize(signals_to_intercept); ++i)
signal(signals_to_intercept[i], ExitSignalHandler);
- }
}
+
+} // namespace mac
+} // namespace base
diff --git a/base/mac/os_crash_dumps.h b/base/mac/os_crash_dumps.h
new file mode 100644
index 0000000..9758575
--- /dev/null
+++ b/base/mac/os_crash_dumps.h
@@ -0,0 +1,20 @@
+// 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.
+
+#ifndef BASE_MAC_OS_CRASH_DUMPS_H_
+#define BASE_MAC_OS_CRASH_DUMPS_H_
+
+namespace base {
+namespace mac {
+
+// On Mac OS X, it can take a really long time for the OS crash handler to
+// process a Chrome crash when debugging symbols are available. This
+// translates into a long wait until the process actually dies. This call
+// disables Apple Crash Reporter entirely.
+void DisableOSCrashDumps();
+
+} // namespace mac
+} // namespace base
+
+#endif // BASE_MAC_OS_CRASH_DUMPS_H_
diff --git a/base/message_loop.cc b/base/message_loop.cc
index d3766b1..7e35d9f 100644
--- a/base/message_loop.cc
+++ b/base/message_loop.cc
@@ -11,7 +11,8 @@
#include "base/logging.h"
#include "base/message_pump_default.h"
#include "base/metrics/histogram.h"
-#include "base/thread_local.h"
+#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
+#include "base/threading/thread_local.h"
#if defined(OS_MACOSX)
#include "base/message_pump_mac.h"
@@ -112,14 +113,6 @@
//------------------------------------------------------------------------------
-// static
-MessageLoop* MessageLoop::current() {
- // TODO(darin): sadly, we cannot enable this yet since people call us even
- // when they have no intention of using us.
- // DCHECK(loop) << "Ouch, did you forget to initialize me?";
- return lazy_tls_ptr.Pointer()->Get();
-}
-
MessageLoop::MessageLoop(Type type)
: type_(type),
nestable_tasks_allowed_(true),
@@ -194,6 +187,19 @@
lazy_tls_ptr.Pointer()->Set(NULL);
}
+// static
+MessageLoop* MessageLoop::current() {
+ // TODO(darin): sadly, we cannot enable this yet since people call us even
+ // when they have no intention of using us.
+ // DCHECK(loop) << "Ouch, did you forget to initialize me?";
+ return lazy_tls_ptr.Pointer()->Get();
+}
+
+// static
+void MessageLoop::EnableHistogrammer(bool enable) {
+ enable_histogrammer_ = enable;
+}
+
void MessageLoop::AddDestructionObserver(
DestructionObserver* destruction_observer) {
DCHECK_EQ(this, current());
@@ -206,110 +212,6 @@
destruction_observers_.RemoveObserver(destruction_observer);
}
-void MessageLoop::AddTaskObserver(TaskObserver* task_observer) {
- DCHECK_EQ(this, current());
- task_observers_.AddObserver(task_observer);
-}
-
-void MessageLoop::RemoveTaskObserver(TaskObserver* task_observer) {
- DCHECK_EQ(this, current());
- task_observers_.RemoveObserver(task_observer);
-}
-
-void MessageLoop::Run() {
- AutoRunState save_state(this);
- RunHandler();
-}
-
-void MessageLoop::RunAllPending() {
- AutoRunState save_state(this);
- state_->quit_received = true; // Means run until we would otherwise block.
- RunHandler();
-}
-
-// Runs the loop in two different SEH modes:
-// enable_SEH_restoration_ = false : any unhandled exception goes to the last
-// one that calls SetUnhandledExceptionFilter().
-// enable_SEH_restoration_ = true : any unhandled exception goes to the filter
-// that was existed before the loop was run.
-void MessageLoop::RunHandler() {
-#if defined(OS_WIN)
- if (exception_restoration_) {
- RunInternalInSEHFrame();
- return;
- }
-#endif
-
- RunInternal();
-}
-//------------------------------------------------------------------------------
-#if defined(OS_WIN)
-__declspec(noinline) void MessageLoop::RunInternalInSEHFrame() {
- LPTOP_LEVEL_EXCEPTION_FILTER current_filter = GetTopSEHFilter();
- __try {
- RunInternal();
- } __except(SEHFilter(current_filter)) {
- }
- return;
-}
-#endif
-//------------------------------------------------------------------------------
-
-void MessageLoop::RunInternal() {
- DCHECK_EQ(this, current());
-
-#ifndef ANDROID
- StartHistogrammer();
-#endif
-
-#if !defined(OS_MACOSX)
- if (state_->dispatcher && type() == TYPE_UI) {
- static_cast<base::MessagePumpForUI*>(pump_.get())->
- RunWithDispatcher(this, state_->dispatcher);
- return;
- }
-#endif
-
- pump_->Run(this);
-}
-
-//------------------------------------------------------------------------------
-// Wrapper functions for use in above message loop framework.
-
-bool MessageLoop::ProcessNextDelayedNonNestableTask() {
- if (state_->run_depth != 1)
- return false;
-
- if (deferred_non_nestable_work_queue_.empty())
- return false;
-
- Task* task = deferred_non_nestable_work_queue_.front().task;
- deferred_non_nestable_work_queue_.pop();
-
- RunTask(task);
- return true;
-}
-
-//------------------------------------------------------------------------------
-
-void MessageLoop::Quit() {
- DCHECK_EQ(this, current());
- if (state_) {
- state_->quit_received = true;
- } else {
- NOTREACHED() << "Must be inside Run to call Quit";
- }
-}
-
-void MessageLoop::QuitNow() {
- DCHECK_EQ(this, current());
- if (state_) {
- pump_->Quit();
- } else {
- NOTREACHED() << "Must be inside Run to call Quit";
- }
-}
-
void MessageLoop::PostTask(
const tracked_objects::Location& from_here, Task* task) {
PostTask_Helper(from_here, task, 0, true);
@@ -330,68 +232,33 @@
PostTask_Helper(from_here, task, delay_ms, false);
}
-// Possibly called on a background thread!
-void MessageLoop::PostTask_Helper(
- const tracked_objects::Location& from_here, Task* task, int64 delay_ms,
- bool nestable) {
- task->SetBirthPlace(from_here);
+void MessageLoop::Run() {
+ AutoRunState save_state(this);
+ RunHandler();
+}
- PendingTask pending_task(task, nestable);
+void MessageLoop::RunAllPending() {
+ AutoRunState save_state(this);
+ state_->quit_received = true; // Means run until we would otherwise block.
+ RunHandler();
+}
- if (delay_ms > 0) {
- pending_task.delayed_run_time =
- TimeTicks::Now() + TimeDelta::FromMilliseconds(delay_ms);
-
-#if defined(OS_WIN)
- if (high_resolution_timer_expiration_.is_null()) {
- // Windows timers are granular to 15.6ms. If we only set high-res
- // timers for those under 15.6ms, then a 18ms timer ticks at ~32ms,
- // which as a percentage is pretty inaccurate. So enable high
- // res timers for any timer which is within 2x of the granularity.
- // This is a tradeoff between accuracy and power management.
- bool needs_high_res_timers =
- delay_ms < (2 * base::Time::kMinLowResolutionThresholdMs);
- if (needs_high_res_timers) {
- base::Time::ActivateHighResolutionTimer(true);
- high_resolution_timer_expiration_ = TimeTicks::Now() +
- TimeDelta::FromMilliseconds(kHighResolutionTimerModeLeaseTimeMs);
- }
- }
-#endif
+void MessageLoop::Quit() {
+ DCHECK_EQ(this, current());
+ if (state_) {
+ state_->quit_received = true;
} else {
- DCHECK_EQ(delay_ms, 0) << "delay should not be negative";
+ NOTREACHED() << "Must be inside Run to call Quit";
}
+}
-#if defined(OS_WIN)
- if (!high_resolution_timer_expiration_.is_null()) {
- if (TimeTicks::Now() > high_resolution_timer_expiration_) {
- base::Time::ActivateHighResolutionTimer(false);
- high_resolution_timer_expiration_ = TimeTicks();
- }
+void MessageLoop::QuitNow() {
+ DCHECK_EQ(this, current());
+ if (state_) {
+ pump_->Quit();
+ } else {
+ NOTREACHED() << "Must be inside Run to call Quit";
}
-#endif
-
- // Warning: Don't try to short-circuit, and handle this thread's tasks more
- // directly, as it could starve handling of foreign threads. Put every task
- // into this queue.
-
- scoped_refptr<base::MessagePump> pump;
- {
- AutoLock locked(incoming_queue_lock_);
-
- bool was_empty = incoming_queue_.empty();
- incoming_queue_.push(pending_task);
- if (!was_empty)
- return; // Someone else should have started the sub-pump.
-
- pump = pump_;
- }
- // Since the incoming_queue_ may contain a task that destroys this message
- // loop, we cannot exit incoming_queue_lock_ until we are done with |this|.
- // We use a stack-based reference to the message pump so that we can call
- // ScheduleWork outside of incoming_queue_lock_.
-
- pump->ScheduleWork();
}
void MessageLoop::SetNestableTasksAllowed(bool allowed) {
@@ -412,8 +279,77 @@
return state_->run_depth > 1;
}
+void MessageLoop::AddTaskObserver(TaskObserver* task_observer) {
+ DCHECK_EQ(this, current());
+ task_observers_.AddObserver(task_observer);
+}
+
+void MessageLoop::RemoveTaskObserver(TaskObserver* task_observer) {
+ DCHECK_EQ(this, current());
+ task_observers_.RemoveObserver(task_observer);
+}
+
//------------------------------------------------------------------------------
+// Runs the loop in two different SEH modes:
+// enable_SEH_restoration_ = false : any unhandled exception goes to the last
+// one that calls SetUnhandledExceptionFilter().
+// enable_SEH_restoration_ = true : any unhandled exception goes to the filter
+// that was existed before the loop was run.
+void MessageLoop::RunHandler() {
+#if defined(OS_WIN)
+ if (exception_restoration_) {
+ RunInternalInSEHFrame();
+ return;
+ }
+#endif
+
+ RunInternal();
+}
+
+#if defined(OS_WIN)
+__declspec(noinline) void MessageLoop::RunInternalInSEHFrame() {
+ LPTOP_LEVEL_EXCEPTION_FILTER current_filter = GetTopSEHFilter();
+ __try {
+ RunInternal();
+ } __except(SEHFilter(current_filter)) {
+ }
+ return;
+}
+#endif
+
+void MessageLoop::RunInternal() {
+ DCHECK_EQ(this, current());
+
+#ifndef ANDROID
+ StartHistogrammer();
+#endif
+
+#if !defined(OS_MACOSX)
+ if (state_->dispatcher && type() == TYPE_UI) {
+ static_cast<base::MessagePumpForUI*>(pump_.get())->
+ RunWithDispatcher(this, state_->dispatcher);
+ return;
+ }
+#endif
+
+ pump_->Run(this);
+}
+
+bool MessageLoop::ProcessNextDelayedNonNestableTask() {
+ if (state_->run_depth != 1)
+ return false;
+
+ if (deferred_non_nestable_work_queue_.empty())
+ return false;
+
+ Task* task = deferred_non_nestable_work_queue_.front().task;
+ deferred_non_nestable_work_queue_.pop();
+
+ RunTask(task);
+ return true;
+}
+
void MessageLoop::RunTask(Task* task) {
DCHECK(nestable_tasks_allowed_);
// Execute the task and assume the worst: It is probably not reentrant.
@@ -487,8 +423,8 @@
// Valgrind.
#if defined(PURIFY) || defined(USE_HEAPCHECKER)
delete pending_task.task;
-#elif defined(OS_POSIX)
- if (RUNNING_ON_VALGRIND)
+#else
+ if (RunningOnValgrind())
delete pending_task.task;
#endif // defined(OS_POSIX)
}
@@ -500,8 +436,8 @@
Task* task = NULL;
#if defined(PURIFY) || defined(USE_HEAPCHECKER)
task = deferred_non_nestable_work_queue_.front().task;
-#elif defined(OS_POSIX)
- if (RUNNING_ON_VALGRIND)
+#else
+ if (RunningOnValgrind())
task = deferred_non_nestable_work_queue_.front().task;
#endif
deferred_non_nestable_work_queue_.pop();
@@ -517,6 +453,92 @@
return did_work;
}
+// Possibly called on a background thread!
+void MessageLoop::PostTask_Helper(
+ const tracked_objects::Location& from_here, Task* task, int64 delay_ms,
+ bool nestable) {
+ task->SetBirthPlace(from_here);
+
+ PendingTask pending_task(task, nestable);
+
+ if (delay_ms > 0) {
+ pending_task.delayed_run_time =
+ TimeTicks::Now() + TimeDelta::FromMilliseconds(delay_ms);
+
+#if defined(OS_WIN)
+ if (high_resolution_timer_expiration_.is_null()) {
+ // Windows timers are granular to 15.6ms. If we only set high-res
+ // timers for those under 15.6ms, then a 18ms timer ticks at ~32ms,
+ // which as a percentage is pretty inaccurate. So enable high
+ // res timers for any timer which is within 2x of the granularity.
+ // This is a tradeoff between accuracy and power management.
+ bool needs_high_res_timers =
+ delay_ms < (2 * base::Time::kMinLowResolutionThresholdMs);
+ if (needs_high_res_timers) {
+ base::Time::ActivateHighResolutionTimer(true);
+ high_resolution_timer_expiration_ = TimeTicks::Now() +
+ TimeDelta::FromMilliseconds(kHighResolutionTimerModeLeaseTimeMs);
+ }
+ }
+#endif
+ } else {
+ DCHECK_EQ(delay_ms, 0) << "delay should not be negative";
+ }
+
+#if defined(OS_WIN)
+ if (!high_resolution_timer_expiration_.is_null()) {
+ if (TimeTicks::Now() > high_resolution_timer_expiration_) {
+ base::Time::ActivateHighResolutionTimer(false);
+ high_resolution_timer_expiration_ = TimeTicks();
+ }
+ }
+#endif
+
+ // Warning: Don't try to short-circuit, and handle this thread's tasks more
+ // directly, as it could starve handling of foreign threads. Put every task
+ // into this queue.
+
+ scoped_refptr<base::MessagePump> pump;
+ {
+ AutoLock locked(incoming_queue_lock_);
+
+ bool was_empty = incoming_queue_.empty();
+ incoming_queue_.push(pending_task);
+ if (!was_empty)
+ return; // Someone else should have started the sub-pump.
+
+ pump = pump_;
+ }
+ // Since the incoming_queue_ may contain a task that destroys this message
+ // loop, we cannot exit incoming_queue_lock_ until we are done with |this|.
+ // We use a stack-based reference to the message pump so that we can call
+ // ScheduleWork outside of incoming_queue_lock_.
+
+ pump->ScheduleWork();
+}
+
+//------------------------------------------------------------------------------
+// Method and data for histogramming events and actions taken by each instance
+// on each thread.
+
+void MessageLoop::StartHistogrammer() {
+ if (enable_histogrammer_ && !message_histogram_.get()
+ && base::StatisticsRecorder::IsActive()) {
+ DCHECK(!thread_name_.empty());
+ message_histogram_ = base::LinearHistogram::FactoryGet(
+ "MsgLoop:" + thread_name_,
+ kLeastNonZeroMessageId, kMaxMessageId,
+ kNumberOfDistinctMessagesDisplayed,
+ message_histogram_->kHexRangePrintingFlag);
+ message_histogram_->SetRangeDescriptions(event_descriptions_);
+ }
+}
+
+void MessageLoop::HistogramEvent(int event) {
+ if (message_histogram_.get())
+ message_histogram_->Add(event);
+}
+
bool MessageLoop::DoWork() {
if (!nestable_tasks_allowed_) {
// Task can't be executed right now.
@@ -633,33 +655,6 @@
}
//------------------------------------------------------------------------------
-// Method and data for histogramming events and actions taken by each instance
-// on each thread.
-
-// static
-void MessageLoop::EnableHistogrammer(bool enable) {
- enable_histogrammer_ = enable;
-}
-
-void MessageLoop::StartHistogrammer() {
- if (enable_histogrammer_ && !message_histogram_.get()
- && base::StatisticsRecorder::IsActive()) {
- DCHECK(!thread_name_.empty());
- message_histogram_ = base::LinearHistogram::FactoryGet(
- "MsgLoop:" + thread_name_,
- kLeastNonZeroMessageId, kMaxMessageId,
- kNumberOfDistinctMessagesDisplayed,
- message_histogram_->kHexRangePrintingFlag);
- message_histogram_->SetRangeDescriptions(event_descriptions_);
- }
-}
-
-void MessageLoop::HistogramEvent(int event) {
- if (message_histogram_.get())
- message_histogram_->Add(event);
-}
-
-//------------------------------------------------------------------------------
// MessageLoopForUI
#if defined(OS_WIN)
diff --git a/base/message_loop.h b/base/message_loop.h
index a5a94bc..d5093a9 100644
--- a/base/message_loop.h
+++ b/base/message_loop.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -66,24 +66,46 @@
//
class MessageLoop : public base::MessagePump::Delegate {
public:
- // A TaskObserver is an object that receives task notifications from the
- // MessageLoop.
+#if defined(OS_WIN)
+ typedef base::MessagePumpWin::Dispatcher Dispatcher;
+ typedef base::MessagePumpForUI::Observer Observer;
+#elif !defined(OS_MACOSX)
+#if defined(TOUCH_UI)
+ typedef base::MessagePumpGlibXDispatcher Dispatcher;
+#else
+ typedef base::MessagePumpForUI::Dispatcher Dispatcher;
+#endif
+ typedef base::MessagePumpForUI::Observer Observer;
+#endif
+
+ // A MessageLoop has a particular type, which indicates the set of
+ // asynchronous events it may process in addition to tasks and timers.
//
- // NOTE: A TaskObserver implementation should be extremely fast!
- class TaskObserver {
- public:
- TaskObserver();
-
- // This method is called before processing a task.
- virtual void WillProcessTask(const Task* task) = 0;
-
- // This method is called after processing a task.
- virtual void DidProcessTask(const Task* task) = 0;
-
- protected:
- virtual ~TaskObserver();
+ // TYPE_DEFAULT
+ // This type of ML only supports tasks and timers.
+ //
+ // TYPE_UI
+ // This type of ML also supports native UI events (e.g., Windows messages).
+ // See also MessageLoopForUI.
+ //
+ // TYPE_IO
+ // This type of ML also supports asynchronous IO. See also
+ // MessageLoopForIO.
+ //
+ enum Type {
+ TYPE_DEFAULT,
+ TYPE_UI,
+ TYPE_IO
};
+ // Normally, it is not necessary to instantiate a MessageLoop. Instead, it
+ // is typical to make use of the current thread's MessageLoop instance.
+ explicit MessageLoop(Type type = TYPE_DEFAULT);
+ ~MessageLoop();
+
+ // Returns the MessageLoop object for the current thread, or null if none.
+ static MessageLoop* current();
+
static void EnableHistogrammer(bool enable_histogrammer);
// A DestructionObserver is notified when the current MessageLoop is being
@@ -200,31 +222,6 @@
}
};
- // A MessageLoop has a particular type, which indicates the set of
- // asynchronous events it may process in addition to tasks and timers.
- //
- // TYPE_DEFAULT
- // This type of ML only supports tasks and timers.
- //
- // TYPE_UI
- // This type of ML also supports native UI events (e.g., Windows messages).
- // See also MessageLoopForUI.
- //
- // TYPE_IO
- // This type of ML also supports asynchronous IO. See also
- // MessageLoopForIO.
- //
- enum Type {
- TYPE_DEFAULT,
- TYPE_UI,
- TYPE_IO
- };
-
- // Normally, it is not necessary to instantiate a MessageLoop. Instead, it
- // is typical to make use of the current thread's MessageLoop instance.
- explicit MessageLoop(Type type = TYPE_DEFAULT);
- ~MessageLoop();
-
// Returns the type passed to the constructor.
Type type() const { return type_; }
@@ -235,9 +232,6 @@
}
const std::string& thread_name() const { return thread_name_; }
- // Returns the MessageLoop object for the current thread, or null if none.
- static MessageLoop* current();
-
// Enables or disables the recursive task processing. This happens in the case
// of recursive message loops. Some unwanted message loop may occurs when
// using common controls or printer functions. By default, recursive task
@@ -284,23 +278,29 @@
// Returns true if we are currently running a nested message loop.
bool IsNested();
+ // A TaskObserver is an object that receives task notifications from the
+ // MessageLoop.
+ //
+ // NOTE: A TaskObserver implementation should be extremely fast!
+ class TaskObserver {
+ public:
+ TaskObserver();
+
+ // This method is called before processing a task.
+ virtual void WillProcessTask(const Task* task) = 0;
+
+ // This method is called after processing a task.
+ virtual void DidProcessTask(const Task* task) = 0;
+
+ protected:
+ virtual ~TaskObserver();
+ };
+
// These functions can only be called on the same thread that |this| is
// running on.
void AddTaskObserver(TaskObserver* task_observer);
void RemoveTaskObserver(TaskObserver* task_observer);
-#if defined(OS_WIN)
- typedef base::MessagePumpWin::Dispatcher Dispatcher;
- typedef base::MessagePumpForUI::Observer Observer;
-#elif !defined(OS_MACOSX)
-#if defined(TOUCH_UI)
- typedef base::MessagePumpGlibXDispatcher Dispatcher;
-#else
- typedef base::MessagePumpForUI::Dispatcher Dispatcher;
-#endif
- typedef base::MessagePumpForUI::Observer Observer;
-#endif
-
// Returns true if the message loop has high resolution timers enabled.
// Provided for testing.
bool high_resolution_timers_enabled() {
@@ -341,17 +341,17 @@
// This structure is copied around by value.
struct PendingTask {
- Task* task; // The task to run.
- base::TimeTicks delayed_run_time; // The time when the task should be run.
- int sequence_num; // Secondary sort key for run time.
- bool nestable; // OK to dispatch from a nested loop.
-
PendingTask(Task* task, bool nestable)
: task(task), sequence_num(0), nestable(nestable) {
}
// Used to support sorting.
bool operator<(const PendingTask& other) const;
+
+ Task* task; // The task to run.
+ base::TimeTicks delayed_run_time; // The time when the task should be run.
+ int sequence_num; // Secondary sort key for run time.
+ bool nestable; // OK to dispatch from a nested loop.
};
class TaskQueue : public std::queue<PendingTask> {
@@ -391,18 +391,6 @@
// Called to process any delayed non-nestable tasks.
bool ProcessNextDelayedNonNestableTask();
- //----------------------------------------------------------------------------
- // Run a work_queue_ task or new_task, and delete it (if it was processed by
- // PostTask). If there are queued tasks, the oldest one is executed and
- // new_task is queued. new_task is optional and can be NULL. In this NULL
- // case, the method will run one pending task (if any exist). Returns true if
- // it executes a task. Queued tasks accumulate only when there is a
- // non-nestable task currently processing, in which case the new_task is
- // appended to the list work_queue_. Such re-entrancy generally happens when
- // an unrequested message pump (typical of a native dialog) is executing in
- // the context of a task.
- bool QueueOrRunTask(Task* new_task);
-
// Runs the specified task and deletes it.
void RunTask(Task* task);
@@ -427,11 +415,6 @@
void PostTask_Helper(const tracked_objects::Location& from_here, Task* task,
int64 delay_ms, bool nestable);
- // base::MessagePump::Delegate methods:
- virtual bool DoWork();
- virtual bool DoDelayedWork(base::TimeTicks* next_delayed_work_time);
- virtual bool DoIdleWork();
-
// Start recording histogram info about events and action IF it was enabled
// and IF the statistics recorder can accept a registration of our histogram.
void StartHistogrammer();
@@ -441,6 +424,11 @@
// If message_histogram_ is NULL, this is a no-op.
void HistogramEvent(int event);
+ // base::MessagePump::Delegate methods:
+ virtual bool DoWork();
+ virtual bool DoDelayedWork(base::TimeTicks* next_delayed_work_time);
+ virtual bool DoIdleWork();
+
Type type_;
// A list of tasks that need to be processed by this instance. Note that
diff --git a/base/message_loop_proxy_impl.cc b/base/message_loop_proxy_impl.cc
index c0619aa..3b01fd6 100644
--- a/base/message_loop_proxy_impl.cc
+++ b/base/message_loop_proxy_impl.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/message_loop_proxy_impl.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
namespace base {
diff --git a/base/message_loop_proxy_impl_unittest.cc b/base/message_loop_proxy_impl_unittest.cc
index 8d8ef4e..61c7850 100644
--- a/base/message_loop_proxy_impl_unittest.cc
+++ b/base/message_loop_proxy_impl_unittest.cc
@@ -5,7 +5,7 @@
#include "base/message_loop.h"
#include "base/message_loop_proxy_impl.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc
index a196519..c471e38 100644
--- a/base/message_loop_unittest.cc
+++ b/base/message_loop_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,20 +7,21 @@
#include "base/eintr_wrapper.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_WIN)
#include "base/message_pump_win.h"
-#include "base/scoped_handle.h"
+#include "base/win/scoped_handle.h"
#endif
#if defined(OS_POSIX)
#include "base/message_pump_libevent.h"
#endif
+using base::PlatformThread;
using base::Thread;
using base::Time;
using base::TimeDelta;
@@ -936,7 +937,7 @@
options.message_loop_type = message_loop_type;
ASSERT_EQ(true, worker.StartWithOptions(options));
TaskList order;
- ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
+ base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
worker.message_loop()->PostTask(FROM_HERE,
new Recursive2Tasks(MessageLoop::current(),
event,
@@ -979,7 +980,7 @@
options.message_loop_type = message_loop_type;
ASSERT_EQ(true, worker.StartWithOptions(options));
TaskList order;
- ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
+ base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL));
worker.message_loop()->PostTask(FROM_HERE,
new Recursive2Tasks(MessageLoop::current(),
event,
@@ -1186,7 +1187,7 @@
char buffer_[48];
MessageLoopForIO::IOContext context_;
HANDLE signal_;
- ScopedHandle file_;
+ base::win::ScopedHandle file_;
bool wait_;
};
@@ -1234,12 +1235,12 @@
};
void RunTest_IOHandler() {
- ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL));
+ base::win::ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL));
ASSERT_TRUE(callback_called.IsValid());
const wchar_t* kPipeName = L"\\\\.\\pipe\\iohandler_pipe";
- ScopedHandle server(CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1,
- 0, 0, 0, NULL));
+ base::win::ScopedHandle server(
+ CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
ASSERT_TRUE(server.IsValid());
Thread thread("IOHandler test");
@@ -1266,17 +1267,19 @@
}
void RunTest_WaitForIO() {
- ScopedHandle callback1_called(CreateEvent(NULL, TRUE, FALSE, NULL));
- ScopedHandle callback2_called(CreateEvent(NULL, TRUE, FALSE, NULL));
+ base::win::ScopedHandle callback1_called(
+ CreateEvent(NULL, TRUE, FALSE, NULL));
+ base::win::ScopedHandle callback2_called(
+ CreateEvent(NULL, TRUE, FALSE, NULL));
ASSERT_TRUE(callback1_called.IsValid());
ASSERT_TRUE(callback2_called.IsValid());
const wchar_t* kPipeName1 = L"\\\\.\\pipe\\iohandler_pipe1";
const wchar_t* kPipeName2 = L"\\\\.\\pipe\\iohandler_pipe2";
- ScopedHandle server1(CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1,
- 0, 0, 0, NULL));
- ScopedHandle server2(CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1,
- 0, 0, 0, NULL));
+ base::win::ScopedHandle server1(
+ CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
+ base::win::ScopedHandle server2(
+ CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL));
ASSERT_TRUE(server1.IsValid());
ASSERT_TRUE(server2.IsValid());
diff --git a/base/message_pump_default.h b/base/message_pump_default.h
index 3dfbf1c..5030aa9 100644
--- a/base/message_pump_default.h
+++ b/base/message_pump_default.h
@@ -8,7 +8,7 @@
#include "base/message_pump.h"
#include "base/time.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
namespace base {
diff --git a/base/message_pump_glib.cc b/base/message_pump_glib.cc
index fd24285..b9dcc46 100644
--- a/base/message_pump_glib.cc
+++ b/base/message_pump_glib.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,7 +12,7 @@
#include "base/eintr_wrapper.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
namespace {
@@ -177,8 +177,8 @@
#ifndef NDEBUG
// Make sure we only run this on one thread. GTK only has one message pump
// so we can only have one UI loop per process.
- static PlatformThreadId thread_id = PlatformThread::CurrentId();
- DCHECK(thread_id == PlatformThread::CurrentId()) <<
+ static base::PlatformThreadId thread_id = base::PlatformThread::CurrentId();
+ DCHECK(thread_id == base::PlatformThread::CurrentId()) <<
"Running MessagePumpForUI on two different threads; "
"this is unsupported by GLib!";
#endif
diff --git a/base/message_pump_glib.h b/base/message_pump_glib.h
index c118155..70bf108 100644
--- a/base/message_pump_glib.h
+++ b/base/message_pump_glib.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -62,11 +62,6 @@
// is ready for processing.
virtual bool RunOnce(GMainContext* context, bool block);
- virtual void Run(Delegate* delegate);
- virtual void Quit();
- virtual void ScheduleWork();
- virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
-
// Internal methods used for processing the pump callbacks. They are
// public for simplicity but should not be used directly. HandlePrepare
// is called during the prepare step of glib, and returns a timeout that
@@ -88,6 +83,12 @@
// some task before/after calling the default handler (EventDispatcher).
virtual void DispatchEvents(GdkEvent* event);
+ // Overridden from MessagePump:
+ virtual void Run(Delegate* delegate);
+ virtual void Quit();
+ virtual void ScheduleWork();
+ virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
+
protected:
// Returns the dispatcher for the current run state (|state_->dispatcher|).
Dispatcher* GetDispatcher();
diff --git a/base/message_pump_glib_unittest.cc b/base/message_pump_glib_unittest.cc
index 72d2fbf..9c9f288 100644
--- a/base/message_pump_glib_unittest.cc
+++ b/base/message_pump_glib_unittest.cc
@@ -11,9 +11,8 @@
#include <vector>
#include "base/message_loop.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
diff --git a/base/message_pump_glib_x.cc b/base/message_pump_glib_x.cc
index 26c4b87..775e940 100644
--- a/base/message_pump_glib_x.cc
+++ b/base/message_pump_glib_x.cc
@@ -84,6 +84,9 @@
bool MessagePumpGlibX::RunOnce(GMainContext* context, bool block) {
GdkDisplay* gdisp = gdk_display_get_default();
+ if (!gdisp)
+ return MessagePumpForUI::RunOnce(context, block);
+
Display* display = GDK_DISPLAY_XDISPLAY(gdisp);
bool should_quit = false;
@@ -189,6 +192,9 @@
#if defined(HAVE_XINPUT2)
void MessagePumpGlibX::InitializeXInput2(void) {
GdkDisplay* display = gdk_display_get_default();
+ if (!display)
+ return;
+
Display* xdisplay = GDK_DISPLAY_XDISPLAY(display);
int event, err;
diff --git a/base/message_pump_glib_x.h b/base/message_pump_glib_x.h
index fc3f3b1..e94b797 100644
--- a/base/message_pump_glib_x.h
+++ b/base/message_pump_glib_x.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -22,9 +22,6 @@
MessagePumpGlibX();
virtual ~MessagePumpGlibX();
- // MessagePumpForUI implementation.
- virtual bool RunOnce(GMainContext* context, bool block);
-
// Indicates whether a GDK event was injected by chrome (when |true|) or if it
// was captured and being processed by GDK (when |false|).
bool IsDispatchingEvent(void) { return dispatching_event_; }
@@ -34,6 +31,9 @@
void SetupXInput2ForXWindow(Window xid);
#endif
+ // Overridden from MessagePumpForUI:
+ virtual bool RunOnce(GMainContext* context, bool block);
+
private:
static void EventDispatcherX(GdkEvent* event, gpointer data);
diff --git a/base/message_pump_glib_x_dispatch.h b/base/message_pump_glib_x_dispatch.h
index faee5b5..4a97372 100644
--- a/base/message_pump_glib_x_dispatch.h
+++ b/base/message_pump_glib_x_dispatch.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -18,13 +18,12 @@
// GdkEvents. This class provides additional mechanism for dispatching XEvents.
class MessagePumpGlibXDispatcher : public MessagePumpForUI::Dispatcher {
public:
-
- typedef enum {
+ enum DispatchStatus {
EVENT_IGNORED, // The event was not processed.
EVENT_PROCESSED, // The event has been processed.
EVENT_QUIT // The event was processed and the message-loop should
// terminate.
- } DispatchStatus;
+ };
// Dispatches the event. EVENT_IGNORED is returned if the event was ignored
// (i.e. not processed). EVENT_PROCESSED is returned if the event was
diff --git a/base/message_pump_libevent.h b/base/message_pump_libevent.h
index d8d000d..2ade511 100644
--- a/base/message_pump_libevent.h
+++ b/base/message_pump_libevent.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -86,15 +86,15 @@
DISALLOW_COPY_AND_ASSIGN(FileDescriptorWatcher);
};
- MessagePumpLibevent();
- virtual ~MessagePumpLibevent();
-
enum Mode {
WATCH_READ = 1 << 0,
WATCH_WRITE = 1 << 1,
WATCH_READ_WRITE = WATCH_READ | WATCH_WRITE
};
+ MessagePumpLibevent();
+ virtual ~MessagePumpLibevent();
+
// Have the current thread's message loop watch for a a situation in which
// reading/writing to the FD can be performed without blocking.
// Callers must provide a preallocated FileDescriptorWatcher object which
@@ -128,6 +128,14 @@
// Risky part of constructor. Returns true on success.
bool Init();
+ // Called by libevent to tell us a registered FD can be read/written to.
+ static void OnLibeventNotification(int fd, short flags,
+ void* context);
+
+ // Unix pipe used to implement ScheduleWork()
+ // ... callback; called by libevent inside Run() when pipe is ready to read
+ static void OnWakeup(int socket, short flags, void* context);
+
// This flag is set to false when Run should return.
bool keep_running_;
@@ -141,13 +149,6 @@
// readiness callbacks when a socket is ready for I/O.
event_base* event_base_;
- // Called by libevent to tell us a registered FD can be read/written to.
- static void OnLibeventNotification(int fd, short flags,
- void* context);
-
- // Unix pipe used to implement ScheduleWork()
- // ... callback; called by libevent inside Run() when pipe is ready to read
- static void OnWakeup(int socket, short flags, void* context);
// ... write end; ScheduleWork() writes a single byte to it
int wakeup_pipe_in_;
// ... read end; OnWakeup reads it and then breaks Run() out of its sleep
diff --git a/base/message_pump_win.h b/base/message_pump_win.h
index ea7dd39..af97530 100644
--- a/base/message_pump_win.h
+++ b/base/message_pump_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,8 +13,8 @@
#include "base/basictypes.h"
#include "base/message_pump.h"
#include "base/observer_list.h"
-#include "base/scoped_handle.h"
#include "base/time.h"
+#include "base/win/scoped_handle.h"
namespace base {
@@ -356,7 +356,7 @@
void DidProcessIOEvent();
// The completion port associated with this thread.
- ScopedHandle port_;
+ win::ScopedHandle port_;
// This list will be empty almost always. It stores IO completions that have
// not been delivered yet because somebody was doing cleanup.
std::list<IOItem> completed_io_;
diff --git a/base/metrics/field_trial.h b/base/metrics/field_trial.h
index 1f0af9e..8902077 100644
--- a/base/metrics/field_trial.h
+++ b/base/metrics/field_trial.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -217,12 +217,12 @@
static size_t GetFieldTrialCount();
private:
- // Helper function should be called only while holding lock_.
- FieldTrial* PreLockedFind(const std::string& name);
-
// A map from FieldTrial names to the actual instances.
typedef std::map<std::string, FieldTrial*> RegistrationList;
+ // Helper function should be called only while holding lock_.
+ FieldTrial* PreLockedFind(const std::string& name);
+
static FieldTrialList* global_; // The singleton of this class.
// This will tell us if there is an attempt to register a field trial without
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index 75df12e..1526cd8 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -14,10 +14,10 @@
#include <algorithm>
#include <string>
-#include "base/lock.h"
#include "base/logging.h"
#include "base/pickle.h"
#include "base/stringprintf.h"
+#include "base/synchronization/lock.h"
namespace base {
@@ -911,9 +911,9 @@
// during the termination phase. Since it's a static data member, we will
// leak one per process, which would be similar to the instance allocated
// during static initialization and released only on process termination.
- lock_ = new Lock;
+ lock_ = new base::Lock;
}
- AutoLock auto_lock(*lock_);
+ base::AutoLock auto_lock(*lock_);
histograms_ = new HistogramMap;
}
@@ -928,7 +928,7 @@
// Clean up.
HistogramMap* histograms = NULL;
{
- AutoLock auto_lock(*lock_);
+ base::AutoLock auto_lock(*lock_);
histograms = histograms_;
histograms_ = NULL;
}
@@ -941,7 +941,7 @@
bool StatisticsRecorder::IsActive() {
if (lock_ == NULL)
return false;
- AutoLock auto_lock(*lock_);
+ base::AutoLock auto_lock(*lock_);
return NULL != histograms_;
}
@@ -954,7 +954,7 @@
void StatisticsRecorder::Register(Histogram* histogram) {
if (lock_ == NULL)
return;
- AutoLock auto_lock(*lock_);
+ base::AutoLock auto_lock(*lock_);
if (!histograms_)
return;
const std::string name = histogram->histogram_name();
@@ -1011,7 +1011,7 @@
void StatisticsRecorder::GetHistograms(Histograms* output) {
if (lock_ == NULL)
return;
- AutoLock auto_lock(*lock_);
+ base::AutoLock auto_lock(*lock_);
if (!histograms_)
return;
for (HistogramMap::iterator it = histograms_->begin();
@@ -1026,7 +1026,7 @@
scoped_refptr<Histogram>* histogram) {
if (lock_ == NULL)
return false;
- AutoLock auto_lock(*lock_);
+ base::AutoLock auto_lock(*lock_);
if (!histograms_)
return false;
HistogramMap::iterator it = histograms_->find(name);
@@ -1041,7 +1041,7 @@
Histograms* snapshot) {
if (lock_ == NULL)
return;
- AutoLock auto_lock(*lock_);
+ base::AutoLock auto_lock(*lock_);
if (!histograms_)
return;
for (HistogramMap::iterator it = histograms_->begin();
@@ -1055,7 +1055,7 @@
// static
StatisticsRecorder::HistogramMap* StatisticsRecorder::histograms_ = NULL;
// static
-Lock* StatisticsRecorder::lock_ = NULL;
+base::Lock* StatisticsRecorder::lock_ = NULL;
// static
bool StatisticsRecorder::dump_on_exit_ = false;
diff --git a/base/metrics/histogram.h b/base/metrics/histogram.h
index 6b09aa3..3bb3f03 100644
--- a/base/metrics/histogram.h
+++ b/base/metrics/histogram.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -41,11 +41,12 @@
#include "base/logging.h"
#include "base/time.h"
-class Lock;
class Pickle;
namespace base {
+class Lock;
+
//------------------------------------------------------------------------------
// Provide easy general purpose histogram in a macro, just like stats counters.
// The first four macros use 50 buckets.
@@ -541,11 +542,7 @@
// buckets.
class LinearHistogram : public Histogram {
public:
- virtual ClassType histogram_type() const;
-
- // Store a list of number/text values for use in rendering the histogram.
- // The last element in the array has a null in its "description" slot.
- virtual void SetRangeDescriptions(const DescriptionPair descriptions[]);
+ virtual ~LinearHistogram();
/* minimum should start from 1. 0 is as minimum is invalid. 0 is an implicit
default underflow bucket. */
@@ -555,7 +552,12 @@
TimeDelta minimum, TimeDelta maximum, size_t bucket_count,
Flags flags);
- virtual ~LinearHistogram();
+ // Overridden from Histogram:
+ virtual ClassType histogram_type() const;
+
+ // Store a list of number/text values for use in rendering the histogram.
+ // The last element in the array has a null in its "description" slot.
+ virtual void SetRangeDescriptions(const DescriptionPair descriptions[]);
protected:
LinearHistogram(const std::string& name, Sample minimum,
@@ -609,11 +611,13 @@
// CustomHistogram is a histogram for a set of custom integers.
class CustomHistogram : public Histogram {
public:
- virtual ClassType histogram_type() const;
static scoped_refptr<Histogram> FactoryGet(const std::string& name,
const std::vector<Sample>& custom_ranges, Flags flags);
+ // Overridden from Histogram:
+ virtual ClassType histogram_type() const;
+
protected:
CustomHistogram(const std::string& name,
const std::vector<Sample>& custom_ranges);
@@ -681,7 +685,7 @@
static HistogramMap* histograms_;
// lock protects access to the above map.
- static Lock* lock_;
+ static base::Lock* lock_;
// Dump all known histograms to log.
static bool dump_on_exit_;
diff --git a/base/metrics/stats_table.cc b/base/metrics/stats_table.cc
index bf93395..757c08e 100644
--- a/base/metrics/stats_table.cc
+++ b/base/metrics/stats_table.cc
@@ -5,13 +5,13 @@
#include "base/metrics/stats_table.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/scoped_ptr.h"
#include "base/shared_memory.h"
#include "base/string_piece.h"
#include "base/string_util.h"
-#include "base/thread_local_storage.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/thread_local_storage.h"
#include "base/utf_string_conversions.h"
#if defined(OS_POSIX)
diff --git a/base/metrics/stats_table.h b/base/metrics/stats_table.h
index e83039c..32b22eb 100644
--- a/base/metrics/stats_table.h
+++ b/base/metrics/stats_table.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -26,7 +26,7 @@
#include "base/basictypes.h"
#include "base/hash_tables.h"
#include "base/lock.h"
-#include "base/thread_local_storage.h"
+#include "base/threading/thread_local_storage.h"
namespace base {
@@ -132,6 +132,7 @@
private:
class Private;
struct TLSData;
+ typedef hash_map<std::string, int> CountersMap;
// Returns the space occupied by a thread in the table. Generally used
// if a thread terminates but the process continues. This function
@@ -171,8 +172,6 @@
// initialized.
TLSData* GetTLSData() const;
- typedef hash_map<std::string, int> CountersMap;
-
Private* impl_;
// The counters_lock_ protects the counters_ hash table.
@@ -184,7 +183,7 @@
// we don't have a counter in our hash table, another process may
// have created it.
CountersMap counters_;
- TLSSlot tls_index_;
+ ThreadLocalStorage::Slot tls_index_;
static StatsTable* global_table_;
diff --git a/base/metrics/stats_table_unittest.cc b/base/metrics/stats_table_unittest.cc
index c9eb9a2..944813d 100644
--- a/base/metrics/stats_table_unittest.cc
+++ b/base/metrics/stats_table_unittest.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/platform_thread.h"
-#include "base/simple_thread.h"
-#include "base/shared_memory.h"
-#include "base/metrics/stats_table.h"
#include "base/metrics/stats_counters.h"
+#include "base/metrics/stats_table.h"
+#include "base/shared_memory.h"
#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/test/multiprocess_test.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
diff --git a/base/native_library_linux.cc b/base/native_library_linux.cc
index d5ab128..e282bce 100644
--- a/base/native_library_linux.cc
+++ b/base/native_library_linux.cc
@@ -8,7 +8,7 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
namespace base {
diff --git a/base/native_library_mac.mm b/base/native_library_mac.mm
index 0669bee..742d92a 100644
--- a/base/native_library_mac.mm
+++ b/base/native_library_mac.mm
@@ -10,7 +10,7 @@
#include "base/file_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
namespace base {
diff --git a/base/native_library_win.cc b/base/native_library_win.cc
index b8a806b..b77fbe1 100644
--- a/base/native_library_win.cc
+++ b/base/native_library_win.cc
@@ -7,7 +7,7 @@
#include <windows.h>
#include "base/file_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
namespace base {
diff --git a/base/nss_util.cc b/base/nss_util.cc
index 36394da..b411422 100644
--- a/base/nss_util.cc
+++ b/base/nss_util.cc
@@ -22,7 +22,7 @@
#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
// USE_NSS means we use NSS for everything crypto-related. If USE_NSS is not
// defined, such as on Mac and Windows, we use NSS for SSL only -- we don't
diff --git a/base/nss_util.h b/base/nss_util.h
index d1e36ac..2b0139e 100644
--- a/base/nss_util.h
+++ b/base/nss_util.h
@@ -10,7 +10,6 @@
#if defined(USE_NSS)
class FilePath;
-class Lock;
#endif // defined(USE_NSS)
// This file specifically doesn't depend on any NSS or NSPR headers because it
@@ -18,6 +17,7 @@
// initialization functions.
namespace base {
+class Lock;
class Time;
// Initialize NRPR if it isn't already initialized. This function is
diff --git a/base/observer_list_unittest.cc b/base/observer_list_unittest.cc
index 6b57550..652d358 100644
--- a/base/observer_list_unittest.cc
+++ b/base/observer_list_unittest.cc
@@ -8,17 +8,15 @@
#include <vector>
#include "base/message_loop.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
+#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
+using base::PlatformThread;
using base::Time;
namespace {
-class ObserverListTest : public testing::Test {
-};
-
class Foo {
public:
virtual void Observe(int x) = 0;
@@ -291,7 +289,7 @@
observer_list->AddObserver(&b);
AddRemoveThread* threaded_observer[kMaxThreads];
- PlatformThreadHandle threads[kMaxThreads];
+ base::PlatformThreadHandle threads[kMaxThreads];
for (int index = 0; index < num_threads; index++) {
threaded_observer[index] = new AddRemoveThread(observer_list.get(), false);
EXPECT_TRUE(PlatformThread::Create(0,
diff --git a/base/pickle.cc b/base/pickle.cc
index 3f376e3..a05df28 100644
--- a/base/pickle.cc
+++ b/base/pickle.cc
@@ -140,12 +140,6 @@
return true;
}
-bool Pickle::ReadLength(void** iter, int* result) const {
- if (!ReadInt(iter, result))
- return false;
- return ((*result) >= 0);
-}
-
bool Pickle::ReadSize(void** iter, size_t* result) const {
DCHECK(iter);
if (!*iter)
@@ -256,6 +250,19 @@
return true;
}
+bool Pickle::ReadData(void** iter, const char** data, int* length) const {
+ DCHECK(iter);
+ DCHECK(data);
+ DCHECK(length);
+ *length = 0;
+ *data = 0;
+
+ if (!ReadLength(iter, length))
+ return false;
+
+ return ReadBytes(iter, data, *length);
+}
+
bool Pickle::ReadBytes(void** iter, const char** data, int length) const {
DCHECK(iter);
DCHECK(data);
@@ -272,54 +279,10 @@
return true;
}
-bool Pickle::ReadData(void** iter, const char** data, int* length) const {
- DCHECK(iter);
- DCHECK(data);
- DCHECK(length);
- *length = 0;
- *data = 0;
-
- if (!ReadLength(iter, length))
+bool Pickle::ReadLength(void** iter, int* result) const {
+ if (!ReadInt(iter, result))
return false;
-
- return ReadBytes(iter, data, *length);
-}
-
-char* Pickle::BeginWrite(size_t length) {
- // write at a uint32-aligned offset from the beginning of the header
- size_t offset = AlignInt(header_->payload_size, sizeof(uint32));
-
- size_t new_size = offset + length;
- size_t needed_size = header_size_ + new_size;
- if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
- return NULL;
-
-#ifdef ARCH_CPU_64_BITS
- DCHECK_LE(length, std::numeric_limits<uint32>::max());
-#endif
-
- header_->payload_size = static_cast<uint32>(new_size);
- return payload() + offset;
-}
-
-void Pickle::EndWrite(char* dest, int length) {
- // Zero-pad to keep tools like purify from complaining about uninitialized
- // memory.
- if (length % sizeof(uint32))
- memset(dest + length, 0, sizeof(uint32) - (length % sizeof(uint32)));
-}
-
-bool Pickle::WriteBytes(const void* data, int data_len) {
- DCHECK(capacity_ != kCapacityReadOnly) << "oops: pickle is readonly";
-
- char* dest = BeginWrite(data_len);
- if (!dest)
- return false;
-
- memcpy(dest, data, data_len);
-
- EndWrite(dest, data_len);
- return true;
+ return ((*result) >= 0);
}
bool Pickle::WriteString(const std::string& value) {
@@ -349,6 +312,19 @@
return length >= 0 && WriteInt(length) && WriteBytes(data, length);
}
+bool Pickle::WriteBytes(const void* data, int data_len) {
+ DCHECK(capacity_ != kCapacityReadOnly) << "oops: pickle is readonly";
+
+ char* dest = BeginWrite(data_len);
+ if (!dest)
+ return false;
+
+ memcpy(dest, data, data_len);
+
+ EndWrite(dest, data_len);
+ return true;
+}
+
char* Pickle::BeginWriteData(int length) {
DCHECK_EQ(variable_buffer_offset_, 0U) <<
"There can only be one variable buffer in a Pickle";
@@ -386,6 +362,30 @@
*cur_length = new_length;
}
+char* Pickle::BeginWrite(size_t length) {
+ // write at a uint32-aligned offset from the beginning of the header
+ size_t offset = AlignInt(header_->payload_size, sizeof(uint32));
+
+ size_t new_size = offset + length;
+ size_t needed_size = header_size_ + new_size;
+ if (needed_size > capacity_ && !Resize(std::max(capacity_ * 2, needed_size)))
+ return NULL;
+
+#ifdef ARCH_CPU_64_BITS
+ DCHECK_LE(length, std::numeric_limits<uint32>::max());
+#endif
+
+ header_->payload_size = static_cast<uint32>(new_size);
+ return payload() + offset;
+}
+
+void Pickle::EndWrite(char* dest, int length) {
+ // Zero-pad to keep tools like purify from complaining about uninitialized
+ // memory.
+ if (length % sizeof(uint32))
+ memset(dest + length, 0, sizeof(uint32) - (length % sizeof(uint32)));
+}
+
bool Pickle::Resize(size_t new_capacity) {
new_capacity = AlignInt(new_capacity, kPayloadUnit);
diff --git a/base/pickle.h b/base/pickle.h
index 6006e62..bbe5d34 100644
--- a/base/pickle.h
+++ b/base/pickle.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -32,8 +32,6 @@
//
class Pickle {
public:
- virtual ~Pickle();
-
// Initialize a Pickle object using the default header size.
Pickle();
@@ -51,6 +49,8 @@
// Initializes a Pickle as a deep copy of another Pickle.
Pickle(const Pickle& other);
+ virtual ~Pickle();
+
// Performs a deep copy.
Pickle& operator=(const Pickle& other);
diff --git a/base/platform_file.cc b/base/platform_file.cc
new file mode 100644
index 0000000..70700fc
--- /dev/null
+++ b/base/platform_file.cc
@@ -0,0 +1,17 @@
+// 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 "base/platform_file.h"
+
+namespace base {
+
+PlatformFileInfo::PlatformFileInfo()
+ : size(0),
+ is_directory(false),
+ is_symbolic_link(false) {
+}
+
+PlatformFileInfo::~PlatformFileInfo() {}
+
+} // namespace base
diff --git a/base/platform_file.h b/base/platform_file.h
index 1ca9868..dd3028b 100644
--- a/base/platform_file.h
+++ b/base/platform_file.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -71,6 +71,9 @@
// too, and the ParamTraits<base::PlatformFileInfo> implementation in
// chrome/common/common_param_traits.cc.
struct PlatformFileInfo {
+ PlatformFileInfo();
+ ~PlatformFileInfo();
+
// The size of the file in bytes. Undefined when is_directory is true.
int64 size;
diff --git a/base/platform_file_win.cc b/base/platform_file_win.cc
index 1398397..f9eb234 100644
--- a/base/platform_file_win.cc
+++ b/base/platform_file_win.cc
@@ -6,7 +6,7 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
namespace base {
diff --git a/base/process_util.h b/base/process_util.h
index ce4b0bb..a7f8496 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -76,12 +76,6 @@
ProcessEntry();
~ProcessEntry();
- ProcessId pid_;
- ProcessId ppid_;
- ProcessId gid_;
- std::string exe_file_;
- std::vector<std::string> cmd_line_args_;
-
ProcessId pid() const { return pid_; }
ProcessId parent_pid() const { return ppid_; }
ProcessId gid() const { return gid_; }
@@ -89,6 +83,12 @@
const std::vector<std::string>& cmd_line_args() const {
return cmd_line_args_;
}
+
+ ProcessId pid_;
+ ProcessId ppid_;
+ ProcessId gid_;
+ std::string exe_file_;
+ std::vector<std::string> cmd_line_args_;
};
struct IoCounters {
@@ -528,6 +528,8 @@
// methods.
class ProcessMetrics {
public:
+ ~ProcessMetrics();
+
// Creates a ProcessMetrics for the specified process.
// The caller owns the returned object.
#if !defined(OS_MACOSX)
@@ -549,8 +551,6 @@
PortProvider* port_provider);
#endif // !defined(OS_MACOSX)
- ~ProcessMetrics();
-
// Returns the current space allocated for the pagefile, in bytes (these pages
// may or may not be in memory). On Linux, this returns the total virtual
// memory size.
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index 670de6a..dcaeeb4 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -22,7 +22,7 @@
#include "base/string_tokenizer.h"
#include "base/string_util.h"
#include "base/sys_info.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
namespace {
diff --git a/base/process_util_posix.cc b/base/process_util_posix.cc
index f31ffdd..ce19bc6 100644
--- a/base/process_util_posix.cc
+++ b/base/process_util_posix.cc
@@ -22,13 +22,13 @@
#include "base/dir_reader_posix.h"
#include "base/eintr_wrapper.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/scoped_ptr.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
-#include "base/waitable_event.h"
#if defined(OS_MACOSX)
#include <crt_externs.h>
@@ -898,7 +898,7 @@
result = true;
break;
}
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
} while ((base::Time::Now() - end_time) > base::TimeDelta());
return result;
diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc
index 0eaf5d4..672e396 100644
--- a/base/process_util_unittest.cc
+++ b/base/process_util_unittest.cc
@@ -7,16 +7,15 @@
#include <limits>
#include "base/command_line.h"
-#include "base/debug_util.h"
#include "base/eintr_wrapper.h"
#include "base/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/scoped_ptr.h"
#include "base/test/multiprocess_test.h"
#include "base/test/test_timeouts.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
@@ -67,7 +66,7 @@
void WaitToDie(const char* filename) {
FILE *fp;
do {
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
fp = fopen(filename, "r");
} while (!fp);
fclose(fp);
@@ -92,7 +91,7 @@
int waited = 0;
do {
status = base::GetTerminationStatus(handle, exit_code);
- PlatformThread::Sleep(kIntervalMs);
+ base::PlatformThread::Sleep(kIntervalMs);
waited += kIntervalMs;
} while (status == base::TERMINATION_STATUS_STILL_RUNNING &&
waited < kMaxWaitTimeMs);
diff --git a/base/ref_counted.cc b/base/ref_counted.cc
index f1dffa4..2f795ea 100644
--- a/base/ref_counted.cc
+++ b/base/ref_counted.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
#include "base/ref_counted.h"
#include "base/logging.h"
-#include "base/thread_collision_warner.h"
+#include "base/threading/thread_collision_warner.h"
namespace base {
diff --git a/base/ref_counted.h b/base/ref_counted.h
index 9c84efa..4c3aeb8 100644
--- a/base/ref_counted.h
+++ b/base/ref_counted.h
@@ -7,7 +7,7 @@
#pragma once
#include "base/atomic_ref_count.h"
-#include "base/thread_collision_warner.h"
+#include "base/threading/thread_collision_warner.h"
namespace base {
diff --git a/base/ref_counted_memory.cc b/base/ref_counted_memory.cc
index 0a4a613..dc244b9 100644
--- a/base/ref_counted_memory.cc
+++ b/base/ref_counted_memory.cc
@@ -18,13 +18,6 @@
return length_;
}
-RefCountedBytes* RefCountedBytes::TakeVector(
- std::vector<unsigned char>* to_destroy) {
- RefCountedBytes* bytes = new RefCountedBytes;
- bytes->data.swap(*to_destroy);
- return bytes;
-}
-
RefCountedBytes::RefCountedBytes() {
}
@@ -32,7 +25,11 @@
: data(initializer) {
}
-RefCountedBytes::~RefCountedBytes() {
+RefCountedBytes* RefCountedBytes::TakeVector(
+ std::vector<unsigned char>* to_destroy) {
+ RefCountedBytes* bytes = new RefCountedBytes;
+ bytes->data.swap(*to_destroy);
+ return bytes;
}
const unsigned char* RefCountedBytes::front() const {
@@ -44,3 +41,6 @@
size_t RefCountedBytes::size() const {
return data.size();
}
+
+RefCountedBytes::~RefCountedBytes() {
+}
diff --git a/base/ref_counted_memory.h b/base/ref_counted_memory.h
index 08400ec..fe7427e 100644
--- a/base/ref_counted_memory.h
+++ b/base/ref_counted_memory.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -40,6 +40,7 @@
RefCountedStaticMemory(const unsigned char* data, size_t length)
: data_(data), length_(length) {}
+ // Overriden from RefCountedMemory:
virtual const unsigned char* front() const;
virtual size_t size() const;
@@ -54,16 +55,17 @@
// vector.
class RefCountedBytes : public RefCountedMemory {
public:
- // Constructs a RefCountedBytes object by performing a swap. (To non
- // destructively build a RefCountedBytes, use the constructor that takes a
- // vector.)
- static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy);
-
RefCountedBytes();
// Constructs a RefCountedBytes object by _copying_ from |initializer|.
RefCountedBytes(const std::vector<unsigned char>& initializer);
+ // Constructs a RefCountedBytes object by performing a swap. (To non
+ // destructively build a RefCountedBytes, use the constructor that takes a
+ // vector.)
+ static RefCountedBytes* TakeVector(std::vector<unsigned char>* to_destroy);
+
+ // Overriden from RefCountedMemory:
virtual const unsigned char* front() const;
virtual size_t size() const;
diff --git a/base/scoped_handle.h b/base/scoped_handle.h
index 43ee975..90cb5d5 100644
--- a/base/scoped_handle.h
+++ b/base/scoped_handle.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -10,10 +10,6 @@
#include "base/basictypes.h"
-#if defined(OS_WIN)
-#include "base/scoped_handle_win.h"
-#endif
-
class ScopedStdioHandle {
public:
ScopedStdioHandle()
diff --git a/base/scoped_handle_win.h b/base/scoped_handle_win.h
deleted file mode 100644
index 09bb2cb..0000000
--- a/base/scoped_handle_win.h
+++ /dev/null
@@ -1,19 +0,0 @@
-// 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.
-
-// TODO(brettw) remove this file when all callers are converted to using the
-// new location/namespace
-#include "base/win/scoped_gdi_object.h"
-#include "base/win/scoped_handle.h"
-#include "base/win/scoped_handle.h"
-#include "base/win/scoped_hdc.h"
-#include "base/win/scoped_hglobal.h"
-
-using base::win::ScopedBitmap;
-using base::win::ScopedHandle;
-using base::win::ScopedHDC;
-using base::win::ScopedHFONT;
-using base::win::ScopedHGlobal;
-using base::win::ScopedHICON;
-using base::win::ScopedRegion;
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc
index 88203dd..e83b982 100644
--- a/base/shared_memory_posix.cc
+++ b/base/shared_memory_posix.cc
@@ -12,9 +12,9 @@
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/safe_strerror_posix.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
namespace base {
@@ -300,7 +300,7 @@
continue;
} else if (errno == ENOLCK) {
// temporary kernel resource exaustion
- PlatformThread::Sleep(500);
+ base::PlatformThread::Sleep(500);
continue;
} else {
NOTREACHED() << "lockf() failed."
diff --git a/base/shared_memory_unittest.cc b/base/shared_memory_unittest.cc
index f646158..b515e79 100644
--- a/base/shared_memory_unittest.cc
+++ b/base/shared_memory_unittest.cc
@@ -4,10 +4,10 @@
#include "base/basictypes.h"
#include "base/mac/scoped_nsautorelease_pool.h"
-#include "base/platform_thread.h"
#include "base/shared_memory.h"
#include "base/scoped_ptr.h"
#include "base/test/multiprocess_test.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/multiprocess_func_list.h"
@@ -327,7 +327,7 @@
// On POSIX it is especially important we test shmem across processes,
// not just across threads. But the test is enabled on all platforms.
-class SharedMemoryProcessTest : public base::MultiProcessTest {
+class SharedMemoryProcessTest : public MultiProcessTest {
public:
static void CleanUp() {
@@ -380,14 +380,14 @@
TEST_F(SharedMemoryProcessTest, MAYBE_Tasks) {
SharedMemoryProcessTest::CleanUp();
- base::ProcessHandle handles[kNumTasks];
+ ProcessHandle handles[kNumTasks];
for (int index = 0; index < kNumTasks; ++index) {
handles[index] = SpawnChild("SharedMemoryTestMain", false);
}
int exit_code = 0;
for (int index = 0; index < kNumTasks; ++index) {
- EXPECT_TRUE(base::WaitForExitCode(handles[index], &exit_code));
+ EXPECT_TRUE(WaitForExitCode(handles[index], &exit_code));
EXPECT_TRUE(exit_code == 0);
}
diff --git a/base/singleton.h b/base/singleton.h
index e5713c4..5bd5c35 100644
--- a/base/singleton.h
+++ b/base/singleton.h
@@ -8,9 +8,9 @@
#include "base/at_exit.h"
#include "base/atomicops.h"
-#include "base/platform_thread.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/thread_restrictions.h"
// Default traits for Singleton<Type>. Calls operator new and operator delete on
// the object. Registers automatic deletion at process exit.
@@ -243,7 +243,7 @@
value = base::subtle::NoBarrier_Load(&instance_);
if (value != kBeingCreatedMarker)
break;
- PlatformThread::YieldCurrentThread();
+ base::PlatformThread::YieldCurrentThread();
}
// See the corresponding HAPPENS_BEFORE above.
diff --git a/base/spin_wait.h b/base/spin_wait.h
index 34484d2..1e31b14 100644
--- a/base/spin_wait.h
+++ b/base/spin_wait.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,11 +12,11 @@
// We provide a simple one argument spin wait (for 1 second), and a generic
// spin wait (for longer periods of time).
-#ifndef BASE_SPIN_WAIT_H__
-#define BASE_SPIN_WAIT_H__
+#ifndef BASE_SPIN_WAIT_H_
+#define BASE_SPIN_WAIT_H_
#pragma once
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
// Provide a macro that will wait no longer than 1 second for an asynchronous
@@ -44,8 +44,8 @@
kTimeout.InMilliseconds()) << "Timed out"; \
break; \
} \
- PlatformThread::Sleep(50); \
+ base::PlatformThread::Sleep(50); \
} \
} while (0)
-#endif // BASE_SPIN_WAIT_H__
+#endif // BASE_SPIN_WAIT_H_
diff --git a/base/string_piece.h b/base/string_piece.h
index 70c0480..80c6cab 100644
--- a/base/string_piece.h
+++ b/base/string_piece.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
// Copied from strings/stringpiece.h with modifications
@@ -29,11 +29,19 @@
class StringPiece {
public:
+ // standard STL container boilerplate
typedef size_t size_type;
+ typedef char value_type;
+ typedef const char* pointer;
+ typedef const char& reference;
+ typedef const char& const_reference;
+ typedef ptrdiff_t difference_type;
+ typedef const char* const_iterator;
+ typedef const char* iterator;
+ typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+ typedef std::reverse_iterator<iterator> reverse_iterator;
- private:
- const char* ptr_;
- size_type length_;
+ static const size_type npos;
public:
// We provide non-explicit singleton constructors so users can pass
@@ -113,17 +121,6 @@
(wordmemcmp(ptr_ + (length_-x.length_), x.ptr_, x.length_) == 0));
}
- // standard STL container boilerplate
- typedef char value_type;
- typedef const char* pointer;
- typedef const char& reference;
- typedef const char& const_reference;
- typedef ptrdiff_t difference_type;
- static const size_type npos;
- typedef const char* const_iterator;
- typedef const char* iterator;
- typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
- typedef std::reverse_iterator<iterator> reverse_iterator;
iterator begin() const { return ptr_; }
iterator end() const { return ptr_ + length_; }
const_reverse_iterator rbegin() const {
@@ -161,6 +158,10 @@
static int wordmemcmp(const char* p, const char* p2, size_type N) {
return memcmp(p, p2, N);
}
+
+ private:
+ const char* ptr_;
+ size_type length_;
};
bool operator==(const StringPiece& x, const StringPiece& y);
diff --git a/base/string_util.h b/base/string_util.h
index f65652c..ed7adec 100644
--- a/base/string_util.h
+++ b/base/string_util.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -276,7 +276,7 @@
// first case) or characters that use only 8-bits and whose 8-bit
// representation looks like a UTF-8 string (the second case).
//
-// Note that IsStringUTF8 checks not only if the input is structrually
+// Note that IsStringUTF8 checks not only if the input is structurally
// valid but also if it doesn't contain any non-character codepoint
// (e.g. U+FFFE). It's done on purpose because all the existing callers want
// to have the maximum 'discriminating' power from other encodings. If
diff --git a/base/cancellation_flag.cc b/base/synchronization/cancellation_flag.cc
similarity index 78%
rename from base/cancellation_flag.cc
rename to base/synchronization/cancellation_flag.cc
index 50e30ec..ad3b551 100644
--- a/base/cancellation_flag.cc
+++ b/base/synchronization/cancellation_flag.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "base/cancellation_flag.h"
+#include "base/synchronization/cancellation_flag.h"
#include "base/logging.h"
diff --git a/base/cancellation_flag.h b/base/synchronization/cancellation_flag.h
similarity index 77%
rename from base/cancellation_flag.h
rename to base/synchronization/cancellation_flag.h
index 98ca846..29ecd89 100644
--- a/base/cancellation_flag.h
+++ b/base/synchronization/cancellation_flag.h
@@ -1,13 +1,13 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
-#ifndef BASE_CANCELLATION_FLAG_H_
-#define BASE_CANCELLATION_FLAG_H_
+#ifndef BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
+#define BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
#pragma once
#include "base/atomicops.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
namespace base {
@@ -40,4 +40,4 @@
} // namespace base
-#endif // BASE_CANCELLATION_FLAG_H_
+#endif // BASE_SYNCHRONIZATION_CANCELLATION_FLAG_H_
diff --git a/base/cancellation_flag_unittest.cc b/base/synchronization/cancellation_flag_unittest.cc
similarity index 88%
rename from base/cancellation_flag_unittest.cc
rename to base/synchronization/cancellation_flag_unittest.cc
index eb28b53..c405c79 100644
--- a/base/cancellation_flag_unittest.cc
+++ b/base/synchronization/cancellation_flag_unittest.cc
@@ -1,22 +1,20 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
// Tests of CancellationFlag class.
-#include "base/cancellation_flag.h"
+#include "base/synchronization/cancellation_flag.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/spin_wait.h"
#include "base/time.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-using base::CancellationFlag;
-using base::TimeDelta;
-using base::Thread;
+namespace base {
namespace {
@@ -65,3 +63,5 @@
}
} // namespace
+
+} // namespace base
diff --git a/base/condition_variable.h b/base/synchronization/condition_variable.h
similarity index 95%
rename from base/condition_variable.h
rename to base/synchronization/condition_variable.h
index 4fe1892..3acd0ac 100644
--- a/base/condition_variable.h
+++ b/base/synchronization/condition_variable.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -62,8 +62,8 @@
// For a discussion of the many very subtle implementation details, see the FAQ
// at the end of condition_variable_win.cc.
-#ifndef BASE_CONDITION_VARIABLE_H_
-#define BASE_CONDITION_VARIABLE_H_
+#ifndef BASE_SYNCHRONIZATION_CONDITION_VARIABLE_H_
+#define BASE_SYNCHRONIZATION_CONDITION_VARIABLE_H_
#pragma once
#include "build/build_config.h"
@@ -78,8 +78,8 @@
#include "base/lock.h"
namespace base {
- class TimeDelta;
-}
+
+class TimeDelta;
class ConditionVariable {
public:
@@ -91,7 +91,7 @@
// Wait() releases the caller's critical section atomically as it starts to
// sleep, and the reacquires it when it is signaled.
void Wait();
- void TimedWait(const base::TimeDelta& max_time);
+ void TimedWait(const TimeDelta& max_time);
// Broadcast() revives all waiting threads.
void Broadcast();
@@ -184,4 +184,6 @@
DISALLOW_COPY_AND_ASSIGN(ConditionVariable);
};
-#endif // BASE_CONDITION_VARIABLE_H_
+} // namespace base
+
+#endif // BASE_SYNCHRONIZATION_CONDITION_VARIABLE_H_
diff --git a/base/condition_variable_posix.cc b/base/synchronization/condition_variable_posix.cc
similarity index 86%
rename from base/condition_variable_posix.cc
rename to base/synchronization/condition_variable_posix.cc
index 5d9ccb4..eff7053 100644
--- a/base/condition_variable_posix.cc
+++ b/base/synchronization/condition_variable_posix.cc
@@ -1,23 +1,22 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/condition_variable.h"
+#include "base/synchronization/condition_variable.h"
#include <errno.h>
#include <sys/time.h>
-#include "base/lock.h"
#include "base/logging.h"
+#include "base/synchronization/lock.h"
#include "base/time.h"
-using base::Time;
-using base::TimeDelta;
+namespace base {
ConditionVariable::ConditionVariable(Lock* user_lock)
- : user_mutex_(user_lock->lock_.os_lock())
+ : user_mutex_(user_lock->lock_.os_lock())
#if !defined(NDEBUG)
- , user_lock_(user_lock)
+ , user_lock_(user_lock)
#endif
{
int rv = pthread_cond_init(&condition_, NULL);
@@ -74,3 +73,5 @@
int rv = pthread_cond_signal(&condition_);
DCHECK(rv == 0);
}
+
+} // namespace base
diff --git a/base/condition_variable_unittest.cc b/base/synchronization/condition_variable_unittest.cc
similarity index 96%
rename from base/condition_variable_unittest.cc
rename to base/synchronization/condition_variable_unittest.cc
index 67d1839..8cfe4fe 100644
--- a/base/condition_variable_unittest.cc
+++ b/base/synchronization/condition_variable_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,19 +8,18 @@
#include <algorithm>
#include <vector>
-#include "base/condition_variable.h"
+#include "base/synchronization/condition_variable.h"
#include "base/lock.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
#include "base/spin_wait.h"
-#include "base/thread_collision_warner.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/thread_collision_warner.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-using base::TimeDelta;
-using base::TimeTicks;
+namespace base {
namespace {
//------------------------------------------------------------------------------
@@ -37,12 +36,12 @@
const TimeDelta kOneHundredMs;
explicit ConditionVariableTest()
- : kZeroMs(TimeDelta::FromMilliseconds(0)),
- kTenMs(TimeDelta::FromMilliseconds(10)),
- kThirtyMs(TimeDelta::FromMilliseconds(30)),
- kFortyFiveMs(TimeDelta::FromMilliseconds(45)),
- kSixtyMs(TimeDelta::FromMilliseconds(60)),
- kOneHundredMs(TimeDelta::FromMilliseconds(100)) {
+ : kZeroMs(TimeDelta::FromMilliseconds(0)),
+ kTenMs(TimeDelta::FromMilliseconds(10)),
+ kThirtyMs(TimeDelta::FromMilliseconds(30)),
+ kFortyFiveMs(TimeDelta::FromMilliseconds(45)),
+ kSixtyMs(TimeDelta::FromMilliseconds(60)),
+ kOneHundredMs(TimeDelta::FromMilliseconds(100)) {
}
};
@@ -196,7 +195,7 @@
const int kTaskCount = 10; // Number of tasks in each mini-test here.
- base::Time start_time; // Used to time task processing.
+ Time start_time; // Used to time task processing.
{
AutoLock auto_lock(*queue.lock());
@@ -224,7 +223,7 @@
queue.SetWorkTime(kThirtyMs);
queue.SetAllowHelp(false);
- start_time = base::Time::Now();
+ start_time = Time::Now();
}
queue.work_is_available()->Signal(); // Start up one thread.
@@ -239,7 +238,7 @@
// The last of the tasks *might* still be running, but... all but one should
// be done by now, since tasks are being done serially.
EXPECT_LE(queue.GetWorkTime().InMilliseconds() * (kTaskCount - 1),
- (base::Time::Now() - start_time).InMilliseconds());
+ (Time::Now() - start_time).InMilliseconds());
EXPECT_EQ(1, queue.GetNumThreadsTakingAssignments());
EXPECT_EQ(1, queue.GetNumThreadsCompletingTasks());
@@ -268,7 +267,7 @@
queue.SetWorkTime(kThirtyMs);
queue.SetAllowHelp(true);
- start_time = base::Time::Now();
+ start_time = Time::Now();
}
queue.work_is_available()->Signal(); // But each worker can signal another.
@@ -747,3 +746,5 @@
}
} // namespace
+
+} // namespace base
diff --git a/base/condition_variable_win.cc b/base/synchronization/condition_variable_win.cc
similarity index 97%
rename from base/condition_variable_win.cc
rename to base/synchronization/condition_variable_win.cc
index 5150c23..3030178 100644
--- a/base/condition_variable_win.cc
+++ b/base/synchronization/condition_variable_win.cc
@@ -1,22 +1,22 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/condition_variable.h"
+#include "base/synchronization/condition_variable.h"
#include <stack>
-#include "base/lock.h"
#include "base/logging.h"
+#include "base/synchronization/lock.h"
#include "base/time.h"
-using base::TimeDelta;
+namespace base {
ConditionVariable::ConditionVariable(Lock* user_lock)
- : user_lock_(*user_lock),
- run_state_(RUNNING),
- allocation_counter_(0),
- recycling_list_size_(0) {
+ : user_lock_(*user_lock),
+ run_state_(RUNNING),
+ allocation_counter_(0),
+ recycling_list_size_(0) {
DCHECK(user_lock);
}
@@ -443,3 +443,5 @@
code review and validate its correctness.
*/
+
+} // namespace base
diff --git a/base/lock.cc b/base/synchronization/lock.cc
similarity index 86%
rename from base/lock.cc
rename to base/synchronization/lock.cc
index c73a458..6445ce8 100644
--- a/base/lock.cc
+++ b/base/synchronization/lock.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,9 +8,11 @@
#if !defined(NDEBUG)
-#include "base/lock.h"
+#include "base/synchronization/lock.h"
#include "base/logging.h"
+namespace base {
+
Lock::Lock() : lock_() {
owned_by_thread_ = false;
owning_thread_id_ = static_cast<PlatformThreadId>(0);
@@ -34,4 +36,6 @@
owning_thread_id_ = PlatformThread::CurrentId();
}
+} // namespace base
+
#endif // NDEBUG
diff --git a/base/synchronization/lock.h b/base/synchronization/lock.h
new file mode 100644
index 0000000..f7c9c49
--- /dev/null
+++ b/base/synchronization/lock.h
@@ -0,0 +1,131 @@
+// 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.
+
+#ifndef BASE_SYNCHRONIZATION_LOCK_H_
+#define BASE_SYNCHRONIZATION_LOCK_H_
+#pragma once
+
+#include "base/synchronization/lock_impl.h"
+#include "base/threading/platform_thread.h"
+
+namespace base {
+
+// A convenient wrapper for an OS specific critical section. The only real
+// intelligence in this class is in debug mode for the support for the
+// AssertAcquired() method.
+class Lock {
+ public:
+#if defined(NDEBUG) // Optimized wrapper implementation
+ Lock() : lock_() {}
+ ~Lock() {}
+ void Acquire() { lock_.Lock(); }
+ void Release() { lock_.Unlock(); }
+
+ // If the lock is not held, take it and return true. If the lock is already
+ // held by another thread, immediately return false. This must not be called
+ // by a thread already holding the lock (what happens is undefined and an
+ // assertion may fail).
+ bool Try() { return lock_.Try(); }
+
+ // Null implementation if not debug.
+ void AssertAcquired() const {}
+#else
+ Lock();
+ ~Lock() {}
+
+ // NOTE: Although windows critical sections support recursive locks, we do not
+ // allow this, and we will commonly fire a DCHECK() if a thread attempts to
+ // acquire the lock a second time (while already holding it).
+ void Acquire() {
+ lock_.Lock();
+ CheckUnheldAndMark();
+ }
+ void Release() {
+ CheckHeldAndUnmark();
+ lock_.Unlock();
+ }
+
+ bool Try() {
+ bool rv = lock_.Try();
+ if (rv) {
+ CheckUnheldAndMark();
+ }
+ return rv;
+ }
+
+ void AssertAcquired() const;
+#endif // NDEBUG
+
+#if defined(OS_POSIX)
+ // The posix implementation of ConditionVariable needs to be able
+ // to see our lock and tweak our debugging counters, as it releases
+ // and acquires locks inside of pthread_cond_{timed,}wait.
+ // Windows doesn't need to do this as it calls the Lock::* methods.
+ friend class ConditionVariable;
+#endif
+
+ private:
+#if !defined(NDEBUG)
+ // Members and routines taking care of locks assertions.
+ // Note that this checks for recursive locks and allows them
+ // if the variable is set. This is allowed by the underlying implementation
+ // on windows but not on Posix, so we're doing unneeded checks on Posix.
+ // It's worth it to share the code.
+ void CheckHeldAndUnmark();
+ void CheckUnheldAndMark();
+
+ // All private data is implicitly protected by lock_.
+ // Be VERY careful to only access members under that lock.
+
+ // Determines validity of owning_thread_id_. Needed as we don't have
+ // a null owning_thread_id_ value.
+ bool owned_by_thread_;
+ base::PlatformThreadId owning_thread_id_;
+#endif // NDEBUG
+
+ // Platform specific underlying lock implementation.
+ internal::LockImpl lock_;
+
+ DISALLOW_COPY_AND_ASSIGN(Lock);
+};
+
+// A helper class that acquires the given Lock while the AutoLock is in scope.
+class AutoLock {
+ public:
+ explicit AutoLock(Lock& lock) : lock_(lock) {
+ lock_.Acquire();
+ }
+
+ ~AutoLock() {
+ lock_.AssertAcquired();
+ lock_.Release();
+ }
+
+ private:
+ Lock& lock_;
+ DISALLOW_COPY_AND_ASSIGN(AutoLock);
+};
+
+// AutoUnlock is a helper that will Release() the |lock| argument in the
+// constructor, and re-Acquire() it in the destructor.
+class AutoUnlock {
+ public:
+ explicit AutoUnlock(Lock& lock) : lock_(lock) {
+ // We require our caller to have the lock.
+ lock_.AssertAcquired();
+ lock_.Release();
+ }
+
+ ~AutoUnlock() {
+ lock_.Acquire();
+ }
+
+ private:
+ Lock& lock_;
+ DISALLOW_COPY_AND_ASSIGN(AutoUnlock);
+};
+
+} // namespace base
+
+#endif // BASE_SYNCHRONIZATION_LOCK_H_
diff --git a/base/lock_impl.h b/base/synchronization/lock_impl.h
similarity index 82%
rename from base/lock_impl.h
rename to base/synchronization/lock_impl.h
index 6066495..2994610 100644
--- a/base/lock_impl.h
+++ b/base/synchronization/lock_impl.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
-#ifndef BASE_LOCK_IMPL_H_
-#define BASE_LOCK_IMPL_H_
+#ifndef BASE_SYNCHRONIZATION_LOCK_IMPL_H_
+#define BASE_SYNCHRONIZATION_LOCK_IMPL_H_
#pragma once
#include "build/build_config.h"
@@ -16,6 +16,9 @@
#include "base/basictypes.h"
+namespace base {
+namespace internal {
+
// This class implements the underlying platform-specific spin-lock mechanism
// used for the Lock class. Most users should not use LockImpl directly, but
// should instead use Lock.
@@ -54,5 +57,7 @@
DISALLOW_COPY_AND_ASSIGN(LockImpl);
};
+} // namespace internal
+} // namespace base
-#endif // BASE_LOCK_IMPL_H_
+#endif // BASE_SYNCHRONIZATION_LOCK_IMPL_H_
diff --git a/base/lock_impl_posix.cc b/base/synchronization/lock_impl_posix.cc
similarity index 84%
rename from base/lock_impl_posix.cc
rename to base/synchronization/lock_impl_posix.cc
index 355149f..f638fcd 100644
--- a/base/lock_impl_posix.cc
+++ b/base/synchronization/lock_impl_posix.cc
@@ -1,13 +1,16 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/lock_impl.h"
+#include "base/synchronization/lock_impl.h"
#include <errno.h>
#include "base/logging.h"
+namespace base {
+namespace internal {
+
LockImpl::LockImpl() {
#ifndef NDEBUG
// In debug, setup attributes for lock error checking.
@@ -46,3 +49,6 @@
int rv = pthread_mutex_unlock(&os_lock_);
DCHECK_EQ(rv, 0);
}
+
+} // namespace internal
+} // namespace base
diff --git a/base/lock_impl_win.cc b/base/synchronization/lock_impl_win.cc
similarity index 77%
rename from base/lock_impl_win.cc
rename to base/synchronization/lock_impl_win.cc
index 8c03b61..bb8a23d 100644
--- a/base/lock_impl_win.cc
+++ b/base/synchronization/lock_impl_win.cc
@@ -1,8 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "base/lock_impl.h"
+#include "base/synchronization/lock_impl.h"
+
+namespace base {
+namespace internal {
LockImpl::LockImpl() {
// The second parameter is the spin count, for short-held locks it avoid the
@@ -28,3 +31,6 @@
void LockImpl::Unlock() {
::LeaveCriticalSection(&os_lock_);
}
+
+} // namespace internal
+} // namespace base
diff --git a/base/lock_unittest.cc b/base/synchronization/lock_unittest.cc
similarity index 93%
rename from base/lock_unittest.cc
rename to base/synchronization/lock_unittest.cc
index cf99df9..5ac3e6b 100644
--- a/base/lock_unittest.cc
+++ b/base/synchronization/lock_unittest.cc
@@ -1,15 +1,14 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "base/lock.h"
-
#include <stdlib.h>
-#include "base/platform_thread.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-typedef testing::Test LockTest;
+namespace base {
// Basic test to make sure that Acquire()/Release()/Try() don't crash ----------
@@ -47,7 +46,7 @@
DISALLOW_COPY_AND_ASSIGN(BasicLockTestThread);
};
-TEST_F(LockTest, Basic) {
+TEST(LockTest, Basic) {
Lock lock;
BasicLockTestThread thread(&lock);
PlatformThreadHandle handle = kNullThreadHandle;
@@ -107,7 +106,7 @@
DISALLOW_COPY_AND_ASSIGN(TryLockTestThread);
};
-TEST_F(LockTest, TryLock) {
+TEST(LockTest, TryLock) {
Lock lock;
ASSERT_TRUE(lock.Try());
@@ -172,7 +171,7 @@
DISALLOW_COPY_AND_ASSIGN(MutexLockTestThread);
};
-TEST_F(LockTest, MutexTwoThreads) {
+TEST(LockTest, MutexTwoThreads) {
Lock lock;
int value = 0;
@@ -188,7 +187,7 @@
EXPECT_EQ(2 * 40, value);
}
-TEST_F(LockTest, MutexFourThreads) {
+TEST(LockTest, MutexFourThreads) {
Lock lock;
int value = 0;
@@ -211,3 +210,5 @@
EXPECT_EQ(4 * 40, value);
}
+
+} // namespace base
diff --git a/base/waitable_event.h b/base/synchronization/waitable_event.h
similarity index 96%
rename from base/waitable_event.h
rename to base/synchronization/waitable_event.h
index 081ad66..01b5987 100644
--- a/base/waitable_event.h
+++ b/base/synchronization/waitable_event.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
-#ifndef BASE_WAITABLE_EVENT_H_
-#define BASE_WAITABLE_EVENT_H_
+#ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_
+#define BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_
#pragma once
#include "base/basictypes.h"
@@ -155,20 +155,21 @@
std::list<Waiter*> waiters_;
};
- scoped_refptr<WaitableEventKernel> kernel_;
-
- bool SignalAll();
- bool SignalOne();
- void Enqueue(Waiter* waiter);
+ typedef std::pair<WaitableEvent*, size_t> WaiterAndIndex;
// When dealing with arrays of WaitableEvent*, we want to sort by the address
// of the WaitableEvent in order to have a globally consistent locking order.
// In that case we keep them, in sorted order, in an array of pairs where the
// second element is the index of the WaitableEvent in the original,
// unsorted, array.
- typedef std::pair<WaitableEvent*, size_t> WaiterAndIndex;
static size_t EnqueueMany(WaiterAndIndex* waitables,
size_t count, Waiter* waiter);
+
+ bool SignalAll();
+ bool SignalOne();
+ void Enqueue(Waiter* waiter);
+
+ scoped_refptr<WaitableEventKernel> kernel_;
#endif
DISALLOW_COPY_AND_ASSIGN(WaitableEvent);
@@ -176,4 +177,4 @@
} // namespace base
-#endif // BASE_WAITABLE_EVENT_H_
+#endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_H_
diff --git a/base/waitable_event_posix.cc b/base/synchronization/waitable_event_posix.cc
similarity index 96%
rename from base/waitable_event_posix.cc
rename to base/synchronization/waitable_event_posix.cc
index adc521e..9cbc03a 100644
--- a/base/waitable_event_posix.cc
+++ b/base/synchronization/waitable_event_posix.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
-#include "base/condition_variable.h"
-#include "base/lock.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/synchronization/lock.h"
#include "base/message_loop.h"
// -----------------------------------------------------------------------------
@@ -42,12 +42,12 @@
}
void WaitableEvent::Reset() {
- AutoLock locked(kernel_->lock_);
+ base::AutoLock locked(kernel_->lock_);
kernel_->signaled_ = false;
}
void WaitableEvent::Signal() {
- AutoLock locked(kernel_->lock_);
+ base::AutoLock locked(kernel_->lock_);
if (kernel_->signaled_)
return;
@@ -64,7 +64,7 @@
}
bool WaitableEvent::IsSignaled() {
- AutoLock locked(kernel_->lock_);
+ base::AutoLock locked(kernel_->lock_);
const bool result = kernel_->signaled_;
if (result && !kernel_->manual_reset_)
@@ -89,7 +89,7 @@
}
bool Fire(WaitableEvent* signaling_event) {
- AutoLock locked(lock_);
+ base::AutoLock locked(lock_);
if (fired_)
return false;
@@ -134,19 +134,19 @@
fired_ = true;
}
- Lock* lock() {
+ base::Lock* lock() {
return &lock_;
}
- ConditionVariable* cv() {
+ base::ConditionVariable* cv() {
return &cv_;
}
private:
bool fired_;
WaitableEvent* signaling_event_; // The WaitableEvent which woke us
- Lock lock_;
- ConditionVariable cv_;
+ base::Lock lock_;
+ base::ConditionVariable cv_;
};
bool WaitableEvent::TimedWait(const TimeDelta& max_time) {
diff --git a/base/waitable_event_unittest.cc b/base/synchronization/waitable_event_unittest.cc
similarity index 90%
rename from base/waitable_event_unittest.cc
rename to base/synchronization/waitable_event_unittest.cc
index b2590a8..47e7ff7 100644
--- a/base/waitable_event_unittest.cc
+++ b/base/synchronization/waitable_event_unittest.cc
@@ -1,18 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/time.h"
-#include "base/waitable_event.h"
-#include "base/platform_thread.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::TimeDelta;
-using base::WaitableEvent;
-
-namespace {
-typedef testing::Test WaitableEventTest;
-}
+namespace base {
TEST(WaitableEventTest, ManualBasics) {
WaitableEvent event(true, false);
@@ -107,3 +102,5 @@
for (unsigned i = 0; i < 5; ++i)
delete ev[i];
}
+
+} // namespace base
diff --git a/base/waitable_event_watcher.h b/base/synchronization/waitable_event_watcher.h
similarity index 92%
rename from base/waitable_event_watcher.h
rename to base/synchronization/waitable_event_watcher.h
index 04aa8cf..1b93b66 100644
--- a/base/waitable_event_watcher.h
+++ b/base/synchronization/waitable_event_watcher.h
@@ -1,18 +1,18 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#ifndef BASE_WAITABLE_EVENT_WATCHER_H_
-#define BASE_WAITABLE_EVENT_WATCHER_H_
+#ifndef BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_
+#define BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_
#pragma once
#include "build/build_config.h"
#if defined(OS_WIN)
-#include "base/object_watcher.h"
+#include "base/win/object_watcher.h"
#else
#include "base/message_loop.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#endif
namespace base {
@@ -115,8 +115,6 @@
}
private:
- WaitableEvent* event_;
-
#if defined(OS_WIN)
// ---------------------------------------------------------------------------
// The helper class exists because, if WaitableEventWatcher were to inherit
@@ -124,7 +122,7 @@
// called Delegate (at least on Windows). Thus this object exists to proxy
// the callback function
// ---------------------------------------------------------------------------
- class ObjectWatcherHelper : public ObjectWatcher::Delegate {
+ class ObjectWatcherHelper : public win::ObjectWatcher::Delegate {
public:
ObjectWatcherHelper(WaitableEventWatcher* watcher);
@@ -140,7 +138,7 @@
void OnObjectSignaled();
ObjectWatcherHelper helper_;
- ObjectWatcher watcher_;
+ win::ObjectWatcher watcher_;
#else
// ---------------------------------------------------------------------------
// Implementation of MessageLoop::DestructionObserver
@@ -154,9 +152,11 @@
scoped_refptr<WaitableEvent::WaitableEventKernel> kernel_;
#endif
+ WaitableEvent* event_;
+
Delegate* delegate_;
};
} // namespace base
-#endif // BASE_WAITABLE_EVENT_WATCHER_H_
+#endif // BASE_SYNCHRONIZATION_WAITABLE_EVENT_WATCHER_H_
diff --git a/base/waitable_event_watcher_posix.cc b/base/synchronization/waitable_event_watcher_posix.cc
similarity index 96%
rename from base/waitable_event_watcher_posix.cc
rename to base/synchronization/waitable_event_watcher_posix.cc
index 07ae694..0d6ff26 100644
--- a/base/waitable_event_watcher_posix.cc
+++ b/base/synchronization/waitable_event_watcher_posix.cc
@@ -1,13 +1,12 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/waitable_event_watcher.h"
+#include "base/synchronization/waitable_event_watcher.h"
-#include "base/condition_variable.h"
-#include "base/lock.h"
#include "base/message_loop.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/lock.h"
+#include "base/synchronization/waitable_event.h"
namespace base {
@@ -119,11 +118,11 @@
};
WaitableEventWatcher::WaitableEventWatcher()
- : event_(NULL),
- message_loop_(NULL),
+ : message_loop_(NULL),
cancel_flag_(NULL),
waiter_(NULL),
callback_task_(NULL),
+ event_(NULL),
delegate_(NULL) {
}
diff --git a/base/waitable_event_watcher_unittest.cc b/base/synchronization/waitable_event_watcher_unittest.cc
similarity index 93%
rename from base/waitable_event_watcher_unittest.cc
rename to base/synchronization/waitable_event_watcher_unittest.cc
index e6a6ac0..1715dff 100644
--- a/base/waitable_event_watcher_unittest.cc
+++ b/base/synchronization/waitable_event_watcher_unittest.cc
@@ -1,15 +1,14 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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 "base/message_loop.h"
-#include "base/platform_thread.h"
-#include "base/waitable_event.h"
-#include "base/waitable_event_watcher.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/synchronization/waitable_event_watcher.h"
+#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::WaitableEvent;
-using base::WaitableEventWatcher;
+namespace base {
namespace {
@@ -81,7 +80,7 @@
event.Signal();
// Let the background thread do its business
- PlatformThread::Sleep(30);
+ base::PlatformThread::Sleep(30);
watcher.StopWatching();
@@ -162,3 +161,5 @@
RunTest_DeleteUnder(MessageLoop::TYPE_IO);
RunTest_DeleteUnder(MessageLoop::TYPE_UI);
}
+
+} // namespace base
diff --git a/base/waitable_event_watcher_win.cc b/base/synchronization/waitable_event_watcher_win.cc
similarity index 80%
rename from base/waitable_event_watcher_win.cc
rename to base/synchronization/waitable_event_watcher_win.cc
index 7619aa4..43e3c47 100644
--- a/base/waitable_event_watcher_win.cc
+++ b/base/synchronization/waitable_event_watcher_win.cc
@@ -1,12 +1,12 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/waitable_event_watcher.h"
+#include "base/synchronization/waitable_event_watcher.h"
#include "base/compiler_specific.h"
-#include "base/object_watcher.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/win/object_watcher.h"
namespace base {
@@ -21,8 +21,8 @@
WaitableEventWatcher::WaitableEventWatcher()
- : event_(NULL),
- ALLOW_THIS_IN_INITIALIZER_LIST(helper_(this)),
+ : ALLOW_THIS_IN_INITIALIZER_LIST(helper_(this)),
+ event_(NULL),
delegate_(NULL) {
}
diff --git a/base/waitable_event_win.cc b/base/synchronization/waitable_event_win.cc
similarity index 95%
rename from base/waitable_event_win.cc
rename to base/synchronization/waitable_event_win.cc
index 3d0eb14..0fcf488 100644
--- a/base/waitable_event_win.cc
+++ b/base/synchronization/waitable_event_win.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include <math.h>
#include <windows.h>
diff --git a/base/sys_info_chromeos.cc b/base/sys_info_chromeos.cc
index e554d73..5834389 100644
--- a/base/sys_info_chromeos.cc
+++ b/base/sys_info_chromeos.cc
@@ -9,7 +9,7 @@
#include "base/file_util.h"
#include "base/string_number_conversions.h"
#include "base/string_tokenizer.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
namespace base {
diff --git a/base/task.h b/base/task.h
index e6e0d2d..fc986b2 100644
--- a/base/task.h
+++ b/base/task.h
@@ -6,7 +6,6 @@
#define BASE_TASK_H_
#pragma once
-#include "base/non_thread_safe.h"
#include "base/raw_scoped_refptr_mismatch_checker.h"
#include "base/tracked.h"
#include "base/tuple.h"
@@ -228,7 +227,7 @@
struct RunnableMethodTraits {
RunnableMethodTraits() {
#ifndef NDEBUG
- origin_thread_id_ = PlatformThread::CurrentId();
+ origin_thread_id_ = base::PlatformThread::CurrentId();
#endif
}
@@ -236,7 +235,7 @@
#ifndef NDEBUG
// If destroyed on a separate thread, then we had better have been using
// thread-safe reference counting!
- if (origin_thread_id_ != PlatformThread::CurrentId())
+ if (origin_thread_id_ != base::PlatformThread::CurrentId())
DCHECK(T::ImplementsThreadSafeReferenceCounting());
#endif
}
@@ -258,7 +257,7 @@
private:
#ifndef NDEBUG
- PlatformThreadId origin_thread_id_;
+ base::PlatformThreadId origin_thread_id_;
#endif
};
diff --git a/base/task_queue.cc b/base/task_queue.cc
index e3c196b..fdff8ac 100644
--- a/base/task_queue.cc
+++ b/base/task_queue.cc
@@ -15,6 +15,22 @@
STLDeleteElements(&queue_);
}
+void TaskQueue::Push(Task* task) {
+ DCHECK(task);
+
+ // Add the task to the back of the queue.
+ queue_.push_back(task);
+}
+
+void TaskQueue::Clear() {
+ // Delete all the elements in the queue and clear the dead pointers.
+ STLDeleteElements(&queue_);
+}
+
+bool TaskQueue::IsEmpty() const {
+ return queue_.empty();
+}
+
void TaskQueue::Run() {
// Nothing to run if our queue is empty.
if (queue_.empty())
@@ -31,19 +47,3 @@
delete (*task);
}
}
-
-void TaskQueue::Push(Task* task) {
- DCHECK(task);
-
- // Add the task to the back of the queue.
- queue_.push_back(task);
-}
-
-void TaskQueue::Clear() {
- // Delete all the elements in the queue and clear the dead pointers.
- STLDeleteElements(&queue_);
-}
-
-bool TaskQueue::IsEmpty() const {
- return queue_.empty();
-}
diff --git a/base/task_queue.h b/base/task_queue.h
index 5bfc777..75b38b2 100644
--- a/base/task_queue.h
+++ b/base/task_queue.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -18,10 +18,6 @@
TaskQueue();
~TaskQueue();
- // Run all the tasks in the queue. New tasks pushed onto the queue during
- // a run will be run next time |Run| is called.
- virtual void Run();
-
// Push the specified task onto the queue. When the queue is run, the tasks
// will be run in the order they are pushed.
//
@@ -35,6 +31,10 @@
// Returns true if this queue contains no tasks.
bool IsEmpty() const;
+ // Run all the tasks in the queue. New tasks pushed onto the queue during
+ // a run will be run next time |Run| is called.
+ virtual void Run();
+
private:
// The list of tasks we are waiting to run.
std::deque<Task*> queue_;
diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc
index fc3d018..7ca7e84 100644
--- a/base/test/test_file_util_win.cc
+++ b/base/test/test_file_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,8 +12,8 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
-#include "base/scoped_handle.h"
+#include "base/win/scoped_handle.h"
+#include "base/threading/platform_thread.h"
namespace file_util {
@@ -32,14 +32,14 @@
for (int i = 0; i < 25; ++i) {
if (file_util::Delete(file, recurse))
return true;
- PlatformThread::Sleep(kTimeoutMs / 25);
+ base::PlatformThread::Sleep(kTimeoutMs / 25);
}
return false;
}
bool EvictFileFromSystemCache(const FilePath& file) {
// Request exclusive access to the file and overwrite it with no buffering.
- ScopedHandle file_handle(
+ base::win::ScopedHandle file_handle(
CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL,
OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL));
if (!file_handle)
@@ -203,7 +203,7 @@
// Windows does not guarantee that we will get the same contents even after
// the other process closes the handle, flushes the buffers, etc.
for (int i = 0; i < 20; i++) {
- PlatformThread::Sleep(1000);
+ base::PlatformThread::Sleep(1000);
const DWORD kShare = FILE_SHARE_READ |
FILE_SHARE_WRITE |
diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc
index 7d25a60..aa23f04 100644
--- a/base/test/test_suite.cc
+++ b/base/test/test_suite.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,9 +8,7 @@
#include "base/base_paths.h"
#include "base/base_switches.h"
#include "base/command_line.h"
-#include "base/debug_on_start.h"
-#include "base/debug_util.h"
-#include "base/debug/debugger.h"
+#include "base/debug/debug_on_start_win.h"
#include "base/debug/debugger.h"
#include "base/file_path.h"
#include "base/i18n/icu_util.h"
@@ -196,7 +194,7 @@
if (!base::debug::BeingDebugged() &&
!CommandLine::ForCurrentProcess()->HasSwitch("show-error-dialogs")) {
SuppressErrorDialogs();
- DebugUtil::SuppressDialogs();
+ base::debug::SetSuppressDebugUI(true);
logging::SetLogAssertHandler(UnitTestAssertHandler);
}
diff --git a/base/test/test_timeouts.cc b/base/test/test_timeouts.cc
index 046f320..016456e 100644
--- a/base/test/test_timeouts.cc
+++ b/base/test/test_timeouts.cc
@@ -55,7 +55,7 @@
int TestTimeouts::wait_for_terminate_timeout_ms_ = 15000;
// static
-int TestTimeouts::live_operation_timeout_ms_ = 30000;
+int TestTimeouts::live_operation_timeout_ms_ = 45000;
// static
void TestTimeouts::Initialize() {
diff --git a/base/non_thread_safe.cc b/base/threading/non_thread_safe.cc
similarity index 86%
rename from base/non_thread_safe.cc
rename to base/threading/non_thread_safe.cc
index b01ed55..8b41bc0 100644
--- a/base/non_thread_safe.cc
+++ b/base/threading/non_thread_safe.cc
@@ -2,13 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/non_thread_safe.h"
+#include "base/threading/non_thread_safe.h"
// These checks are only done in debug builds.
#ifndef NDEBUG
#include "base/logging.h"
+namespace base {
+
NonThreadSafe::~NonThreadSafe() {
DCHECK(CalledOnValidThread());
}
@@ -21,4 +23,6 @@
thread_checker_.DetachFromThread();
}
+} // namespace base
+
#endif // NDEBUG
diff --git a/base/non_thread_safe.h b/base/threading/non_thread_safe.h
similarity index 87%
rename from base/non_thread_safe.h
rename to base/threading/non_thread_safe.h
index 6f993ee..868a031 100644
--- a/base/non_thread_safe.h
+++ b/base/threading/non_thread_safe.h
@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_NON_THREAD_SAFE_H_
-#define BASE_NON_THREAD_SAFE_H_
+#ifndef BASE_THREADING_NON_THREAD_SAFE_H_
+#define BASE_THREADING_NON_THREAD_SAFE_H_
#pragma once
-#include "base/platform_thread.h"
-#include "base/thread_checker.h"
+#include "base/threading/thread_checker.h"
+
+namespace base {
// A helper class used to help verify that methods of a class are
// called from the same thread. One can inherit from this class and use
@@ -17,7 +18,7 @@
// aren't. For example, a service or a singleton like the preferences system.
//
// Example:
-// class MyClass : public NonThreadSafe {
+// class MyClass : public base::NonThreadSafe {
// public:
// void Foo() {
// DCHECK(CalledOnValidThread());
@@ -58,4 +59,6 @@
};
#endif // NDEBUG
+} // namespace base
+
#endif // BASE_NON_THREAD_SAFE_H_
diff --git a/base/non_thread_safe_unittest.cc b/base/threading/non_thread_safe_unittest.cc
similarity index 93%
rename from base/non_thread_safe_unittest.cc
rename to base/threading/non_thread_safe_unittest.cc
index 1db198b..7d158cf 100644
--- a/base/non_thread_safe_unittest.cc
+++ b/base/threading/non_thread_safe_unittest.cc
@@ -4,13 +4,15 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
-#include "base/simple_thread.h"
+#include "base/threading/non_thread_safe.h"
+#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#ifndef NDEBUG
+namespace base {
+
// Simple class to exersice the basics of NonThreadSafe.
// Both the destructor and DoStuff should verify that they were
// called on the same thread as the constructor.
@@ -32,7 +34,7 @@
};
// Calls NonThreadSafeClass::DoStuff on another thread.
-class CallDoStuffOnThread : public base::SimpleThread {
+class CallDoStuffOnThread : public SimpleThread {
public:
CallDoStuffOnThread(NonThreadSafeClass* non_thread_safe_class)
: SimpleThread("call_do_stuff_on_thread"),
@@ -50,7 +52,7 @@
};
// Deletes NonThreadSafeClass on a different thread.
-class DeleteNonThreadSafeClassOnThread : public base::SimpleThread {
+class DeleteNonThreadSafeClassOnThread : public SimpleThread {
public:
DeleteNonThreadSafeClassOnThread(NonThreadSafeClass* non_thread_safe_class)
: SimpleThread("delete_non_thread_safe_class_on_thread"),
@@ -123,4 +125,6 @@
#endif // GTEST_HAS_DEATH_TEST
+} // namespace base
+
#endif // NDEBUG
diff --git a/base/platform_thread.h b/base/threading/platform_thread.h
similarity index 88%
rename from base/platform_thread.h
rename to base/threading/platform_thread.h
index 43bf298..0a3c75d 100644
--- a/base/platform_thread.h
+++ b/base/threading/platform_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,30 +6,40 @@
// the low-level platform-specific abstraction to the OS's threading interface.
// You should instead be using a message-loop driven Thread, see thread.h.
-#ifndef BASE_PLATFORM_THREAD_H_
-#define BASE_PLATFORM_THREAD_H_
+#ifndef BASE_THREADING_PLATFORM_THREAD_H_
+#define BASE_THREADING_PLATFORM_THREAD_H_
#pragma once
#include "base/basictypes.h"
+#include "build/build_config.h"
+
+#if defined(OS_WIN)
+#include <windows.h>
+#elif defined(OS_POSIX)
+#include <pthread.h>
+#if defined(OS_MACOSX)
+#include <mach/mach.h>
+#else // OS_POSIX && !OS_MACOSX
+#include <unistd.h>
+#endif
+#endif
+
+namespace base {
// PlatformThreadHandle should not be assumed to be a numeric type, since the
// standard intends to allow pthread_t to be a structure. This means you
// should not initialize it to a value, like 0. If it's a member variable, the
// constructor can safely "value initialize" using () in the initializer list.
#if defined(OS_WIN)
-#include <windows.h>
typedef DWORD PlatformThreadId;
typedef void* PlatformThreadHandle; // HANDLE
const PlatformThreadHandle kNullThreadHandle = NULL;
#elif defined(OS_POSIX)
-#include <pthread.h>
typedef pthread_t PlatformThreadHandle;
const PlatformThreadHandle kNullThreadHandle = 0;
#if defined(OS_MACOSX)
-#include <mach/mach.h>
typedef mach_port_t PlatformThreadId;
#else // OS_POSIX && !OS_MACOSX
-#include <unistd.h>
typedef pid_t PlatformThreadId;
#endif
#endif
@@ -84,4 +94,6 @@
DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
};
-#endif // BASE_PLATFORM_THREAD_H_
+} // namespace base
+
+#endif // BASE_THREADING_PLATFORM_THREAD_H_
diff --git a/base/platform_thread_mac.mm b/base/threading/platform_thread_mac.mm
similarity index 94%
rename from base/platform_thread_mac.mm
rename to base/threading/platform_thread_mac.mm
index 36e08be..d77307c 100644
--- a/base/platform_thread_mac.mm
+++ b/base/threading/platform_thread_mac.mm
@@ -1,8 +1,8 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#import <Foundation/Foundation.h>
#include <dlfcn.h>
@@ -32,8 +32,6 @@
}
}
-} // namespace base
-
// static
void PlatformThread::SetName(const char* name) {
// pthread_setname_np is only available in 10.6 or later, so test
@@ -52,3 +50,5 @@
// See http://crbug.com/47058
dynamic_pthread_setname_np(shortened_name.c_str());
}
+
+} // namespace base
diff --git a/base/platform_thread_posix.cc b/base/threading/platform_thread_posix.cc
similarity index 96%
rename from base/platform_thread_posix.cc
rename to base/threading/platform_thread_posix.cc
index 9807ac6..8452909 100644
--- a/base/platform_thread_posix.cc
+++ b/base/threading/platform_thread_posix.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include <errno.h>
#include <sched.h>
@@ -10,7 +10,7 @@
#include "base/logging.h"
#include "base/safe_strerror_posix.h"
#include "base/scoped_ptr.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#if defined(OS_MACOSX)
#include <mach/mach.h>
@@ -29,10 +29,10 @@
#include <sys/nacl_syscalls.h>
#endif
-#if defined(OS_MACOSX)
namespace base {
+
+#if defined(OS_MACOSX)
void InitThreading();
-} // namespace base
#endif
namespace {
@@ -42,9 +42,7 @@
bool joinable;
};
-} // namespace
-
-static void* ThreadFunc(void* params) {
+void* ThreadFunc(void* params) {
ThreadParams* thread_params = static_cast<ThreadParams*>(params);
PlatformThread::Delegate* delegate = thread_params->delegate;
if (!thread_params->joinable)
@@ -54,6 +52,70 @@
return NULL;
}
+bool CreateThread(size_t stack_size, bool joinable,
+ PlatformThread::Delegate* delegate,
+ PlatformThreadHandle* thread_handle) {
+#if defined(OS_MACOSX)
+ base::InitThreading();
+#endif // OS_MACOSX
+
+ bool success = false;
+ pthread_attr_t attributes;
+ pthread_attr_init(&attributes);
+
+ // Pthreads are joinable by default, so only specify the detached attribute if
+ // the thread should be non-joinable.
+ if (!joinable) {
+ pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED);
+ }
+
+#if defined(OS_MACOSX)
+ // The Mac OS X default for a pthread stack size is 512kB.
+ // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses
+ // DEFAULT_STACK_SIZE for this purpose.
+ //
+ // 512kB isn't quite generous enough for some deeply recursive threads that
+ // otherwise request the default stack size by specifying 0. Here, adopt
+ // glibc's behavior as on Linux, which is to use the current stack size
+ // limit (ulimit -s) as the default stack size. See
+ // glibc-2.11.1/nptl/nptl-init.c's __pthread_initialize_minimal_internal. To
+ // avoid setting the limit below the Mac OS X default or the minimum usable
+ // stack size, these values are also considered. If any of these values
+ // can't be determined, or if stack size is unlimited (ulimit -s unlimited),
+ // stack_size is left at 0 to get the system default.
+ //
+ // Mac OS X normally only applies ulimit -s to the main thread stack. On
+ // contemporary OS X and Linux systems alike, this value is generally 8MB
+ // or in that neighborhood.
+ if (stack_size == 0) {
+ size_t default_stack_size;
+ struct rlimit stack_rlimit;
+ if (pthread_attr_getstacksize(&attributes, &default_stack_size) == 0 &&
+ getrlimit(RLIMIT_STACK, &stack_rlimit) == 0 &&
+ stack_rlimit.rlim_cur != RLIM_INFINITY) {
+ stack_size = std::max(std::max(default_stack_size,
+ static_cast<size_t>(PTHREAD_STACK_MIN)),
+ static_cast<size_t>(stack_rlimit.rlim_cur));
+ }
+ }
+#endif // OS_MACOSX
+
+ if (stack_size > 0)
+ pthread_attr_setstacksize(&attributes, stack_size);
+
+ ThreadParams* params = new ThreadParams;
+ params->delegate = delegate;
+ params->joinable = joinable;
+ success = !pthread_create(thread_handle, &attributes, ThreadFunc, params);
+
+ pthread_attr_destroy(&attributes);
+ if (!success)
+ delete params;
+ return success;
+}
+
+} // namespace
+
// static
PlatformThreadId PlatformThread::CurrentId() {
// Pthreads doesn't have the concept of a thread ID, so we have to reach down
@@ -135,72 +197,6 @@
}
#endif // defined(OS_LINUX)
-namespace {
-
-bool CreateThread(size_t stack_size, bool joinable,
- PlatformThread::Delegate* delegate,
- PlatformThreadHandle* thread_handle) {
-#if defined(OS_MACOSX)
- base::InitThreading();
-#endif // OS_MACOSX
-
- bool success = false;
- pthread_attr_t attributes;
- pthread_attr_init(&attributes);
-
- // Pthreads are joinable by default, so only specify the detached attribute if
- // the thread should be non-joinable.
- if (!joinable) {
- pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED);
- }
-
-#if defined(OS_MACOSX)
- // The Mac OS X default for a pthread stack size is 512kB.
- // Libc-594.1.4/pthreads/pthread.c's pthread_attr_init uses
- // DEFAULT_STACK_SIZE for this purpose.
- //
- // 512kB isn't quite generous enough for some deeply recursive threads that
- // otherwise request the default stack size by specifying 0. Here, adopt
- // glibc's behavior as on Linux, which is to use the current stack size
- // limit (ulimit -s) as the default stack size. See
- // glibc-2.11.1/nptl/nptl-init.c's __pthread_initialize_minimal_internal. To
- // avoid setting the limit below the Mac OS X default or the minimum usable
- // stack size, these values are also considered. If any of these values
- // can't be determined, or if stack size is unlimited (ulimit -s unlimited),
- // stack_size is left at 0 to get the system default.
- //
- // Mac OS X normally only applies ulimit -s to the main thread stack. On
- // contemporary OS X and Linux systems alike, this value is generally 8MB
- // or in that neighborhood.
- if (stack_size == 0) {
- size_t default_stack_size;
- struct rlimit stack_rlimit;
- if (pthread_attr_getstacksize(&attributes, &default_stack_size) == 0 &&
- getrlimit(RLIMIT_STACK, &stack_rlimit) == 0 &&
- stack_rlimit.rlim_cur != RLIM_INFINITY) {
- stack_size = std::max(std::max(default_stack_size,
- static_cast<size_t>(PTHREAD_STACK_MIN)),
- static_cast<size_t>(stack_rlimit.rlim_cur));
- }
- }
-#endif // OS_MACOSX
-
- if (stack_size > 0)
- pthread_attr_setstacksize(&attributes, stack_size);
-
- ThreadParams* params = new ThreadParams;
- params->delegate = delegate;
- params->joinable = joinable;
- success = !pthread_create(thread_handle, &attributes, ThreadFunc, params);
-
- pthread_attr_destroy(&attributes);
- if (!success)
- delete params;
- return success;
-}
-
-} // anonymous namespace
-
// static
bool PlatformThread::Create(size_t stack_size, Delegate* delegate,
PlatformThreadHandle* thread_handle) {
@@ -225,3 +221,5 @@
base::ThreadRestrictions::AssertIOAllowed();
pthread_join(thread_handle, NULL);
}
+
+} // namespace base
diff --git a/base/platform_thread_unittest.cc b/base/threading/platform_thread_unittest.cc
similarity index 91%
rename from base/platform_thread_unittest.cc
rename to base/threading/platform_thread_unittest.cc
index 9875aa8..4b49450 100644
--- a/base/platform_thread_unittest.cc
+++ b/base/threading/platform_thread_unittest.cc
@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
-typedef testing::Test PlatformThreadTest;
+namespace base {
// Trivial tests that thread runs and doesn't crash on create and join ---------
@@ -26,7 +26,7 @@
DISALLOW_COPY_AND_ASSIGN(TrivialThread);
};
-TEST_F(PlatformThreadTest, Trivial) {
+TEST(PlatformThreadTest, Trivial) {
TrivialThread thread;
PlatformThreadHandle handle = kNullThreadHandle;
@@ -36,7 +36,7 @@
ASSERT_TRUE(thread.did_run());
}
-TEST_F(PlatformThreadTest, TrivialTimesTen) {
+TEST(PlatformThreadTest, TrivialTimesTen) {
TrivialThread thread[10];
PlatformThreadHandle handle[arraysize(thread)];
@@ -72,7 +72,7 @@
DISALLOW_COPY_AND_ASSIGN(FunctionTestThread);
};
-TEST_F(PlatformThreadTest, Function) {
+TEST(PlatformThreadTest, Function) {
PlatformThreadId main_thread_id = PlatformThread::CurrentId();
FunctionTestThread thread;
@@ -85,7 +85,7 @@
EXPECT_NE(thread.thread_id(), main_thread_id);
}
-TEST_F(PlatformThreadTest, FunctionTimesTen) {
+TEST(PlatformThreadTest, FunctionTimesTen) {
PlatformThreadId main_thread_id = PlatformThread::CurrentId();
FunctionTestThread thread[10];
@@ -102,3 +102,5 @@
EXPECT_NE(thread[n].thread_id(), main_thread_id);
}
}
+
+} // namespace base
diff --git a/base/platform_thread_win.cc b/base/threading/platform_thread_win.cc
similarity index 96%
rename from base/platform_thread_win.cc
rename to base/threading/platform_thread_win.cc
index ac8a5db..734f404 100644
--- a/base/platform_thread_win.cc
+++ b/base/threading/platform_thread_win.cc
@@ -2,12 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/logging.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/win/windows_version.h"
+namespace base {
+
namespace {
// The information on how to set the thread name comes from
@@ -141,3 +143,5 @@
CloseHandle(thread_handle);
}
+
+} // namespace base
diff --git a/base/simple_thread.cc b/base/threading/simple_thread.cc
similarity index 96%
rename from base/simple_thread.cc
rename to base/threading/simple_thread.cc
index 086a430..2b030f6 100644
--- a/base/simple_thread.cc
+++ b/base/threading/simple_thread.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/string_number_conversions.h"
namespace base {
diff --git a/base/simple_thread.h b/base/threading/simple_thread.h
similarity index 94%
rename from base/simple_thread.h
rename to base/threading/simple_thread.h
index 13c46c0..f55bd62 100644
--- a/base/simple_thread.h
+++ b/base/threading/simple_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -37,8 +37,8 @@
// // The SimpleThread object is still valid, however you may not call Join
// // or Start again.
-#ifndef BASE_SIMPLE_THREAD_H_
-#define BASE_SIMPLE_THREAD_H_
+#ifndef BASE_THREADING_SIMPLE_THREAD_H_
+#define BASE_THREADING_SIMPLE_THREAD_H_
#pragma once
#include <string>
@@ -47,8 +47,8 @@
#include "base/basictypes.h"
#include "base/lock.h"
-#include "base/waitable_event.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
+#include "base/synchronization/waitable_event.h"
namespace base {
@@ -82,9 +82,6 @@
virtual void Start();
virtual void Join();
- // We follow the PlatformThread Delegate interface.
- virtual void ThreadMain();
-
// Subclasses should override the Run method.
virtual void Run() = 0;
@@ -103,6 +100,9 @@
// Return True if Join() has evern been called.
bool HasBeenJoined() { return joined_; }
+ // Overridden from PlatformThread::Delegate:
+ virtual void ThreadMain();
+
private:
const std::string name_prefix_;
std::string name_;
@@ -179,4 +179,4 @@
} // namespace base
-#endif // BASE_SIMPLE_THREAD_H_
+#endif // BASE_THREADING_SIMPLE_THREAD_H_
diff --git a/base/simple_thread_unittest.cc b/base/threading/simple_thread_unittest.cc
similarity index 69%
rename from base/simple_thread_unittest.cc
rename to base/threading/simple_thread_unittest.cc
index 208290a..4014d70 100644
--- a/base/simple_thread_unittest.cc
+++ b/base/threading/simple_thread_unittest.cc
@@ -3,14 +3,16 @@
// found in the LICENSE file.
#include "base/atomic_sequence_num.h"
-#include "base/simple_thread.h"
#include "base/string_number_conversions.h"
-#include "base/waitable_event.h"
+#include "base/threading/simple_thread.h"
+#include "base/synchronization/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace base {
+
namespace {
-class SetIntRunner : public base::DelegateSimpleThread::Delegate {
+class SetIntRunner : public DelegateSimpleThread::Delegate {
public:
SetIntRunner(int* ptr, int val) : ptr_(ptr), val_(val) { }
~SetIntRunner() { }
@@ -24,9 +26,9 @@
int val_;
};
-class WaitEventRunner : public base::DelegateSimpleThread::Delegate {
+class WaitEventRunner : public DelegateSimpleThread::Delegate {
public:
- explicit WaitEventRunner(base::WaitableEvent* event) : event_(event) { }
+ explicit WaitEventRunner(WaitableEvent* event) : event_(event) { }
~WaitEventRunner() { }
virtual void Run() {
@@ -35,27 +37,27 @@
EXPECT_TRUE(event_->IsSignaled());
}
private:
- base::WaitableEvent* event_;
+ WaitableEvent* event_;
};
-class SeqRunner : public base::DelegateSimpleThread::Delegate {
+class SeqRunner : public DelegateSimpleThread::Delegate {
public:
- explicit SeqRunner(base::AtomicSequenceNumber* seq) : seq_(seq) { }
+ explicit SeqRunner(AtomicSequenceNumber* seq) : seq_(seq) { }
virtual void Run() {
seq_->GetNext();
}
private:
- base::AtomicSequenceNumber* seq_;
+ AtomicSequenceNumber* seq_;
};
// We count up on a sequence number, firing on the event when we've hit our
// expected amount, otherwise we wait on the event. This will ensure that we
// have all threads outstanding until we hit our expected thread pool size.
-class VerifyPoolRunner : public base::DelegateSimpleThread::Delegate {
+class VerifyPoolRunner : public DelegateSimpleThread::Delegate {
public:
- VerifyPoolRunner(base::AtomicSequenceNumber* seq,
- int total, base::WaitableEvent* event)
+ VerifyPoolRunner(AtomicSequenceNumber* seq,
+ int total, WaitableEvent* event)
: seq_(seq), total_(total), event_(event) { }
virtual void Run() {
@@ -67,9 +69,9 @@
}
private:
- base::AtomicSequenceNumber* seq_;
+ AtomicSequenceNumber* seq_;
int total_;
- base::WaitableEvent* event_;
+ WaitableEvent* event_;
};
} // namespace
@@ -80,7 +82,7 @@
SetIntRunner runner(&stack_int, 7);
EXPECT_EQ(0, stack_int);
- base::DelegateSimpleThread thread(&runner, "int_setter");
+ DelegateSimpleThread thread(&runner, "int_setter");
EXPECT_FALSE(thread.HasBeenStarted());
EXPECT_FALSE(thread.HasBeenJoined());
EXPECT_EQ(0, stack_int);
@@ -97,10 +99,10 @@
TEST(SimpleThreadTest, WaitForEvent) {
// Create a thread, and wait for it to signal us.
- base::WaitableEvent event(true, false);
+ WaitableEvent event(true, false);
WaitEventRunner runner(&event);
- base::DelegateSimpleThread thread(&runner, "event_waiter");
+ DelegateSimpleThread thread(&runner, "event_waiter");
EXPECT_FALSE(event.IsSignaled());
thread.Start();
@@ -110,18 +112,18 @@
}
TEST(SimpleThreadTest, NamedWithOptions) {
- base::WaitableEvent event(true, false);
+ WaitableEvent event(true, false);
WaitEventRunner runner(&event);
- base::SimpleThread::Options options;
- base::DelegateSimpleThread thread(&runner, "event_waiter", options);
+ SimpleThread::Options options;
+ DelegateSimpleThread thread(&runner, "event_waiter", options);
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_FALSE(event.IsSignaled());
thread.Start();
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_EQ(thread.name(),
- std::string("event_waiter/") + base::IntToString(thread.tid()));
+ std::string("event_waiter/") + IntToString(thread.tid()));
event.Wait();
EXPECT_TRUE(event.IsSignaled());
@@ -130,13 +132,13 @@
// We keep the name and tid, even after the thread is gone.
EXPECT_EQ(thread.name_prefix(), "event_waiter");
EXPECT_EQ(thread.name(),
- std::string("event_waiter/") + base::IntToString(thread.tid()));
+ std::string("event_waiter/") + IntToString(thread.tid()));
}
TEST(SimpleThreadTest, ThreadPool) {
- base::AtomicSequenceNumber seq;
+ AtomicSequenceNumber seq;
SeqRunner runner(&seq);
- base::DelegateSimpleThreadPool pool("seq_runner", 10);
+ DelegateSimpleThreadPool pool("seq_runner", 10);
// Add work before we're running.
pool.AddWork(&runner, 300);
@@ -153,8 +155,8 @@
// We can reuse our pool. Verify that all 10 threads can actually run in
// parallel, so this test will only pass if there are actually 10 threads.
- base::AtomicSequenceNumber seq2;
- base::WaitableEvent event(true, false);
+ AtomicSequenceNumber seq2;
+ WaitableEvent event(true, false);
// Changing 9 to 10, for example, would cause us JoinAll() to never return.
VerifyPoolRunner verifier(&seq2, 9, &event);
pool.Start();
@@ -164,3 +166,5 @@
pool.JoinAll();
EXPECT_EQ(seq2.GetNext(), 10);
}
+
+} // namespace base
diff --git a/base/thread.cc b/base/threading/thread.cc
similarity index 96%
rename from base/thread.cc
rename to base/threading/thread.cc
index bc715f0..09f8847 100644
--- a/base/thread.cc
+++ b/base/threading/thread.cc
@@ -2,12 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/lazy_instance.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
-#include "base/thread_local.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread_local.h"
+#include "base/synchronization/waitable_event.h"
namespace base {
diff --git a/base/thread.h b/base/threading/thread.h
similarity index 98%
rename from base/thread.h
rename to base/threading/thread.h
index fc542f0..811dd80 100644
--- a/base/thread.h
+++ b/base/threading/thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -10,7 +10,7 @@
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
namespace base {
@@ -29,6 +29,10 @@
class Thread : PlatformThread::Delegate {
public:
struct Options {
+ Options() : message_loop_type(MessageLoop::TYPE_DEFAULT), stack_size(0) {}
+ Options(MessageLoop::Type type, size_t size)
+ : message_loop_type(type), stack_size(size) {}
+
// Specifies the type of message loop that will be allocated on the thread.
MessageLoop::Type message_loop_type;
@@ -36,10 +40,6 @@
// This does not necessarily correspond to the thread's initial stack size.
// A value of 0 indicates that the default maximum should be used.
size_t stack_size;
-
- Options() : message_loop_type(MessageLoop::TYPE_DEFAULT), stack_size(0) {}
- Options(MessageLoop::Type type, size_t size)
- : message_loop_type(type), stack_size(size) {}
};
// Constructor.
@@ -152,11 +152,11 @@
}
private:
+ bool thread_was_started() const { return started_; }
+
// PlatformThread::Delegate methods:
virtual void ThreadMain();
- bool thread_was_started() const { return started_; }
-
// Whether we successfully started the thread.
bool started_;
diff --git a/base/thread_checker.cc b/base/threading/thread_checker.cc
similarity index 90%
rename from base/thread_checker.cc
rename to base/threading/thread_checker.cc
index 52f9847..28ba400 100644
--- a/base/thread_checker.cc
+++ b/base/threading/thread_checker.cc
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/thread_checker.h"
+#include "base/threading/thread_checker.h"
// This code is only done in debug builds.
#ifndef NDEBUG
+namespace base {
+
ThreadChecker::ThreadChecker() : valid_thread_id_(kInvalidThreadId) {
EnsureThreadIdAssigned();
}
@@ -31,4 +33,6 @@
valid_thread_id_ = PlatformThread::CurrentId();
}
+} // namespace base
+
#endif // NDEBUG
diff --git a/base/thread_checker.h b/base/threading/thread_checker.h
similarity index 88%
rename from base/thread_checker.h
rename to base/threading/thread_checker.h
index c09bcbe..c0010fb 100644
--- a/base/thread_checker.h
+++ b/base/threading/thread_checker.h
@@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_THREAD_CHECKER_H_
-#define BASE_THREAD_CHECKER_H_
+#ifndef BASE_THREADING_THREAD_CHECKER_H_
+#define BASE_THREADING_THREAD_CHECKER_H_
#pragma once
#ifndef NDEBUG
#include "base/lock.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#endif // NDEBUG
+namespace base {
+
// Before using this class, please consider using NonThreadSafe as it
// makes it much easier to determine the nature of your class.
//
@@ -66,4 +68,6 @@
};
#endif // NDEBUG
-#endif // BASE_THREAD_CHECKER_H_
+} // namespace base
+
+#endif // BASE_THREADING_THREAD_CHECKER_H_
diff --git a/base/thread_checker_unittest.cc b/base/threading/thread_checker_unittest.cc
similarity index 96%
rename from base/thread_checker_unittest.cc
rename to base/threading/thread_checker_unittest.cc
index 6c55348..6ce5bf1 100644
--- a/base/thread_checker_unittest.cc
+++ b/base/threading/thread_checker_unittest.cc
@@ -4,13 +4,15 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/thread_checker.h"
#include "base/scoped_ptr.h"
-#include "base/simple_thread.h"
+#include "base/threading/thread_checker.h"
+#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
#ifndef NDEBUG
+namespace base {
+
// Simple class to exersice the basics of ThreadChecker.
// Both the destructor and DoStuff should verify that they were
// called on the same thread as the constructor.
@@ -139,4 +141,6 @@
#endif // GTEST_HAS_DEATH_TEST
+} // namespace base
+
#endif // NDEBUG
diff --git a/base/thread_collision_warner.cc b/base/threading/thread_collision_warner.cc
similarity index 92%
rename from base/thread_collision_warner.cc
rename to base/threading/thread_collision_warner.cc
index 1a13643..547e11c 100644
--- a/base/thread_collision_warner.cc
+++ b/base/threading/thread_collision_warner.cc
@@ -1,11 +1,11 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/thread_collision_warner.h"
+#include "base/threading/thread_collision_warner.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
namespace base {
diff --git a/base/thread_collision_warner.h b/base/threading/thread_collision_warner.h
similarity index 96%
rename from base/thread_collision_warner.h
rename to base/threading/thread_collision_warner.h
index 1e14d1a..17ed5a4 100644
--- a/base/thread_collision_warner.h
+++ b/base/threading/thread_collision_warner.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 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.
-#ifndef BASE_THREAD_COLLISION_WARNER_H_
-#define BASE_THREAD_COLLISION_WARNER_H_
+#ifndef BASE_THREADING_THREAD_COLLISION_WARNER_H_
+#define BASE_THREADING_THREAD_COLLISION_WARNER_H_
#pragma once
#include <memory>
@@ -240,4 +240,4 @@
} // namespace base
-#endif // BASE_THREAD_COLLISION_WARNER_H_
+#endif // BASE_THREADING_THREAD_COLLISION_WARNER_H_
diff --git a/base/thread_collision_warner_unittest.cc b/base/threading/thread_collision_warner_unittest.cc
similarity index 96%
rename from base/thread_collision_warner_unittest.cc
rename to base/threading/thread_collision_warner_unittest.cc
index b70cfbe..68987c3 100644
--- a/base/thread_collision_warner_unittest.cc
+++ b/base/threading/thread_collision_warner_unittest.cc
@@ -1,13 +1,13 @@
-// Copyright (c) 2008 The Chromium Authors. All rights reserved.
+// 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.
#include "base/compiler_specific.h"
#include "base/lock.h"
-#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
-#include "base/simple_thread.h"
-#include "base/thread_collision_warner.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/simple_thread.h"
+#include "base/threading/thread_collision_warner.h"
#include "testing/gtest/include/gtest/gtest.h"
// '' : local class member function does not have a body
@@ -190,7 +190,7 @@
void push(int value) {
DFAKE_SCOPED_LOCK(push_pop_);
- PlatformThread::Sleep(5000);
+ base::PlatformThread::Sleep(5000);
}
int pop() {
@@ -248,7 +248,7 @@
void push(int value) {
DFAKE_SCOPED_LOCK(push_pop_);
- PlatformThread::Sleep(2000);
+ base::PlatformThread::Sleep(2000);
}
int pop() {
@@ -318,7 +318,7 @@
void push(int) {
DFAKE_SCOPED_RECURSIVE_LOCK(push_pop_);
bar();
- PlatformThread::Sleep(2000);
+ base::PlatformThread::Sleep(2000);
}
int pop() {
diff --git a/base/thread_local.h b/base/threading/thread_local.h
similarity index 96%
rename from base/thread_local.h
rename to base/threading/thread_local.h
index eba48d2..069543f 100644
--- a/base/thread_local.h
+++ b/base/threading/thread_local.h
@@ -45,8 +45,8 @@
// return Singleton<ThreadLocalPointer<MyClass> >::get()->Get();
// }
-#ifndef BASE_THREAD_LOCAL_H_
-#define BASE_THREAD_LOCAL_H_
+#ifndef BASE_THREADING_THREAD_LOCAL_H_
+#define BASE_THREADING_THREAD_LOCAL_H_
#pragma once
#include "base/basictypes.h"
@@ -124,4 +124,4 @@
} // namespace base
-#endif // BASE_THREAD_LOCAL_H_
+#endif // BASE_THREADING_THREAD_LOCAL_H_
diff --git a/base/thread_local_posix.cc b/base/threading/thread_local_posix.cc
similarity index 87%
rename from base/thread_local_posix.cc
rename to base/threading/thread_local_posix.cc
index 4d03403..568fa4b 100644
--- a/base/thread_local_posix.cc
+++ b/base/threading/thread_local_posix.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/thread_local.h"
+#include "base/threading/thread_local.h"
#include <pthread.h>
diff --git a/base/thread_local_storage.h b/base/threading/thread_local_storage.h
similarity index 91%
rename from base/thread_local_storage.h
rename to base/threading/thread_local_storage.h
index b37a53c..204b653 100644
--- a/base/thread_local_storage.h
+++ b/base/threading/thread_local_storage.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_THREAD_LOCAL_STORAGE_H_
-#define BASE_THREAD_LOCAL_STORAGE_H_
+#ifndef BASE_THREADING_THREAD_LOCAL_STORAGE_H_
+#define BASE_THREADING_THREAD_LOCAL_STORAGE_H_
#pragma once
#include "base/basictypes.h"
@@ -12,6 +12,8 @@
#include <pthread.h>
#endif
+namespace base {
+
// Wrapper for thread local storage. This class doesn't do much except provide
// an API for portability.
class ThreadLocalStorage {
@@ -88,8 +90,6 @@
DISALLOW_COPY_AND_ASSIGN(ThreadLocalStorage);
};
-// Temporary backwards-compatible name.
-// TODO(evanm): replace all usage of TLSSlot.
-typedef ThreadLocalStorage::Slot TLSSlot;
+} // namespace base
-#endif // BASE_THREAD_LOCAL_STORAGE_H_
+#endif // BASE_THREADING_THREAD_LOCAL_STORAGE_H_
diff --git a/base/thread_local_storage_posix.cc b/base/threading/thread_local_storage_posix.cc
similarity index 85%
rename from base/thread_local_storage_posix.cc
rename to base/threading/thread_local_storage_posix.cc
index eac74fd..81b7332 100644
--- a/base/thread_local_storage_posix.cc
+++ b/base/threading/thread_local_storage_posix.cc
@@ -1,11 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/thread_local_storage.h"
+#include "base/threading/thread_local_storage.h"
#include "base/logging.h"
+namespace base {
+
ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor)
: initialized_(false) {
Initialize(destructor);
@@ -42,3 +44,5 @@
if (error)
NOTREACHED();
}
+
+} // namespace base
diff --git a/base/thread_local_storage_unittest.cc b/base/threading/thread_local_storage_unittest.cc
similarity index 80%
rename from base/thread_local_storage_unittest.cc
rename to base/threading/thread_local_storage_unittest.cc
index cb24c75..216e650 100644
--- a/base/thread_local_storage_unittest.cc
+++ b/base/threading/thread_local_storage_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,8 +7,8 @@
#include <process.h>
#endif
-#include "base/simple_thread.h"
-#include "base/thread_local_storage.h"
+#include "base/threading/simple_thread.h"
+#include "base/threading/thread_local_storage.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_WIN)
@@ -17,11 +17,14 @@
#pragma warning(disable : 4311 4312)
#endif
+namespace base {
+
+namespace {
+
const int kInitialTlsValue = 0x5555;
-static ThreadLocalStorage::Slot tls_slot(base::LINKER_INITIALIZED);
+static ThreadLocalStorage::Slot tls_slot(LINKER_INITIALIZED);
-
-class ThreadLocalStorageRunner : public base::DelegateSimpleThread::Delegate {
+class ThreadLocalStorageRunner : public DelegateSimpleThread::Delegate {
public:
explicit ThreadLocalStorageRunner(int* tls_value_ptr)
: tls_value_ptr_(tls_value_ptr) {}
@@ -54,6 +57,7 @@
*ptr = kInitialTlsValue;
}
+} // namespace
TEST(ThreadLocalStorageTest, Basics) {
ThreadLocalStorage::Slot slot;
@@ -69,7 +73,7 @@
const int kNumThreads = 5;
int values[kNumThreads];
ThreadLocalStorageRunner* thread_delegates[kNumThreads];
- base::DelegateSimpleThread* threads[kNumThreads];
+ DelegateSimpleThread* threads[kNumThreads];
tls_slot.Initialize(ThreadLocalStorageCleanup);
@@ -77,8 +81,8 @@
for (int index = 0; index < kNumThreads; index++) {
values[index] = kInitialTlsValue;
thread_delegates[index] = new ThreadLocalStorageRunner(&values[index]);
- threads[index] = new base::DelegateSimpleThread(thread_delegates[index],
- "tls thread");
+ threads[index] = new DelegateSimpleThread(thread_delegates[index],
+ "tls thread");
threads[index]->Start();
}
@@ -92,3 +96,5 @@
EXPECT_EQ(values[index], kInitialTlsValue);
}
}
+
+} // namespace base
diff --git a/base/thread_local_storage_win.cc b/base/threading/thread_local_storage_win.cc
similarity index 96%
rename from base/thread_local_storage_win.cc
rename to base/threading/thread_local_storage_win.cc
index 7f8ea27..2967a27 100644
--- a/base/thread_local_storage_win.cc
+++ b/base/threading/thread_local_storage_win.cc
@@ -1,13 +1,15 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/thread_local_storage.h"
+#include "base/threading/thread_local_storage.h"
#include <windows.h>
#include "base/logging.h"
+namespace base {
+
// In order to make TLS destructors work, we need to keep function
// pointers to the destructor for each TLS that we allocate.
// We make this work by allocating a single OS-level TLS, which
@@ -122,6 +124,8 @@
TlsSetValue(tls_key_, NULL);
}
+} // namespace base
+
// Thread Termination Callbacks.
// Windows doesn't support a per-thread destructor with its
// TLS primitives. So, we build it manually by inserting a
@@ -150,7 +154,7 @@
// On XP SP0 & SP1, the DLL_PROCESS_ATTACH is never seen. It is sent on SP2+
// and on W2K and W2K3. So don't assume it is sent.
if (DLL_THREAD_DETACH == reason || DLL_PROCESS_DETACH == reason)
- ThreadLocalStorage::ThreadExit();
+ base::ThreadLocalStorage::ThreadExit();
}
// .CRT$XLA to .CRT$XLZ is an array of PIMAGE_TLS_CALLBACK pointers that are
diff --git a/base/thread_local_unittest.cc b/base/threading/thread_local_unittest.cc
similarity index 93%
rename from base/thread_local_unittest.cc
rename to base/threading/thread_local_unittest.cc
index 7632c56..ba12898 100644
--- a/base/thread_local_unittest.cc
+++ b/base/threading/thread_local_unittest.cc
@@ -1,13 +1,15 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
#include "base/logging.h"
-#include "base/simple_thread.h"
-#include "base/thread_local.h"
-#include "base/waitable_event.h"
+#include "base/threading/simple_thread.h"
+#include "base/threading/thread_local.h"
+#include "base/synchronization/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace base {
+
namespace {
class ThreadLocalTesterBase : public base::DelegateSimpleThreadPool::Delegate {
@@ -157,3 +159,5 @@
EXPECT_FALSE(tlb.Get());
}
}
+
+} // namespace base
diff --git a/base/thread_local_win.cc b/base/threading/thread_local_win.cc
similarity index 88%
rename from base/thread_local_win.cc
rename to base/threading/thread_local_win.cc
index ea14a67..56d3a3a 100644
--- a/base/thread_local_win.cc
+++ b/base/threading/thread_local_win.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/thread_local.h"
+#include "base/threading/thread_local.h"
#include <windows.h>
diff --git a/base/thread_restrictions.cc b/base/threading/thread_restrictions.cc
similarity index 95%
rename from base/thread_restrictions.cc
rename to base/threading/thread_restrictions.cc
index 6767d80..a0c24b0 100644
--- a/base/thread_restrictions.cc
+++ b/base/threading/thread_restrictions.cc
@@ -2,14 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
// This entire file is compiled out in Release mode.
#ifndef NDEBUG
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/thread_local.h"
+#include "base/threading/thread_local.h"
namespace base {
diff --git a/base/thread_restrictions.h b/base/threading/thread_restrictions.h
similarity index 95%
rename from base/thread_restrictions.h
rename to base/threading/thread_restrictions.h
index 51e5a15..de8174f 100644
--- a/base/thread_restrictions.h
+++ b/base/threading/thread_restrictions.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_THREAD_RESTRICTIONS_H_
-#define BASE_THREAD_RESTRICTIONS_H_
+#ifndef BASE_THREADING_THREAD_RESTRICTIONS_H_
+#define BASE_THREADING_THREAD_RESTRICTIONS_H_
#include "base/basictypes.h"
@@ -97,4 +97,4 @@
} // namespace base
-#endif // BASE_THREAD_RESTRICTIONS_H_
+#endif // BASE_THREADING_THREAD_RESTRICTIONS_H_
diff --git a/base/thread_unittest.cc b/base/threading/thread_unittest.cc
similarity index 97%
rename from base/thread_unittest.cc
rename to base/threading/thread_unittest.cc
index 6b72b83..3748fc3 100644
--- a/base/thread_unittest.cc
+++ b/base/threading/thread_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include <vector>
@@ -35,7 +35,7 @@
explicit SleepSome(int msec) : msec_(msec) {
}
virtual void Run() {
- PlatformThread::Sleep(msec_);
+ base::PlatformThread::Sleep(msec_);
}
private:
int msec_;
@@ -47,7 +47,7 @@
virtual ~SleepInsideInitThread() { }
virtual void Init() {
- PlatformThread::Sleep(500);
+ base::PlatformThread::Sleep(500);
init_called_ = true;
}
bool InitCalled() { return init_called_; }
@@ -178,7 +178,7 @@
// instead to avoid busy waiting, but this is sufficient for
// testing purposes).
for (int i = 100; i >= 0 && !was_invoked; --i) {
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
}
EXPECT_TRUE(was_invoked);
}
diff --git a/base/watchdog.cc b/base/threading/watchdog.cc
similarity index 95%
rename from base/watchdog.cc
rename to base/threading/watchdog.cc
index f9326e1..cd21578 100644
--- a/base/watchdog.cc
+++ b/base/threading/watchdog.cc
@@ -2,17 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/watchdog.h"
+#include "base/threading/watchdog.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
-using base::TimeDelta;
-using base::TimeTicks;
-
-//------------------------------------------------------------------------------
-// Public API methods.
+namespace base {
// Start thread running in a Disarmed state.
Watchdog::Watchdog(const TimeDelta& duration,
@@ -144,3 +140,5 @@
TimeTicks Watchdog::last_debugged_alarm_time_ = TimeTicks();
// static
TimeDelta Watchdog::last_debugged_alarm_delay_;
+
+} // namespace base
diff --git a/base/watchdog.h b/base/threading/watchdog.h
similarity index 79%
rename from base/watchdog.h
rename to base/threading/watchdog.h
index b4262d4..4af45dc 100644
--- a/base/watchdog.h
+++ b/base/threading/watchdog.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -15,29 +15,31 @@
// a second thread, and their methods call (Arm() and Disarm()) return very
// quickly.
-#ifndef BASE_WATCHDOG_H__
-#define BASE_WATCHDOG_H__
+#ifndef BASE_THREADING_WATCHDOG_H_
+#define BASE_THREADING_WATCHDOG_H_
#pragma once
#include <string>
-#include "base/condition_variable.h"
-#include "base/lock.h"
-#include "base/platform_thread.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
+namespace base {
+
class Watchdog {
public:
// Constructor specifies how long the Watchdog will wait before alarming.
- Watchdog(const base::TimeDelta& duration,
+ Watchdog(const TimeDelta& duration,
const std::string& thread_watched_name,
bool enabled);
virtual ~Watchdog();
// Start timing, and alarm when time expires (unless we're disarm()ed.)
void Arm(); // Arm starting now.
- void ArmSomeTimeDeltaAgo(const base::TimeDelta& time_delta);
- void ArmAtStartTime(const base::TimeTicks start_time);
+ void ArmSomeTimeDeltaAgo(const TimeDelta& time_delta);
+ void ArmAtStartTime(const TimeTicks start_time);
// Reset time, and do not set off the alarm.
void Disarm();
@@ -57,9 +59,9 @@
}
virtual void ThreadMain();
private:
- Watchdog* watchdog_;
-
void SetThreadName() const;
+
+ Watchdog* watchdog_;
};
enum State {ARMED, DISARMED, SHUTDOWN };
@@ -69,12 +71,12 @@
Lock lock_; // Mutex for state_.
ConditionVariable condition_variable_;
State state_;
- const base::TimeDelta duration_; // How long after start_time_ do we alarm?
+ const TimeDelta duration_; // How long after start_time_ do we alarm?
const std::string thread_watched_name_;
PlatformThreadHandle handle_;
ThreadDelegate delegate_; // Store it, because it must outlive the thread.
- base::TimeTicks start_time_; // Start of epoch, and alarm after duration_.
+ TimeTicks start_time_; // Start of epoch, and alarm after duration_.
// When the debugger breaks (when we alarm), all the other alarms that are
// armed will expire (also alarm). To diminish this effect, we track any
@@ -84,11 +86,13 @@
// on alarms from callers that specify old times.
static Lock static_lock_; // Lock for access of static data...
// When did we last alarm and get stuck (for a while) in a debugger?
- static base::TimeTicks last_debugged_alarm_time_;
+ static TimeTicks last_debugged_alarm_time_;
// How long did we sit on a break in the debugger?
- static base::TimeDelta last_debugged_alarm_delay_;
+ static TimeDelta last_debugged_alarm_delay_;
DISALLOW_COPY_AND_ASSIGN(Watchdog);
};
-#endif // BASE_WATCHDOG_H__
+} // namespace base
+
+#endif // BASE_THREADING_WATCHDOG_H_
diff --git a/base/watchdog_unittest.cc b/base/threading/watchdog_unittest.cc
similarity index 96%
rename from base/watchdog_unittest.cc
rename to base/threading/watchdog_unittest.cc
index 658a31a..f96487b 100644
--- a/base/watchdog_unittest.cc
+++ b/base/threading/watchdog_unittest.cc
@@ -2,18 +2,15 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Tests for Watchdog class.
-
-#include "base/watchdog.h"
+#include "base/threading/watchdog.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
#include "base/spin_wait.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::TimeDelta;
-using base::TimeTicks;
+namespace base {
namespace {
@@ -50,6 +47,7 @@
}
};
+} // namespace
//------------------------------------------------------------------------------
// Actual tests
@@ -139,4 +137,4 @@
EXPECT_EQ(1, watchdog.alarm_counter());
}
-} // namespace
+} // namespace base
diff --git a/base/worker_pool.h b/base/threading/worker_pool.h
similarity index 82%
rename from base/worker_pool.h
rename to base/threading/worker_pool.h
index e0b75a9..9a02acc 100644
--- a/base/worker_pool.h
+++ b/base/threading/worker_pool.h
@@ -1,15 +1,17 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#ifndef BASE_WORKER_POOL_H_
-#define BASE_WORKER_POOL_H_
+#ifndef BASE_THREADING_WORKER_POOL_H_
+#define BASE_THREADING_WORKER_POOL_H_
#pragma once
#include "base/tracked.h"
class Task;
+namespace base {
+
// This is a facility that runs tasks that don't require a specific thread or
// a message loop.
//
@@ -28,4 +30,6 @@
Task* task, bool task_is_slow);
};
-#endif // BASE_WORKER_POOL_H_
+} // namespace base
+
+#endif // BASE_THREADING_WORKER_POOL_H_
diff --git a/base/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
similarity index 93%
rename from base/worker_pool_posix.cc
rename to base/threading/worker_pool_posix.cc
index 85e1d8e..8466403 100644
--- a/base/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -2,15 +2,17 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/worker_pool.h"
-#include "base/worker_pool_posix.h"
+#include "base/threading/worker_pool_posix.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/stringprintf.h"
#include "base/task.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/worker_pool.h"
+
+namespace base {
namespace {
@@ -32,8 +34,9 @@
};
WorkerPoolImpl::WorkerPoolImpl()
- : pool_(new base::PosixDynamicThreadPool(
- "WorkerPool", kIdleSecondsBeforeExit)) {}
+ : pool_(new base::PosixDynamicThreadPool("WorkerPool",
+ kIdleSecondsBeforeExit)) {
+}
WorkerPoolImpl::~WorkerPoolImpl() {
pool_->Terminate();
@@ -90,8 +93,6 @@
return true;
}
-namespace base {
-
PosixDynamicThreadPool::PosixDynamicThreadPool(
const std::string& name_prefix,
int idle_seconds_before_exit)
diff --git a/base/worker_pool_posix.h b/base/threading/worker_pool_posix.h
similarity index 90%
rename from base/worker_pool_posix.h
rename to base/threading/worker_pool_posix.h
index 73d8287..1b68aef 100644
--- a/base/worker_pool_posix.h
+++ b/base/threading/worker_pool_posix.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -21,19 +21,19 @@
// implementation of WorkerPool. No one else should be using these classes.
// These symbols are exported in a header purely for testing purposes.
-#ifndef BASE_WORKER_POOL_POSIX_H_
-#define BASE_WORKER_POOL_POSIX_H_
+#ifndef BASE_THREADING_WORKER_POOL_POSIX_H_
+#define BASE_THREADING_WORKER_POOL_POSIX_H_
#pragma once
#include <queue>
#include <string>
#include "base/basictypes.h"
-#include "base/condition_variable.h"
-#include "base/lock.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/platform_thread.h"
class Task;
@@ -86,4 +86,4 @@
} // namespace base
-#endif // BASE_WORKER_POOL_POSIX_H_
+#endif // BASE_THREADING_WORKER_POOL_POSIX_H_
diff --git a/base/worker_pool_posix_unittest.cc b/base/threading/worker_pool_posix_unittest.cc
similarity index 96%
rename from base/worker_pool_posix_unittest.cc
rename to base/threading/worker_pool_posix_unittest.cc
index 55453c8..332c55e 100644
--- a/base/worker_pool_posix_unittest.cc
+++ b/base/threading/worker_pool_posix_unittest.cc
@@ -1,16 +1,16 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/worker_pool_posix.h"
+#include "base/threading/worker_pool_posix.h"
#include <set>
-#include "base/condition_variable.h"
#include "base/lock.h"
-#include "base/platform_thread.h"
+#include "base/synchronization/condition_variable.h"
#include "base/task.h"
-#include "base/waitable_event.h"
+#include "base/threading/platform_thread.h"
+#include "base/synchronization/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -40,8 +40,6 @@
DISALLOW_COPY_AND_ASSIGN(PosixDynamicThreadPoolPeer);
};
-} // namespace base
-
namespace {
// IncrementingTask's main purpose is to increment a counter. It also updates a
@@ -177,6 +175,8 @@
base::WaitableEvent start_;
};
+} // namespace
+
TEST_F(PosixDynamicThreadPoolTest, Basic) {
EXPECT_EQ(0, peer_.num_idle_threads());
EXPECT_EQ(0U, unique_threads_.size());
@@ -265,4 +265,4 @@
EXPECT_EQ(4, counter_);
}
-} // namespace
+} // namespace base
diff --git a/base/worker_pool_unittest.cc b/base/threading/worker_pool_unittest.cc
similarity index 86%
rename from base/worker_pool_unittest.cc
rename to base/threading/worker_pool_unittest.cc
index f6bee96..f044e10 100644
--- a/base/worker_pool_unittest.cc
+++ b/base/threading/worker_pool_unittest.cc
@@ -3,15 +3,15 @@
// found in the LICENSE file.
#include "base/task.h"
-#include "base/waitable_event.h"
-#include "base/worker_pool.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/threading/worker_pool.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-using base::WaitableEvent;
-
typedef PlatformTest WorkerPoolTest;
+namespace base {
+
namespace {
class PostTaskTestTask : public Task {
@@ -27,6 +27,8 @@
WaitableEvent* event_;
};
+} // namespace
+
TEST_F(WorkerPoolTest, PostTask) {
WaitableEvent test_event(false, false);
WaitableEvent long_test_event(false, false);
@@ -41,4 +43,4 @@
EXPECT_TRUE(signaled);
}
-} // namespace
+} // namespace base
diff --git a/base/worker_pool_win.cc b/base/threading/worker_pool_win.cc
similarity index 83%
rename from base/worker_pool_win.cc
rename to base/threading/worker_pool_win.cc
index 3f383b9..2072e52 100644
--- a/base/worker_pool_win.cc
+++ b/base/threading/worker_pool_win.cc
@@ -1,12 +1,14 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "base/logging.h"
#include "base/task.h"
+namespace base {
+
namespace {
DWORD CALLBACK WorkItemCallback(void* param) {
@@ -34,3 +36,5 @@
return true;
}
+
+} // namespace base
diff --git a/base/time.h b/base/time.h
index 79e30b4..e1fbf96 100644
--- a/base/time.h
+++ b/base/time.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -385,6 +385,9 @@
private:
friend class TimeDelta;
+ explicit Time(int64 us) : us_(us) {
+ }
+
// Explodes the given time to either local time |is_local = true| or UTC
// |is_local = false|.
void Explode(bool is_local, Exploded* exploded) const;
@@ -393,9 +396,6 @@
// |is_local = true| or UTC |is_local = false|.
static Time FromExploded(bool is_local, const Exploded& exploded);
- explicit Time(int64 us) : us_(us) {
- }
-
// The representation of Jan 1, 1970 UTC in microseconds since the
// platform-dependent epoch.
static const int64 kTimeTToMicrosecondsOffset;
diff --git a/base/time_unittest.cc b/base/time_unittest.cc
index 6ddf4d3..6c64b48 100644
--- a/base/time_unittest.cc
+++ b/base/time_unittest.cc
@@ -1,10 +1,10 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
#include <time.h>
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -106,7 +106,7 @@
TEST(TimeTicks, Deltas) {
for (int index = 0; index < 50; index++) {
TimeTicks ticks_start = TimeTicks::Now();
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
TimeTicks ticks_stop = TimeTicks::Now();
TimeDelta delta = ticks_stop - ticks_start;
// Note: Although we asked for a 10ms sleep, if the
diff --git a/base/time_win_unittest.cc b/base/time_win_unittest.cc
index 4389e7a..3a96b91 100644
--- a/base/time_win_unittest.cc
+++ b/base/time_win_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,7 +6,7 @@
#include <mmsystem.h>
#include <process.h>
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -220,7 +220,7 @@
// Sleep for a few milliseconds (note that it means 1000 microseconds).
// If we check the drift too frequently, it's going to increase
// monotonically, making our measurement less realistic.
- PlatformThread::Sleep((i % 2 == 0) ? 1 : 2);
+ base::PlatformThread::Sleep((i % 2 == 0) ? 1 : 2);
total_drift += drift_microseconds;
}
diff --git a/base/timer_unittest.cc b/base/timer_unittest.cc
index 6453672..c2289c8 100644
--- a/base/timer_unittest.cc
+++ b/base/timer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -267,7 +267,7 @@
// When the timer is deleted, the DelayTimerFatalTarget should never be
// called.
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
}
} // namespace
diff --git a/base/tools_sanity_unittest.cc b/base/tools_sanity_unittest.cc
index 2824836..779c236 100644
--- a/base/tools_sanity_unittest.cc
+++ b/base/tools_sanity_unittest.cc
@@ -1,12 +1,14 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
#include "base/message_loop.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace base {
+
namespace {
// We use caps here just to ensure that the method name doesn't interfere with
@@ -136,3 +138,5 @@
delete thread1;
delete thread2;
}
+
+} // namespace base
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index 9db25ff..3646000 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -10,7 +10,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
using base::TimeDelta;
@@ -18,7 +18,7 @@
// A TLS slot to the TrackRegistry for the current thread.
// static
-TLSSlot ThreadData::tls_index_(base::LINKER_INITIALIZED);
+base::ThreadLocalStorage::Slot ThreadData::tls_index_(base::LINKER_INITIALIZED);
// A global state variable to prevent repeated initialization during tests.
// static
diff --git a/base/tracked_objects.h b/base/tracked_objects.h
index 8590a8c..07731ff 100644
--- a/base/tracked_objects.h
+++ b/base/tracked_objects.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,8 +11,8 @@
#include <vector>
#include "base/lock.h"
-#include "base/thread_local_storage.h"
#include "base/tracked.h"
+#include "base/threading/thread_local_storage.h"
// TrackedObjects provides a database of stats about objects (generally Tasks)
// that are tracked. Tracking means their birth, death, duration, birth thread,
@@ -307,6 +307,8 @@
void AddListOfLivingObjects();
private:
+ typedef std::map<const BirthOnThread*, int> BirthCount;
+
// This instance may be provided to several threads to contribute data. The
// following counter tracks how many more threads will contribute. When it is
// zero, then all asynchronous contributions are complete, and locked access
@@ -318,7 +320,6 @@
// The total number of births recorded at each location for which we have not
// seen a death count.
- typedef std::map<const BirthOnThread*, int> BirthCount;
BirthCount global_birth_count_;
Lock accumulation_lock_; // Protects access during accumulation phase.
@@ -571,7 +572,7 @@
static void ShutdownDisablingFurtherTracking();
// We use thread local store to identify which ThreadData to interact with.
- static TLSSlot tls_index_;
+ static base::ThreadLocalStorage::Slot tls_index_;
// Link to the most recently created instance (starts a null terminated list).
static ThreadData* first_;
diff --git a/base/values.cc b/base/values.cc
index 4553e68..3522569 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -263,6 +263,12 @@
///////////////////// BinaryValue ////////////////////
+BinaryValue::~BinaryValue() {
+ DCHECK(buffer_);
+ if (buffer_)
+ delete[] buffer_;
+}
+
// static
BinaryValue* BinaryValue::Create(char* buffer, size_t size) {
if (!buffer)
@@ -282,20 +288,6 @@
return new BinaryValue(buffer_copy, size);
}
-
-BinaryValue::BinaryValue(char* buffer, size_t size)
- : Value(TYPE_BINARY),
- buffer_(buffer),
- size_(size) {
- DCHECK(buffer_);
-}
-
-BinaryValue::~BinaryValue() {
- DCHECK(buffer_);
- if (buffer_)
- delete[] buffer_;
-}
-
Value* BinaryValue::DeepCopy() const {
return CreateWithCopiedBuffer(buffer_, size_);
}
@@ -309,6 +301,13 @@
return !memcmp(buffer_, other_binary->buffer_, size_);
}
+BinaryValue::BinaryValue(char* buffer, size_t size)
+ : Value(TYPE_BINARY),
+ buffer_(buffer),
+ size_(size) {
+ DCHECK(buffer_);
+}
+
///////////////////// DictionaryValue ////////////////////
DictionaryValue::DictionaryValue()
@@ -319,44 +318,6 @@
Clear();
}
-Value* DictionaryValue::DeepCopy() const {
- DictionaryValue* result = new DictionaryValue;
-
- for (ValueMap::const_iterator current_entry(dictionary_.begin());
- current_entry != dictionary_.end(); ++current_entry) {
- result->SetWithoutPathExpansion(current_entry->first,
- current_entry->second->DeepCopy());
- }
-
- return result;
-}
-
-bool DictionaryValue::Equals(const Value* other) const {
- if (other->GetType() != GetType())
- return false;
-
- const DictionaryValue* other_dict =
- static_cast<const DictionaryValue*>(other);
- key_iterator lhs_it(begin_keys());
- key_iterator rhs_it(other_dict->begin_keys());
- while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) {
- Value* lhs;
- Value* rhs;
- if (*lhs_it != *rhs_it ||
- !GetWithoutPathExpansion(*lhs_it, &lhs) ||
- !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) ||
- !lhs->Equals(rhs)) {
- return false;
- }
- ++lhs_it;
- ++rhs_it;
- }
- if (lhs_it != end_keys() || rhs_it != other_dict->end_keys())
- return false;
-
- return true;
-}
-
bool DictionaryValue::HasKey(const std::string& key) const {
DCHECK(IsStringUTF8(key));
ValueMap::const_iterator current_entry = dictionary_.find(key);
@@ -685,6 +646,44 @@
}
}
+Value* DictionaryValue::DeepCopy() const {
+ DictionaryValue* result = new DictionaryValue;
+
+ for (ValueMap::const_iterator current_entry(dictionary_.begin());
+ current_entry != dictionary_.end(); ++current_entry) {
+ result->SetWithoutPathExpansion(current_entry->first,
+ current_entry->second->DeepCopy());
+ }
+
+ return result;
+}
+
+bool DictionaryValue::Equals(const Value* other) const {
+ if (other->GetType() != GetType())
+ return false;
+
+ const DictionaryValue* other_dict =
+ static_cast<const DictionaryValue*>(other);
+ key_iterator lhs_it(begin_keys());
+ key_iterator rhs_it(other_dict->begin_keys());
+ while (lhs_it != end_keys() && rhs_it != other_dict->end_keys()) {
+ Value* lhs;
+ Value* rhs;
+ if (*lhs_it != *rhs_it ||
+ !GetWithoutPathExpansion(*lhs_it, &lhs) ||
+ !other_dict->GetWithoutPathExpansion(*rhs_it, &rhs) ||
+ !lhs->Equals(rhs)) {
+ return false;
+ }
+ ++lhs_it;
+ ++rhs_it;
+ }
+ if (lhs_it != end_keys() || rhs_it != other_dict->end_keys())
+ return false;
+
+ return true;
+}
+
///////////////////// ListValue ////////////////////
ListValue::ListValue() : Value(TYPE_LIST) {
diff --git a/base/values.h b/base/values.h
index 2719d27..d69a685 100644
--- a/base/values.h
+++ b/base/values.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -46,6 +46,17 @@
// creating instances of the subclasses.
class Value {
public:
+ enum ValueType {
+ TYPE_NULL = 0,
+ TYPE_BOOLEAN,
+ TYPE_INTEGER,
+ TYPE_REAL,
+ TYPE_STRING,
+ TYPE_BINARY,
+ TYPE_DICTIONARY,
+ TYPE_LIST
+ };
+
virtual ~Value();
// Convenience methods for creating Value objects for various
@@ -62,17 +73,6 @@
// is non-null, the new object has taken ownership of the buffer pointer.
static BinaryValue* CreateBinaryValue(char* buffer, size_t size);
- typedef enum {
- TYPE_NULL = 0,
- TYPE_BOOLEAN,
- TYPE_INTEGER,
- TYPE_REAL,
- TYPE_STRING,
- TYPE_BINARY,
- TYPE_DICTIONARY,
- TYPE_LIST
- } ValueType;
-
// Returns the type of the value stored by the current Value object.
// Each type will be implemented by only one subclass of Value, so it's
// safe to use the ValueType to determine whether you can cast from
@@ -167,6 +167,8 @@
class BinaryValue: public Value {
public:
+ virtual ~BinaryValue();
+
// Creates a Value to represent a binary buffer. The new object takes
// ownership of the pointer passed in, if successful.
// Returns NULL if buffer is NULL.
@@ -178,16 +180,14 @@
// Returns NULL if buffer is NULL.
static BinaryValue* CreateWithCopiedBuffer(const char* buffer, size_t size);
- virtual ~BinaryValue();
-
- // Subclassed methods
- virtual Value* DeepCopy() const;
- virtual bool Equals(const Value* other) const;
-
size_t GetSize() const { return size_; }
char* GetBuffer() { return buffer_; }
const char* GetBuffer() const { return buffer_; }
+ // Overridden from Value:
+ virtual Value* DeepCopy() const;
+ virtual bool Equals(const Value* other) const;
+
private:
// Constructor is private so that only objects with valid buffer pointers
// and size values can be created.
@@ -207,10 +207,6 @@
DictionaryValue();
virtual ~DictionaryValue();
- // Subclassed methods
- virtual Value* DeepCopy() const;
- virtual bool Equals(const Value* other) const;
-
// Returns true if the current dictionary has a value for the given key.
bool HasKey(const std::string& key) const;
@@ -333,6 +329,10 @@
key_iterator begin_keys() const { return key_iterator(dictionary_.begin()); }
key_iterator end_keys() const { return key_iterator(dictionary_.end()); }
+ // Overridden from Value:
+ virtual Value* DeepCopy() const;
+ virtual bool Equals(const Value* other) const;
+
private:
ValueMap dictionary_;
@@ -342,14 +342,12 @@
// This type of Value represents a list of other Value values.
class ListValue : public Value {
public:
+ typedef ValueVector::iterator iterator;
+ typedef ValueVector::const_iterator const_iterator;
+
ListValue();
~ListValue();
- // Subclassed methods
- virtual bool GetAsList(ListValue** out_value);
- virtual Value* DeepCopy() const;
- virtual bool Equals(const Value* other) const;
-
// Clears the contents of this ListValue
void Clear();
@@ -411,15 +409,17 @@
}
// Iteration
- typedef ValueVector::iterator iterator;
- typedef ValueVector::const_iterator const_iterator;
-
ListValue::iterator begin() { return list_.begin(); }
ListValue::iterator end() { return list_.end(); }
ListValue::const_iterator begin() const { return list_.begin(); }
ListValue::const_iterator end() const { return list_.end(); }
+ // Overridden from Value:
+ virtual bool GetAsList(ListValue** out_value);
+ virtual Value* DeepCopy() const;
+ virtual bool Equals(const Value* other) const;
+
private:
ValueVector list_;
diff --git a/base/version.cc b/base/version.cc
index 384be0a..571672c 100644
--- a/base/version.cc
+++ b/base/version.cc
@@ -12,6 +12,10 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+Version::Version() : is_valid_(false) {}
+
+Version::~Version() {}
+
// static
Version* Version::GetVersionFromString(const std::string& version_str) {
Version* vers = new Version();
@@ -23,10 +27,6 @@
return NULL;
}
-Version::Version() : is_valid_(false) {}
-
-Version::~Version() {}
-
Version* Version::Clone() const {
DCHECK(is_valid_);
Version* copy = new Version();
diff --git a/base/version.h b/base/version.h
index 2fda4ad..28ee227 100644
--- a/base/version.h
+++ b/base/version.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -17,11 +17,6 @@
// Each component is limited to a uint16.
class Version {
public:
- // The version string must be made up of 1 or more uint16's separated
- // by '.'. Returns NULL if string is not in this format.
- // Caller is responsible for freeing the Version object once done.
- static Version* GetVersionFromString(const std::string& version_str);
-
// Exposed only so that a Version can be stored in STL containers;
// any call to the methods below on a default-constructed Version
// will DCHECK.
@@ -29,6 +24,11 @@
~Version();
+ // The version string must be made up of 1 or more uint16's separated
+ // by '.'. Returns NULL if string is not in this format.
+ // Caller is responsible for freeing the Version object once done.
+ static Version* GetVersionFromString(const std::string& version_str);
+
// Creates a copy of this version. Caller takes ownership.
Version* Clone() const;
diff --git a/base/weak_ptr.h b/base/weak_ptr.h
index ed9ef66..6168367 100644
--- a/base/weak_ptr.h
+++ b/base/weak_ptr.h
@@ -53,8 +53,8 @@
#pragma once
#include "base/logging.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
namespace base {
@@ -64,7 +64,7 @@
class WeakReference {
public:
- class Flag : public RefCounted<Flag>, public NonThreadSafe {
+ class Flag : public RefCounted<Flag>, public base::NonThreadSafe {
public:
Flag(Flag** handle);
~Flag();
@@ -74,7 +74,7 @@
void Invalidate() { handle_ = NULL; }
bool is_valid() const { return handle_ != NULL; }
- void DetachFromThread() { NonThreadSafe::DetachFromThread(); }
+ void DetachFromThread() { base::NonThreadSafe::DetachFromThread(); }
private:
Flag** handle_;
diff --git a/base/weak_ptr_unittest.cc b/base/weak_ptr_unittest.cc
index b808401..bcaca9e 100644
--- a/base/weak_ptr_unittest.cc
+++ b/base/weak_ptr_unittest.cc
@@ -4,7 +4,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "base/message_loop.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/scoped_ptr.h"
#include "base/weak_ptr.h"
diff --git a/base/win/event_trace_consumer_unittest.cc b/base/win/event_trace_consumer_unittest.cc
index f11f459..efbfdf9 100644
--- a/base/win/event_trace_consumer_unittest.cc
+++ b/base/win/event_trace_consumer_unittest.cc
@@ -4,14 +4,16 @@
//
// Unit tests for event trace consumer_ base class.
#include "base/win/event_trace_consumer.h"
+
#include <list>
+
#include "base/basictypes.h"
-#include "base/win/event_trace_controller.h"
-#include "base/win/event_trace_provider.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/scoped_handle.h"
+#include "base/win/event_trace_controller.h"
+#include "base/win/event_trace_provider.h"
+#include "base/win/scoped_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
#include <initguid.h> // NOLINT - has to be last
@@ -63,14 +65,14 @@
::SetEvent(sank_event_.Get());
}
- static ScopedHandle sank_event_;
+ static base::win::ScopedHandle sank_event_;
static EventQueue events_;
private:
DISALLOW_COPY_AND_ASSIGN(TestConsumer);
};
-ScopedHandle TestConsumer::sank_event_;
+base::win::ScopedHandle TestConsumer::sank_event_;
EventQueue TestConsumer::events_;
const wchar_t* const kTestSessionName = L"TestLogSession";
@@ -175,8 +177,8 @@
}
TestConsumer consumer_;
- ScopedHandle consumer_ready_;
- ScopedHandle consumer_thread_;
+ base::win::ScopedHandle consumer_ready_;
+ base::win::ScopedHandle consumer_thread_;
};
} // namespace
diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc
index 2b3cd66..8eab40a 100644
--- a/base/win/event_trace_controller_unittest.cc
+++ b/base/win/event_trace_controller_unittest.cc
@@ -1,17 +1,19 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
//
// Unit tests for event trace controller.
-#include "base/win/event_trace_controller.h"
-#include "base/win/event_trace_provider.h"
+
+#include <initguid.h> // NOLINT.
+
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/scoped_handle.h"
#include "base/sys_info.h"
+#include "base/win/event_trace_controller.h"
+#include "base/win/event_trace_provider.h"
+#include "base/win/scoped_handle.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include <initguid.h> // NOLINT - must be last.
namespace {
@@ -50,7 +52,7 @@
::SetEvent(callback_event_.Get());
}
- ScopedHandle callback_event_;
+ base::win::ScopedHandle callback_event_;
DISALLOW_COPY_AND_ASSIGN(TestingProvider);
};
diff --git a/base/object_watcher.cc b/base/win/object_watcher.cc
similarity index 96%
rename from base/object_watcher.cc
rename to base/win/object_watcher.cc
index a15234b..4f5e7ab 100644
--- a/base/object_watcher.cc
+++ b/base/win/object_watcher.cc
@@ -1,12 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 "base/object_watcher.h"
+#include "base/win/object_watcher.h"
#include "base/logging.h"
namespace base {
+namespace win {
//-----------------------------------------------------------------------------
@@ -135,4 +136,5 @@
StopWatching();
}
+} // namespace win
} // namespace base
diff --git a/base/object_watcher.h b/base/win/object_watcher.h
similarity index 94%
rename from base/object_watcher.h
rename to base/win/object_watcher.h
index e05ceac..16534c2 100644
--- a/base/object_watcher.h
+++ b/base/win/object_watcher.h
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
-#ifndef BASE_OBJECT_WATCHER_H_
-#define BASE_OBJECT_WATCHER_H_
+#ifndef BASE_WIN_OBJECT_WATCHER_H_
+#define BASE_WIN_OBJECT_WATCHER_H_
#pragma once
#include <windows.h>
@@ -11,6 +11,7 @@
#include "base/message_loop.h"
namespace base {
+namespace win {
// A class that provides a means to asynchronously wait for a Windows object to
// become signaled. It is an abstraction around RegisterWaitForSingleObject
@@ -87,6 +88,7 @@
DISALLOW_COPY_AND_ASSIGN(ObjectWatcher);
};
+} // namespace win
} // namespace base
#endif // BASE_OBJECT_WATCHER_H_
diff --git a/base/object_watcher_unittest.cc b/base/win/object_watcher_unittest.cc
similarity index 89%
rename from base/object_watcher_unittest.cc
rename to base/win/object_watcher_unittest.cc
index 3605dbb..fe151d9 100644
--- a/base/object_watcher_unittest.cc
+++ b/base/win/object_watcher_unittest.cc
@@ -1,23 +1,26 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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 <process.h>
#include "base/message_loop.h"
-#include "base/object_watcher.h"
+#include "base/win/object_watcher.h"
#include "testing/gtest/include/gtest/gtest.h"
+namespace base {
+namespace win {
+
namespace {
-class QuitDelegate : public base::ObjectWatcher::Delegate {
+class QuitDelegate : public ObjectWatcher::Delegate {
public:
virtual void OnObjectSignaled(HANDLE object) {
MessageLoop::current()->Quit();
}
};
-class DecrementCountDelegate : public base::ObjectWatcher::Delegate {
+class DecrementCountDelegate : public ObjectWatcher::Delegate {
public:
explicit DecrementCountDelegate(int* counter) : counter_(counter) {
}
@@ -28,12 +31,10 @@
int* counter_;
};
-} // namespace
-
void RunTest_BasicSignal(MessageLoop::Type message_loop_type) {
MessageLoop message_loop(message_loop_type);
- base::ObjectWatcher watcher;
+ ObjectWatcher watcher;
EXPECT_EQ(NULL, watcher.GetWatchedObject());
// A manual-reset event that is not yet signaled.
@@ -55,7 +56,7 @@
void RunTest_BasicCancel(MessageLoop::Type message_loop_type) {
MessageLoop message_loop(message_loop_type);
- base::ObjectWatcher watcher;
+ ObjectWatcher watcher;
// A manual-reset event that is not yet signaled.
HANDLE event = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -73,7 +74,7 @@
void RunTest_CancelAfterSet(MessageLoop::Type message_loop_type) {
MessageLoop message_loop(message_loop_type);
- base::ObjectWatcher watcher;
+ ObjectWatcher watcher;
int counter = 1;
DecrementCountDelegate delegate(&counter);
@@ -105,7 +106,7 @@
// people use the Singleton pattern or atexit.
HANDLE event = CreateEvent(NULL, TRUE, FALSE, NULL); // not signaled
{
- base::ObjectWatcher watcher;
+ ObjectWatcher watcher;
{
MessageLoop message_loop(message_loop_type);
@@ -116,6 +117,8 @@
CloseHandle(event);
}
+} // namespace
+
//-----------------------------------------------------------------------------
TEST(ObjectWatcherTest, BasicSignal) {
@@ -141,3 +144,6 @@
RunTest_OutlivesMessageLoop(MessageLoop::TYPE_IO);
RunTest_OutlivesMessageLoop(MessageLoop::TYPE_UI);
}
+
+} // namespace win
+} // namespace base
diff --git a/base/win/registry.cc b/base/win/registry.cc
index f8e05a7..dbb8d7a 100644
--- a/base/win/registry.cc
+++ b/base/win/registry.cc
@@ -7,7 +7,7 @@
#include <shlwapi.h>
#include "base/logging.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#pragma comment(lib, "shlwapi.lib") // for SHDeleteKey
diff --git a/base/win/rgs_helper.h b/base/win/rgs_helper.h
deleted file mode 100644
index 16e33bf..0000000
--- a/base/win/rgs_helper.h
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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.
-//
-// Defines a map for adding variables to rgs files. This allows COM object
-// classes to declare the values of these variables so that we don't need to
-// copy/paste them and manually keep them in sync.
-// To use this, declare the registry ID of your RGS file using
-// the DECLARE_REGISTRY_RESOURCEID_EX macro, instead of the
-// DECLARE_REGISTRY_RESOURCEID, then add a registry map to your class
-// using the registry map macros:
-// BEGIN_REGISTRY_MAP(MyClassName)
-// REGMAP_ENTRY("NAME", "MyClassName Class")
-// REGMAP_ENTRY_UUID("CLSID", CLSID_MyClassName)
-// END_REGISTRY_MAP()
-//
-// You can then refer to the names above in your RGS file as
-// variables %NAME% and %CLSID%, respectively.
-#ifndef BASE_WIN_RGS_HELPER_H_
-#define BASE_WIN_RGS_HELPER_H_
-
-#include "base/string_util.h"
-
-struct ATLRegmapEntryHelper : public _ATL_REGMAP_ENTRY {
- ATLRegmapEntryHelper() {
- szKey = NULL;
- szData = NULL;
- }
- ATLRegmapEntryHelper(LPCOLESTR key, LPCOLESTR data) {
- szKey = key;
- size_t size = lstrlen(data) + 1;
- szData = new wchar_t[size];
- base::wcslcpy(const_cast<wchar_t*>(szData), data, size);
- }
-
- ATLRegmapEntryHelper(LPCOLESTR key, UINT resid) {
- wchar_t data[256] = {0};
- szKey = key;
- if (::LoadString(_pModule->m_hInstResource, resid, data,
- arraysize(data) - 1) == 0) {
- *data = L'\0';
- }
-
- size_t size = lstrlen(data) + 1;
-
- szData = new wchar_t[size];
- base::wcslcpy(const_cast<wchar_t*>(szData), data, size);
- }
-
- ATLRegmapEntryHelper(LPCOLESTR key, REFGUID guid) {
- szKey = key;
- static const size_t kGuidStringSize = 40;
- szData = new wchar_t[kGuidStringSize];
- if (szData) {
- if (::StringFromGUID2(guid, const_cast<LPOLESTR>(szData),
- kGuidStringSize) == 0) {
- *const_cast<LPOLESTR>(szData) = L'\0';
- }
- }
- }
- ~ATLRegmapEntryHelper() {
- delete [] szData;
- }
-};
-
-#define BEGIN_REGISTRY_MAP(x)\
- static struct _ATL_REGMAP_ENTRY *_GetRegistryMap() {\
- static const ATLRegmapEntryHelper map[] = {
-#define REGMAP_ENTRY(x, y) ATLRegmapEntryHelper(OLESTR(##x), OLESTR(##y)),
-
-#define REGMAP_UUID(x, clsid) ATLRegmapEntryHelper(OLESTR(##x), clsid),
-
-// This allows usage of a Resource string.
-#define REGMAP_RESOURCE(x, resid) ATLRegmapEntryHelper(OLESTR(##x), resid),
-
-// This allows usage of a static function to be called to provide the string.
-#define REGMAP_FUNCTION(x, f) ATLRegmapEntryHelper(OLESTR(##x), ##f()),
-
-#define END_REGISTRY_MAP() ATLRegmapEntryHelper() };\
- return (_ATL_REGMAP_ENTRY*)map;\
- }
-
-#define DECLARE_REGISTRY_RESOURCEID_EX(x)\
- static HRESULT WINAPI UpdateRegistry(BOOL bRegister) {\
- return ATL::_pAtlModule->UpdateRegistryFromResource((UINT)x, bRegister, \
- _GetRegistryMap());\
- }
-
-#endif // BASE_WIN_RGS_HELPER_H_
diff --git a/base/win_util.cc b/base/win/win_util.cc
similarity index 67%
rename from base/win_util.cc
rename to base/win/win_util.cc
index 3fcfb92..87905ea 100644
--- a/base/win_util.cc
+++ b/base/win/win_util.cc
@@ -1,8 +1,8 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "base/win_util.h"
+#include "base/win/win_util.h"
#include <aclapi.h>
#include <shobjidl.h> // Must be before propkey.
@@ -13,14 +13,15 @@
#include "base/logging.h"
#include "base/win/registry.h"
-#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
+#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
-namespace win_util {
+namespace base {
+namespace win {
#define SIZEOF_STRUCT_WITH_SPECIFIED_LAST_MEMBER(struct_name, member) \
offsetof(struct_name, member) + \
@@ -46,7 +47,7 @@
HANDLE token = NULL;
if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token))
return false;
- ScopedHandle token_scoped(token);
+ base::win::ScopedHandle token_scoped(token);
DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE;
scoped_array<BYTE> user_bytes(new BYTE[size]);
@@ -70,30 +71,6 @@
return true;
}
-#pragma warning(push)
-#pragma warning(disable:4312 4244)
-WNDPROC SetWindowProc(HWND hwnd, WNDPROC proc) {
- // The reason we don't return the SetwindowLongPtr() value is that it returns
- // the orignal window procedure and not the current one. I don't know if it is
- // a bug or an intended feature.
- WNDPROC oldwindow_proc =
- reinterpret_cast<WNDPROC>(GetWindowLongPtr(hwnd, GWLP_WNDPROC));
- SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(proc));
- return oldwindow_proc;
-}
-
-void* SetWindowUserData(HWND hwnd, void* user_data) {
- return
- reinterpret_cast<void*>(SetWindowLongPtr(hwnd, GWLP_USERDATA,
- reinterpret_cast<LONG_PTR>(user_data)));
-}
-
-void* GetWindowUserData(HWND hwnd) {
- return reinterpret_cast<void*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
-}
-
-#pragma warning(pop)
-
bool IsShiftPressed() {
return (::GetKeyState(VK_SHIFT) & 0x8000) == 0x8000;
}
@@ -106,27 +83,6 @@
return (::GetKeyState(VK_MENU) & 0x8000) == 0x8000;
}
-std::wstring GetClassName(HWND window) {
- // GetClassNameW will return a truncated result (properly null terminated) if
- // the given buffer is not large enough. So, it is not possible to determine
- // that we got the entire class name if the result is exactly equal to the
- // size of the buffer minus one.
- DWORD buffer_size = MAX_PATH;
- while (true) {
- std::wstring output;
- DWORD size_ret =
- GetClassNameW(window, WriteInto(&output, buffer_size), buffer_size);
- if (size_ret == 0)
- break;
- if (size_ret < (buffer_size - 1)) {
- output.resize(size_ret);
- return output;
- }
- buffer_size *= 2;
- }
- return std::wstring(); // error
-}
-
bool UserAccountControlIsEnabled() {
// This can be slow if Windows ends up going to disk. Should watch this key
// for changes and only read it once, preferably on the file thread.
@@ -144,28 +100,6 @@
return (uac_enabled != 0);
}
-std::wstring FormatMessage(unsigned messageid) {
- wchar_t* string_buffer = NULL;
- unsigned string_length = ::FormatMessage(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS, NULL, messageid, 0,
- reinterpret_cast<wchar_t *>(&string_buffer), 0, NULL);
-
- std::wstring formatted_string;
- if (string_buffer) {
- formatted_string = string_buffer;
- LocalFree(reinterpret_cast<HLOCAL>(string_buffer));
- } else {
- // The formating failed. simply convert the message value into a string.
- base::SStringPrintf(&formatted_string, L"message number %d", messageid);
- }
- return formatted_string;
-}
-
-std::wstring FormatLastWin32Error() {
- return FormatMessage(GetLastError());
-}
-
bool SetAppIdForPropertyStore(IPropertyStore* property_store,
const wchar_t* app_id) {
DCHECK(property_store);
@@ -202,7 +136,8 @@
return autorun_key.DeleteValue(name.c_str());
}
-} // namespace win_util
+} // namespace win
+} // namespace base
#ifdef _MSC_VER
//
diff --git a/base/win_util.h b/base/win/win_util.h
similarity index 65%
rename from base/win_util.h
rename to base/win/win_util.h
index 4ba7eeb..187e42d 100644
--- a/base/win_util.h
+++ b/base/win/win_util.h
@@ -2,8 +2,25 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_WIN_UTIL_H_
-#define BASE_WIN_UTIL_H_
+// =============================================================================
+// PLEASE READ
+//
+// In general, you should not be adding stuff to this file.
+//
+// - If your thing is only used in one place, just put it in a reasonable
+// location in or near that one place. It's nice you want people to be able
+// to re-use your function, but realistically, if it hasn't been necessary
+// before after so many years of development, it's probably not going to be
+// used in other places in the future unless you know of them now.
+//
+// - If your thing is used by multiple callers and is UI-related, it should
+// probably be in app/win/ instead. Try to put it in the most specific file
+// possible (avoiding the *_util files when practical).
+//
+// =============================================================================
+
+#ifndef BASE_WIN_WIN_UTIL_H_
+#define BASE_WIN_WIN_UTIL_H_
#pragma once
#include <windows.h>
@@ -16,21 +33,14 @@
struct _tagpropertykey;
typedef _tagpropertykey PROPERTYKEY;
-namespace win_util {
+namespace base {
+namespace win {
void GetNonClientMetrics(NONCLIENTMETRICS* metrics);
// Returns the string representing the current user sid.
bool GetUserSidString(std::wstring* user_sid);
-// Useful for subclassing a HWND. Returns the previous window procedure.
-WNDPROC SetWindowProc(HWND hwnd, WNDPROC wndproc);
-
-// Pointer-friendly wrappers around Get/SetWindowLong(..., GWLP_USERDATA, ...)
-// Returns the previously set value.
-void* SetWindowUserData(HWND hwnd, void* user_data);
-void* GetWindowUserData(HWND hwnd);
-
// Returns true if the shift key is currently pressed.
bool IsShiftPressed();
@@ -40,10 +50,6 @@
// Returns true if the alt key is currently pressed.
bool IsAltPressed();
-// A version of the GetClassNameW API that returns the class name in an
-// std::wstring. An empty result indicates a failure to get the class name.
-std::wstring GetClassName(HWND window);
-
// Returns false if user account control (UAC) has been disabled with the
// EnableLUA registry flag. Returns true if user account control is enabled.
// NOTE: The EnableLUA registry flag, which is ignored on Windows XP
@@ -52,13 +58,6 @@
// if the OS is Vista.
bool UserAccountControlIsEnabled();
-// Use the Win32 API FormatMessage() function to generate a string, using
-// Windows's default Message Compiled resources; ignoring the inserts.
-std::wstring FormatMessage(unsigned messageid);
-
-// Uses the last Win32 error to generate a human readable message string.
-std::wstring FormatLastWin32Error();
-
// Sets the application id in given IPropertyStore. The function is intended
// for tagging application/chromium shortcut, browser window and jump list for
// Win7.
@@ -73,6 +72,7 @@
// could be HKCU or HKLM or the root of any user hive.
bool RemoveCommandFromAutoRun(HKEY root_key, const string16& name);
-} // namespace win_util
+} // namespace win
+} // namespace base
-#endif // BASE_WIN_UTIL_H_
+#endif // BASE_WIN_WIN_UTIL_H_
diff --git a/base/win/win_util_unittest.cc b/base/win/win_util_unittest.cc
new file mode 100644
index 0000000..b79ed56
--- /dev/null
+++ b/base/win/win_util_unittest.cc
@@ -0,0 +1,58 @@
+// 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.
+
+#include <windows.h>
+
+#include "base/basictypes.h"
+#include "base/string_util.h"
+#include "base/win/win_util.h"
+#include "base/win/windows_version.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace base {
+namespace win {
+
+namespace {
+
+// Saves the current thread's locale ID when initialized, and restores it when
+// the instance is going out of scope.
+class ThreadLocaleSaver {
+ public:
+ ThreadLocaleSaver() : original_locale_id_(GetThreadLocale()) {}
+ ~ThreadLocaleSaver() { SetThreadLocale(original_locale_id_); }
+
+ private:
+ LCID original_locale_id_;
+
+ DISALLOW_COPY_AND_ASSIGN(ThreadLocaleSaver);
+};
+
+} // namespace
+
+// The test is somewhat silly, because the Vista bots some have UAC enabled
+// and some have it disabled. At least we check that it does not crash.
+TEST(BaseWinUtilTest, TestIsUACEnabled) {
+ if (GetVersion() >= base::win::VERSION_VISTA) {
+ UserAccountControlIsEnabled();
+ } else {
+ EXPECT_TRUE(UserAccountControlIsEnabled());
+ }
+}
+
+TEST(BaseWinUtilTest, TestGetUserSidString) {
+ std::wstring user_sid;
+ EXPECT_TRUE(GetUserSidString(&user_sid));
+ EXPECT_TRUE(!user_sid.empty());
+}
+
+TEST(BaseWinUtilTest, TestGetNonClientMetrics) {
+ NONCLIENTMETRICS metrics = {0};
+ GetNonClientMetrics(&metrics);
+ EXPECT_TRUE(metrics.cbSize > 0);
+ EXPECT_TRUE(metrics.iScrollWidth > 0);
+ EXPECT_TRUE(metrics.iScrollHeight > 0);
+}
+
+} // namespace win
+} // namespace base
diff --git a/base/win_util_unittest.cc b/base/win_util_unittest.cc
deleted file mode 100644
index 673bc84..0000000
--- a/base/win_util_unittest.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// 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.
-
-#include <windows.h>
-
-#include "base/basictypes.h"
-#include "base/string_util.h"
-#include "base/win_util.h"
-#include "base/win/windows_version.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-// The test is somewhat silly, because the Vista bots some have UAC enabled
-// and some have it disabled. At least we check that it does not crash.
-TEST(BaseWinUtilTest, TestIsUACEnabled) {
- if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
- win_util::UserAccountControlIsEnabled();
- } else {
- EXPECT_TRUE(win_util::UserAccountControlIsEnabled());
- }
-}
-
-TEST(BaseWinUtilTest, TestGetUserSidString) {
- std::wstring user_sid;
- EXPECT_TRUE(win_util::GetUserSidString(&user_sid));
- EXPECT_TRUE(!user_sid.empty());
-}
-
-TEST(BaseWinUtilTest, TestGetNonClientMetrics) {
- NONCLIENTMETRICS metrics = {0};
- win_util::GetNonClientMetrics(&metrics);
- EXPECT_TRUE(metrics.cbSize > 0);
- EXPECT_TRUE(metrics.iScrollWidth > 0);
- EXPECT_TRUE(metrics.iScrollHeight > 0);
-}
-
-namespace {
-
-// Saves the current thread's locale ID when initialized, and restores it when
-// the instance is going out of scope.
-class ThreadLocaleSaver {
- public:
- ThreadLocaleSaver() : original_locale_id_(GetThreadLocale()) {}
- ~ThreadLocaleSaver() { SetThreadLocale(original_locale_id_); }
-
- private:
- LCID original_locale_id_;
-
- DISALLOW_COPY_AND_ASSIGN(ThreadLocaleSaver);
-};
-
-} // namespace
-
-TEST(BaseWinUtilTest, FormatMessage) {
- // Because we cannot write tests of every language, we only test the message
- // of en-US locale. Here, we change the current locale temporarily.
- ThreadLocaleSaver thread_locale_saver;
- WORD language_id = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
- LCID locale_id = MAKELCID(language_id, SORT_DEFAULT);
- ASSERT_TRUE(SetThreadLocale(locale_id));
-
- const int kAccessDeniedErrorCode = 5;
- SetLastError(kAccessDeniedErrorCode);
- ASSERT_EQ(GetLastError(), kAccessDeniedErrorCode);
- std::wstring value;
- TrimWhitespace(win_util::FormatLastWin32Error(), TRIM_ALL, &value);
- EXPECT_EQ(std::wstring(L"Access is denied."), value);
-
- // Manually call the OS function
- wchar_t * string_buffer = NULL;
- unsigned string_length =
- ::FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER |
- FORMAT_MESSAGE_FROM_SYSTEM |
- FORMAT_MESSAGE_IGNORE_INSERTS, NULL,
- kAccessDeniedErrorCode, 0,
- reinterpret_cast<wchar_t *>(&string_buffer), 0, NULL);
-
- // Verify the call succeeded
- ASSERT_TRUE(string_length);
- ASSERT_TRUE(string_buffer);
-
- // Verify the string is the same by different calls
- EXPECT_EQ(win_util::FormatLastWin32Error(), std::wstring(string_buffer));
- EXPECT_EQ(win_util::FormatMessage(kAccessDeniedErrorCode),
- std::wstring(string_buffer));
-
- // Done with the buffer allocated by ::FormatMessage()
- LocalFree(string_buffer);
-}
diff --git a/build/.svn/all-wcprops b/build/.svn/all-wcprops
new file mode 100644
index 0000000..9f84447
--- /dev/null
+++ b/build/.svn/all-wcprops
@@ -0,0 +1,137 @@
+K 25
+svn:wc:ra_dav:version-url
+V 35
+/svn/!svn/ver/70757/trunk/src/build
+END
+README.chromium
+K 25
+svn:wc:ra_dav:version-url
+V 51
+/svn/!svn/ver/26095/trunk/src/build/README.chromium
+END
+features_override.gypi
+K 25
+svn:wc:ra_dav:version-url
+V 58
+/svn/!svn/ver/70340/trunk/src/build/features_override.gypi
+END
+release.gypi
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/!svn/ver/45665/trunk/src/build/release.gypi
+END
+extract_from_cab.py
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/54058/trunk/src/build/extract_from_cab.py
+END
+branding_value.sh
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/16372/trunk/src/build/branding_value.sh
+END
+build-bisect.py
+K 25
+svn:wc:ra_dav:version-url
+V 51
+/svn/!svn/ver/70112/trunk/src/build/build-bisect.py
+END
+common.gypi
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/!svn/ver/70757/trunk/src/build/common.gypi
+END
+gyp_chromium
+K 25
+svn:wc:ra_dav:version-url
+V 48
+/svn/!svn/ver/65408/trunk/src/build/gyp_chromium
+END
+dir_exists.py
+K 25
+svn:wc:ra_dav:version-url
+V 49
+/svn/!svn/ver/53810/trunk/src/build/dir_exists.py
+END
+install-build-deps.sh
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/!svn/ver/65094/trunk/src/build/install-build-deps.sh
+END
+sanitize-win-build-log.sh
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/!svn/ver/69510/trunk/src/build/sanitize-win-build-log.sh
+END
+compiler_version.py
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/30847/trunk/src/build/compiler_version.py
+END
+all.gyp
+K 25
+svn:wc:ra_dav:version-url
+V 43
+/svn/!svn/ver/70743/trunk/src/build/all.gyp
+END
+sanitize-win-build-log.sed
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/!svn/ver/69510/trunk/src/build/sanitize-win-build-log.sed
+END
+whitespace_file.txt
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/69665/trunk/src/build/whitespace_file.txt
+END
+sanitize-mac-build-log.sh
+K 25
+svn:wc:ra_dav:version-url
+V 61
+/svn/!svn/ver/69274/trunk/src/build/sanitize-mac-build-log.sh
+END
+build_config.h
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/66999/trunk/src/build/build_config.h
+END
+sanitize-mac-build-log.sed
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/!svn/ver/69510/trunk/src/build/sanitize-mac-build-log.sed
+END
+install-chroot.sh
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/63175/trunk/src/build/install-chroot.sh
+END
+common.croc
+K 25
+svn:wc:ra_dav:version-url
+V 47
+/svn/!svn/ver/47071/trunk/src/build/common.croc
+END
+apply_locales.py
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/!svn/ver/40985/trunk/src/build/apply_locales.py
+END
+output_dll_copy.rules
+K 25
+svn:wc:ra_dav:version-url
+V 53
+/svn/!svn/ver/7/trunk/src/build/output_dll_copy.rules
+END
diff --git a/build/.svn/dir-prop-base b/build/.svn/dir-prop-base
new file mode 100644
index 0000000..7f87c4c
--- /dev/null
+++ b/build/.svn/dir-prop-base
@@ -0,0 +1,23 @@
+K 10
+svn:ignore
+V 288
+all.xcodeproj
+all.sln
+All.vcproj
+SConstruct
+All.scons
+all_main.scons
+All.mk
+chromium_builder.vcproj
+chromium_builder_dbg_tsan_win.vcproj
+chrome_frame_builder.vcproj
+purify_builder_webkit.vcproj
+purify_builder_ui.vcproj
+purify_builder_unit.vcproj
+Debug
+Release
+all.Makefile
+All.target.mk
+
+
+END
diff --git a/build/.svn/entries b/build/.svn/entries
new file mode 100644
index 0000000..592df7e
--- /dev/null
+++ b/build/.svn/entries
@@ -0,0 +1,794 @@
+10
+
+dir
+70875
+http://src.chromium.org/svn/trunk/src/build
+http://src.chromium.org/svn
+
+
+
+2011-01-07T19:04:43.430431Z
+70757
+tony@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+
+README.chromium
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+b1b2b94038acd18317539e008a57d128
+2009-09-14T07:41:01.707457Z
+26095
+mmoss@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+892
+
+features_override.gypi
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+26d3a011c9bdceb65dcecb854d6a59b4
+2010-12-31T15:51:00.487219Z
+70340
+jknotten@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3189
+
+temp_gyp
+dir
+
+release.gypi
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+0526837d358186e0e12f1d9478f3b053
+2010-04-27T02:39:59.936412Z
+45665
+thestig@chromium.org
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+405
+
+extract_from_cab.py
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+4ef80d98b03c939518bc87f558dc495d
+2010-07-28T23:02:22.712200Z
+54058
+apatrick@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+907
+
+branding_value.sh
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+b112e1931330a24299ba260670ec4d81
+2009-05-19T14:10:09.659125Z
+16372
+thomasvl@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1153
+
+build-bisect.py
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+7a326f8988096282613f80e11c56f43b
+2010-12-23T23:10:06.000703Z
+70112
+evan@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+324
+
+win
+dir
+
+common.gypi
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+cad584dc1df7b44ed8f4eaec309ee6fb
+2011-01-07T19:04:43.430431Z
+70757
+tony@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+57516
+
+linux
+dir
+
+mac
+dir
+
+gyp_chromium
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+faa7afb6ebca58654fdaa6b64c4f8e1c
+2010-11-08T20:09:23.594639Z
+65408
+thomasvl@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4574
+
+dir_exists.py
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+ee6646b94087e15ba8228a7105b2be3b
+2010-07-27T18:18:17.292389Z
+53810
+apatrick@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+278
+
+install-build-deps.sh
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+6b61028bf33aa5cb009d1366b771431e
+2010-11-04T19:23:30.249443Z
+65094
+ajwong@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+17320
+
+all.gyp
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+e280224af6ab1ed31db64c900e9e7c09
+2011-01-07T17:33:39.224582Z
+70743
+ben@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+19516
+
+compiler_version.py
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+1982cea7747ba14187db345788c3db60
+2009-11-03T19:27:51.521029Z
+30847
+evan@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1319
+
+sanitize-win-build-log.sh
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+e411ca475511ea20d53ff380dc6799f3
+2010-12-17T03:46:15.376564Z
+69510
+evan@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+225
+
+sanitize-win-build-log.sed
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+1ceed875276096426dbb8c62fb83ef00
+2010-12-17T03:46:15.376564Z
+69510
+evan@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+436
+
+sanitize-mac-build-log.sh
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+e411ca475511ea20d53ff380dc6799f3
+2010-12-15T17:23:25.256786Z
+69274
+scottbyer@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+225
+
+whitespace_file.txt
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+c8105449e62f4bd21d7cc259100255fa
+2010-12-19T02:31:19.684120Z
+69665
+thakis@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+378
+
+build_config.h
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+a03a886228958a0a53a08b7daba5d89d
+2010-11-22T20:57:18.360081Z
+66999
+nkostylev@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4225
+
+sanitize-mac-build-log.sed
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+83432c11a9684f06e26c83bde3747af4
+2010-12-17T03:46:15.376564Z
+69510
+evan@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+779
+
+install-chroot.sh
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+49577308f291ba3b818b4c368c1c0cb2
+2010-10-20T03:32:17.054408Z
+63175
+mmoss@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+10683
+
+internal
+dir
+
+util
+dir
+
+common.croc
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+e491aebfacd2671fbc9b031977539efb
+2010-05-12T21:10:56.860034Z
+47071
+jhawkins@chromium.org
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3333
+
+apply_locales.py
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+9cdf546ccf194961bfee8ee689d18561
+2010-03-09T02:00:21.811249Z
+40985
+tony@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1455
+
+output_dll_copy.rules
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+6652d32450a16fbbc0d589355d264267
+2008-07-26T20:52:30.524983Z
+7
+initial.commit
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+375
+
diff --git a/build/.svn/prop-base/README.chromium.svn-base b/build/.svn/prop-base/README.chromium.svn-base
new file mode 100644
index 0000000..0b9192f
--- /dev/null
+++ b/build/.svn/prop-base/README.chromium.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 13
+svn:mergeinfo
+V 64
+/branches/chrome_webkit_merge_branch/build/README.google:69-2775
+END
diff --git a/build/.svn/prop-base/all.gyp.svn-base b/build/.svn/prop-base/all.gyp.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/all.gyp.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/prop-base/apply_locales.py.svn-base b/build/.svn/prop-base/apply_locales.py.svn-base
new file mode 100644
index 0000000..76c8123
--- /dev/null
+++ b/build/.svn/prop-base/apply_locales.py.svn-base
@@ -0,0 +1,13 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+K 13
+svn:mergeinfo
+V 80
+/branches/chrome_webkit_merge_branch/chrome/tools/build/apply_locales.py:69-2775
+END
diff --git a/build/.svn/prop-base/branding_value.sh.svn-base b/build/.svn/prop-base/branding_value.sh.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/.svn/prop-base/branding_value.sh.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/.svn/prop-base/build-bisect.py.svn-base b/build/.svn/prop-base/build-bisect.py.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/.svn/prop-base/build-bisect.py.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/.svn/prop-base/build_config.h.svn-base b/build/.svn/prop-base/build_config.h.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/build_config.h.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/prop-base/common.gypi.svn-base b/build/.svn/prop-base/common.gypi.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/common.gypi.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/prop-base/compiler_version.py.svn-base b/build/.svn/prop-base/compiler_version.py.svn-base
new file mode 100644
index 0000000..869ac71
--- /dev/null
+++ b/build/.svn/prop-base/compiler_version.py.svn-base
@@ -0,0 +1,5 @@
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/.svn/prop-base/dir_exists.py.svn-base b/build/.svn/prop-base/dir_exists.py.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/dir_exists.py.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/prop-base/extract_from_cab.py.svn-base b/build/.svn/prop-base/extract_from_cab.py.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/extract_from_cab.py.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/prop-base/features_override.gypi.svn-base b/build/.svn/prop-base/features_override.gypi.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/features_override.gypi.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/prop-base/gyp_chromium.svn-base b/build/.svn/prop-base/gyp_chromium.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/.svn/prop-base/gyp_chromium.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/.svn/prop-base/install-build-deps.sh.svn-base b/build/.svn/prop-base/install-build-deps.sh.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/.svn/prop-base/install-build-deps.sh.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/.svn/prop-base/install-chroot.sh.svn-base b/build/.svn/prop-base/install-chroot.sh.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/.svn/prop-base/install-chroot.sh.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/.svn/prop-base/output_dll_copy.rules.svn-base b/build/.svn/prop-base/output_dll_copy.rules.svn-base
new file mode 100644
index 0000000..bdbd305
--- /dev/null
+++ b/build/.svn/prop-base/output_dll_copy.rules.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 6
+native
+END
diff --git a/build/.svn/prop-base/sanitize-mac-build-log.sed.svn-base b/build/.svn/prop-base/sanitize-mac-build-log.sed.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/sanitize-mac-build-log.sed.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/prop-base/sanitize-mac-build-log.sh.svn-base b/build/.svn/prop-base/sanitize-mac-build-log.sh.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/.svn/prop-base/sanitize-mac-build-log.sh.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/.svn/prop-base/sanitize-win-build-log.sed.svn-base b/build/.svn/prop-base/sanitize-win-build-log.sed.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/sanitize-win-build-log.sed.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/prop-base/sanitize-win-build-log.sh.svn-base b/build/.svn/prop-base/sanitize-win-build-log.sh.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/.svn/prop-base/sanitize-win-build-log.sh.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/.svn/prop-base/whitespace_file.txt.svn-base b/build/.svn/prop-base/whitespace_file.txt.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/.svn/prop-base/whitespace_file.txt.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/.svn/text-base/README.chromium.svn-base b/build/.svn/text-base/README.chromium.svn-base
new file mode 100644
index 0000000..012df35
--- /dev/null
+++ b/build/.svn/text-base/README.chromium.svn-base
@@ -0,0 +1,15 @@
+List of property sheets to be included by projects:
+ common.vsprops
+ Not used anymore. No-op. Kept for compatibility with current projects.
+
+ debug.vsprops
+ Enables debug settings. Must be included directly in Debug configuration. Includes internal\essential.vsprops.
+
+ external_code.vsprops
+ Contains settings made to simplify usage of external (non-Google) code. It relaxes the warning levels. Should be included after debug.vsprops or release.vsprops to override their settings.
+
+ output_dll_copy.rules
+ Run to enable automatic copy of DLL when they are as an input file in a vcproj project.
+
+ release.vsprops
+ Enables release settings. Must be included directly in Release configuration. Includes internal\essential.vsprops. Also includes "internal\release_impl$(CHROME_BUILD_TYPE).vsprops". So the behavior is dependant on the CHROME_BUILD_TYPE environment variable.
diff --git a/build/.svn/text-base/all.gyp.svn-base b/build/.svn/text-base/all.gyp.svn-base
new file mode 100644
index 0000000..ba9bc45
--- /dev/null
+++ b/build/.svn/text-base/all.gyp.svn-base
@@ -0,0 +1,476 @@
+# 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'All',
+ 'type': 'none',
+ 'xcode_create_dependents_test_runner': 1,
+ 'dependencies': [
+ '../app/app.gyp:*',
+ '../base/base.gyp:*',
+ '../chrome/browser/sync/tools/sync_tools.gyp:*',
+ '../chrome/chrome.gyp:*',
+ '../gfx/gfx.gyp:*',
+ '../gpu/gpu.gyp:*',
+ '../gpu/demos/demos.gyp:*',
+ '../ipc/ipc.gyp:*',
+ '../jingle/jingle.gyp:*',
+ '../media/media.gyp:*',
+ '../net/net.gyp:*',
+ '../ppapi/ppapi.gyp:*',
+ '../printing/printing.gyp:*',
+ '../sdch/sdch.gyp:*',
+ '../skia/skia.gyp:*',
+ '../testing/gmock.gyp:*',
+ '../testing/gtest.gyp:*',
+ '../third_party/bzip2/bzip2.gyp:*',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:*',
+ '../third_party/cld/cld.gyp:*',
+ '../third_party/codesighs/codesighs.gyp:*',
+ '../third_party/ffmpeg/ffmpeg.gyp:*',
+ '../third_party/iccjpeg/iccjpeg.gyp:*',
+ '../third_party/icu/icu.gyp:*',
+ '../third_party/libpng/libpng.gyp:*',
+ '../third_party/libwebp/libwebp.gyp:*',
+ '../third_party/libxml/libxml.gyp:*',
+ '../third_party/libxslt/libxslt.gyp:*',
+ '../third_party/lzma_sdk/lzma_sdk.gyp:*',
+ '../third_party/mesa/mesa.gyp:*',
+ '../third_party/modp_b64/modp_b64.gyp:*',
+ '../third_party/npapi/npapi.gyp:*',
+ '../third_party/ots/ots.gyp:*',
+ '../third_party/qcms/qcms.gyp:*',
+ '../third_party/sqlite/sqlite.gyp:*',
+ '../third_party/WebKit/WebKit/chromium/WebKit.gyp:*',
+ '../third_party/zlib/zlib.gyp:*',
+ '../ui/ui.gyp:*',
+ '../webkit/support/webkit_support.gyp:*',
+ '../webkit/webkit.gyp:*',
+ 'util/build_util.gyp:*',
+ 'temp_gyp/googleurl.gyp:*',
+ '<(libjpeg_gyp_path):*',
+ ],
+ 'conditions': [
+ ['javascript_engine=="v8"', {
+ 'dependencies': [
+ '../v8/tools/gyp/v8.gyp:*',
+ ],
+ }],
+ ['OS=="mac" or OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ 'dependencies': [
+ '../third_party/yasm/yasm.gyp:*#host',
+ ],
+ }],
+ ['OS=="mac" or OS=="win"', {
+ 'dependencies': [
+ '../third_party/nss/nss.gyp:*',
+ ],
+ }],
+ ['OS=="mac"', {
+ 'dependencies': [
+ '../third_party/ocmock/ocmock.gyp:*',
+ ],
+ }],
+ ['OS=="linux"', {
+ 'dependencies': [
+ '../breakpad/breakpad.gyp:*',
+ '../courgette/courgette.gyp:*',
+ '../sandbox/sandbox.gyp:*',
+ ],
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'dependencies': [
+ '../chrome/chrome.gyp:linux_packages_<(channel)',
+ ],
+ }],
+ ],
+ }],
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ 'dependencies': [
+ '../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*',
+ '../tools/xdisplaycheck/xdisplaycheck.gyp:*',
+ ],
+ }],
+ ['OS=="win"', {
+ 'conditions': [
+ ['win_use_allocator_shim==1', {
+ 'dependencies': [
+ '../base/allocator/allocator.gyp:*',
+ ],
+ }],
+ ],
+ 'dependencies': [
+ '../breakpad/breakpad.gyp:*',
+ '../chrome/app/locales/locales.gyp:*',
+ '../ceee/ceee.gyp:*',
+ '../chrome_frame/chrome_frame.gyp:*',
+ '../courgette/courgette.gyp:*',
+ '../gears/gears.gyp:*',
+ '../rlz/rlz.gyp:*',
+ '../sandbox/sandbox.gyp:*',
+ '../third_party/angle/src/build_angle.gyp:*',
+ '../third_party/bsdiff/bsdiff.gyp:*',
+ '../third_party/bspatch/bspatch.gyp:*',
+ '../third_party/gles2_book/gles2_book.gyp:*',
+ '../tools/memory_watcher/memory_watcher.gyp:*',
+ ],
+ }, {
+ 'dependencies': [
+ '../third_party/libevent/libevent.gyp:*',
+ ],
+ }],
+ ['toolkit_views==1', {
+ 'dependencies': [
+ '../views/views.gyp:*',
+ ],
+ }],
+ ['chromeos==1', {
+ 'dependencies': [
+ '../chrome/browser/chromeos/input_method/candidate_window.gyp:*',
+ ],
+ }],
+ ['remoting==1', {
+ 'dependencies': [
+ '../remoting/remoting.gyp:*',
+ ],
+ }],
+ ['use_openssl!=1', {
+ 'dependencies': [
+ '../net/third_party/nss/ssl.gyp:*',
+ ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'chromium_builder_tests',
+ 'type': 'none',
+ 'dependencies': [
+ '../app/app.gyp:app_unittests',
+ '../base/base.gyp:base_unittests',
+ '../chrome/chrome.gyp:browser_tests',
+ '../chrome/chrome.gyp:interactive_ui_tests',
+ '../chrome/chrome.gyp:nacl_ui_tests',
+ '../chrome/chrome.gyp:nacl_sandbox_tests',
+ '../chrome/chrome.gyp:safe_browsing_tests',
+ '../chrome/chrome.gyp:sync_integration_tests',
+ '../chrome/chrome.gyp:sync_unit_tests',
+ '../chrome/chrome.gyp:ui_tests',
+ '../chrome/chrome.gyp:unit_tests',
+ '../gfx/gfx.gyp:gfx_unittests',
+ '../gpu/gpu.gyp:gpu_unittests',
+ '../ipc/ipc.gyp:ipc_tests',
+ '../jingle/jingle.gyp:notifier_unit_tests',
+ '../media/media.gyp:media_unittests',
+ '../net/net.gyp:net_unittests',
+ '../printing/printing.gyp:printing_unittests',
+ '../remoting/remoting.gyp:remoting_unittests',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+ 'temp_gyp/googleurl.gyp:googleurl_unittests',
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'dependencies': [
+ '../chrome/chrome.gyp:installer_util_unittests',
+ '../chrome/chrome.gyp:mini_installer_test',
+ # mini_installer_tests depends on mini_installer. This should be
+ # defined in installer.gyp.
+ '../chrome/installer/mini_installer.gyp:mini_installer',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_net_tests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_perftests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_reliability_tests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_tests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_unittests',
+ '../chrome_frame/chrome_frame.gyp:npchrome_frame',
+ '../courgette/courgette.gyp:courgette_unittests',
+ '../sandbox/sandbox.gyp:sbox_integration_tests',
+ '../sandbox/sandbox.gyp:sbox_unittests',
+ '../sandbox/sandbox.gyp:sbox_validation_tests',
+ '../views/views.gyp:views_unittests',
+ '../third_party/WebKit/WebKit/chromium/WebKit.gyp:copy_TestNetscapePlugIn',
+ # TODO(nsylvain) ui_tests.exe depends on test_shell_common.
+ # This should:
+ # 1) not be the case. OR.
+ # 2) be expressed in the ui tests dependencies.
+ '../webkit/webkit.gyp:test_shell_common',
+ ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'chromium_gpu_builder',
+ 'type': 'none',
+ 'dependencies': [
+ '../chrome/chrome.gyp:gpu_tests',
+ '../third_party/WebKit/WebKit/chromium/WebKit.gyp:DumpRenderTree',
+ ],
+ }
+ ],
+ 'conditions': [
+ ['OS=="mac"', {
+ 'targets': [
+ {
+ # Target to build everything plus the dmg. We don't put the dmg
+ # in the All target because developers really don't need it.
+ 'target_name': 'all_and_dmg',
+ 'type': 'none',
+ 'dependencies': [
+ 'All',
+ '../chrome/chrome.gyp:build_app_dmg',
+ ],
+ },
+ # These targets are here so the build bots can use them to build
+ # subsets of a full tree for faster cycle times.
+ {
+ 'target_name': 'chromium_builder_dbg',
+ 'type': 'none',
+ 'dependencies': [
+ '../app/app.gyp:app_unittests',
+ '../chrome/chrome.gyp:browser_tests',
+ '../chrome/chrome.gyp:interactive_ui_tests',
+ '../chrome/chrome.gyp:nacl_ui_tests',
+ '../chrome/chrome.gyp:nacl_sandbox_tests',
+ '../chrome/chrome.gyp:safe_browsing_tests',
+ '../chrome/chrome.gyp:sync_integration_tests',
+ '../chrome/chrome.gyp:sync_unit_tests',
+ '../chrome/chrome.gyp:ui_tests',
+ '../chrome/chrome.gyp:unit_tests',
+ '../gfx/gfx.gyp:gfx_unittests',
+ '../gpu/gpu.gyp:gpu_unittests',
+ '../ipc/ipc.gyp:ipc_tests',
+ '../jingle/jingle.gyp:notifier_unit_tests',
+ '../media/media.gyp:media_unittests',
+ '../printing/printing.gyp:printing_unittests',
+ '../remoting/remoting.gyp:remoting_unittests',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+ 'temp_gyp/googleurl.gyp:googleurl_unittests',
+ ],
+ },
+ {
+ 'target_name': 'chromium_builder_rel',
+ 'type': 'none',
+ 'dependencies': [
+ '../app/app.gyp:app_unittests',
+ '../chrome/chrome.gyp:browser_tests',
+ '../chrome/chrome.gyp:memory_test',
+ '../chrome/chrome.gyp:nacl_ui_tests',
+ '../chrome/chrome.gyp:nacl_sandbox_tests',
+ '../chrome/chrome.gyp:page_cycler_tests',
+ '../chrome/chrome.gyp:plugin_tests',
+ '../chrome/chrome.gyp:safe_browsing_tests',
+ '../chrome/chrome.gyp:startup_tests',
+ '../chrome/chrome.gyp:sync_integration_tests',
+ '../chrome/chrome.gyp:sync_unit_tests',
+ '../chrome/chrome.gyp:tab_switching_test',
+ '../chrome/chrome.gyp:ui_tests',
+ '../chrome/chrome.gyp:unit_tests',
+ '../chrome/chrome.gyp:url_fetch_test',
+ '../gfx/gfx.gyp:gfx_unittests',
+ '../gpu/gpu.gyp:gpu_unittests',
+ '../ipc/ipc.gyp:ipc_tests',
+ '../jingle/jingle.gyp:notifier_unit_tests',
+ '../media/media.gyp:media_unittests',
+ '../printing/printing.gyp:printing_unittests',
+ '../remoting/remoting.gyp:remoting_unittests',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+ 'temp_gyp/googleurl.gyp:googleurl_unittests',
+ ],
+ },
+ {
+ 'target_name': 'chromium_builder_dbg_tsan_mac',
+ 'type': 'none',
+ 'dependencies': [
+ '../base/base.gyp:base_unittests',
+ 'temp_gyp/googleurl.gyp:googleurl_unittests',
+ '../net/net.gyp:net_unittests',
+ '../ipc/ipc.gyp:ipc_tests',
+ '../jingle/jingle.gyp:notifier_unit_tests',
+ '../media/media.gyp:media_unittests',
+ '../printing/printing.gyp:printing_unittests',
+ '../remoting/remoting.gyp:remoting_unittests',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+ ],
+ },
+ {
+ 'target_name': 'chromium_builder_dbg_valgrind_mac',
+ 'type': 'none',
+ 'dependencies': [
+ '../app/app.gyp:app_unittests',
+ '../base/base.gyp:base_unittests',
+ 'temp_gyp/googleurl.gyp:googleurl_unittests',
+ '../ipc/ipc.gyp:ipc_tests',
+ '../media/media.gyp:media_unittests',
+ '../net/net.gyp:net_unittests',
+ '../printing/printing.gyp:printing_unittests',
+ '../remoting/remoting.gyp:remoting_unittests',
+ '../chrome/chrome.gyp:safe_browsing_tests',
+ '../chrome/chrome.gyp:sync_unit_tests',
+ '../chrome/chrome.gyp:unit_tests',
+ '../chrome/chrome.gyp:ui_tests',
+ '../jingle/jingle.gyp:notifier_unit_tests',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+ ],
+ },
+ ], # targets
+ }], # OS="mac"
+ ['OS=="win"', {
+ 'targets': [
+ # These targets are here so the build bots can use them to build
+ # subsets of a full tree for faster cycle times.
+ {
+ 'target_name': 'chromium_builder',
+ 'type': 'none',
+ 'dependencies': [
+ '../app/app.gyp:app_unittests',
+ '../chrome/chrome.gyp:browser_tests',
+ '../chrome/chrome.gyp:installer_util_unittests',
+ '../chrome/chrome.gyp:interactive_ui_tests',
+ '../chrome/chrome.gyp:memory_test',
+ '../chrome/chrome.gyp:mini_installer_test',
+ '../chrome/chrome.gyp:nacl_ui_tests',
+ '../chrome/chrome.gyp:nacl_sandbox_tests',
+ '../chrome/chrome.gyp:page_cycler_tests',
+ '../chrome/chrome.gyp:plugin_tests',
+ '../chrome/chrome.gyp:safe_browsing_tests',
+ '../chrome/chrome.gyp:selenium_tests',
+ '../chrome/chrome.gyp:startup_tests',
+ '../chrome/chrome.gyp:sync_integration_tests',
+ '../chrome/chrome.gyp:sync_unit_tests',
+ '../chrome/chrome.gyp:tab_switching_test',
+ '../chrome/chrome.gyp:ui_tests',
+ '../chrome/chrome.gyp:unit_tests',
+ '../chrome/chrome.gyp:url_fetch_test',
+ # mini_installer_tests depends on mini_installer. This should be
+ # defined in installer.gyp.
+ '../chrome/installer/mini_installer.gyp:mini_installer',
+ '../courgette/courgette.gyp:courgette_unittests',
+ '../gfx/gfx.gyp:gfx_unittests',
+ '../gpu/gpu.gyp:gpu_unittests',
+ '../ipc/ipc.gyp:ipc_tests',
+ '../jingle/jingle.gyp:notifier_unit_tests',
+ '../media/media.gyp:media_unittests',
+ '../printing/printing.gyp:printing_unittests',
+ '../remoting/remoting.gyp:remoting_unittests',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+ '../third_party/WebKit/WebKit/chromium/WebKit.gyp:copy_TestNetscapePlugIn',
+ # TODO(nsylvain) ui_tests.exe depends on test_shell_common.
+ # This should:
+ # 1) not be the case. OR.
+ # 2) be expressed in the ui tests dependencies.
+ '../webkit/webkit.gyp:test_shell_common',
+ 'temp_gyp/googleurl.gyp:googleurl_unittests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_net_tests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_perftests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_reliability_tests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_tests',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_unittests',
+ '../chrome_frame/chrome_frame.gyp:npchrome_frame',
+ ],
+ },
+ {
+ 'target_name': 'chromium_builder_dbg_tsan_win',
+ 'type': 'none',
+ 'dependencies': [
+ '../app/app.gyp:app_unittests',
+ # TODO(bradnelson): app_unittests should depend on locales.
+ # However, we can't add dependencies on chrome/ to app/
+ # See http://crbug.com/43603
+ '../base/base.gyp:base_unittests',
+ '../chrome/app/locales/locales.gyp:*',
+ '../chrome/chrome.gyp:sync_unit_tests',
+ '../ipc/ipc.gyp:ipc_tests',
+ '../jingle/jingle.gyp:notifier_unit_tests',
+ '../media/media.gyp:media_unittests',
+ '../net/net.gyp:net_unittests',
+ '../printing/printing.gyp:printing_unittests',
+ '../remoting/remoting.gyp:remoting_unittests',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+ 'temp_gyp/googleurl.gyp:googleurl_unittests',
+ ],
+ },
+ ], # targets
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'targets': [
+ {
+ 'target_name': 'chrome_official_builder',
+ 'type': 'none',
+ 'dependencies': [
+ '../chrome/app/locales/locales.gyp:*',
+ '../chrome/chrome.gyp:crash_service',
+ '../chrome/chrome.gyp:page_cycler_tests',
+ '../chrome/chrome.gyp:policy_templates',
+ '../chrome/chrome.gyp:pyautolib',
+ '../chrome/chrome.gyp:reliability_tests',
+ '../chrome/chrome.gyp:startup_tests',
+ '../chrome/chrome.gyp:automated_ui_tests',
+ '../chrome/installer/mini_installer.gyp:mini_installer',
+ '../chrome_frame/chrome_frame.gyp:chrome_frame_unittests',
+ '../chrome_frame/chrome_frame.gyp:npchrome_frame',
+ '../courgette/courgette.gyp:courgette',
+ '../third_party/adobe/flash/flash_player.gyp:flash_player',
+ '../webkit/webkit.gyp:test_shell',
+ ],
+ 'conditions': [
+ ['internal_pdf', {
+ 'dependencies': [
+ '../pdf/pdf.gyp:pdf',
+ ],
+ }], # internal_pdf
+ ]
+ },
+ ], # targets
+ }], # branding=="Chrome"
+ ], # conditions
+ }], # OS="win"
+ ['chromeos==1', {
+ 'targets': [
+ {
+ 'target_name': 'chromeos_builder',
+ 'type': 'none',
+ 'sources': [
+ # TODO(bradnelson): This is here to work around gyp issue 137.
+ # Remove this sources list when that issue has been fixed.
+ 'all.gyp',
+ ],
+ 'dependencies': [
+ '../app/app.gyp:app_unittests',
+ '../base/base.gyp:base_unittests',
+ '../chrome/chrome.gyp:browser_tests',
+ '../chrome/chrome.gyp:chrome',
+ '../chrome/chrome.gyp:interactive_ui_tests',
+ '../chrome/chrome.gyp:memory_test',
+ '../chrome/chrome.gyp:page_cycler_tests',
+ '../chrome/chrome.gyp:safe_browsing_tests',
+ '../chrome/chrome.gyp:startup_tests',
+ '../chrome/chrome.gyp:sync_unit_tests',
+ '../chrome/chrome.gyp:tab_switching_test',
+ '../chrome/chrome.gyp:ui_tests',
+ '../chrome/chrome.gyp:unit_tests',
+ '../chrome/chrome.gyp:url_fetch_test',
+ '../gfx/gfx.gyp:gfx_unittests',
+ '../ipc/ipc.gyp:ipc_tests',
+ '../jingle/jingle.gyp:notifier_unit_tests',
+ '../media/media.gyp:ffmpeg_tests',
+ '../media/media.gyp:media_unittests',
+ '../media/media.gyp:omx_test',
+ '../net/net.gyp:net_unittests',
+ '../printing/printing.gyp:printing_unittests',
+ '../remoting/remoting.gyp:remoting_unittests',
+ '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
+ 'temp_gyp/googleurl.gyp:googleurl_unittests',
+ '../chrome/browser/chromeos/input_method/candidate_window.gyp:candidate_window',
+ ],
+ },
+ ], # targets
+ }], # "chromeos==1"
+ ], # conditions
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/build/.svn/text-base/apply_locales.py.svn-base b/build/.svn/text-base/apply_locales.py.svn-base
new file mode 100644
index 0000000..6af7280
--- /dev/null
+++ b/build/.svn/text-base/apply_locales.py.svn-base
@@ -0,0 +1,45 @@
+#!/usr/bin/env python
+# Copyright (c) 2009 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.
+
+# TODO: remove this script when GYP has for loops
+
+import sys
+import optparse
+
+def main(argv):
+
+ parser = optparse.OptionParser()
+ usage = 'usage: %s [options ...] format_string locale_list'
+ parser.set_usage(usage.replace('%s', '%prog'))
+ parser.add_option('-d', dest='dash_to_underscore', action="store_true",
+ default=False,
+ help='map "en-US" to "en" and "-" to "_" in locales')
+
+ (options, arglist) = parser.parse_args(argv)
+
+ if len(arglist) < 3:
+ print 'ERROR: need string and list of locales'
+ return 1
+
+ str_template = arglist[1]
+ locales = arglist[2:]
+
+ results = []
+ for locale in locales:
+ # For Cocoa to find the locale at runtime, it needs to use '_' instead
+ # of '-' (http://crbug.com/20441). Also, 'en-US' should be represented
+ # simply as 'en' (http://crbug.com/19165, http://crbug.com/25578).
+ if options.dash_to_underscore:
+ if locale == 'en-US':
+ locale = 'en'
+ locale = locale.replace('-', '_')
+ results.append(str_template.replace('ZZLOCALE', locale))
+
+ # Quote each element so filename spaces don't mess up GYP's attempt to parse
+ # it into a list.
+ print ' '.join(["'%s'" % x for x in results])
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/build/.svn/text-base/branding_value.sh.svn-base b/build/.svn/text-base/branding_value.sh.svn-base
new file mode 100644
index 0000000..9fcb550
--- /dev/null
+++ b/build/.svn/text-base/branding_value.sh.svn-base
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+# Copyright (c) 2008 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 is a wrapper for fetching values from the BRANDING files. Pass the
+# value of GYP's branding variable followed by the key you want and the right
+# file is checked.
+#
+# branding_value.sh Chromium COPYRIGHT
+# branding_value.sh Chromium PRODUCT_FULLNAME
+#
+
+set -e
+
+if [ $# -ne 2 ] ; then
+ echo "error: expect two arguments, branding and key" >&2
+ exit 1
+fi
+
+BUILD_BRANDING=$1
+THE_KEY=$2
+
+pushd $(dirname "${0}") > /dev/null
+BUILD_DIR=$(pwd)
+popd > /dev/null
+
+TOP="${BUILD_DIR}/.."
+
+case ${BUILD_BRANDING} in
+ Chromium)
+ BRANDING_FILE="${TOP}/chrome/app/theme/chromium/BRANDING"
+ ;;
+ Chrome)
+ BRANDING_FILE="${TOP}/chrome/app/theme/google_chrome/BRANDING"
+ ;;
+ *)
+ echo "error: unknown branding: ${BUILD_BRANDING}" >&2
+ exit 1
+ ;;
+esac
+
+BRANDING_VALUE=$(sed -n -e "s/^${THE_KEY}=\(.*\)\$/\1/p" "${BRANDING_FILE}")
+
+if [ -z "${BRANDING_VALUE}" ] ; then
+ echo "error: failed to find key '${THE_KEY}'" >&2
+ exit 1
+fi
+
+echo "${BRANDING_VALUE}"
diff --git a/build/.svn/text-base/build-bisect.py.svn-base b/build/.svn/text-base/build-bisect.py.svn-base
new file mode 100644
index 0000000..33fcb89
--- /dev/null
+++ b/build/.svn/text-base/build-bisect.py.svn-base
@@ -0,0 +1,11 @@
+#!/usr/bin/python
+# 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 sys
+
+print "This script has been moved to tools/bisect-builds.py."
+print "Please update any docs you're working from!"
+
+sys.exit(1)
diff --git a/build/.svn/text-base/build_config.h.svn-base b/build/.svn/text-base/build_config.h.svn-base
new file mode 100644
index 0000000..0bfccd7
--- /dev/null
+++ b/build/.svn/text-base/build_config.h.svn-base
@@ -0,0 +1,136 @@
+// Copyright (c) 2006-2008 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 adds defines about the platform we're currently building on.
+// Operating System:
+// OS_WIN / OS_MACOSX / OS_LINUX / OS_POSIX (MACOSX or LINUX)
+// Compiler:
+// COMPILER_MSVC / COMPILER_GCC
+// Processor:
+// ARCH_CPU_X86 / ARCH_CPU_X86_64 / ARCH_CPU_X86_FAMILY (X86 or X86_64)
+// ARCH_CPU_32_BITS / ARCH_CPU_64_BITS
+
+#ifndef BUILD_BUILD_CONFIG_H_
+#define BUILD_BUILD_CONFIG_H_
+
+// A set of macros to use for platform detection.
+#if defined(__APPLE__)
+#define OS_MACOSX 1
+#elif defined(__native_client__)
+#define OS_NACL 1
+#elif defined(__linux__)
+#define OS_LINUX 1
+// Use TOOLKIT_GTK on linux if TOOLKIT_VIEWS isn't defined.
+#if !defined(TOOLKIT_VIEWS)
+#define TOOLKIT_GTK
+#endif
+#elif defined(_WIN32)
+#define OS_WIN 1
+#define TOOLKIT_VIEWS 1
+#elif defined(__FreeBSD__)
+#define OS_FREEBSD 1
+#define TOOLKIT_GTK
+#elif defined(__OpenBSD__)
+#define OS_OPENBSD 1
+#define TOOLKIT_GTK
+#elif defined(__sun)
+#define OS_SOLARIS 1
+#define TOOLKIT_GTK
+#else
+#error Please add support for your platform in build/build_config.h
+#endif
+
+// A flag derived from the above flags, used to cover GTK code in
+// both TOOLKIT_GTK and TOOLKIT_VIEWS.
+#if defined(TOOLKIT_GTK) || (defined(TOOLKIT_VIEWS) && !defined(OS_WIN))
+#define TOOLKIT_USES_GTK 1
+#endif
+
+#if defined(OS_LINUX) || defined(OS_FREEBSD) || defined(OS_OPENBSD) || \
+ defined(OS_SOLARIS)
+#if !defined(USE_OPENSSL)
+#define USE_NSS 1 // Default to use NSS for crypto, unless OpenSSL is chosen.
+#endif
+#define USE_X11 1 // Use X for graphics.
+#endif
+
+#if defined(USE_OPENSSL) && defined(USE_NSS)
+#error Cannot use both OpenSSL and NSS
+#endif
+
+// For access to standard POSIXish features, use OS_POSIX instead of a
+// more specific macro.
+#if defined(OS_MACOSX) || defined(OS_LINUX) || defined(OS_FREEBSD) || \
+ defined(OS_OPENBSD) || defined(OS_SOLARIS) || defined(OS_NACL)
+#define OS_POSIX 1
+// Use base::DataPack for name/value pairs.
+#define USE_BASE_DATA_PACK 1
+#endif
+
+// Use tcmalloc
+#if (defined(OS_WIN) || defined(OS_LINUX)) && !defined(NO_TCMALLOC)
+#define USE_TCMALLOC 1
+#endif
+
+// Use heapchecker.
+#if defined(OS_LINUX) && !defined(NO_HEAPCHECKER)
+#define USE_HEAPCHECKER 1
+#endif
+
+// Compiler detection.
+#if defined(__GNUC__)
+#define COMPILER_GCC 1
+#elif defined(_MSC_VER)
+#define COMPILER_MSVC 1
+#else
+#error Please add support for your compiler in build/build_config.h
+#endif
+
+// Processor architecture detection. For more info on what's defined, see:
+// http://msdn.microsoft.com/en-us/library/b0084kay.aspx
+// http://www.agner.org/optimize/calling_conventions.pdf
+// or with gcc, run: "echo | gcc -E -dM -"
+#if defined(_M_X64) || defined(__x86_64__)
+#define ARCH_CPU_X86_FAMILY 1
+#define ARCH_CPU_X86_64 1
+#define ARCH_CPU_64_BITS 1
+#elif defined(_M_IX86) || defined(__i386__)
+#define ARCH_CPU_X86_FAMILY 1
+#define ARCH_CPU_X86 1
+#define ARCH_CPU_32_BITS 1
+#elif defined(__ARMEL__)
+#define ARCH_CPU_ARM_FAMILY 1
+#define ARCH_CPU_ARMEL 1
+#define ARCH_CPU_32_BITS 1
+#define WCHAR_T_IS_UNSIGNED 1
+#else
+#error Please add support for your architecture in build/build_config.h
+#endif
+
+// Type detection for wchar_t.
+#if defined(OS_WIN)
+#define WCHAR_T_IS_UTF16
+#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
+ defined(__WCHAR_MAX__) && \
+ (__WCHAR_MAX__ == 0x7fffffff || __WCHAR_MAX__ == 0xffffffff)
+#define WCHAR_T_IS_UTF32
+#elif defined(OS_POSIX) && defined(COMPILER_GCC) && \
+ defined(__WCHAR_MAX__) && \
+ (__WCHAR_MAX__ == 0x7fff || __WCHAR_MAX__ == 0xffff)
+// On Posix, we'll detect short wchar_t, but projects aren't guaranteed to
+// compile in this mode (in particular, Chrome doesn't). This is intended for
+// other projects using base who manage their own dependencies and make sure
+// short wchar works for them.
+#define WCHAR_T_IS_UTF16
+#else
+#error Please add support for your compiler in build/build_config.h
+#endif
+
+#if defined(OS_CHROMEOS)
+// Single define to trigger whether CrOS fonts have BCI on.
+// In that case font sizes/deltas should be adjusted.
+//define CROS_FONTS_USING_BCI
+#endif
+
+#endif // BUILD_BUILD_CONFIG_H_
diff --git a/build/.svn/text-base/common.croc.svn-base b/build/.svn/text-base/common.croc.svn-base
new file mode 100644
index 0000000..5588990
--- /dev/null
+++ b/build/.svn/text-base/common.croc.svn-base
@@ -0,0 +1,127 @@
+# -*- python -*-
+# Crocodile config file for Chromium - settings common to all platforms
+#
+# This should be speicified before the platform-specific config, for example:
+# croc -c chrome_common.croc -c linux/chrome_linux.croc
+
+{
+ # List of root directories, applied in order
+ 'roots' : [
+ # Sub-paths we specifically care about and want to call out
+ {
+ 'root' : '_/src',
+ 'altname' : 'CHROMIUM',
+ },
+ ],
+
+ # List of rules, applied in order
+ # Note that any 'include':0 rules here will be overridden by the 'include':1
+ # rules in the platform-specific configs.
+ 'rules' : [
+ # Don't scan for executable lines in uninstrumented C++ header files
+ {
+ 'regexp' : '.*\\.(h|hpp)$',
+ 'add_if_missing' : 0,
+ },
+
+ # Groups
+ {
+ 'regexp' : '',
+ 'group' : 'source',
+ },
+ {
+ 'regexp' : '.*_(test|unittest)\\.',
+ 'group' : 'test',
+ },
+
+ # Languages
+ {
+ 'regexp' : '.*\\.(c|h)$',
+ 'language' : 'C',
+ },
+ {
+ 'regexp' : '.*\\.(cc|cpp|hpp)$',
+ 'language' : 'C++',
+ },
+
+ # Files/paths to include. Specify these before the excludes, since rules
+ # are in order.
+ {
+ 'regexp' : '^CHROMIUM/(base|media|net|printing|chrome|webkit/glue|native_client)/',
+ 'include' : 1,
+ },
+ # Don't include subversion or mercurial SCM dirs
+ {
+ 'regexp' : '.*/(\\.svn|\\.hg)/',
+ 'include' : 0,
+ },
+ # Don't include output dirs
+ {
+ 'regexp' : '.*/(Debug|Release|sconsbuild|out|xcodebuild)/',
+ 'include' : 0,
+ },
+ # Don't include third-party source
+ {
+ 'regexp' : '.*/third_party/',
+ 'include' : 0,
+ },
+ # We don't run the V8 test suite, so we don't care about V8 coverage.
+ {
+ 'regexp' : '.*/v8/',
+ 'include' : 0,
+ },
+ ],
+
+ # Paths to add source from
+ 'add_files' : [
+ 'CHROMIUM'
+ ],
+
+ # Statistics to print
+ 'print_stats' : [
+ {
+ 'stat' : 'files_executable',
+ 'format' : '*RESULT FilesKnown: files_executable= %d files',
+ },
+ {
+ 'stat' : 'files_instrumented',
+ 'format' : '*RESULT FilesInstrumented: files_instrumented= %d files',
+ },
+ {
+ 'stat' : '100.0 * files_instrumented / files_executable',
+ 'format' : '*RESULT FilesInstrumentedPercent: files_instrumented_percent= %g',
+ },
+ {
+ 'stat' : 'lines_executable',
+ 'format' : '*RESULT LinesKnown: lines_known= %d lines',
+ },
+ {
+ 'stat' : 'lines_instrumented',
+ 'format' : '*RESULT LinesInstrumented: lines_instrumented= %d lines',
+ },
+ {
+ 'stat' : 'lines_covered',
+ 'format' : '*RESULT LinesCoveredSource: lines_covered_source= %d lines',
+ 'group' : 'source',
+ },
+ {
+ 'stat' : 'lines_covered',
+ 'format' : '*RESULT LinesCoveredTest: lines_covered_test= %d lines',
+ 'group' : 'test',
+ },
+ {
+ 'stat' : '100.0 * lines_covered / lines_executable',
+ 'format' : '*RESULT PercentCovered: percent_covered= %g',
+ },
+ {
+ 'stat' : '100.0 * lines_covered / lines_executable',
+ 'format' : '*RESULT PercentCoveredSource: percent_covered_source= %g',
+ 'group' : 'source',
+ },
+ {
+ 'stat' : '100.0 * lines_covered / lines_executable',
+ 'format' : '*RESULT PercentCoveredTest: percent_covered_test= %g',
+ 'group' : 'test',
+ },
+ ],
+}
diff --git a/build/.svn/text-base/common.gypi.svn-base b/build/.svn/text-base/common.gypi.svn-base
new file mode 100644
index 0000000..ae5f41a
--- /dev/null
+++ b/build/.svn/text-base/common.gypi.svn-base
@@ -0,0 +1,1510 @@
+# 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.
+
+# IMPORTANT:
+# Please don't directly include this file if you are building via gyp_chromium,
+# since gyp_chromium is automatically forcing its inclusion.
+{
+ # Variables expected to be overriden on the GYP command line (-D) or by
+ # ~/.gyp/include.gypi.
+ 'variables': {
+ # Putting a variables dict inside another variables dict looks kind of
+ # weird. This is done so that 'host_arch', 'chromeos', etc are defined as
+ # variables within the outer variables dict here. This is necessary
+ # to get these variables defined for the conditions within this variables
+ # dict that operate on these variables (e.g., for setting 'toolkit_views',
+ # we need to have 'chromeos' already set).
+ 'variables': {
+ 'variables': {
+ 'variables': {
+ # Whether we're building a ChromeOS build.
+ 'chromeos%': 0,
+
+ # Disable touch support by default.
+ 'touchui%': 0,
+ },
+ # Copy conditionally-set variables out one scope.
+ 'chromeos%': '<(chromeos)',
+ 'touchui%': '<(touchui)',
+
+ # To do a shared build on linux we need to be able to choose between
+ # type static_library and shared_library. We default to doing a static
+ # build but you can override this with "gyp -Dlibrary=shared_library"
+ # or you can add the following line (without the #) to
+ # ~/.gyp/include.gypi {'variables': {'library': 'shared_library'}}
+ # to compile as shared by default
+ 'library%': 'static_library',
+
+ # Compute the architecture that we're building on.
+ 'conditions': [
+ [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ # This handles the Linux platforms we generally deal with. Anything
+ # else gets passed through, which probably won't work very well; such
+ # hosts should pass an explicit target_arch to gyp.
+ 'host_arch%':
+ '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
+ }, { # OS!="linux"
+ 'host_arch%': 'ia32',
+ }],
+
+ # Set default value of toolkit_views on for Windows, Chrome OS
+ # and the touch UI.
+ ['OS=="win" or chromeos==1 or touchui==1', {
+ 'toolkit_views%': 1,
+ }, {
+ 'toolkit_views%': 0,
+ }],
+ ],
+ },
+
+ # Copy conditionally-set variables out one scope.
+ 'chromeos%': '<(chromeos)',
+ 'touchui%': '<(touchui)',
+ 'host_arch%': '<(host_arch)',
+ 'library%': '<(library)',
+ 'toolkit_views%': '<(toolkit_views)',
+
+ # Override branding to select the desired branding flavor.
+ 'branding%': 'Chromium',
+
+ # Override buildtype to select the desired build flavor.
+ # Dev - everyday build for development/testing
+ # Official - release build (generally implies additional processing)
+ # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
+ # conversion is done), some of the things which are now controlled by
+ # 'branding', such as symbol generation, will need to be refactored based
+ # on 'buildtype' (i.e. we don't care about saving symbols for non-Official
+ # builds).
+ 'buildtype%': 'Dev',
+
+ # Default architecture we're building for is the architecture we're
+ # building on.
+ 'target_arch%': '<(host_arch)',
+
+ # This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are
+ # are built under a chromium full build (1) or a webkit.org chromium
+ # build (0).
+ 'inside_chromium_build%': 1,
+
+ # Set to 1 to enable fast builds. It disables debug info for fastest
+ # compilation.
+ 'fastbuild%': 0,
+
+ # Python version.
+ 'python_ver%': '2.5',
+
+ # Set ARM-v7 compilation flags
+ 'armv7%': 0,
+
+ # Set Neon compilation flags (only meaningful if armv7==1).
+ 'arm_neon%': 1,
+
+ # The system root for cross-compiles. Default: none.
+ 'sysroot%': '',
+
+ # On Linux, we build with sse2 for Chromium builds.
+ 'disable_sse2%': 0,
+
+ # Use libjpeg-turbo as the JPEG codec used by Chromium.
+ 'use_libjpeg_turbo%': 0,
+
+ # Variable 'component' is for cases where we would like to build some
+ # components as dynamic shared libraries but still need variable
+ # 'library' for static libraries.
+ # By default, component is set to whatever library is set to and
+ # it can be overriden by the GYP command line or by ~/.gyp/include.gypi.
+ 'component%': '<(library)',
+
+ # Set to select the Title Case versions of strings in GRD files.
+ 'use_titlecase_in_grd_files%': 0,
+
+ 'conditions': [
+ # A flag to enable or disable our compile-time dependency
+ # on gnome-keyring. If that dependency is disabled, no gnome-keyring
+ # support will be available. This option is useful
+ # for Linux distributions.
+ ['chromeos==1', {
+ 'use_gnome_keyring%': 0,
+ }, {
+ 'use_gnome_keyring%': 1,
+ }],
+
+ # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
+ # libraries on linux x86-64 and arm.
+ ['host_arch=="ia32"', {
+ 'linux_fpic%': 0,
+ }, {
+ 'linux_fpic%': 1,
+ }],
+
+ ['toolkit_views==0 or OS=="mac"', {
+ # GTK+ and Mac wants Title Case strings
+ 'use_titlecase_in_grd_files%': 1,
+ }],
+
+ # Enable some hacks to support Flapper only on Chrome OS.
+ ['chromeos==1', {
+ 'enable_flapper_hacks%': 1,
+ }, {
+ 'enable_flapper_hacks%': 0,
+ }],
+ ],
+ },
+
+ # Copy conditionally-set variables out one scope.
+ 'branding%': '<(branding)',
+ 'buildtype%': '<(buildtype)',
+ 'target_arch%': '<(target_arch)',
+ 'host_arch%': '<(host_arch)',
+ 'toolkit_views%': '<(toolkit_views)',
+ 'use_gnome_keyring%': '<(use_gnome_keyring)',
+ 'linux_fpic%': '<(linux_fpic)',
+ 'enable_flapper_hacks%': '<(enable_flapper_hacks)',
+ 'chromeos%': '<(chromeos)',
+ 'touchui%': '<(touchui)',
+ 'inside_chromium_build%': '<(inside_chromium_build)',
+ 'fastbuild%': '<(fastbuild)',
+ 'python_ver%': '<(python_ver)',
+ 'armv7%': '<(armv7)',
+ 'arm_neon%': '<(arm_neon)',
+ 'sysroot%': '<(sysroot)',
+ 'disable_sse2%': '<(disable_sse2)',
+ 'library%': '<(library)',
+ 'component%': '<(component)',
+ 'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
+
+ # The release channel that this build targets. This is used to restrict
+ # channel-specific build options, like which installer packages to create.
+ # The default is 'all', which does no channel-specific filtering.
+ 'channel%': 'all',
+
+ # Override chromium_mac_pch and set it to 0 to suppress the use of
+ # precompiled headers on the Mac. Prefix header injection may still be
+ # used, but prefix headers will not be precompiled. This is useful when
+ # using distcc to distribute a build to compile slaves that don't
+ # share the same compiler executable as the system driving the compilation,
+ # because precompiled headers rely on pointers into a specific compiler
+ # executable's image. Setting this to 0 is needed to use an experimental
+ # Linux-Mac cross compiler distcc farm.
+ 'chromium_mac_pch%': 1,
+
+ # Mac OS X SDK and deployment target support.
+ # The SDK identifies the version of the system headers that will be used,
+ # and corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time macro.
+ # "Maximum allowed" refers to the operating system version whose APIs are
+ # available in the headers.
+ # The deployment target identifies the minimum system version that the
+ # built products are expected to function on. It corresponds to the
+ # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.
+ # To ensure these macros are available, #include <AvailabilityMacros.h>.
+ # Additional documentation on these macros is available at
+ # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
+ # Chrome normally builds with the Mac OS X 10.5 SDK and sets the
+ # deployment target to 10.5. Other projects, such as O3D, may override
+ # these defaults.
+ 'mac_sdk%': '10.5',
+ 'mac_deployment_target%': '10.5',
+
+ # Set to 1 to enable code coverage. In addition to build changes
+ # (e.g. extra CFLAGS), also creates a new target in the src/chrome
+ # project file called "coverage".
+ # Currently ignored on Windows.
+ 'coverage%': 0,
+
+ # Overridable specification for potential use of alternative
+ # JavaScript engines.
+ 'javascript_engine%': 'v8',
+
+ # Although base/allocator lets you select a heap library via an
+ # environment variable, the libcmt shim it uses sometimes gets in
+ # the way. To disable it entirely, and switch to normal msvcrt, do e.g.
+ # 'win_use_allocator_shim': 0,
+ # 'win_release_RuntimeLibrary': 2
+ # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
+ 'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt
+
+ # Whether usage of OpenMAX is enabled.
+ 'enable_openmax%': 0,
+
+ # Whether proprietary audio/video codecs are assumed to be included with
+ # this build (only meaningful if branding!=Chrome).
+ 'proprietary_codecs%': 0,
+
+ # TODO(bradnelson): eliminate this when possible.
+ # To allow local gyp files to prevent release.vsprops from being included.
+ # Yes(1) means include release.vsprops.
+ # Once all vsprops settings are migrated into gyp, this can go away.
+ 'msvs_use_common_release%': 1,
+
+ # TODO(bradnelson): eliminate this when possible.
+ # To allow local gyp files to override additional linker options for msvs.
+ # Yes(1) means set use the common linker options.
+ 'msvs_use_common_linker_extras%': 1,
+
+ # TODO(sgk): eliminate this if possible.
+ # It would be nicer to support this via a setting in 'target_defaults'
+ # in chrome/app/locales/locales.gypi overriding the setting in the
+ # 'Debug' configuration in the 'target_defaults' dict below,
+ # but that doesn't work as we'd like.
+ 'msvs_debug_link_incremental%': '2',
+
+ # This is the location of the sandbox binary. Chrome looks for this before
+ # running the zygote process. If found, and SUID, it will be used to
+ # sandbox the zygote process and, thus, all renderer processes.
+ 'linux_sandbox_path%': '',
+
+ # Set this to true to enable SELinux support.
+ 'selinux%': 0,
+
+ # Set this to true when building with Clang.
+ # See http://code.google.com/p/chromium/wiki/Clang for details.
+ # TODO: eventually clang should behave identically to gcc, and this
+ # won't be necessary.
+ 'clang%': 0,
+
+ # Override whether we should use Breakpad on Linux. I.e. for Chrome bot.
+ 'linux_breakpad%': 0,
+ # And if we want to dump symbols for Breakpad-enabled builds.
+ 'linux_dump_symbols%': 0,
+ # And if we want to strip the binary after dumping symbols.
+ 'linux_strip_binary%': 0,
+ # Strip the test binaries needed for Linux reliability tests.
+ 'linux_strip_reliability_tests%': 0,
+
+ # Enable TCMalloc.
+ 'linux_use_tcmalloc%': 1,
+
+ # Disable TCMalloc's debugallocation.
+ 'linux_use_debugallocation%': 0,
+
+ # Disable TCMalloc's heapchecker.
+ 'linux_use_heapchecker%': 0,
+
+ # Disable shadow stack keeping used by heapcheck to unwind the stacks
+ # better.
+ 'linux_keep_shadow_stacks%': 0,
+
+ # Set to 1 to turn on seccomp sandbox by default.
+ # (Note: this is ignored for official builds.)
+ 'linux_use_seccomp_sandbox%': 0,
+
+ # Set to 1 to link against libgnome-keyring instead of using dlopen().
+ 'linux_link_gnome_keyring%': 0,
+
+ # Used to disable Native Client at compile time, for platforms where it
+ # isn't supported
+ 'disable_nacl%': 0,
+
+ # Set Thumb compilation flags.
+ 'arm_thumb%': 0,
+
+ # Set ARM fpu compilation flags (only meaningful if armv7==1 and
+ # arm_neon==0).
+ 'arm_fpu%': 'vfpv3',
+
+ # Enable new NPDevice API.
+ 'enable_new_npdevice_api%': 0,
+
+ # Enable EGLImage support in OpenMAX
+ 'enable_eglimage%': 0,
+
+ # Enable a variable used elsewhere throughout the GYP files to determine
+ # whether to compile in the sources for the GPU plugin / process.
+ 'enable_gpu%': 1,
+
+ # Use GConf, the GNOME configuration system.
+ 'use_gconf%': 1,
+
+ # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803
+ 'use_openssl%': 0,
+
+ # .gyp files or targets should set chromium_code to 1 if they build
+ # Chromium-specific code, as opposed to external code. This variable is
+ # used to control such things as the set of warnings to enable, and
+ # whether warnings are treated as errors.
+ 'chromium_code%': 0,
+
+ # Set to 1 to compile with the built in pdf viewer.
+ 'internal_pdf%': 0,
+
+ # This allows to use libcros from the current system, ie. /usr/lib/
+ # The cros_api will be pulled in as a static library, and all headers
+ # from the system include dirs.
+ 'system_libcros%': 0,
+
+ # Remoting compilation is enabled by default. Set to 0 to disable.
+ 'remoting%': 1,
+
+ # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
+ # so Cocoa is happy (http://crbug.com/20441).
+ 'locales': [
+ 'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
+ 'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
+ 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
+ 'ml', 'mr', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
+ 'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
+ 'vi', 'zh-CN', 'zh-TW',
+ ],
+
+ 'grit_defines': [],
+
+ # Use Harfbuzz-NG instead of Harfbuzz.
+ # Under development: http://crbug.com/68551
+ 'use_harfbuzz_ng%': 0,
+
+ 'conditions': [
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ # This will set gcc_version to XY if you are running gcc X.Y.*.
+ # This is used to tweak build flags for gcc 4.4.
+ 'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)',
+ # Figure out the python architecture to decide if we build pyauto.
+ 'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/lib/libpython<(python_ver).so.1.0)',
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'linux_breakpad%': 1,
+ }],
+ # All Chrome builds have breakpad symbols, but only process the
+ # symbols from official builds.
+ ['(branding=="Chrome" and buildtype=="Official")', {
+ 'linux_dump_symbols%': 1,
+ }],
+ ],
+ }], # OS=="linux" or OS=="freebsd" or OS=="openbsd"
+
+ ['OS=="mac"', {
+ 'conditions': [
+ # mac_product_name is set to the name of the .app bundle as it should
+ # appear on disk. This duplicates data from
+ # chrome/app/theme/chromium/BRANDING and
+ # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
+ # these names into the build system.
+ ['branding=="Chrome"', {
+ 'mac_product_name%': 'Google Chrome',
+ }, { # else: branding!="Chrome"
+ 'mac_product_name%': 'Chromium',
+ }],
+
+ # Feature variables for enabling Mac Breakpad and Keystone auto-update
+ # support. Both features are on by default in official builds with
+ # Chrome branding.
+ ['branding=="Chrome" and buildtype=="Official"', {
+ 'mac_breakpad%': 1,
+ 'mac_keystone%': 1,
+ }, { # else: branding!="Chrome" or buildtype!="Official"
+ 'mac_breakpad%': 0,
+ 'mac_keystone%': 0,
+ }],
+ ],
+ }], # OS=="mac"
+
+ # Whether to use multiple cores to compile with visual studio. This is
+ # optional because it sometimes causes corruption on VS 2005.
+ # It is on by default on VS 2008 and off on VS 2005.
+ ['OS=="win"', {
+ 'conditions': [
+ ['component=="shared_library"', {
+ 'win_use_allocator_shim%': 0,
+ }],
+ ['MSVS_VERSION=="2005"', {
+ 'msvs_multi_core_compile%': 0,
+ },{
+ 'msvs_multi_core_compile%': 1,
+ }],
+ # Don't do incremental linking for large modules on 32-bit.
+ ['MSVS_OS_BITS==32', {
+ 'msvs_large_module_debug_link_mode%': '1', # No
+ },{
+ 'msvs_large_module_debug_link_mode%': '2', # Yes
+ }],
+ ],
+ 'nacl_win64_defines': [
+ # This flag is used to minimize dependencies when building
+ # Native Client loader for 64-bit Windows.
+ 'NACL_WIN64',
+ ],
+ }],
+
+ ['OS=="mac" or (OS=="linux" and chromeos==0 and target_arch!="arm")', {
+ 'use_cups%': 1,
+ }, {
+ 'use_cups%': 0,
+ }],
+
+ # Set the relative path from this file to the GYP file of the JPEG
+ # library used by Chromium.
+ ['use_libjpeg_turbo==1', {
+ 'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
+ }, {
+ 'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
+ }], # use_libjpeg_turbo==1
+
+ # Setup -D flags passed into grit.
+ ['chromeos==1', {
+ 'grit_defines': ['-D', 'chromeos'],
+ }],
+ ['toolkit_views==1', {
+ 'grit_defines': ['-D', 'toolkit_views'],
+ }],
+ ['touchui==1', {
+ 'grit_defines': ['-D', 'touchui'],
+ }],
+ ['use_titlecase_in_grd_files==1', {
+ 'grit_defines': ['-D', 'use_titlecase'],
+ }],
+ ],
+ },
+ 'target_defaults': {
+ 'variables': {
+ # The condition that operates on chromium_code is in a target_conditions
+ # section, and will not have access to the default fallback value of
+ # chromium_code at the top of this file, or to the chromium_code
+ # variable placed at the root variables scope of .gyp files, because
+ # those variables are not set at target scope. As a workaround,
+ # if chromium_code is not set at target scope, define it in target scope
+ # to contain whatever value it has during early variable expansion.
+ # That's enough to make it available during target conditional
+ # processing.
+ 'chromium_code%': '<(chromium_code)',
+
+ # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
+ 'mac_release_optimization%': '3', # Use -O3 unless overridden
+ 'mac_debug_optimization%': '0', # Use -O0 unless overridden
+ # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
+ 'win_release_Optimization%': '2', # 2 = /Os
+ 'win_debug_Optimization%': '0', # 0 = /Od
+ # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
+ 'win_debug_RuntimeChecks%': '3', # 3 = all checks enabled, 0 = off
+ # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
+ 'win_debug_InlineFunctionExpansion%': '', # empty = default, 0 = off,
+ 'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
+ # VS inserts quite a lot of extra checks to algorithms like
+ # std::partial_sort in Debug build which make them O(N^2)
+ # instead of O(N*logN). This is particularly slow under memory
+ # tools like ThreadSanitizer so we want it to be disablable.
+ # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx
+ 'win_debug_disable_iterator_debugging%': '0',
+
+ 'release_extra_cflags%': '',
+ 'debug_extra_cflags%': '',
+ 'release_valgrind_build%': 0,
+
+ 'conditions': [
+ ['OS=="win" and component=="shared_library"', {
+ # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
+ 'win_release_RuntimeLibrary%': '2', # 2 = /MT (nondebug DLL)
+ 'win_debug_RuntimeLibrary%': '3', # 3 = /MTd (debug DLL)
+ }, {
+ # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
+ 'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
+ 'win_debug_RuntimeLibrary%': '1', # 1 = /MTd (debug static)
+ }],
+ ],
+ },
+ 'conditions': [
+ ['branding=="Chrome"', {
+ 'defines': ['GOOGLE_CHROME_BUILD'],
+ }, { # else: branding!="Chrome"
+ 'defines': ['CHROMIUM_BUILD'],
+ }],
+ ['toolkit_views==1', {
+ 'defines': ['TOOLKIT_VIEWS=1'],
+ }],
+ ['chromeos==1', {
+ 'defines': ['OS_CHROMEOS=1'],
+ }],
+ ['touchui==1', {
+ 'defines': ['TOUCH_UI=1'],
+ }],
+ ['remoting==1', {
+ 'defines': ['ENABLE_REMOTING=1'],
+ }],
+ ['proprietary_codecs==1', {
+ 'defines': ['USE_PROPRIETARY_CODECS'],
+ }],
+ ['enable_flapper_hacks==1', {
+ 'defines': ['ENABLE_FLAPPER_HACKS=1'],
+ }],
+ ['fastbuild!=0', {
+ 'conditions': [
+ # For Windows, we don't genererate debug information.
+ ['OS=="win"', {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'GenerateDebugInformation': 'false',
+ },
+ 'VCCLCompilerTool': {
+ 'DebugInformationFormat': '0',
+ }
+ }
+ }, { # else: OS != "win", generate less debug information.
+ 'variables': {
+ 'debug_extra_cflags': '-g1',
+ },
+ }],
+ ], # conditions for fastbuild.
+ }], # fastbuild!=0
+ ['selinux==1', {
+ 'defines': ['CHROMIUM_SELINUX=1'],
+ }],
+ ['win_use_allocator_shim==0', {
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines': ['NO_TCMALLOC'],
+ }],
+ ],
+ }],
+ ['enable_gpu==1', {
+ 'defines': [
+ 'ENABLE_GPU=1',
+ ],
+ }],
+ ['use_openssl==1', {
+ 'defines': [
+ 'USE_OPENSSL=1',
+ ],
+ }],
+ ['enable_eglimage==1', {
+ 'defines': [
+ 'ENABLE_EGLIMAGE=1',
+ ],
+ }],
+ ['coverage!=0', {
+ 'conditions': [
+ ['OS=="mac"', {
+ 'xcode_settings': {
+ 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES', # -fprofile-arcs
+ 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES', # -ftest-coverage
+ },
+ # Add -lgcov for types executable, shared_library, and
+ # loadable_module; not for static_library.
+ # This is a delayed conditional.
+ 'target_conditions': [
+ ['_type!="static_library"', {
+ 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
+ }],
+ ],
+ }],
+ ['OS=="linux"', {
+ 'cflags': [ '-ftest-coverage',
+ '-fprofile-arcs' ],
+ 'link_settings': { 'libraries': [ '-lgcov' ] },
+ }],
+ # Finally, for Windows, we simply turn on profiling.
+ ['OS=="win"', {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'Profile': 'true',
+ },
+ 'VCCLCompilerTool': {
+ # /Z7, not /Zi, so coverage is happyb
+ 'DebugInformationFormat': '1',
+ 'AdditionalOptions': ['/Yd'],
+ }
+ }
+ }], # OS==win
+ ], # conditions for coverage
+ }], # coverage!=0
+ ['OS=="win"', {
+ 'defines': [
+ '__STD_C',
+ '_CRT_SECURE_NO_DEPRECATE',
+ '_SCL_SECURE_NO_DEPRECATE',
+ ],
+ 'include_dirs': [
+ '<(DEPTH)/third_party/wtl/include',
+ ],
+ }], # OS==win
+ ], # conditions for 'target_defaults'
+ 'target_conditions': [
+ ['chromium_code==0', {
+ 'conditions': [
+ [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ 'cflags!': [
+ '-Wall',
+ '-Wextra',
+ '-Werror',
+ ],
+ }],
+ [ 'OS=="win"', {
+ 'defines': [
+ '_CRT_SECURE_NO_DEPRECATE',
+ '_CRT_NONSTDC_NO_WARNINGS',
+ '_CRT_NONSTDC_NO_DEPRECATE',
+ '_SCL_SECURE_NO_DEPRECATE',
+ ],
+ 'msvs_disabled_warnings': [4800],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'WarnAsError': 'false',
+ 'Detect64BitPortabilityProblems': 'false',
+ },
+ },
+ }],
+ [ 'OS=="mac"', {
+ 'xcode_settings': {
+ 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
+ 'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
+ },
+ }],
+ ],
+ }, {
+ # In Chromium code, we define __STDC_FORMAT_MACROS in order to get the
+ # C99 macros on Mac and Linux.
+ 'defines': [
+ '__STDC_FORMAT_MACROS',
+ ],
+ 'conditions': [
+ ['OS!="win"', {
+ 'sources/': [ ['exclude', '_win(_unittest)?\\.(h|cc)$'],
+ ['exclude', '(^|/)win/'],
+ ['exclude', '(^|/)win_[^/]*\\.(h|cc)$'] ],
+ }],
+ ['OS!="mac"', {
+ 'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.(h|cc)$'],
+ ['exclude', '(^|/)(cocoa|mac)/'],
+ ['exclude', '\\.mm?$' ] ],
+ }],
+ ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', {
+ 'sources/': [
+ ['exclude', '_(chromeos|gtk|x|x11|xdg)(_unittest)?\\.(h|cc)$'],
+ ['exclude', '(^|/)gtk/'],
+ ['exclude', '(^|/)(gtk|x11)_[^/]*\\.(h|cc)$'],
+ ],
+ }],
+ ['OS!="linux"', {
+ 'sources/': [
+ ['exclude', '_linux(_unittest)?\\.(h|cc)$'],
+ ['exclude', '(^|/)linux/'],
+ ],
+ }],
+ # We use "POSIX" to refer to all non-Windows operating systems.
+ ['OS=="win"', {
+ 'sources/': [ ['exclude', '_posix\\.(h|cc)$'] ],
+ # turn on warnings for signed/unsigned mismatch on chromium code.
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'AdditionalOptions': ['/we4389'],
+ },
+ },
+ }],
+ ['chromeos!=1', {
+ 'sources/': [ ['exclude', '_chromeos\\.(h|cc)$'] ]
+ }],
+ ['toolkit_views==0', {
+ 'sources/': [ ['exclude', '_views\\.(h|cc)$'] ]
+ }],
+ ],
+ }],
+ ], # target_conditions for 'target_defaults'
+ 'default_configuration': 'Debug',
+ 'configurations': {
+ # VCLinkerTool LinkIncremental values below:
+ # 0 == default
+ # 1 == /INCREMENTAL:NO
+ # 2 == /INCREMENTAL
+ # Debug links incremental, Release does not.
+ #
+ # Abstract base configurations to cover common attributes.
+ #
+ 'Common_Base': {
+ 'abstract': 1,
+ 'msvs_configuration_attributes': {
+ 'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
+ 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
+ 'CharacterSet': '1',
+ },
+ },
+ 'x86_Base': {
+ 'abstract': 1,
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'TargetMachine': '1',
+ },
+ },
+ 'msvs_configuration_platform': 'Win32',
+ },
+ 'x64_Base': {
+ 'abstract': 1,
+ 'msvs_configuration_platform': 'x64',
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'TargetMachine': '17', # x86 - 64
+ 'AdditionalLibraryDirectories!':
+ ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
+ 'AdditionalLibraryDirectories':
+ ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'],
+ },
+ 'VCLibrarianTool': {
+ 'AdditionalLibraryDirectories!':
+ ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
+ 'AdditionalLibraryDirectories':
+ ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'],
+ },
+ },
+ 'defines': [
+ # Not sure if tcmalloc works on 64-bit Windows.
+ 'NO_TCMALLOC',
+ ],
+ },
+ 'Debug_Base': {
+ 'abstract': 1,
+ 'defines': ['DYNAMIC_ANNOTATIONS_ENABLED=1'],
+ 'xcode_settings': {
+ 'COPY_PHASE_STRIP': 'NO',
+ 'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
+ 'OTHER_CFLAGS': [ '<@(debug_extra_cflags)', ],
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '<(win_debug_Optimization)',
+ 'PreprocessorDefinitions': ['_DEBUG'],
+ 'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
+ 'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
+ 'conditions': [
+ # According to MSVS, InlineFunctionExpansion=0 means
+ # "default inlining", not "/Ob0".
+ # Thus, we have to handle InlineFunctionExpansion==0 separately.
+ ['win_debug_InlineFunctionExpansion==0', {
+ 'AdditionalOptions': ['/Ob0'],
+ }],
+ ['win_debug_InlineFunctionExpansion!=""', {
+ 'InlineFunctionExpansion':
+ '<(win_debug_InlineFunctionExpansion)',
+ }],
+ ['win_debug_disable_iterator_debugging==1', {
+ 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'],
+ }],
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '<(msvs_debug_link_incremental)',
+ },
+ 'VCResourceCompilerTool': {
+ 'PreprocessorDefinitions': ['_DEBUG'],
+ },
+ },
+ 'conditions': [
+ ['OS=="linux"', {
+ 'cflags': [
+ '<@(debug_extra_cflags)',
+ ],
+ }],
+ ],
+ },
+ 'Release_Base': {
+ 'abstract': 1,
+ 'defines': [
+ 'NDEBUG',
+ ],
+ 'xcode_settings': {
+ 'DEAD_CODE_STRIPPING': 'YES', # -Wl,-dead_strip
+ 'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
+ 'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
+ },
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '<(win_release_Optimization)',
+ 'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
+ 'conditions': [
+ # According to MSVS, InlineFunctionExpansion=0 means
+ # "default inlining", not "/Ob0".
+ # Thus, we have to handle InlineFunctionExpansion==0 separately.
+ ['win_release_InlineFunctionExpansion==0', {
+ 'AdditionalOptions': ['/Ob0'],
+ }],
+ ['win_release_InlineFunctionExpansion!=""', {
+ 'InlineFunctionExpansion':
+ '<(win_release_InlineFunctionExpansion)',
+ }],
+ ],
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '1',
+ },
+ },
+ 'conditions': [
+ ['release_valgrind_build==0', {
+ 'defines': ['NVALGRIND', 'DYNAMIC_ANNOTATIONS_ENABLED=0'],
+ }, {
+ 'defines': ['DYNAMIC_ANNOTATIONS_ENABLED=1'],
+ }],
+ ['win_use_allocator_shim==0', {
+ 'defines': ['NO_TCMALLOC'],
+ }],
+ ['OS=="linux"', {
+ 'cflags': [
+ '<@(release_extra_cflags)',
+ ],
+ }],
+ ],
+ },
+ 'Purify_Base': {
+ 'abstract': 1,
+ 'defines': [
+ 'PURIFY',
+ 'NO_TCMALLOC',
+ ],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '0',
+ 'RuntimeLibrary': '0',
+ 'BufferSecurityCheck': 'false',
+ },
+ 'VCLinkerTool': {
+ 'EnableCOMDATFolding': '1',
+ 'LinkIncremental': '1',
+ },
+ },
+ },
+ #
+ # Concrete configurations
+ #
+ 'Debug': {
+ 'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
+ },
+ 'Release': {
+ 'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
+ 'conditions': [
+ ['msvs_use_common_release', {
+ 'includes': ['release.gypi'],
+ }],
+ ]
+ },
+ 'conditions': [
+ [ 'OS=="win"', {
+ # TODO(bradnelson): add a gyp mechanism to make this more graceful.
+ 'Purify': {
+ 'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base', 'Purify'],
+ },
+ 'Debug_x64': {
+ 'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
+ },
+ 'Release_x64': {
+ 'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
+ },
+ 'Purify_x64': {
+ 'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base', 'Purify_Base'],
+ },
+ }],
+ ],
+ },
+ },
+ 'conditions': [
+ ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
+ 'target_defaults': {
+ # Enable -Werror by default, but put it in a variable so it can
+ # be disabled in ~/.gyp/include.gypi on the valgrind builders.
+ 'variables': {
+ # Use -fno-strict-aliasing by default since gcc 4.4 has periodic
+ # issues that slip through the cracks. We could do this just for
+ # gcc 4.4 but it makes more sense to be consistent on all
+ # compilers in use. TODO(Craig): turn this off again when
+ # there is some 4.4 test infrastructure in place and existing
+ # aliasing issues have been fixed.
+ 'no_strict_aliasing%': 1,
+ 'conditions': [['OS=="linux"', {'werror%': '-Werror',}],
+ ['OS=="freebsd"', {'werror%': '',}],
+ ['OS=="openbsd"', {'werror%': '',}],
+ ],
+ },
+ 'cflags': [
+ '<(werror)', # See note above about the werror variable.
+ '-pthread',
+ '-fno-exceptions',
+ '-Wall',
+ # TODO(evan): turn this back on once all the builds work.
+ # '-Wextra',
+ # Don't warn about unused function params. We use those everywhere.
+ '-Wno-unused-parameter',
+ # Don't warn about the "struct foo f = {0};" initialization pattern.
+ '-Wno-missing-field-initializers',
+ '-D_FILE_OFFSET_BITS=64',
+ # Don't export any symbols (for example, to plugins we dlopen()).
+ # Note: this is *required* to make some plugins work.
+ '-fvisibility=hidden',
+ '-pipe',
+ ],
+ 'cflags_cc': [
+ '-fno-rtti',
+ '-fno-threadsafe-statics',
+ # Make inline functions have hidden visiblity by default.
+ # Surprisingly, not covered by -fvisibility=hidden.
+ '-fvisibility-inlines-hidden',
+ ],
+ 'ldflags': [
+ '-pthread', '-Wl,-z,noexecstack',
+ ],
+ 'configurations': {
+ 'Debug_Base': {
+ 'variables': {
+ 'debug_optimize%': '0',
+ },
+ 'defines': [
+ '_DEBUG',
+ ],
+ 'cflags': [
+ '-O>(debug_optimize)',
+ '-g',
+ ],
+ },
+ 'Release_Base': {
+ 'variables': {
+ 'release_optimize%': '2',
+ # Binaries become big and gold is unable to perform GC
+ # and remove unused sections for some of test targets
+ # on 32 bit platform.
+ # (This is currently observed only in chromeos valgrind bots)
+ # The following flag is to disable --gc-sections linker
+ # option for these bots.
+ 'no_gc_sections%': 0,
+ },
+ 'cflags': [
+ '-O>(release_optimize)',
+ # Don't emit the GCC version ident directives, they just end up
+ # in the .comment section taking up binary size.
+ '-fno-ident',
+ # Put data and code in their own sections, so that unused symbols
+ # can be removed at link time with --gc-sections.
+ '-fdata-sections',
+ '-ffunction-sections',
+ ],
+ 'ldflags': [
+ # Specifically tell the linker to perform optimizations.
+ # See http://lwn.net/Articles/192624/ .
+ '-Wl,-O1',
+ '-Wl,--as-needed',
+ ],
+ 'conditions' : [
+ ['no_gc_sections==0', {
+ 'ldflags': [
+ '-Wl,--gc-sections',
+ ],
+ }],
+ ['clang==1', {
+ 'cflags!': [
+ '-fno-ident',
+ ],
+ }],
+ ]
+ },
+ },
+ 'variants': {
+ 'coverage': {
+ 'cflags': ['-fprofile-arcs', '-ftest-coverage'],
+ 'ldflags': ['-fprofile-arcs'],
+ },
+ 'profile': {
+ 'cflags': ['-pg', '-g'],
+ 'ldflags': ['-pg'],
+ },
+ 'symbols': {
+ 'cflags': ['-g'],
+ },
+ },
+ 'conditions': [
+ [ 'target_arch=="ia32"', {
+ 'asflags': [
+ # Needed so that libs with .s files (e.g. libicudata.a)
+ # are compatible with the general 32-bit-ness.
+ '-32',
+ ],
+ # All floating-point computations on x87 happens in 80-bit
+ # precision. Because the C and C++ language standards allow
+ # the compiler to keep the floating-point values in higher
+ # precision than what's specified in the source and doing so
+ # is more efficient than constantly rounding up to 64-bit or
+ # 32-bit precision as specified in the source, the compiler,
+ # especially in the optimized mode, tries very hard to keep
+ # values in x87 floating-point stack (in 80-bit precision)
+ # as long as possible. This has important side effects, that
+ # the real value used in computation may change depending on
+ # how the compiler did the optimization - that is, the value
+ # kept in 80-bit is different than the value rounded down to
+ # 64-bit or 32-bit. There are possible compiler options to make
+ # this behavior consistent (e.g. -ffloat-store would keep all
+ # floating-values in the memory, thus force them to be rounded
+ # to its original precision) but they have significant runtime
+ # performance penalty.
+ #
+ # -mfpmath=sse -msse2 makes the compiler use SSE instructions
+ # which keep floating-point values in SSE registers in its
+ # native precision (32-bit for single precision, and 64-bit for
+ # double precision values). This means the floating-point value
+ # used during computation does not change depending on how the
+ # compiler optimized the code, since the value is always kept
+ # in its specified precision.
+ 'conditions': [
+ ['branding=="Chromium" and disable_sse2==0', {
+ 'cflags': [
+ '-march=pentium4',
+ '-msse2',
+ '-mfpmath=sse',
+ ],
+ }],
+ # ChromeOS targets Pinetrail, which is sse3, but most of the
+ # benefit comes from sse2 so this setting allows ChromeOS
+ # to build on other CPUs. In the future -march=atom would help
+ # but requires a newer compiler.
+ ['chromeos==1 and disable_sse2==0', {
+ 'cflags': [
+ '-msse2',
+ ],
+ }],
+ # Install packages have started cropping up with
+ # different headers between the 32-bit and 64-bit
+ # versions, so we have to shadow those differences off
+ # and make sure a 32-bit-on-64-bit build picks up the
+ # right files.
+ ['host_arch!="ia32"', {
+ 'include_dirs+': [
+ '/usr/include32',
+ ],
+ }],
+ ],
+ # -mmmx allows mmintrin.h to be used for mmx intrinsics.
+ # video playback is mmx and sse2 optimized.
+ 'cflags': [
+ '-m32',
+ '-mmmx',
+ ],
+ 'ldflags': [
+ '-m32',
+ ],
+ }],
+ ['target_arch=="arm"', {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'cflags_cc': [
+ # The codesourcery arm-2009q3 toolchain warns at that the ABI
+ # has changed whenever it encounters a varargs function. This
+ # silences those warnings, as they are not helpful and
+ # clutter legitimate warnings.
+ '-Wno-abi',
+ ],
+ 'conditions': [
+ ['arm_thumb == 1', {
+ 'cflags': [
+ '-mthumb',
+ # TODO(piman): -Wa,-mimplicit-it=thumb is needed for
+ # inline assembly that uses condition codes but it's
+ # suboptimal. Better would be to #ifdef __thumb__ at the
+ # right place and have a separate thumb path.
+ '-Wa,-mimplicit-it=thumb',
+ ]
+ }],
+ ['armv7==1', {
+ 'cflags': [
+ '-march=armv7-a',
+ '-mtune=cortex-a8',
+ '-mfloat-abi=softfp',
+ ],
+ 'conditions': [
+ ['arm_neon==1', {
+ 'cflags': [ '-mfpu=neon', ],
+ }, {
+ 'cflags': [ '-mfpu=<(arm_fpu)', ],
+ }]
+ ],
+ }],
+ ],
+ }],
+ ],
+ }],
+ ['linux_fpic==1', {
+ 'cflags': [
+ '-fPIC',
+ ],
+ }],
+ ['sysroot!=""', {
+ 'target_conditions': [
+ ['_toolset=="target"', {
+ 'cflags': [
+ '--sysroot=<(sysroot)',
+ ],
+ 'ldflags': [
+ '--sysroot=<(sysroot)',
+ ],
+ }]]
+ }],
+ ['clang==1', {
+ 'cflags': [
+ # Don't warn about unused variables, due to a common pattern:
+ # scoped_deleter unused_variable(&thing_to_delete);
+ '-Wno-unused-variable',
+ # Clang spots more unused functions.
+ '-Wno-unused-function',
+ # gtest confuses clang.
+ '-Wno-bool-conversions',
+ # Don't die on dtoa code that uses a char as an array index.
+ '-Wno-char-subscripts',
+ # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see
+ # http://code.google.com/p/googletest/source/detail?r=446 .
+ # TODO(thakis): Use -isystem instead (http://crbug.com/58751 ).
+ '-Wno-unnamed-type-template-args',
+ ],
+ 'cflags!': [
+ # Clang doesn't seem to know know this flag.
+ '-mfpmath=sse',
+ ],
+ }],
+ ['no_strict_aliasing==1', {
+ 'cflags': [
+ '-fno-strict-aliasing',
+ ],
+ }],
+ ['linux_breakpad==1', {
+ 'cflags': [ '-g' ],
+ 'defines': ['USE_LINUX_BREAKPAD'],
+ }],
+ ['library=="shared_library"', {
+ # When building with shared libraries, remove the visiblity-hiding
+ # flag.
+ 'cflags!': [ '-fvisibility=hidden' ],
+ 'conditions': [
+ ['target_arch=="x64" or target_arch=="arm"', {
+ # Shared libraries need -fPIC on x86-64 and arm
+ 'cflags': ['-fPIC']
+ }]
+ ],
+ 'ldflags!': [
+ # --as-needed confuses library interdependencies.
+ # See http://code.google.com/p/chromium/issues/detail?id=61430
+ '-Wl,--as-needed',
+ ],
+ }],
+ ['linux_use_heapchecker==1', {
+ 'variables': {'linux_use_tcmalloc%': 1},
+ }],
+ ['linux_use_tcmalloc==0', {
+ 'defines': ['NO_TCMALLOC'],
+ }],
+ ['linux_use_heapchecker==0', {
+ 'defines': ['NO_HEAPCHECKER'],
+ }],
+ ['linux_keep_shadow_stacks==1', {
+ 'defines': ['KEEP_SHADOW_STACKS'],
+ 'cflags': ['-finstrument-functions'],
+ }],
+ ],
+ },
+ }],
+ # FreeBSD-specific options; note that most FreeBSD options are set above,
+ # with Linux.
+ ['OS=="freebsd"', {
+ 'target_defaults': {
+ 'ldflags': [
+ '-Wl,--no-keep-memory',
+ ],
+ },
+ }],
+ ['OS=="solaris"', {
+ 'cflags!': ['-fvisibility=hidden'],
+ 'cflags_cc!': ['-fvisibility-inlines-hidden'],
+ }],
+ ['OS=="mac"', {
+ 'target_defaults': {
+ 'variables': {
+ # These should be 'mac_real_dsym%' and 'mac_strip%', but there
+ # seems to be a bug with % in variables that are intended to be
+ # set to different values in different targets, like these two.
+ 'mac_strip': 1, # Strip debugging symbols from the target.
+ 'mac_real_dsym': 0, # Fake .dSYMs are fine in most cases.
+ },
+ 'mac_bundle': 0,
+ 'xcode_settings': {
+ 'ALWAYS_SEARCH_USER_PATHS': 'NO',
+ 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99
+ 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
+ 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
+ # (Equivalent to -fPIC)
+ 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
+ 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
+ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
+ # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
+ 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
+ 'GCC_OBJC_CALL_CXX_CDTORS': 'YES', # -fobjc-call-cxx-cdtors
+ 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
+ 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
+ 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror
+ 'GCC_VERSION': '4.2',
+ 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
+ # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
+ 'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
+ 'PREBINDING': 'NO', # No -Wl,-prebind
+ 'USE_HEADERMAP': 'NO',
+ 'WARNING_CFLAGS': [
+ '-Wall',
+ '-Wendif-labels',
+ '-Wextra',
+ # Don't warn about unused function parameters.
+ '-Wno-unused-parameter',
+ # Don't warn about the "struct foo f = {0};" initialization
+ # pattern.
+ '-Wno-missing-field-initializers',
+ ],
+ 'conditions': [
+ ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
+ {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
+ ],
+ ['clang==1', {
+ 'WARNING_CFLAGS': [
+ # Don't die on dtoa code that uses a char as an array index.
+ # This is required solely for base/third_party/dmg_fp/dtoa.cc.
+ '-Wno-char-subscripts',
+ # Clang spots more unused functions.
+ '-Wno-unused-function',
+ # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see
+ # http://code.google.com/p/googletest/source/detail?r=446 .
+ # TODO(thakis): Use -isystem instead (http://crbug.com/58751 ).
+ '-Wno-unnamed-type-template-args',
+ ],
+ }],
+ ],
+ },
+ 'target_conditions': [
+ ['_type!="static_library"', {
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
+ }],
+ ['_mac_bundle', {
+ 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
+ }],
+ ['(_type=="executable" or _type=="shared_library" or \
+ _type=="loadable_module") and mac_strip!=0', {
+ 'target_conditions': [
+ ['mac_real_dsym == 1', {
+ # To get a real .dSYM bundle produced by dsymutil, set the
+ # debug information format to dwarf-with-dsym. Since
+ # strip_from_xcode will not be used, set Xcode to do the
+ # stripping as well.
+ 'configurations': {
+ 'Release_Base': {
+ 'xcode_settings': {
+ 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
+ 'DEPLOYMENT_POSTPROCESSING': 'YES',
+ 'STRIP_INSTALLED_PRODUCT': 'YES',
+ 'target_conditions': [
+ ['_type=="shared_library" or _type=="loadable_module"', {
+ # The Xcode default is to strip debugging symbols
+ # only (-S). Local symbols should be stripped as
+ # well, which will be handled by -x. Xcode will
+ # continue to insert -S when stripping even when
+ # additional flags are added with STRIPFLAGS.
+ 'STRIPFLAGS': '-x',
+ }], # _type=="shared_library" or _type=="loadable_module"'
+ ], # target_conditions
+ }, # xcode_settings
+ }, # configuration "Release"
+ }, # configurations
+ }, { # mac_real_dsym != 1
+ # To get a fast fake .dSYM bundle, use a post-build step to
+ # produce the .dSYM and strip the executable. strip_from_xcode
+ # only operates in the Release configuration.
+ 'postbuilds': [
+ {
+ 'variables': {
+ # Define strip_from_xcode in a variable ending in _path
+ # so that gyp understands it's a path and performs proper
+ # relativization during dict merging.
+ 'strip_from_xcode_path': 'mac/strip_from_xcode',
+ },
+ 'postbuild_name': 'Strip If Needed',
+ 'action': ['<(strip_from_xcode_path)'],
+ },
+ ], # postbuilds
+ }], # mac_real_dsym
+ ], # target_conditions
+ }], # (_type=="executable" or _type=="shared_library" or
+ # _type=="loadable_module") and mac_strip!=0
+ ], # target_conditions
+ }, # target_defaults
+ }], # OS=="mac"
+ ['OS=="win"', {
+ 'target_defaults': {
+ 'defines': [
+ '_WIN32_WINNT=0x0600',
+ 'WINVER=0x0600',
+ 'WIN32',
+ '_WINDOWS',
+ 'NOMINMAX',
+ '_CRT_RAND_S',
+ 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
+ 'WIN32_LEAN_AND_MEAN',
+ '_SECURE_ATL',
+ '_ATL_NO_OPENGL',
+ '_HAS_TR1=0',
+ ],
+ 'conditions': [
+ ['component=="static_library"', {
+ 'defines': [
+ '_HAS_EXCEPTIONS=0',
+ ],
+ }],
+ ],
+ 'msvs_system_include_dirs': [
+ '<(DEPTH)/third_party/platformsdk_win7/files/Include',
+ '<(DEPTH)/third_party/directxsdk/files/Include',
+ '$(VSInstallDir)/VC/atlmfc/include',
+ ],
+ 'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
+ 'msvs_disabled_warnings': [4351, 4396, 4503, 4819],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'MinimalRebuild': 'false',
+ 'BufferSecurityCheck': 'true',
+ 'EnableFunctionLevelLinking': 'true',
+ 'RuntimeTypeInfo': 'false',
+ 'WarningLevel': '3',
+ 'WarnAsError': 'true',
+ 'DebugInformationFormat': '3',
+ 'conditions': [
+ [ 'msvs_multi_core_compile', {
+ 'AdditionalOptions': ['/MP'],
+ }],
+ ['component=="shared_library"', {
+ 'ExceptionHandling': '1', # /EHsc
+ }, {
+ 'ExceptionHandling': '0',
+ }],
+ ],
+ },
+ 'VCLibrarianTool': {
+ 'AdditionalOptions': ['/ignore:4221'],
+ 'AdditionalLibraryDirectories': [
+ '<(DEPTH)/third_party/platformsdk_win7/files/Lib',
+ '<(DEPTH)/third_party/directxsdk/files/Lib/x86',
+ ],
+ },
+ 'VCLinkerTool': {
+ 'AdditionalDependencies': [
+ 'wininet.lib',
+ 'version.lib',
+ 'msimg32.lib',
+ 'ws2_32.lib',
+ 'usp10.lib',
+ 'psapi.lib',
+ 'dbghelp.lib',
+ ],
+ 'AdditionalLibraryDirectories': [
+ '<(DEPTH)/third_party/platformsdk_win7/files/Lib',
+ '<(DEPTH)/third_party/directxsdk/files/Lib/x86',
+ ],
+ 'GenerateDebugInformation': 'true',
+ 'MapFileName': '$(OutDir)\\$(TargetName).map',
+ 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
+ 'FixedBaseAddress': '1',
+ # SubSystem values:
+ # 0 == not set
+ # 1 == /SUBSYSTEM:CONSOLE
+ # 2 == /SUBSYSTEM:WINDOWS
+ # Most of the executables we'll ever create are tests
+ # and utilities with console output.
+ 'SubSystem': '1',
+ },
+ 'VCMIDLTool': {
+ 'GenerateStublessProxies': 'true',
+ 'TypeLibraryName': '$(InputName).tlb',
+ 'OutputDirectory': '$(IntDir)',
+ 'HeaderFileName': '$(InputName).h',
+ 'DLLDataFileName': 'dlldata.c',
+ 'InterfaceIdentifierFileName': '$(InputName)_i.c',
+ 'ProxyFileName': '$(InputName)_p.c',
+ },
+ 'VCResourceCompilerTool': {
+ 'Culture' : '1033',
+ 'AdditionalIncludeDirectories': [
+ '<(DEPTH)',
+ '<(SHARED_INTERMEDIATE_DIR)',
+ ],
+ },
+ },
+ },
+ }],
+ ['disable_nacl==1 or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
+ 'target_defaults': {
+ 'defines': [
+ 'DISABLE_NACL',
+ ],
+ },
+ }],
+ ['OS=="win" and msvs_use_common_linker_extras', {
+ 'target_defaults': {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'DelayLoadDLLs': [
+ 'dbghelp.dll',
+ 'dwmapi.dll',
+ 'uxtheme.dll',
+ ],
+ },
+ },
+ 'configurations': {
+ 'x86_Base': {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'AdditionalOptions': [
+ '/safeseh',
+ '/dynamicbase',
+ '/ignore:4199',
+ '/ignore:4221',
+ '/nxcompat',
+ ],
+ },
+ },
+ },
+ 'x64_Base': {
+ 'msvs_settings': {
+ 'VCLinkerTool': {
+ 'AdditionalOptions': [
+ # safeseh is not compatible with x64
+ '/dynamicbase',
+ '/ignore:4199',
+ '/ignore:4221',
+ '/nxcompat',
+ ],
+ },
+ },
+ },
+ },
+ },
+ }],
+ ['enable_new_npdevice_api==1', {
+ 'target_defaults': {
+ 'defines': [
+ 'ENABLE_NEW_NPDEVICE_API',
+ ],
+ },
+ }],
+ ],
+ 'xcode_settings': {
+ # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
+ # This block adds *project-wide* configuration settings to each project
+ # file. It's almost always wrong to put things here. Specify your
+ # custom xcode_settings in target_defaults to add them to targets instead.
+
+ # In an Xcode Project Info window, the "Base SDK for All Configurations"
+ # setting sets the SDK on a project-wide basis. In order to get the
+ # configured SDK to show properly in the Xcode UI, SDKROOT must be set
+ # here at the project level.
+ 'SDKROOT': 'macosx<(mac_sdk)', # -isysroot
+
+ # The Xcode generator will look for an xcode_settings section at the root
+ # of each dict and use it to apply settings on a file-wide basis. Most
+ # settings should not be here, they should be in target-specific
+ # xcode_settings sections, or better yet, should use non-Xcode-specific
+ # settings in target dicts. SYMROOT is a special case, because many other
+ # Xcode variables depend on it, including variables such as
+ # PROJECT_DERIVED_FILE_DIR. When a source group corresponding to something
+ # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
+ # files to appear (when present) in the UI as actual files and not red
+ # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
+ # and therefore SYMROOT, needs to be set at the project level.
+ 'SYMROOT': '<(DEPTH)/xcodebuild',
+ },
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/build/.svn/text-base/compiler_version.py.svn-base b/build/.svn/text-base/compiler_version.py.svn-base
new file mode 100644
index 0000000..69f0a50
--- /dev/null
+++ b/build/.svn/text-base/compiler_version.py.svn-base
@@ -0,0 +1,50 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 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.
+
+"""Compiler version checking tool for gcc
+
+Print gcc version as XY if you are running gcc X.Y.*.
+This is used to tweak build flags for gcc 4.4.
+"""
+
+import os
+import re
+import subprocess
+import sys
+
+def GetVersion(compiler):
+ try:
+ # Note that compiler could be something tricky like "distcc g++".
+ compiler = compiler + " -dumpversion"
+ pipe = subprocess.Popen(compiler, stdout=subprocess.PIPE, shell=True)
+ gcc_output = pipe.communicate()[0]
+ result = re.match(r"(\d+)\.(\d+)", gcc_output)
+ return result.group(1) + result.group(2)
+ except Exception, e:
+ print >> sys.stderr, "compiler_version.py failed to execute:", compiler
+ print >> sys.stderr, e
+ return ""
+
+def main():
+ # Check if CXX environment variable exists and
+ # if it does use that compiler.
+ cxx = os.getenv("CXX", None)
+ if cxx:
+ cxxversion = GetVersion(cxx)
+ if cxxversion != "":
+ print cxxversion
+ return 0
+ else:
+ # Otherwise we check the g++ version.
+ gccversion = GetVersion("g++")
+ if gccversion != "":
+ print gccversion
+ return 0
+
+ return 1
+
+if __name__ == "__main__":
+ sys.exit(main())
diff --git a/build/.svn/text-base/dir_exists.py.svn-base b/build/.svn/text-base/dir_exists.py.svn-base
new file mode 100644
index 0000000..d1c194f
--- /dev/null
+++ b/build/.svn/text-base/dir_exists.py.svn-base
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+# Copyright (c) 2009 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 os.path
+import sys
+
+sys.stdout.write(str(os.path.isdir(sys.argv[1])))
+sys.exit(0)
diff --git a/build/.svn/text-base/extract_from_cab.py.svn-base b/build/.svn/text-base/extract_from_cab.py.svn-base
new file mode 100644
index 0000000..fd99184
--- /dev/null
+++ b/build/.svn/text-base/extract_from_cab.py.svn-base
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+# Copyright (c) 2009 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.
+
+# Extracts a single file from a CAB archive.
+
+import os
+import subprocess
+import sys
+
+if len(sys.argv) != 4:
+ print 'Usage: extract_from_cab.py cab_path archived_file output_dir'
+ sys.exit(1)
+
+[cab_path, archived_file, output_dir] = sys.argv[1:]
+
+# Invoke the Windows expand utility to extract the file.
+level = subprocess.call(['expand', cab_path, '-F:' + archived_file, output_dir])
+if level != 0:
+ sys.exit(level)
+
+# The expand utility preserves the modification date and time of the archived
+# file. Touch the extracted file. This helps build systems that compare the
+# modification times of input and output files to determine whether to do an
+# action.
+os.utime(os.path.join(output_dir, archived_file), None)
diff --git a/build/.svn/text-base/features_override.gypi.svn-base b/build/.svn/text-base/features_override.gypi.svn-base
new file mode 100644
index 0000000..770778d
--- /dev/null
+++ b/build/.svn/text-base/features_override.gypi.svn-base
@@ -0,0 +1,93 @@
+# Copyright (c) 2009 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 only included in full-chromium builds, and overrides the
+# feature_defines variable in third_party/WebKit/WebKit/chromium/features.gypi.
+{
+ 'variables': {
+ # WARNING: This list of strings completely replaces the list in
+ # features.gypi. Therefore, if an enable is listed in features.gypi
+ # but not listed below, it will revert to its hardcoded webkit value.
+ 'feature_defines': [
+ 'ENABLE_3D_CANVAS=1',
+ 'ENABLE_3D_PLUGIN=1',
+ 'ENABLE_BLOB=1',
+ 'ENABLE_BLOB_SLICE=1',
+ 'ENABLE_CHANNEL_MESSAGING=1',
+ 'ENABLE_CLIENT_BASED_GEOLOCATION=1',
+ 'ENABLE_DASHBOARD_SUPPORT=0',
+ 'ENABLE_DATABASE=1',
+ 'ENABLE_DATAGRID=0',
+ 'ENABLE_DEVICE_ORIENTATION=1',
+ 'ENABLE_DIRECTORY_UPLOAD=1',
+ 'ENABLE_DOM_STORAGE=1',
+ 'ENABLE_EVENTSOURCE=1',
+ 'ENABLE_FILE_SYSTEM=1',
+ 'ENABLE_FILTERS=1',
+ 'ENABLE_GEOLOCATION=1',
+ 'ENABLE_ICONDATABASE=0',
+ 'ENABLE_INDEXED_DATABASE=1',
+ 'ENABLE_INPUT_SPEECH=1',
+ 'ENABLE_JAVASCRIPT_DEBUGGER=1',
+ 'ENABLE_JSC_MULTIPLE_THREADS=0',
+ 'ENABLE_LINK_PREFETCH=1',
+ 'ENABLE_METER_TAG=1',
+ 'ENABLE_NOTIFICATIONS=1',
+ 'ENABLE_OFFLINE_WEB_APPLICATIONS=1',
+ 'ENABLE_OPENTYPE_SANITIZER=1',
+ 'ENABLE_ORIENTATION_EVENTS=0',
+ 'ENABLE_PROGRESS_TAG=1',
+ 'ENABLE_RUBY=1',
+ 'ENABLE_SANDBOX=1',
+ 'ENABLE_SHARED_WORKERS=1',
+ 'ENABLE_SVG=<(enable_svg)',
+ 'ENABLE_SVG_ANIMATION=<(enable_svg)',
+ 'ENABLE_SVG_AS_IMAGE=<(enable_svg)',
+ 'ENABLE_SVG_FONTS=<(enable_svg)',
+ 'ENABLE_SVG_FOREIGN_OBJECT=<(enable_svg)',
+ 'ENABLE_SVG_USE=<(enable_svg)',
+ 'ENABLE_TOUCH_EVENTS=<(enable_touch_events)',
+ 'ENABLE_V8_SCRIPT_DEBUG_SERVER=1',
+ 'ENABLE_VIDEO=1',
+ 'ENABLE_WEB_SOCKETS=1',
+ 'ENABLE_WEB_TIMING=1',
+ 'ENABLE_WORKERS=1',
+ 'ENABLE_XHR_RESPONSE_BLOB=1',
+ 'ENABLE_XPATH=1',
+ 'ENABLE_XSLT=1',
+ 'WTF_USE_WEBP=1',
+ 'WTF_USE_WEBKIT_IMAGE_DECODERS=1',
+ ],
+ # We have to nest variables inside variables so that they can be overridden
+ # through GYP_DEFINES.
+ 'variables': {
+ 'use_accelerated_compositing%': 1,
+ 'enable_svg%': 1,
+ 'enable_touch_events%': 1,
+ },
+ 'use_accelerated_compositing%': '<(use_accelerated_compositing)',
+ 'enable_svg%': '<(enable_svg)',
+ 'enable_touch_events%': '<(enable_touch_events)',
+ 'conditions': [
+ ['(OS=="win" or OS=="linux" or OS=="mac") and use_accelerated_compositing==1', {
+ 'feature_defines': [
+ 'WTF_USE_ACCELERATED_COMPOSITING=1',
+ 'ENABLE_3D_RENDERING=1',
+ 'ENABLE_ACCELERATED_2D_CANVAS=1',
+ ],
+ 'use_accelerated_compositing': 1,
+ }],
+ ],
+ # TODO: If the need arises, create a mechanism that will intelligently
+ # merge the lists rather than replace one with the other. This may
+ # require changes in gyp.
+ },
+
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/build/.svn/text-base/gyp_chromium.svn-base b/build/.svn/text-base/gyp_chromium.svn-base
new file mode 100644
index 0000000..2171770
--- /dev/null
+++ b/build/.svn/text-base/gyp_chromium.svn-base
@@ -0,0 +1,129 @@
+#!/usr/bin/python
+
+# Copyright (c) 2009 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 script is wrapper for Chromium that adds some support for how GYP
+# is invoked by Chromium beyond what can be done in the gclient hooks.
+
+import glob
+import os
+import shlex
+import sys
+
+script_dir = os.path.dirname(__file__)
+chrome_src = os.path.normpath(os.path.join(script_dir, os.pardir))
+
+sys.path.insert(0, os.path.join(chrome_src, 'tools', 'gyp', 'pylib'))
+import gyp
+
+def apply_gyp_environment(file_path=None):
+ """
+ Reads in a *.gyp_env file and applies the valid keys to os.environ.
+ """
+ if not file_path or not os.path.exists(file_path):
+ return
+ file_contents = open(file_path).read()
+ try:
+ file_data = eval(file_contents, {'__builtins__': None}, None)
+ except SyntaxError, e:
+ e.filename = os.path.abspath(file_path)
+ raise
+ supported_vars = ( 'CHROMIUM_GYP_FILE',
+ 'CHROMIUM_GYP_SYNTAX_CHECK',
+ 'GYP_DEFINES',
+ 'GYP_GENERATOR_FLAGS',
+ 'GYP_GENERATOR_OUTPUT', )
+ for var in supported_vars:
+ val = file_data.get(var)
+ if val:
+ if var in os.environ:
+ print 'INFO: Environment value for "%s" overrides value in %s.' % (
+ var, os.path.abspath(file_path)
+ )
+ else:
+ os.environ[var] = val
+
+def additional_include_files(args=[]):
+ """
+ Returns a list of additional (.gypi) files to include, without
+ duplicating ones that are already specified on the command line.
+ """
+ # Determine the include files specified on the command line.
+ # This doesn't cover all the different option formats you can use,
+ # but it's mainly intended to avoid duplicating flags on the automatic
+ # makefile regeneration which only uses this format.
+ specified_includes = set()
+ for arg in args:
+ if arg.startswith('-I') and len(arg) > 2:
+ specified_includes.add(os.path.realpath(arg[2:]))
+
+ result = []
+ def AddInclude(path):
+ if os.path.realpath(path) not in specified_includes:
+ result.append(path)
+
+ # Always include common.gypi & features_override.gypi
+ AddInclude(os.path.join(script_dir, 'common.gypi'))
+ AddInclude(os.path.join(script_dir, 'features_override.gypi'))
+
+ # Optionally add supplemental .gypi files if present.
+ supplements = glob.glob(os.path.join(chrome_src, '*', 'supplement.gypi'))
+ for supplement in supplements:
+ AddInclude(supplement)
+
+ return result
+
+if __name__ == '__main__':
+ args = sys.argv[1:]
+
+ if 'SKIP_CHROMIUM_GYP_ENV' not in os.environ:
+ # Update the environment based on chromium.gyp_env
+ gyp_env_path = os.path.join(os.path.dirname(chrome_src), 'chromium.gyp_env')
+ apply_gyp_environment(gyp_env_path)
+
+ # This could give false positives since it doesn't actually do real option
+ # parsing. Oh well.
+ gyp_file_specified = False
+ for arg in args:
+ if arg.endswith('.gyp'):
+ gyp_file_specified = True
+ break
+
+ # If we didn't get a file, check an env var, and then fall back to
+ # assuming 'all.gyp' from the same directory as the script.
+ if not gyp_file_specified:
+ gyp_file = os.environ.get('CHROMIUM_GYP_FILE')
+ if gyp_file:
+ # Note that CHROMIUM_GYP_FILE values can't have backslashes as
+ # path separators even on Windows due to the use of shlex.split().
+ args.extend(shlex.split(gyp_file))
+ else:
+ args.append(os.path.join(script_dir, 'all.gyp'))
+
+ args.extend(['-I' + i for i in additional_include_files(args)])
+
+ # There shouldn't be a circular dependency relationship between .gyp files,
+ # but in Chromium's .gyp files, on non-Mac platforms, circular relationships
+ # currently exist. The check for circular dependencies is currently
+ # bypassed on other platforms, but is left enabled on the Mac, where a
+ # violation of the rule causes Xcode to misbehave badly.
+ # TODO(mark): Find and kill remaining circular dependencies, and remove this
+ # option. http://crbug.com/35878.
+ # TODO(tc): Fix circular dependencies in ChromiumOS then add linux2 to the
+ # list.
+ if sys.platform not in ('darwin',):
+ args.append('--no-circular-check')
+
+ # If CHROMIUM_GYP_SYNTAX_CHECK is set to 1, it will invoke gyp with --check
+ # to enfore syntax checking.
+ syntax_check = os.environ.get('CHROMIUM_GYP_SYNTAX_CHECK')
+ if syntax_check and int(syntax_check):
+ args.append('--check')
+
+ print 'Updating projects from gyp files...'
+ sys.stdout.flush()
+
+ # Off we go...
+ sys.exit(gyp.main(args))
diff --git a/build/.svn/text-base/install-build-deps.sh.svn-base b/build/.svn/text-base/install-build-deps.sh.svn-base
new file mode 100644
index 0000000..3ed5513
--- /dev/null
+++ b/build/.svn/text-base/install-build-deps.sh.svn-base
@@ -0,0 +1,458 @@
+#!/bin/bash -e
+
+# Copyright (c) 2009 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.
+
+# Script to install everything needed to build chromium (well, ideally, anyway)
+# See http://code.google.com/p/chromium/wiki/LinuxBuildInstructions
+# and http://code.google.com/p/chromium/wiki/LinuxBuild64Bit
+
+usage() {
+ echo "Usage: $0 [--options]"
+ echo "Options:"
+ echo "--[no-]syms: enable or disable installation of debugging symbols"
+ echo "--[no-]gold: enable or disable installation of gold linker"
+ echo "--[no-]lib32: enable or disable installation of 32 bit libraries"
+ echo "Script will prompt interactively if options not given."
+ exit 1
+}
+
+while test "$1" != ""
+do
+ case "$1" in
+ --syms) do_inst_syms=1;;
+ --no-syms) do_inst_syms=0;;
+ --gold) do_inst_gold=1;;
+ --no-gold) do_inst_gold=0;;
+ --lib32) do_inst_lib32=1;;
+ --no-lib32) do_inst_lib32=0;;
+ *) usage;;
+ esac
+ shift
+done
+
+install_gold() {
+ # Gold is optional; it's a faster replacement for ld,
+ # and makes life on 2GB machines much more pleasant.
+
+ # First make sure root can access this directory, as that's tripped
+ # up some folks.
+ if sudo touch xyz.$$
+ then
+ sudo rm xyz.$$
+ else
+ echo root cannot write to the current directory, not installing gold
+ return
+ fi
+
+ BINUTILS=binutils-2.20.1
+ BINUTILS_URL=http://ftp.gnu.org/gnu/binutils/$BINUTILS.tar.bz2
+ BINUTILS_SHA1=fd2ba806e6f3a55cee453cb25c86991b26a75dee
+
+ test -f $BINUTILS.tar.bz2 || wget $BINUTILS_URL
+ if test "`sha1sum $BINUTILS.tar.bz2|cut -d' ' -f1`" != "$BINUTILS_SHA1"
+ then
+ echo Bad sha1sum for $BINUTILS.tar.bz2
+ exit 1
+ fi
+
+ tar -xjvf $BINUTILS.tar.bz2
+ cd $BINUTILS
+ ./configure --prefix=/usr/local/gold --enable-gold
+ make -j3
+ if sudo make install
+ then
+ # Still need to figure out graceful way of pointing gyp to use
+ # /usr/local/gold/bin/ld without requiring him to set environment
+ # variables. That will go into bootstrap-linux.sh when it's ready.
+ echo "Installing gold as /usr/bin/ld."
+ echo "To uninstall, do 'cd /usr/bin; sudo rm ld; sudo mv ld.orig ld'"
+ test -f /usr/bin/ld && test ! -f /usr/bin/ld.orig && \
+ sudo mv /usr/bin/ld /usr/bin/ld.orig
+ sudo strip /usr/local/gold/bin/ld
+ sudo ln -fs /usr/local/gold/bin/ld /usr/bin/ld.gold
+ sudo ln -fs /usr/bin/ld.gold /usr/bin/ld
+ else
+ echo "make install failed, not installing gold"
+ fi
+}
+
+if ! egrep -q \
+ 'Ubuntu (8\.04|8\.10|9\.04|9\.10|10\.04|10\.10|karmic|lucid|maverick)' \
+ /etc/issue; then
+ echo "Only Ubuntu 8.04 (hardy) through 10.10 (maverick) are currently" \
+ "supported" >&2
+ exit 1
+fi
+
+if ! uname -m | egrep -q "i686|x86_64"; then
+ echo "Only x86 architectures are currently supported" >&2
+ exit
+fi
+
+if [ "x$(id -u)" != x0 ]; then
+ echo "Running as non-root user."
+ echo "You might have to enter your password one or more times for 'sudo'."
+ echo
+fi
+
+# Packages needed for chromeos only
+chromeos_dev_list="libpulse-dev"
+
+# Packages need for development
+dev_list="apache2 bison fakeroot flex g++ gperf libapache2-mod-php5
+ libasound2-dev libbz2-dev libcairo2-dev libdbus-glib-1-dev
+ libgconf2-dev libgl1-mesa-dev libglu1-mesa-dev libglib2.0-dev
+ libgnome-keyring-dev libgtk2.0-dev libjpeg62-dev libnspr4-dev
+ libnss3-dev libpam0g-dev libsqlite3-dev libxslt1-dev libxss-dev
+ libxtst-dev lighttpd mesa-common-dev msttcorefonts patch perl
+ php5-cgi pkg-config python python-dev rpm subversion ttf-dejavu-core
+ ttf-kochi-gothic ttf-kochi-mincho wdiff libcurl4-gnutls-dev
+ $chromeos_dev_list"
+
+# Run-time libraries required by chromeos only
+chromeos_lib_list="libpulse0 libbz2-1.0 libcurl4-gnutls-dev"
+
+# Full list of required run-time libraries
+lib_list="libatk1.0-0 libc6 libasound2 libcairo2 libdbus-glib-1-2 libexpat1
+ libfontconfig1 libfreetype6 libglib2.0-0 libgnome-keyring0 libgtk2.0-0
+ libnspr4-0d libnss3-1d libpango1.0-0 libpcre3 libpixman-1-0 libpng12-0
+ libstdc++6 libsqlite3-0 libx11-6 libxau6 libxcb1 libxcomposite1
+ libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6
+ libxinerama1 libxrandr2 libxrender1 libxtst6 zlib1g
+ $chromeos_lib_list"
+
+# Debugging symbols for all of the run-time libraries
+dbg_list="libatk1.0-dbg libc6-dbg libcairo2-dbg
+ libfontconfig1-dbg libglib2.0-0-dbg libgtk2.0-0-dbg libnspr4-0d-dbg
+ libnss3-1d-dbg libpango1.0-0-dbg libpcre3-dbg libpixman-1-0-dbg
+ libx11-6-dbg libxau6-dbg libxcb1-dbg libxcomposite1-dbg
+ libxcursor1-dbg libxdamage1-dbg libxdmcp6-dbg libxext6-dbg
+ libxfixes3-dbg libxi6-dbg libxinerama1-dbg libxrandr2-dbg
+ libxrender1-dbg libxtst6-dbg zlib1g-dbg"
+
+# CUPS package changed its name from hardy to the next version. Include
+# proper package here depending on the system.
+if egrep -q 'Ubuntu (8\.04|8\.10)' /etc/issue; then
+ dev_list="${dev_list} libcupsys2-dev"
+else
+ dev_list="${dev_list} libcups2-dev"
+fi
+
+# Waits for the user to press 'Y' or 'N'. Either uppercase of lowercase is
+# accepted. Returns 0 for 'Y' and 1 for 'N'. If an optional parameter has
+# been provided to yes_no(), the function also accepts RETURN as a user input.
+# The parameter specifies the exit code that should be returned in that case.
+# The function will echo the user's selection followed by a newline character.
+# Users can abort the function by pressing CTRL-C. This will call "exit 1".
+yes_no() {
+ local c
+ while :; do
+ c="$(trap 'stty echo -iuclc icanon 2>/dev/null' EXIT INT TERM QUIT
+ stty -echo iuclc -icanon 2>/dev/null
+ dd count=1 bs=1 2>/dev/null | od -An -tx1)"
+ case "$c" in
+ " 0a") if [ -n "$1" ]; then
+ [ $1 -eq 0 ] && echo "Y" || echo "N"
+ return $1
+ fi
+ ;;
+ " 79") echo "Y"
+ return 0
+ ;;
+ " 6e") echo "N"
+ return 1
+ ;;
+ "") echo "Aborted" >&2
+ exit 1
+ ;;
+ *) # The user pressed an unrecognized key. As we are not echoing
+ # any incorrect user input, alert the user by ringing the bell.
+ (tput bel) 2>/dev/null
+ ;;
+ esac
+ done
+}
+
+if test "$do_inst_syms" = ""
+then
+ echo "This script installs all tools and libraries needed to build Chromium."
+ echo ""
+ echo "For most of the libraries, it can also install debugging symbols, which"
+ echo "will allow you to debug code in the system libraries. Most developers"
+ echo "won't need these symbols."
+ echo -n "Do you want me to install them for you (y/N) "
+ if yes_no 1; then
+ do_inst_syms=1
+ fi
+fi
+if test "$do_inst_syms" = "1"; then
+ echo "Installing debugging symbols."
+else
+ echo "Skipping installation of debugging symbols."
+ dbg_list=
+fi
+
+sudo apt-get update
+
+# We initially run "apt-get" with the --reinstall option and parse its output.
+# This way, we can find all the packages that need to be newly installed
+# without accidentally promoting any packages from "auto" to "manual".
+# We then re-run "apt-get" with just the list of missing packages.
+echo "Finding missing packages..."
+packages="${dev_list} ${lib_list} ${dbg_list}"
+# Intentially leaving $packages unquoted so it's more readable.
+echo "Packages required: " $packages
+echo
+new_list_cmd="sudo apt-get install --reinstall $(echo $packages)"
+if new_list="$(yes n | LANG=C $new_list_cmd)"; then
+ # We probably never hit this following line.
+ echo "No missing packages, and the packages are up-to-date."
+elif [ $? -eq 1 ]; then
+ # We expect apt-get to have exit status of 1.
+ # This indicates that we canceled the install with "yes n|".
+ new_list=$(echo "$new_list" |
+ sed -e '1,/The following NEW packages will be installed:/d;s/^ //;t;d')
+ new_list=$(echo "$new_list" | sed 's/ *$//')
+ if [ -z "$new_list" ] ; then
+ echo "No missing packages, and the packages are up-to-date."
+ else
+ echo "Installing missing packages: $new_list."
+ sudo apt-get install ${new_list}
+ fi
+ echo
+else
+ # An apt-get exit status of 100 indicates that a real error has occurred.
+
+ # I am intentionally leaving out the '"'s around new_list_cmd,
+ # as this makes it easier to cut and paste the output
+ echo "The following command failed: " ${new_list_cmd}
+ echo
+ echo "It produces the following output:"
+ yes n | $new_list_cmd || true
+ echo
+ echo "You will have to install the above packages yourself."
+ echo
+ exit 100
+fi
+
+# Some operating systems already ship gold (on recent Debian and
+# Ubuntu you can do "apt-get install binutils-gold" to get it), but
+# older releases didn't. Additionally, gold 2.20 (included in Ubuntu
+# Lucid) makes binaries that just segfault.
+# So install from source if we don't have a good version.
+
+case `ld --version` in
+*gold*2.20.1*) ;;
+*gold*2.2[1-9]*) ;;
+* )
+ if test "$do_inst_gold" = ""
+ then
+ echo "Gold is a new linker that links Chrome 5x faster than ld."
+ echo "Don't use it if you need to link other apps (e.g. valgrind, wine)"
+ echo -n "REPLACE SYSTEM LINKER ld with gold and back up ld? (y/N) "
+ if yes_no 1; then
+ do_inst_gold=1
+ fi
+ fi
+ if test "$do_inst_gold" = "1"
+ then
+ # If the system provides a good version of gold, just install it.
+ if apt-cache show binutils-gold | grep -Eq 'Version: 2.2(0.1|[1-9]*)'; then
+ echo "Installing binutils-gold. Backing up ld as ld.single."
+ sudo apt-get install binutils-gold
+ else
+ # FIXME: avoid installing as /usr/bin/ld
+ echo "Building binutils. Backing up ld as ld.orig."
+ install_gold || exit 99
+ fi
+ else
+ echo "Not installing gold."
+ fi
+esac
+
+# Install 32bit backwards compatibility support for 64bit systems
+if [ "$(uname -m)" = "x86_64" ]; then
+ if test "$do_inst_lib32" = ""
+ then
+ echo "Installing 32bit libraries not already provided by the system"
+ echo
+ echo "This is only needed to build a 32-bit Chrome on your 64-bit system."
+ echo
+ echo "While we only need to install a relatively small number of library"
+ echo "files, we temporarily need to download a lot of large *.deb packages"
+ echo "that contain these files. We will create new *.deb packages that"
+ echo "include just the 32bit libraries. These files will then be found on"
+ echo "your system in places like /lib32, /usr/lib32, /usr/lib/debug/lib32,"
+ echo "/usr/lib/debug/usr/lib32. If you ever need to uninstall these files,"
+ echo "look for packages named *-ia32.deb."
+ echo "Do you want me to download all packages needed to build new 32bit"
+ echo -n "package files (Y/n) "
+ if yes_no 0; then
+ do_inst_lib32=1
+ fi
+ fi
+ if test "$do_inst_lib32" != "1"
+ then
+ echo "Exiting without installing any 32bit libraries."
+ exit 0
+ fi
+
+ # Standard 32bit compatibility libraries
+ echo "First, installing the limited existing 32-bit support..."
+ cmp_list="ia32-libs lib32asound2-dev lib32readline5-dev lib32stdc++6 lib32z1
+ lib32z1-dev libc6-dev-i386 libc6-i386 g++-multilib"
+ sudo apt-get install $cmp_list
+
+ tmp=/tmp/install-32bit.$$
+ trap 'rm -rf "${tmp}"' EXIT INT TERM QUIT
+ mkdir -p "${tmp}/apt/lists/partial" "${tmp}/cache" "${tmp}/partial"
+ touch "${tmp}/status"
+
+ [ -r /etc/apt/apt.conf ] && cp /etc/apt/apt.conf "${tmp}/apt/"
+ cat >>"${tmp}/apt/apt.conf" <<EOF
+ Apt::Architecture "i386";
+ Dir::Cache "${tmp}/cache";
+ Dir::Cache::Archives "${tmp}/";
+ Dir::State::Lists "${tmp}/apt/lists/";
+ Dir::State::status "${tmp}/status";
+EOF
+
+ # Download 32bit packages
+ echo "Computing list of available 32bit packages..."
+ sudo apt-get -c="${tmp}/apt/apt.conf" update
+
+ echo "Downloading available 32bit packages..."
+ sudo apt-get -c="${tmp}/apt/apt.conf" \
+ --yes --download-only --force-yes --reinstall install \
+ ${lib_list} ${dbg_list}
+
+ # Open packages, remove everything that is not a library, move the
+ # library to a lib32 directory and package everything as a *.deb file.
+ echo "Repackaging and installing 32bit packages for use on 64bit systems..."
+ for i in ${lib_list} ${dbg_list}; do
+ orig="$(echo "${tmp}/${i}"_*_i386.deb)"
+ compat="$(echo "${orig}" |
+ sed -e 's,\(_[^_/]*_\)i386\(.deb\),-ia32\1amd64\2,')"
+ rm -rf "${tmp}/staging"
+ msg="$(fakeroot -u sh -exc '
+ # Unpack 32bit Debian archive
+ umask 022
+ mkdir -p "'"${tmp}"'/staging/dpkg/DEBIAN"
+ cd "'"${tmp}"'/staging"
+ ar x "'${orig}'"
+ tar zCfx dpkg data.tar.gz
+ tar zCfx dpkg/DEBIAN control.tar.gz
+
+ # Create a posix extended regular expression fragment that will
+ # recognize the includes which have changed. Should be rare,
+ # will almost always be empty.
+ includes=`sed -n -e "s/^[0-9a-z]* //g" \
+ -e "\,usr/include/,p" dpkg/DEBIAN/md5sums |
+ xargs -n 1 -I FILE /bin/sh -c \
+ "cmp -s dpkg/FILE /FILE || echo FILE" |
+ tr "\n" "|" |
+ sed -e "s,|$,,"`
+
+ # If empty, set it to not match anything.
+ test -z "$includes" && includes="^//"
+
+ # Turn the conflicts into an extended RE for removal from the
+ # Provides line.
+ conflicts=`sed -n -e "/Conflicts/s/Conflicts: *//;T;s/, */|/g;p" \
+ dpkg/DEBIAN/control`
+
+ # Rename package, change architecture, remove conflicts and dependencies
+ sed -r -i \
+ -e "/Package/s/$/-ia32/" \
+ -e "/Architecture/s/:.*$/: amd64/" \
+ -e "/Depends/s/:.*/: ia32-libs/" \
+ -e "/Provides/s/($conflicts)(, *)?//g;T1;s/, *$//;:1" \
+ -e "/Recommends/d" \
+ -e "/Conflicts/d" \
+ dpkg/DEBIAN/control
+
+ # Only keep files that live in "lib" directories or the includes
+ # that have changed.
+ sed -r -i \
+ -e "/\/lib64\//d" -e "/\/.?bin\//d" \
+ -e "\,$includes,s,[ /]include/,&32/,g;s,include/32/,include32/,g" \
+ -e "s, lib/, lib32/,g" \
+ -e "s,/lib/,/lib32/,g" \
+ -e "t;d" \
+ -e "\,^/usr/lib32/debug\(.*/lib32\),s,^/usr/lib32/debug,/usr/lib/debug," \
+ dpkg/DEBIAN/md5sums
+
+ # Re-run ldconfig after installation/removal
+ { echo "#!/bin/sh"; echo "[ \"x\$1\" = xconfigure ]&&ldconfig||:"; } \
+ >dpkg/DEBIAN/postinst
+ { echo "#!/bin/sh"; echo "[ \"x\$1\" = xremove ]&&ldconfig||:"; } \
+ >dpkg/DEBIAN/postrm
+ chmod 755 dpkg/DEBIAN/postinst dpkg/DEBIAN/postrm
+
+ # Remove any other control files
+ find dpkg/DEBIAN -mindepth 1 "(" -name control -o -name md5sums -o \
+ -name postinst -o -name postrm ")" -o -print |
+ xargs -r rm -rf
+
+ # Remove any files/dirs that live outside of "lib" directories,
+ # or are not in our list of changed includes.
+ find dpkg -mindepth 1 -regextype posix-extended \
+ "(" -name DEBIAN -o -name lib -o -regex "dpkg/($includes)" ")" \
+ -prune -o -print | tac |
+ xargs -r -n 1 sh -c "rm \$0 2>/dev/null || rmdir \$0 2>/dev/null || : "
+ find dpkg -name lib64 -o -name bin -o -name "?bin" |
+ tac | xargs -r rm -rf
+
+ # Remove any symbolic links that were broken by the above steps.
+ find -L dpkg -type l -print | tac | xargs -r rm -rf
+
+ # Rename lib to lib32, but keep debug symbols in /usr/lib/debug/usr/lib32
+ # That is where gdb looks for them.
+ find dpkg -type d -o -path "*/lib/*" -print |
+ xargs -r -n 1 sh -c "
+ i=\$(echo \"\${0}\" |
+ sed -e s,/lib/,/lib32/,g \
+ -e s,/usr/lib32/debug\\\\\(.*/lib32\\\\\),/usr/lib/debug\\\\1,);
+ mkdir -p \"\${i%/*}\";
+ mv \"\${0}\" \"\${i}\""
+
+ # Rename include to include32.
+ [ -d "dpkg/usr/include" ] && mv "dpkg/usr/include" "dpkg/usr/include32"
+
+ # Prune any empty directories
+ find dpkg -type d | tac | xargs -r -n 1 rmdir 2>/dev/null || :
+
+ # Create our own Debian package
+ cd ..
+ dpkg --build staging/dpkg .' 2>&1)"
+ compat="$(eval echo $(echo "${compat}" |
+ sed -e 's,_[^_/]*_amd64.deb,_*_amd64.deb,'))"
+ [ -r "${compat}" ] || {
+ echo "${msg}" >&2
+ echo "Failed to build new Debian archive!" >&2
+ exit 1
+ }
+
+ msg="$(sudo dpkg -i "${compat}" 2>&1)" && {
+ echo "Installed ${compat##*/}"
+ } || {
+ # echo "${msg}" >&2
+ echo "Skipped ${compat##*/}"
+ }
+ done
+
+ # Add symbolic links for developing 32bit code
+ echo "Adding missing symbolic links, enabling 32bit code development..."
+ for i in $(find /lib32 /usr/lib32 -maxdepth 1 -name \*.so.\* |
+ sed -e 's/[.]so[.][0-9].*/.so/' |
+ sort -u); do
+ [ "x${i##*/}" = "xld-linux.so" ] && continue
+ [ -r "$i" ] && continue
+ j="$(ls "$i."* | sed -e 's/.*[.]so[.]\([^.]*\)$/\1/;t;d' |
+ sort -n | tail -n 1)"
+ [ -r "$i.$j" ] || continue
+ sudo ln -s "${i##*/}.$j" "$i"
+ done
+fi
diff --git a/build/.svn/text-base/install-chroot.sh.svn-base b/build/.svn/text-base/install-chroot.sh.svn-base
new file mode 100644
index 0000000..b80aea0
--- /dev/null
+++ b/build/.svn/text-base/install-chroot.sh.svn-base
@@ -0,0 +1,325 @@
+#!/bin/bash -e
+
+# 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.
+
+# This script installs Debian-derived distributions in a chroot environment.
+# It can for example be used to have an accurate 32bit build and test
+# environment when otherwise working on a 64bit machine.
+# N. B. it is unlikely that this script will ever work on anything other than a
+# Debian-derived system.
+
+usage() {
+ echo "usage: ${0##*/} [-m mirror] [-g group,...] [-s] [-c]"
+ echo "-g group,... groups that can use the chroot unauthenticated"
+ echo " Default: 'admin' and current user's group ('$(id -gn)')"
+ echo "-m mirror an alternate repository mirror for package downloads"
+ echo "-s configure default deb-srcs"
+ echo "-c always copy 64bit helper binaries to 32bit chroot"
+ echo "-h this help message"
+}
+
+process_opts() {
+ local OPTNAME OPTIND OPTERR OPTARG
+ while getopts ":g:m:sch" OPTNAME; do
+ case "$OPTNAME" in
+ g)
+ [ -n "${OPTARG}" ] &&
+ chroot_groups="${chroot_groups}${chroot_groups:+,}${OPTARG}"
+ ;;
+ m)
+ if [ -n "${mirror}" ]; then
+ echo "You can only specify exactly one mirror location"
+ usage
+ exit 1
+ fi
+ mirror="$OPTARG"
+ ;;
+ s)
+ add_srcs="y"
+ ;;
+ c)
+ copy_64="y"
+ ;;
+ h)
+ usage
+ exit 0
+ ;;
+ \:)
+ echo "'-$OPTARG' needs an argument."
+ usage
+ exit 1
+ ;;
+ *)
+ echo "invalid command-line option: $OPTARG"
+ usage
+ exit 1
+ ;;
+ esac
+ done
+
+ if [ $# -ge ${OPTIND} ]; then
+ eval echo "Unexpected command line argument: \${${OPTIND}}"
+ usage
+ exit 1
+ fi
+}
+
+
+# Check that we are running as a regular user
+[ "$(id -nu)" = root ] && {
+ echo "Run this script as a regular user and provide your \"sudo\"" \
+ "password if requested" >&2
+ exit 1
+}
+mkdir -p "$HOME/chroot/"
+
+process_opts "$@"
+
+# Error handler
+trap 'exit 1' INT TERM QUIT
+trap 'sudo apt-get clean; tput bel; echo; echo Failed' EXIT
+
+# Install any missing applications that this script relies on. If these packages
+# are already installed, don't force another "apt-get install". That would
+# prevent them from being auto-removed, if they ever become eligible for that.
+# And as this script only needs the packages once, there is no good reason to
+# introduce a hard dependency on things such as dchroot and debootstrap.
+dep=
+for i in dchroot debootstrap; do
+ [ -d /usr/share/doc/"$i" ] || dep="$dep $i"
+done
+[ -n "$dep" ] && sudo apt-get -y install $dep
+sudo apt-get -y install schroot
+
+# Create directory for chroot
+sudo mkdir -p /var/lib/chroot
+
+# Find chroot environments that can be installed with debootstrap
+targets="$(cd /usr/share/debootstrap/scripts
+ ls | grep '^[a-z]*$')"
+
+# Ask user to pick one of the available targets
+echo "The following targets are available to be installed in a chroot:"
+j=1; for i in $targets; do
+ printf '%4d: %s\n' "$j" "$i"
+ j=$(($j+1))
+done
+while :; do
+ printf "Which target would you like to install: "
+ read n
+ [ "$n" -gt 0 -a "$n" -lt "$j" ] >&/dev/null && break
+done
+j=1; for i in $targets; do
+ [ "$j" -eq "$n" ] && { distname="$i"; break; }
+ j=$(($j+1))
+done
+
+# On x86-64, ask whether the user wants to install x86-32 or x86-64
+archflag=
+arch=
+if [ "$(uname -m)" = x86_64 ]; then
+ while :; do
+ echo "You are running a 64bit kernel. This allows you to install either a"
+ printf "32bit or a 64bit chroot environment. %s" \
+ "Which one do you want (32, 64) "
+ read arch
+ [ "${arch}" == 32 -o "${arch}" == 64 ] && break
+ done
+ [ "${arch}" == 32 ] && archflag="--arch i386" || archflag="--arch amd64"
+ arch="${arch}bit"
+fi
+target="${distname}${arch}"
+
+# Don't overwrite an existing installation
+[ -d /var/lib/chroot/"${target}" ] && {
+ echo "This chroot already exists on your machine." >&2
+ echo "Delete /var/lib/chroot/${target} if you want to start over." >&2
+ exit 1
+}
+sudo mkdir -p /var/lib/chroot/"${target}"
+
+# Offer to include additional standard repositories for Ubuntu-based chroots.
+alt_repos=
+grep ubuntu.com /usr/share/debootstrap/scripts/"${distname}" >&/dev/null && {
+ while :; do
+ echo "Would you like to add ${distname}-updates and ${distname}-security "
+ echo -n "to the chroot's sources.list (y/n)? "
+ read alt_repos
+ case "${alt_repos}" in
+ y|Y)
+ alt_repos="y"
+ break
+ ;;
+ n|N)
+ break
+ ;;
+ esac
+ done
+}
+
+# Remove stale entry from /etc/schroot/schroot.conf. Entries start
+# with the target name in square brackets, followed by an arbitrary
+# number of lines. The entry stops when either the end of file has
+# been reached, or when the beginning of a new target is encountered.
+# This means, we cannot easily match for a range of lines in
+# "sed". Instead, we actually have to iterate over each line and check
+# whether it is the beginning of a new entry.
+sudo sed -ni '/^[[]'"${target%bit}"']$/,${:1;n;/^[[]/b2;b1;:2;p;n;b2};p' \
+ /etc/schroot/schroot.conf
+
+# Download base system. This takes some time
+if [ -z "${mirror}" ]; then
+ grep ubuntu.com /usr/share/debootstrap/scripts/"${distname}" >&/dev/null &&
+ mirror="http://archive.ubuntu.com/ubuntu" ||
+ mirror="http://ftp.us.debian.org/debian"
+fi
+ sudo debootstrap ${archflag} "${distname}" /var/lib/chroot/"${target}" \
+ "$mirror"
+
+# Add new entry to /etc/schroot/schroot.conf
+grep ubuntu.com /usr/share/debootstrap/scripts/"${distname}" >&/dev/null &&
+ brand="Ubuntu" || brand="Debian"
+if [ -z "${chroot_groups}" ]; then
+ chroot_groups="admin,$(id -gn)"
+fi
+sudo sh -c 'cat >>/etc/schroot/schroot.conf' <<EOF
+[${target%bit}]
+description=${brand} ${distname} ${arch}
+type=directory
+directory=/var/lib/chroot/${target}
+priority=3
+users=root
+groups=${chroot_groups}
+root-groups=${chroot_groups}
+personality=linux$([ "${arch}" != 64bit ] && echo 32)
+script-config=script-${target}
+
+EOF
+
+# Set up a special directory that changes contents depending on the target
+# that is executing.
+sed '/^FSTAB=/s,/mount-defaults",/mount-'"${target}"'",' \
+ /etc/schroot/script-defaults |
+ sudo sh -c 'cat >/etc/schroot/script-'"${target}"
+sudo cp /etc/schroot/mount-defaults /etc/schroot/mount-"${target}"
+echo "$HOME/chroot/.${target} $HOME/chroot none rw,bind 0 0" |
+ sudo sh -c 'cat >>/etc/schroot/mount-'"${target}"
+mkdir -p "$HOME/chroot/.${target}"
+
+# Install a helper script to launch commands in the chroot
+sudo sh -c 'cat >/usr/local/bin/'"${target%bit}" <<EOF
+#!/bin/bash
+if [ \$# -eq 0 ]; then
+ exec schroot -c ${target%bit} -p
+else
+ p="\$1"; shift
+ exec schroot -c ${target%bit} -p "\$p" -- "\$@"
+fi
+exit 1
+EOF
+sudo chown root:root /usr/local/bin/"${target%bit}"
+sudo chmod 755 /usr/local/bin/"${target%bit}"
+
+# Add the standard Ubuntu update repositories if requested.
+[ "${alt_repos}" = "y" -a \
+ -r "/var/lib/chroot/${target}/etc/apt/sources.list" ] &&
+sudo sed -i '/^deb .* [^ -]\+ main$/p
+ s/^\(deb .* [^ -]\+\) main/\1-security main/
+ p
+ t1
+ d
+ :1;s/-security main/-updates main/
+ t
+ d' "/var/lib/chroot/${target}/etc/apt/sources.list"
+
+# Add a few more repositories to the chroot
+[ "${add_srcs}" = "y" -a \
+ -r "/var/lib/chroot/${target}/etc/apt/sources.list" ] &&
+sudo sed -i 's/ main$/ main restricted universe multiverse/
+ p
+ t1
+ d
+ :1;s/^deb/deb-src/
+ t
+ d' "/var/lib/chroot/${target}/etc/apt/sources.list"
+
+# Update packages
+sudo schroot -c "${target%bit}" -p -- /bin/sh -c '
+ apt-get update; apt-get -y dist-upgrade' || :
+
+# Install a couple of missing packages
+for i in debian-keyring ubuntu-keyring locales sudo; do
+ [ -d "/var/lib/chroot/${target}/usr/share/doc/$i" ] ||
+ sudo schroot -c "${target%bit}" -p -- apt-get -y install "$i" || :
+done
+
+# Configure locales
+sudo schroot -c "${target%bit}" -p -- /bin/sh -c '
+ l='"${LANG:-en_US}"'; l="${l%%.*}"
+ [ -r /etc/locale.gen ] &&
+ sed -i "s/^# \($l\)/\1/" /etc/locale.gen
+ locale-gen $LANG en_US en_US.UTF-8' || :
+
+# Configure "sudo" package
+sudo schroot -c "${target%bit}" -p -- /bin/sh -c '
+ egrep '"'^$(id -nu) '"' /etc/sudoers >/dev/null 2>&1 ||
+ echo '"'$(id -nu) ALL=(ALL) ALL'"' >>/etc/sudoers'
+
+# Install a few more commonly used packages
+sudo schroot -c "${target%bit}" -p -- apt-get -y install \
+ autoconf automake1.9 dpkg-dev g++-multilib gcc-multilib gdb less libtool \
+ strace
+
+# If running a 32bit environment on a 64bit machine, install a few binaries
+# as 64bit. This is only done automatically if the chroot distro is the same as
+# the host, otherwise there might be incompatibilities in build settings or
+# runtime dependencies. The user can force it with the '-c' flag.
+host_distro=$(grep DISTRIB_CODENAME /etc/lsb-release 2>/dev/null | \
+ cut -d "=" -f 2)
+if [ "${copy_64}" = "y" -o \
+ "${host_distro}" = "${distname}" -a "${arch}" = 32bit ] && \
+ file /bin/bash 2>/dev/null | grep -q x86-64; then
+ readlinepkg=$(sudo schroot -c "${target%bit}" -p -- sh -c \
+ 'apt-cache search "lib64readline.\$" | sort | tail -n 1 | cut -d " " -f 1')
+ sudo schroot -c "${target%bit}" -p -- apt-get -y install \
+ lib64expat1 lib64ncurses5 ${readlinepkg} lib64z1
+ dep=
+ for i in binutils gdb strace; do
+ [ -d /usr/share/doc/"$i" ] || dep="$dep $i"
+ done
+ [ -n "$dep" ] && sudo apt-get -y install $dep
+ sudo cp /usr/bin/gdb "/var/lib/chroot/${target}/usr/local/bin/"
+ sudo cp /usr/bin/ld "/var/lib/chroot/${target}/usr/local/bin/"
+ for i in libbfd libpython; do
+ lib="$({ ldd /usr/bin/ld; ldd /usr/bin/gdb; } |
+ grep "$i" | awk '{ print $3 }')"
+ if [ -n "$lib" -a -r "$lib" ]; then
+ sudo cp "$lib" "/var/lib/chroot/${target}/usr/lib64/"
+ fi
+ done
+ for lib in libssl libcrypt; do
+ sudo cp /usr/lib/$lib* "/var/lib/chroot/${target}/usr/lib64/" || :
+ done
+fi
+
+# Clean up package files
+sudo schroot -c "${target%bit}" -p -- apt-get clean
+sudo apt-get clean
+
+# Let the user know what we did
+trap '' INT TERM QUIT
+trap '' EXIT
+cat <<EOF
+
+
+Successfully installed ${distname} ${arch}
+
+You can run programs inside of the chroot by invoking the "${target%bit}"
+command.
+
+Your home directory is shared between the host and the chroot. But I configured
+$HOME/chroot to be private to the chroot environment. You can use it
+for files that need to differ between environments.
+EOF
diff --git a/build/.svn/text-base/output_dll_copy.rules.svn-base b/build/.svn/text-base/output_dll_copy.rules.svn-base
new file mode 100644
index 0000000..c6e9051
--- /dev/null
+++ b/build/.svn/text-base/output_dll_copy.rules.svn-base
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<VisualStudioToolFile
+ Name="Output DLL copy"
+ Version="8.00"
+ >
+ <Rules>
+ <CustomBuildRule
+ Name="Output DLL copy"
+ CommandLine="xcopy /R /C /Y $(InputPath) $(OutDir)"
+ Outputs="$(OutDir)\$(InputFileName)"
+ FileExtensions="*.dll"
+ >
+ <Properties>
+ </Properties>
+ </CustomBuildRule>
+ </Rules>
+</VisualStudioToolFile>
diff --git a/build/.svn/text-base/release.gypi.svn-base b/build/.svn/text-base/release.gypi.svn-base
new file mode 100644
index 0000000..c12526b
--- /dev/null
+++ b/build/.svn/text-base/release.gypi.svn-base
@@ -0,0 +1,19 @@
+{
+ 'conditions': [
+ # Handle build types.
+ ['buildtype=="Dev"', {
+ 'includes': ['internal/release_impl.gypi'],
+ }],
+ ['buildtype=="Official"', {
+ 'includes': ['internal/release_impl_official.gypi'],
+ }],
+ # TODO(bradnelson): may also need:
+ # checksenabled
+ # coverage
+ # dom_stats
+ # pgo_instrument
+ # pgo_optimize
+ # purify
+ ],
+}
+
diff --git a/build/.svn/text-base/sanitize-mac-build-log.sed.svn-base b/build/.svn/text-base/sanitize-mac-build-log.sed.svn-base
new file mode 100644
index 0000000..d6cef78
--- /dev/null
+++ b/build/.svn/text-base/sanitize-mac-build-log.sed.svn-base
@@ -0,0 +1,22 @@
+#!/bin/echo Use sanitize-mac-build-log.sh or sed -f
+
+# 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.
+
+# Use this sed script to reduce a Mac build log into something readable.
+
+# Drop uninformative lines.
+/^distcc/d
+/^Check dependencies/d
+/^ setenv /d
+/^ cd /d
+/^make: Nothing to be done/d
+
+# Xcode prints a short "compiling foobar.o" line followed by the lengthy
+# full command line. These deletions drop the command line.
+\|^ /Developer/usr/bin/|d
+
+# Shorten the "compiling foobar.o" line.
+s|^Distributed-CompileC \(.*\) normal i386 c++ com.apple.compilers.gcc.4_2| CC \1|
+s|^CompileC \(.*\) normal i386 c++ com.apple.compilers.gcc.4_2| CC \1|
diff --git a/build/.svn/text-base/sanitize-mac-build-log.sh.svn-base b/build/.svn/text-base/sanitize-mac-build-log.sh.svn-base
new file mode 100644
index 0000000..dc743fa
--- /dev/null
+++ b/build/.svn/text-base/sanitize-mac-build-log.sh.svn-base
@@ -0,0 +1,6 @@
+#!/bin/sh
+# 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.
+sed -f `dirname "${0}"`/`basename "${0}" sh`sed
+
diff --git a/build/.svn/text-base/sanitize-win-build-log.sed.svn-base b/build/.svn/text-base/sanitize-win-build-log.sed.svn-base
new file mode 100644
index 0000000..d6d049c
--- /dev/null
+++ b/build/.svn/text-base/sanitize-win-build-log.sed.svn-base
@@ -0,0 +1,14 @@
+#!/bin/echo Use sanitize-win-build-log.sh or sed -f
+
+# 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.
+
+# Use this sed script to reduce a Windows build log into something
+# machine-parsable.
+
+# Drop uninformative lines.
+/The operation completed successfully./d
+
+# Drop parallelization indicators on lines.
+s/^[0-9]\+>//
diff --git a/build/.svn/text-base/sanitize-win-build-log.sh.svn-base b/build/.svn/text-base/sanitize-win-build-log.sh.svn-base
new file mode 100644
index 0000000..dc743fa
--- /dev/null
+++ b/build/.svn/text-base/sanitize-win-build-log.sh.svn-base
@@ -0,0 +1,6 @@
+#!/bin/sh
+# 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.
+sed -f `dirname "${0}"`/`basename "${0}" sh`sed
+
diff --git a/build/.svn/text-base/whitespace_file.txt.svn-base b/build/.svn/text-base/whitespace_file.txt.svn-base
new file mode 100644
index 0000000..ccedfae
--- /dev/null
+++ b/build/.svn/text-base/whitespace_file.txt.svn-base
@@ -0,0 +1,9 @@
+Copyright (c) 2010 The Chromium Authors. All rights reserved.
+Use of this useless file is governed by a BSD-style license that can be
+found in the LICENSE file.
+
+This file is used for making non-code changes to trigger buildbot cycles. Make
+any modification below this line.
+================================================================================
+
+i am somewhat YELLY!
diff --git a/build/all.gyp b/build/all.gyp
index 46d550d..ba9bc45 100644
--- a/build/all.gyp
+++ b/build/all.gyp
@@ -46,6 +46,7 @@
'../third_party/sqlite/sqlite.gyp:*',
'../third_party/WebKit/WebKit/chromium/WebKit.gyp:*',
'../third_party/zlib/zlib.gyp:*',
+ '../ui/ui.gyp:*',
'../webkit/support/webkit_support.gyp:*',
'../webkit/webkit.gyp:*',
'util/build_util.gyp:*',
@@ -391,7 +392,7 @@
},
], # targets
'conditions': [
- ['(branding=="Chrome" and buildtype=="Official")', {
+ ['branding=="Chrome"', {
'targets': [
{
'target_name': 'chrome_official_builder',
@@ -400,6 +401,7 @@
'../chrome/app/locales/locales.gyp:*',
'../chrome/chrome.gyp:crash_service',
'../chrome/chrome.gyp:page_cycler_tests',
+ '../chrome/chrome.gyp:policy_templates',
'../chrome/chrome.gyp:pyautolib',
'../chrome/chrome.gyp:reliability_tests',
'../chrome/chrome.gyp:startup_tests',
@@ -408,13 +410,19 @@
'../chrome_frame/chrome_frame.gyp:chrome_frame_unittests',
'../chrome_frame/chrome_frame.gyp:npchrome_frame',
'../courgette/courgette.gyp:courgette',
- '../pdf/pdf.gyp:pdf',
'../third_party/adobe/flash/flash_player.gyp:flash_player',
'../webkit/webkit.gyp:test_shell',
],
+ 'conditions': [
+ ['internal_pdf', {
+ 'dependencies': [
+ '../pdf/pdf.gyp:pdf',
+ ],
+ }], # internal_pdf
+ ]
},
], # targets
- }], # (branding=="Chrome" and buildtype=="Official")
+ }], # branding=="Chrome"
], # conditions
}], # OS="win"
['chromeos==1', {
diff --git a/build/common.gypi b/build/common.gypi
index e741a29..ae5f41a 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -6,29 +6,65 @@
# Please don't directly include this file if you are building via gyp_chromium,
# since gyp_chromium is automatically forcing its inclusion.
{
+ # Variables expected to be overriden on the GYP command line (-D) or by
+ # ~/.gyp/include.gypi.
'variables': {
- # .gyp files or targets should set chromium_code to 1 if they build
- # Chromium-specific code, as opposed to external code. This variable is
- # used to control such things as the set of warnings to enable, and
- # whether warnings are treated as errors.
- 'chromium_code%': 0,
-
- 'internal_pdf%': 0,
-
- # This allows to use libcros from the current system, ie. /usr/lib/
- # The cros_api will be pulled in as a static library, and all headers
- # from the system include dirs.
- 'system_libcros%': '0',
-
- # Variables expected to be overriden on the GYP command line (-D) or by
- # ~/.gyp/include.gypi.
-
# Putting a variables dict inside another variables dict looks kind of
- # weird. This is done so that "branding" and "buildtype" are defined as
+ # weird. This is done so that 'host_arch', 'chromeos', etc are defined as
# variables within the outer variables dict here. This is necessary
# to get these variables defined for the conditions within this variables
- # dict that operate on these variables.
+ # dict that operate on these variables (e.g., for setting 'toolkit_views',
+ # we need to have 'chromeos' already set).
'variables': {
+ 'variables': {
+ 'variables': {
+ # Whether we're building a ChromeOS build.
+ 'chromeos%': 0,
+
+ # Disable touch support by default.
+ 'touchui%': 0,
+ },
+ # Copy conditionally-set variables out one scope.
+ 'chromeos%': '<(chromeos)',
+ 'touchui%': '<(touchui)',
+
+ # To do a shared build on linux we need to be able to choose between
+ # type static_library and shared_library. We default to doing a static
+ # build but you can override this with "gyp -Dlibrary=shared_library"
+ # or you can add the following line (without the #) to
+ # ~/.gyp/include.gypi {'variables': {'library': 'shared_library'}}
+ # to compile as shared by default
+ 'library%': 'static_library',
+
+ # Compute the architecture that we're building on.
+ 'conditions': [
+ [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ # This handles the Linux platforms we generally deal with. Anything
+ # else gets passed through, which probably won't work very well; such
+ # hosts should pass an explicit target_arch to gyp.
+ 'host_arch%':
+ '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
+ }, { # OS!="linux"
+ 'host_arch%': 'ia32',
+ }],
+
+ # Set default value of toolkit_views on for Windows, Chrome OS
+ # and the touch UI.
+ ['OS=="win" or chromeos==1 or touchui==1', {
+ 'toolkit_views%': 1,
+ }, {
+ 'toolkit_views%': 0,
+ }],
+ ],
+ },
+
+ # Copy conditionally-set variables out one scope.
+ 'chromeos%': '<(chromeos)',
+ 'touchui%': '<(touchui)',
+ 'host_arch%': '<(host_arch)',
+ 'library%': '<(library)',
+ 'toolkit_views%': '<(toolkit_views)',
+
# Override branding to select the desired branding flavor.
'branding%': 'Chromium',
@@ -42,77 +78,10 @@
# builds).
'buildtype%': 'Dev',
- 'variables': {
- # Compute the architecture that we're building on.
- 'conditions': [
- [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
- # This handles the Linux platforms we generally deal with. Anything
- # else gets passed through, which probably won't work very well; such
- # hosts should pass an explicit target_arch to gyp.
- 'host_arch%':
- '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
- }, { # OS!="linux"
- 'host_arch%': 'ia32',
- }],
- ],
-
- # Whether we're building a ChromeOS build. We set the initial
- # value at this level of nesting so it's available for the
- # toolkit_views test below.
- 'chromeos%': '0',
-
- # Disable touch support by default.
- 'touchui%': 0,
-
- # To do a shared build on linux we need to be able to choose between
- # type static_library and shared_library. We default to doing a static
- # build but you can override this with "gyp -Dlibrary=shared_library"
- # or you can add the following line (without the #) to
- # ~/.gyp/include.gypi {'variables': {'library': 'shared_library'}}
- # to compile as shared by default
- 'library%': 'static_library',
- },
-
- # We set those at this level of nesting so the values are available for
- # other conditionals below.
- 'conditions': [
- # Set default value of toolkit_views on for Windows, Chrome OS
- # and the touch UI.
- ['OS=="win" or chromeos==1 or touchui==1', {
- 'toolkit_views%': 1,
- }, {
- 'toolkit_views%': 0,
- }],
-
- # A flag to enable or disable our compile-time dependency
- # on gnome-keyring. If that dependency is disabled, no gnome-keyring
- # support will be available. This option is useful
- # for Linux distributions.
- ['chromeos==1', {
- 'use_gnome_keyring%': 0,
- }, {
- 'use_gnome_keyring%': 1,
- }],
-
- # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
- # libraries on linux x86-64 and arm.
- ['host_arch=="ia32"', {
- 'linux_fpic%': 0,
- }, {
- 'linux_fpic%': 1,
- }],
- ],
-
- 'host_arch%': '<(host_arch)',
-
# Default architecture we're building for is the architecture we're
# building on.
'target_arch%': '<(host_arch)',
- # Copy conditionally-set variables out one scope.
- 'chromeos%': '<(chromeos)',
- 'touchui%': '<(touchui)',
-
# This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are
# are built under a chromium full build (1) or a webkit.org chromium
# build (0).
@@ -137,24 +106,53 @@
# On Linux, we build with sse2 for Chromium builds.
'disable_sse2%': 0,
- # Remoting compilation is enabled by default. Set to 0 to disable.
- 'remoting%': 1,
-
# Use libjpeg-turbo as the JPEG codec used by Chromium.
'use_libjpeg_turbo%': 0,
- 'library%': '<(library)',
-
# Variable 'component' is for cases where we would like to build some
# components as dynamic shared libraries but still need variable
# 'library' for static libraries.
# By default, component is set to whatever library is set to and
# it can be overriden by the GYP command line or by ~/.gyp/include.gypi.
'component%': '<(library)',
+
+ # Set to select the Title Case versions of strings in GRD files.
+ 'use_titlecase_in_grd_files%': 0,
+
+ 'conditions': [
+ # A flag to enable or disable our compile-time dependency
+ # on gnome-keyring. If that dependency is disabled, no gnome-keyring
+ # support will be available. This option is useful
+ # for Linux distributions.
+ ['chromeos==1', {
+ 'use_gnome_keyring%': 0,
+ }, {
+ 'use_gnome_keyring%': 1,
+ }],
+
+ # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
+ # libraries on linux x86-64 and arm.
+ ['host_arch=="ia32"', {
+ 'linux_fpic%': 0,
+ }, {
+ 'linux_fpic%': 1,
+ }],
+
+ ['toolkit_views==0 or OS=="mac"', {
+ # GTK+ and Mac wants Title Case strings
+ 'use_titlecase_in_grd_files%': 1,
+ }],
+
+ # Enable some hacks to support Flapper only on Chrome OS.
+ ['chromeos==1', {
+ 'enable_flapper_hacks%': 1,
+ }, {
+ 'enable_flapper_hacks%': 0,
+ }],
+ ],
},
- # Define branding and buildtype on the basis of their settings within the
- # variables sub-dict above, unless overridden.
+ # Copy conditionally-set variables out one scope.
'branding%': '<(branding)',
'buildtype%': '<(buildtype)',
'target_arch%': '<(target_arch)',
@@ -162,6 +160,7 @@
'toolkit_views%': '<(toolkit_views)',
'use_gnome_keyring%': '<(use_gnome_keyring)',
'linux_fpic%': '<(linux_fpic)',
+ 'enable_flapper_hacks%': '<(enable_flapper_hacks)',
'chromeos%': '<(chromeos)',
'touchui%': '<(touchui)',
'inside_chromium_build%': '<(inside_chromium_build)',
@@ -171,9 +170,9 @@
'arm_neon%': '<(arm_neon)',
'sysroot%': '<(sysroot)',
'disable_sse2%': '<(disable_sse2)',
- 'remoting%': '<(remoting)',
'library%': '<(library)',
'component%': '<(component)',
+ 'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
# The release channel that this build targets. This is used to restrict
# channel-specific build options, like which installer packages to create.
@@ -293,9 +292,6 @@
# Set to 1 to link against libgnome-keyring instead of using dlopen().
'linux_link_gnome_keyring%': 0,
- # Set to select the Title Case versions of strings in GRD files.
- 'use_titlecase_in_grd_files%': 0,
-
# Used to disable Native Client at compile time, for platforms where it
# isn't supported
'disable_nacl%': 0,
@@ -323,6 +319,40 @@
# Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803
'use_openssl%': 0,
+ # .gyp files or targets should set chromium_code to 1 if they build
+ # Chromium-specific code, as opposed to external code. This variable is
+ # used to control such things as the set of warnings to enable, and
+ # whether warnings are treated as errors.
+ 'chromium_code%': 0,
+
+ # Set to 1 to compile with the built in pdf viewer.
+ 'internal_pdf%': 0,
+
+ # This allows to use libcros from the current system, ie. /usr/lib/
+ # The cros_api will be pulled in as a static library, and all headers
+ # from the system include dirs.
+ 'system_libcros%': 0,
+
+ # Remoting compilation is enabled by default. Set to 0 to disable.
+ 'remoting%': 1,
+
+ # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
+ # so Cocoa is happy (http://crbug.com/20441).
+ 'locales': [
+ 'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
+ 'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
+ 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
+ 'ml', 'mr', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
+ 'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
+ 'vi', 'zh-CN', 'zh-TW',
+ ],
+
+ 'grit_defines': [],
+
+ # Use Harfbuzz-NG instead of Harfbuzz.
+ # Under development: http://crbug.com/68551
+ 'use_harfbuzz_ng%': 0,
+
'conditions': [
['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
# This will set gcc_version to XY if you are running gcc X.Y.*.
@@ -339,15 +369,10 @@
['(branding=="Chrome" and buildtype=="Official")', {
'linux_dump_symbols%': 1,
}],
- ['toolkit_views==0', {
- # GTK wants Title Case strings
- 'use_titlecase_in_grd_files%': 1,
- }],
],
}], # OS=="linux" or OS=="freebsd" or OS=="openbsd"
+
['OS=="mac"', {
- # Mac wants Title Case strings
- 'use_titlecase_in_grd_files%': 1,
'conditions': [
# mac_product_name is set to the name of the .app bundle as it should
# appear on disk. This duplicates data from
@@ -372,6 +397,7 @@
}],
],
}], # OS=="mac"
+
# Whether to use multiple cores to compile with visual studio. This is
# optional because it sometimes causes corruption on VS 2005.
# It is on by default on VS 2008 and off on VS 2005.
@@ -398,11 +424,13 @@
'NACL_WIN64',
],
}],
+
['OS=="mac" or (OS=="linux" and chromeos==0 and target_arch!="arm")', {
'use_cups%': 1,
}, {
'use_cups%': 0,
}],
+
# Set the relative path from this file to the GYP file of the JPEG
# library used by Chromium.
['use_libjpeg_turbo==1', {
@@ -410,17 +438,20 @@
}, {
'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
}], # use_libjpeg_turbo==1
- ],
- # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
- # so Cocoa is happy (http://crbug.com/20441).
- 'locales': [
- 'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
- 'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
- 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
- 'ml', 'mr', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
- 'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
- 'vi', 'zh-CN', 'zh-TW',
+ # Setup -D flags passed into grit.
+ ['chromeos==1', {
+ 'grit_defines': ['-D', 'chromeos'],
+ }],
+ ['toolkit_views==1', {
+ 'grit_defines': ['-D', 'toolkit_views'],
+ }],
+ ['touchui==1', {
+ 'grit_defines': ['-D', 'touchui'],
+ }],
+ ['use_titlecase_in_grd_files==1', {
+ 'grit_defines': ['-D', 'use_titlecase'],
+ }],
],
},
'target_defaults': {
@@ -491,6 +522,9 @@
['proprietary_codecs==1', {
'defines': ['USE_PROPRIETARY_CODECS'],
}],
+ ['enable_flapper_hacks==1', {
+ 'defines': ['ENABLE_FLAPPER_HACKS=1'],
+ }],
['fastbuild!=0', {
'conditions': [
# For Windows, we don't genererate debug information.
diff --git a/build/features_override.gypi b/build/features_override.gypi
index dc59950..770778d 100644
--- a/build/features_override.gypi
+++ b/build/features_override.gypi
@@ -15,7 +15,7 @@
'ENABLE_BLOB=1',
'ENABLE_BLOB_SLICE=1',
'ENABLE_CHANNEL_MESSAGING=1',
- 'ENABLE_CLIENT_BASED_GEOLOCATION=0',
+ 'ENABLE_CLIENT_BASED_GEOLOCATION=1',
'ENABLE_DASHBOARD_SUPPORT=0',
'ENABLE_DATABASE=1',
'ENABLE_DATAGRID=0',
diff --git a/build/internal/.svn/all-wcprops b/build/internal/.svn/all-wcprops
new file mode 100644
index 0000000..fa3850c
--- /dev/null
+++ b/build/internal/.svn/all-wcprops
@@ -0,0 +1,29 @@
+K 25
+svn:wc:ra_dav:version-url
+V 44
+/svn/!svn/ver/42890/trunk/src/build/internal
+END
+README.chromium
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/!svn/ver/35367/trunk/src/build/internal/README.chromium
+END
+release_impl_official.gypi
+K 25
+svn:wc:ra_dav:version-url
+V 71
+/svn/!svn/ver/42890/trunk/src/build/internal/release_impl_official.gypi
+END
+release_impl.gypi
+K 25
+svn:wc:ra_dav:version-url
+V 62
+/svn/!svn/ver/35449/trunk/src/build/internal/release_impl.gypi
+END
+release_defaults.gypi
+K 25
+svn:wc:ra_dav:version-url
+V 66
+/svn/!svn/ver/35449/trunk/src/build/internal/release_defaults.gypi
+END
diff --git a/build/internal/.svn/entries b/build/internal/.svn/entries
new file mode 100644
index 0000000..e54058f
--- /dev/null
+++ b/build/internal/.svn/entries
@@ -0,0 +1,164 @@
+10
+
+dir
+70875
+http://src.chromium.org/svn/trunk/src/build/internal
+http://src.chromium.org/svn
+
+
+
+2010-03-27T02:16:29.574773Z
+42890
+maruel@chromium.org
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+
+README.chromium
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+29a46a46f286c28702edc38b379270e7
+2009-12-30T04:39:17.822713Z
+35367
+bradnelson@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2189
+
+release_impl_official.gypi
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+2323279bd929cdb8c81e6b8ff1de8421
+2010-03-27T02:16:29.574773Z
+42890
+maruel@chromium.org
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+567
+
+release_impl.gypi
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+3f7460c6ff5f62fe8ac611440a2aeab0
+2010-01-04T06:40:16.325670Z
+35449
+bradnelson@google.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+45
+
+release_defaults.gypi
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+94e7cde3c64a768becc543257895f783
+2010-01-04T06:40:16.325670Z
+35449
+bradnelson@google.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+318
+
diff --git a/build/internal/.svn/prop-base/README.chromium.svn-base b/build/internal/.svn/prop-base/README.chromium.svn-base
new file mode 100644
index 0000000..92de39c
--- /dev/null
+++ b/build/internal/.svn/prop-base/README.chromium.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 13
+svn:mergeinfo
+V 73
+/branches/chrome_webkit_merge_branch/build/internal/README.google:69-2775
+END
diff --git a/build/internal/.svn/text-base/README.chromium.svn-base b/build/internal/.svn/text-base/README.chromium.svn-base
new file mode 100644
index 0000000..4624830
--- /dev/null
+++ b/build/internal/.svn/text-base/README.chromium.svn-base
@@ -0,0 +1,24 @@
+Internal property sheets:
+ essential.vsprops
+ Contains the common settings used throughout the projects. Is included by either ..\debug.vsprops or ..\release.vsprops, so in general, it is not included directly.
+
+ release_defaults.vsprops
+ Included by ..\release.vsprops. Its settings are overriden by release_impl$(CHROME_BUILD_TYPE).vsprops. Uses the default VS setting which is "Maximize Speed". Results in relatively fast build with reasonable optimization level but without whole program optimization to reduce build time.
+
+ release_impl.vsprops
+ Included by ..\release.vsprops by default when CHROME_BUILD_TYPE is undefined. Includes release_defaults.vsprops.
+
+ release_impl_checksenabled.vsprops
+ Included by ..\release.vsprops when CHROME_BUILD_TYPE=_checksenabled. Matches what release_defaults.vsprops does, but doesn't actually inherit from it as we couldn't quite get that working. The only difference is that _DEBUG is set instead of NDEBUG. Used for keeping debug checks enabled with a build that is fast enough to dogfood with.
+
+ release_impl_official.vsprops
+ Included by ..\release.vsprops when CHROME_BUILD_TYPE=_official. Includes release_defaults.vsprops. Enables Whole Program Optimizations (WPO), which doubles the build time. Results in much more optimized build. Uses "Full Optimization" and "Flavor small code".
+
+ release_impl_pgo_instrument.vsprops
+ Included by ..\release.vsprops when CHROME_BUILD_TYPE=_pgo_instrument. Includes release_defaults.vsprops. Enables Profile Guided Optimization (PGO) instrumentation (first pass). Uses "Full Optimization" and "Flavor small code".
+
+ release_impl_pgo_optimize.vsprops
+ Included by ..\release.vsprops when CHROME_BUILD_TYPE=_pgo_optimize. Includes release_defaults.vsprops. Enables Profile Guided Optimization (PGO) optimization (second pass). Uses "Full Optimization" and "Flavor small code".
+
+ release_impl_purify.vsprops
+ Included by ..\release.vsprops when CHROME_BUILD_TYPE=_purify. Includes release_defaults.vsprops. Disables optimizations. Used with Purify to test without debug tools and without optimization; i.e. NDEBUG is defined but the compiler doesn't optimize the binary.
diff --git a/build/internal/.svn/text-base/release_defaults.gypi.svn-base b/build/internal/.svn/text-base/release_defaults.gypi.svn-base
new file mode 100644
index 0000000..5aa2b75
--- /dev/null
+++ b/build/internal/.svn/text-base/release_defaults.gypi.svn-base
@@ -0,0 +1,15 @@
+{
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimizations': '2',
+ 'StringPooling': 'true',
+ 'OmitFramePointers': 'true',
+ },
+ 'VCLinkerTool': {
+ 'LinkIncremental': '1',
+ 'OptimizeReferences': '2',
+ 'EnableCOMDATFolding': '2',
+ 'OptimizeForWindows98': '1',
+ },
+ },
+}
diff --git a/build/internal/.svn/text-base/release_impl.gypi.svn-base b/build/internal/.svn/text-base/release_impl.gypi.svn-base
new file mode 100644
index 0000000..aff06dc
--- /dev/null
+++ b/build/internal/.svn/text-base/release_impl.gypi.svn-base
@@ -0,0 +1,3 @@
+{
+ 'includes': ['release_defaults.gypi'],
+}
diff --git a/build/internal/.svn/text-base/release_impl_official.gypi.svn-base b/build/internal/.svn/text-base/release_impl_official.gypi.svn-base
new file mode 100644
index 0000000..18f7928
--- /dev/null
+++ b/build/internal/.svn/text-base/release_impl_official.gypi.svn-base
@@ -0,0 +1,21 @@
+{
+ 'includes': ['release_defaults.gypi'],
+ 'defines': ['OFFICIAL_BUILD'],
+ 'msvs_settings': {
+ 'VCCLCompilerTool': {
+ 'Optimization': '3',
+ 'InlineFunctionExpansion': '2',
+ 'EnableIntrinsicFunctions': 'true',
+ 'FavorSizeOrSpeed': '2',
+ 'OmitFramePointers': 'true',
+ 'EnableFiberSafeOptimizations': 'true',
+ 'WholeProgramOptimization': 'true',
+ },
+ 'VCLibrarianTool': {
+ 'AdditionalOptions': ['/ltcg', '/expectedoutputsize:120000000'],
+ },
+ 'VCLinkerTool': {
+ 'LinkTimeCodeGeneration': '1',
+ },
+ },
+}
diff --git a/build/linux/.svn/all-wcprops b/build/linux/.svn/all-wcprops
new file mode 100644
index 0000000..57d6efe
--- /dev/null
+++ b/build/linux/.svn/all-wcprops
@@ -0,0 +1,41 @@
+K 25
+svn:wc:ra_dav:version-url
+V 41
+/svn/!svn/ver/69058/trunk/src/build/linux
+END
+dump_app_syms
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/43724/trunk/src/build/linux/dump_app_syms
+END
+chrome_linux.croc
+K 25
+svn:wc:ra_dav:version-url
+V 59
+/svn/!svn/ver/61430/trunk/src/build/linux/chrome_linux.croc
+END
+pkg-config-wrapper
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/!svn/ver/66712/trunk/src/build/linux/pkg-config-wrapper
+END
+system.gyp
+K 25
+svn:wc:ra_dav:version-url
+V 52
+/svn/!svn/ver/68749/trunk/src/build/linux/system.gyp
+END
+python_arch.sh
+K 25
+svn:wc:ra_dav:version-url
+V 56
+/svn/!svn/ver/40635/trunk/src/build/linux/python_arch.sh
+END
+rewrite_dirs.py
+K 25
+svn:wc:ra_dav:version-url
+V 57
+/svn/!svn/ver/66712/trunk/src/build/linux/rewrite_dirs.py
+END
diff --git a/build/linux/.svn/dir-prop-base b/build/linux/.svn/dir-prop-base
new file mode 100644
index 0000000..f2a987b
--- /dev/null
+++ b/build/linux/.svn/dir-prop-base
@@ -0,0 +1,32 @@
+K 10
+svn:ignore
+V 390
+SConstruct
+dbus-glib.target.mk
+fontconfig.mk
+fontconfig.target.mk
+freetype2.mk
+freetype2.target.mk
+gconf.mk
+gconf.target.mk
+gdk.mk
+gdk.target.mk
+gnome-keyring.target.mk
+gthread.mk
+gtk.mk
+gtk.target.mk
+gtkprint.mk
+gtkprint.target.mk
+libresolv.target.mk
+nss.mk
+nss.target.mk
+openssl.target.mk
+selinux.mk
+selinux.target.mk
+system.Makefile
+system_main.scons
+x11.mk
+x11.target.mk
+xext.target.mk
+
+END
diff --git a/build/linux/.svn/entries b/build/linux/.svn/entries
new file mode 100644
index 0000000..f796eb7
--- /dev/null
+++ b/build/linux/.svn/entries
@@ -0,0 +1,232 @@
+10
+
+dir
+70875
+http://src.chromium.org/svn/trunk/src/build/linux
+http://src.chromium.org/svn
+
+
+
+2010-12-13T22:33:15.612310Z
+69058
+thestig@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+
+dump_app_syms
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+6639f13788fedc69c6ce87b9423d7c7e
+2010-04-06T16:54:40.053082Z
+43724
+thestig@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+737
+
+chrome_linux.croc
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+66c3f67e50e44e48bb50b5c6a88b3c05
+2010-10-04T22:56:50.780169Z
+61430
+jrg@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+653
+
+pkg-config-wrapper
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+64e25fc6c3fce9c4b21b35b060e752f8
+2010-11-19T00:43:49.567135Z
+66712
+piman@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1616
+
+system.gyp
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+7546e8d115920cc410d237f62d9abfac
+2010-12-09T18:36:24.185738Z
+68749
+joth@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+9997
+
+python_arch.sh
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+03c809c6fb307b25f0cfd260d43d0a7c
+2010-03-04T17:32:58.651525Z
+40635
+thestig@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+806
+
+rewrite_dirs.py
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+1cbd0090a5ad2231dae1e0b8c3683d04
+2010-11-19T00:43:49.567135Z
+66712
+piman@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2006
+
diff --git a/build/linux/.svn/prop-base/chrome_linux.croc.svn-base b/build/linux/.svn/prop-base/chrome_linux.croc.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/linux/.svn/prop-base/chrome_linux.croc.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/linux/.svn/prop-base/dump_app_syms.svn-base b/build/linux/.svn/prop-base/dump_app_syms.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/linux/.svn/prop-base/dump_app_syms.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/linux/.svn/prop-base/pkg-config-wrapper.svn-base b/build/linux/.svn/prop-base/pkg-config-wrapper.svn-base
new file mode 100644
index 0000000..869ac71
--- /dev/null
+++ b/build/linux/.svn/prop-base/pkg-config-wrapper.svn-base
@@ -0,0 +1,5 @@
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/linux/.svn/prop-base/python_arch.sh.svn-base b/build/linux/.svn/prop-base/python_arch.sh.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/linux/.svn/prop-base/python_arch.sh.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/linux/.svn/prop-base/rewrite_dirs.py.svn-base b/build/linux/.svn/prop-base/rewrite_dirs.py.svn-base
new file mode 100644
index 0000000..869ac71
--- /dev/null
+++ b/build/linux/.svn/prop-base/rewrite_dirs.py.svn-base
@@ -0,0 +1,5 @@
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/linux/.svn/prop-base/system.gyp.svn-base b/build/linux/.svn/prop-base/system.gyp.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/linux/.svn/prop-base/system.gyp.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/linux/.svn/text-base/chrome_linux.croc.svn-base b/build/linux/.svn/text-base/chrome_linux.croc.svn-base
new file mode 100644
index 0000000..f400306
--- /dev/null
+++ b/build/linux/.svn/text-base/chrome_linux.croc.svn-base
@@ -0,0 +1,29 @@
+# -*- python -*-
+# Crocodile config file for Chromium linux
+
+# TODO(jhawkins): We'll need to add a chromeos.croc once we get a coverage bot
+# for that platform.
+
+{
+ # List of rules, applied in order
+ 'rules' : [
+ # Specify inclusions before exclusions, since rules are in order.
+
+ # Don't include non-Linux platform dirs
+ {
+ 'regexp' : '.*/(chromeos|views)/',
+ 'include' : 0,
+ },
+ # Don't include chromeos, windows, or mac specific files
+ {
+ 'regexp' : '.*(_|/)(chromeos|mac|win|views)(\\.|_)',
+ 'include' : 0,
+ },
+
+ # Groups
+ {
+ 'regexp' : '.*_test_linux\\.',
+ 'group' : 'test',
+ },
+ ],
+}
diff --git a/build/linux/.svn/text-base/dump_app_syms.svn-base b/build/linux/.svn/text-base/dump_app_syms.svn-base
new file mode 100644
index 0000000..632bcc7
--- /dev/null
+++ b/build/linux/.svn/text-base/dump_app_syms.svn-base
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+# 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.
+#
+# Helper script to run dump_syms on Chrome Linux executables and strip
+# them if needed.
+
+set -e
+
+usage() {
+ echo -n "$0 <dump_syms_exe> <strip_binary> " >&2
+ echo "<binary_with_symbols> <symbols_output>" >&2
+}
+
+
+if [ $# -ne 4 ]; then
+ usage
+ exit 1
+fi
+
+SCRIPTDIR="$(readlink -f "$(dirname "$0")")"
+DUMPSYMS="$1"
+STRIP_BINARY="$2"
+INFILE="$3"
+OUTFILE="$4"
+
+# Dump the symbols from the given binary.
+if [ ! -e "$OUTFILE" -o "$INFILE" -nt "$OUTFILE" ]; then
+ "$DUMPSYMS" "$INFILE" > "$OUTFILE"
+fi
+
+if [ "$STRIP_BINARY" != "0" ]; then
+ strip "$INFILE"
+fi
diff --git a/build/linux/.svn/text-base/pkg-config-wrapper.svn-base b/build/linux/.svn/text-base/pkg-config-wrapper.svn-base
new file mode 100644
index 0000000..4b5455b
--- /dev/null
+++ b/build/linux/.svn/text-base/pkg-config-wrapper.svn-base
@@ -0,0 +1,37 @@
+#!/bin/bash
+# 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.
+
+# This program wraps around pkg-config to generate the correct include and
+# library paths when cross-compiling using a sysroot.
+# The assumption is that the sysroot contains the .pc files in usr/lib/pkgconfig
+# and usr/share/pkgconfig (relative to the sysroot) and that they output paths
+# relative to some parent path of the sysroot.
+# This assumption is valid for a range of sysroots, in particular: a
+# LSB-compliant root filesystem mounted at the sysroot, and a board build
+# directory of a Chromium OS chroot.
+
+root="$1"
+if [ -z "$root" ]
+then
+ echo "usage: $0 /path/to/sysroot [pkg-config-arguments] package" >&2
+ exit 1
+fi
+
+rewrite=`dirname $0`/rewrite_dirs.py
+package=${!#}
+
+shift
+config_path=$root/usr/lib/pkgconfig:$root/usr/share/pkgconfig
+set -e
+# Some sysroots, like the Chromium OS ones, may generate paths that are not
+# relative to the sysroot. For example,
+# /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths
+# relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of
+# relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr).
+# To support this correctly, it's necessary to extract the prefix to strip from
+# pkg-config's |prefix| variable.
+prefix=`PKG_CONFIG_PATH=$config_path pkg-config --variable=prefix "$package" | sed -e 's|/usr$||'`
+result=`PKG_CONFIG_PATH=$config_path pkg-config "$@"`
+echo "$result"| $rewrite --sysroot "$root" --strip-prefix "$prefix"
diff --git a/build/linux/.svn/text-base/python_arch.sh.svn-base b/build/linux/.svn/text-base/python_arch.sh.svn-base
new file mode 100644
index 0000000..f364469
--- /dev/null
+++ b/build/linux/.svn/text-base/python_arch.sh.svn-base
@@ -0,0 +1,42 @@
+#!/bin/bash
+# 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.
+
+# This figures out the architecture of the version of Python we are building
+# pyautolib against.
+#
+# python_arch.sh /usr/lib/libpython2.5.so.1.0
+# python_arch.sh /path/to/sysroot/usr/lib/libpython2.4.so.1.0
+#
+
+python=$(readlink -f "$1")
+if [ ! -r "$python" ]; then
+ echo unknown
+ exit 0;
+fi
+file_out=$(file "$python")
+if [ $? -ne 0 ]; then
+ echo unknown
+ exit 0;
+fi
+
+echo $file_out | grep -qs "ARM"
+if [ $? -eq 0 ]; then
+ echo arm
+ exit 0
+fi
+
+echo $file_out | grep -qs "x86-64"
+if [ $? -eq 0 ]; then
+ echo x64
+ exit 0
+fi
+
+echo $file_out | grep -qs "Intel 80386"
+if [ $? -eq 0 ]; then
+ echo ia32
+ exit 0
+fi
+
+exit 1
diff --git a/build/linux/.svn/text-base/rewrite_dirs.py.svn-base b/build/linux/.svn/text-base/rewrite_dirs.py.svn-base
new file mode 100644
index 0000000..9e166d0
--- /dev/null
+++ b/build/linux/.svn/text-base/rewrite_dirs.py.svn-base
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+# Copyright (c) 2009 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.
+
+"""Rewrites paths in -I, -L and other option to be relative to a sysroot."""
+
+import sys
+import os
+import optparse
+
+REWRITE_PREFIX = ['-I',
+ '-idirafter',
+ '-imacros',
+ '-imultilib',
+ '-include',
+ '-iprefix',
+ '-iquote',
+ '-isystem',
+ '-L']
+
+def RewritePath(path, opts):
+ """Rewrites a path by stripping the prefix and prepending the sysroot."""
+ sysroot = opts.sysroot
+ prefix = opts.strip_prefix
+ if os.path.isabs(path) and not path.startswith(sysroot):
+ if path.startswith(prefix):
+ path = path[len(prefix):]
+ path = path.lstrip('/')
+ return os.path.join(sysroot, path)
+ else:
+ return path
+
+def RewriteLine(line, opts):
+ """Rewrites all the paths in recognized options."""
+ args = line.split()
+ count = len(args)
+ i = 0
+ while i < count:
+ for prefix in REWRITE_PREFIX:
+ # The option can be either in the form "-I /path/to/dir" or
+ # "-I/path/to/dir" so handle both.
+ if args[i] == prefix:
+ i += 1
+ try:
+ args[i] = RewritePath(args[i], opts)
+ except IndexError:
+ sys.stderr.write('Missing argument following %s\n' % prefix)
+ break
+ elif args[i].startswith(prefix):
+ args[i] = prefix + RewritePath(args[i][len(prefix):], opts)
+ i += 1
+
+ return ' '.join(args)
+
+def main(argv):
+ parser = optparse.OptionParser()
+ parser.add_option('-s', '--sysroot', default='/', help='sysroot to prepend')
+ parser.add_option('-p', '--strip-prefix', default='', help='prefix to strip')
+ opts, args = parser.parse_args(argv[1:])
+
+ for line in sys.stdin.readlines():
+ line = RewriteLine(line.strip(), opts)
+ print line
+ return 0
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))
diff --git a/build/linux/.svn/text-base/system.gyp.svn-base b/build/linux/.svn/text-base/system.gyp.svn-base
new file mode 100644
index 0000000..39b3a11
--- /dev/null
+++ b/build/linux/.svn/text-base/system.gyp.svn-base
@@ -0,0 +1,356 @@
+# Copyright (c) 2009 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.
+
+{
+ 'conditions': [
+ ['sysroot!=""', {
+ 'variables': {
+ 'pkg-config': './pkg-config-wrapper "<(sysroot)"',
+ },
+ }, {
+ 'variables': {
+ 'pkg-config': 'pkg-config'
+ },
+ }],
+ [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
+ 'variables': {
+ # We use our own copy of libssl3, although we still need to link against
+ # the rest of NSS.
+ 'use_system_ssl%': 0,
+ },
+ }, { # OS!="linux"
+ 'variables': {
+ 'use_system_ssl%': 1,
+ },
+ }],
+ ],
+
+
+ 'targets': [
+ {
+ 'target_name': 'gtk',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags gtk+-2.0 gthread-2.0)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other gtk+-2.0 gthread-2.0)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l gtk+-2.0 gthread-2.0)',
+ ],
+ },
+ }],
+ [ 'chromeos==1', {
+ 'link_settings': {
+ 'libraries': [ '-lXtst' ]
+ }
+ }]]
+ },
+ {
+ 'target_name': 'gtkprint',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags gtk+-unix-print-2.0)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other gtk+-unix-print-2.0)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l gtk+-unix-print-2.0)',
+ ],
+ },
+ }]]
+ },
+ {
+ 'target_name': 'nss',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'conditions': [
+ ['use_system_ssl==0', {
+ 'dependencies': [
+ '../../net/third_party/nss/ssl.gyp:ssl',
+ '../../third_party/zlib/zlib.gyp:zlib',
+ ],
+ 'direct_dependent_settings': {
+ 'cflags': [
+ # We need for our local copies of the libssl3 headers to come
+ # first, otherwise the code will build, but will fallback to
+ # the set of features advertised in the system headers.
+ # Unfortunately, there's no include path that we can filter
+ # out of $(pkg-config --cflags nss) and GYP include paths
+ # come after cflags on the command line. So we have these
+ # bodges:
+ '-Inet/third_party/nss/ssl', # for make
+ '-IWebKit/chromium/net/third_party/nss/ssl', # for make in webkit
+ '<!@(<(pkg-config) --cflags nss)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other nss)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l nss | sed -e "s/-lssl3//")',
+ ],
+ },
+ }, {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags nss)',
+ ],
+ 'defines': [
+ 'USE_SYSTEM_SSL',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other nss)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l nss)',
+ ],
+ },
+ }
+ ]]
+ }],
+ ],
+ },
+ {
+ 'target_name': 'freetype2',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags freetype2)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other freetype2)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l freetype2)',
+ ],
+ },
+ }]]
+ },
+ {
+ 'target_name': 'fontconfig',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags fontconfig)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other fontconfig)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l fontconfig)',
+ ],
+ },
+ }]]
+ },
+ {
+ 'target_name': 'gdk',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags gdk-2.0)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other gdk-2.0)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l gdk-2.0)',
+ ],
+ },
+ }]]
+ },
+ {
+ 'target_name': 'gconf',
+ 'type': 'settings',
+ 'conditions': [
+ ['use_gconf==1 and _toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags gconf-2.0)',
+ ],
+ 'defines': [
+ 'USE_GCONF',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other gconf-2.0)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l gconf-2.0)',
+ ],
+ },
+ }]]
+ },
+ {
+ 'target_name': 'x11',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags x11)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other x11)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l x11)',
+ ],
+ },
+ }],
+ # When XInput2 is available (i.e. inputproto version is 2.0), the
+ # pkg-config command will succeed, so the output will be empty.
+ ['"<!@(<(pkg-config) --atleast-version=2.0 inputproto || echo $?)"==""', {
+ 'direct_dependent_settings': {
+ 'defines': [
+ 'HAVE_XINPUT2',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other xi)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l xi)',
+ ],
+ }
+ }],
+ ],
+ },
+ {
+ 'target_name': 'xext',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags xext)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other xext)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l xext)',
+ ],
+ },
+ }]]
+ },
+ {
+ 'target_name': 'selinux',
+ 'type': 'settings',
+ 'conditions': [
+ ['_toolset=="target"', {
+ 'link_settings': {
+ 'libraries': [
+ '-lselinux',
+ ],
+ },
+ }]]
+ },
+ {
+ 'target_name': 'gnome-keyring',
+ 'type': 'settings',
+ 'conditions': [
+ ['use_gnome_keyring==1', {
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags gnome-keyring-1)',
+ ],
+ 'defines': [
+ 'USE_GNOME_KEYRING',
+ ],
+ 'conditions': [
+ ['linux_link_gnome_keyring==0', {
+ 'defines': ['DLOPEN_GNOME_KEYRING'],
+ }],
+ ],
+ },
+ 'conditions': [
+ ['linux_link_gnome_keyring!=0', {
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other gnome-keyring-1)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l gnome-keyring-1)',
+ ],
+ },
+ }, {
+ 'link_settings': {
+ 'libraries': [
+ '-ldl',
+ ],
+ },
+ }],
+ ],
+ }],
+ ],
+ },
+ {
+ 'target_name': 'dbus-glib',
+ 'type': 'settings',
+ 'direct_dependent_settings': {
+ 'cflags': [
+ '<!@(<(pkg-config) --cflags dbus-glib-1)',
+ ],
+ },
+ 'link_settings': {
+ 'ldflags': [
+ '<!@(<(pkg-config) --libs-only-L --libs-only-other dbus-glib-1)',
+ ],
+ 'libraries': [
+ '<!@(<(pkg-config) --libs-only-l dbus-glib-1)',
+ ],
+ },
+ },
+ {
+ 'target_name': 'libresolv',
+ 'type': 'settings',
+ 'link_settings': {
+ 'libraries': [
+ '-lresolv',
+ ],
+ },
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/build/mac/.svn/all-wcprops b/build/mac/.svn/all-wcprops
new file mode 100644
index 0000000..2dacaaa
--- /dev/null
+++ b/build/mac/.svn/all-wcprops
@@ -0,0 +1,23 @@
+K 25
+svn:wc:ra_dav:version-url
+V 39
+/svn/!svn/ver/61430/trunk/src/build/mac
+END
+chrome_mac.croc
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/61430/trunk/src/build/mac/chrome_mac.croc
+END
+strip_from_xcode
+K 25
+svn:wc:ra_dav:version-url
+V 56
+/svn/!svn/ver/48655/trunk/src/build/mac/strip_from_xcode
+END
+strip_save_dsym
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/41200/trunk/src/build/mac/strip_save_dsym
+END
diff --git a/build/mac/.svn/entries b/build/mac/.svn/entries
new file mode 100644
index 0000000..6c233c0
--- /dev/null
+++ b/build/mac/.svn/entries
@@ -0,0 +1,130 @@
+10
+
+dir
+70875
+http://src.chromium.org/svn/trunk/src/build/mac
+http://src.chromium.org/svn
+
+
+
+2010-10-04T22:56:50.780169Z
+61430
+jrg@chromium.org
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+
+chrome_mac.croc
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+eb4bd7c438ca7678b4d1b094877c7f6e
+2010-10-04T22:56:50.780169Z
+61430
+jrg@chromium.org
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+690
+
+strip_from_xcode
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+7e80feb7fbdfabc2d776c47d212be09d
+2010-06-01T20:49:50.582521Z
+48655
+mark@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+2116
+
+strip_save_dsym
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+852cf0bc96ddd4cf945cdf7f8e905a31
+2010-03-10T20:29:33.433875Z
+41200
+mark@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+12051
+
diff --git a/build/mac/.svn/prop-base/strip_from_xcode.svn-base b/build/mac/.svn/prop-base/strip_from_xcode.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/mac/.svn/prop-base/strip_from_xcode.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/mac/.svn/prop-base/strip_save_dsym.svn-base b/build/mac/.svn/prop-base/strip_save_dsym.svn-base
new file mode 100644
index 0000000..2e70e8f
--- /dev/null
+++ b/build/mac/.svn/prop-base/strip_save_dsym.svn-base
@@ -0,0 +1,9 @@
+K 13
+svn:eol-style
+V 2
+LF
+K 14
+svn:executable
+V 1
+*
+END
diff --git a/build/mac/.svn/text-base/chrome_mac.croc.svn-base b/build/mac/.svn/text-base/chrome_mac.croc.svn-base
new file mode 100644
index 0000000..8cde00c
--- /dev/null
+++ b/build/mac/.svn/text-base/chrome_mac.croc.svn-base
@@ -0,0 +1,36 @@
+# -*- python -*-
+# Crocodile config file for Chromium mac
+
+{
+ # List of rules, applied in order
+ 'rules' : [
+ # Specify inclusions before exclusions, since rules are in order.
+
+ # Don't include chromeos, linux, or windows specific files
+ {
+ 'regexp' : '.*(_|/)(chromeos|linux|win|views)(\\.|_)',
+ 'include' : 0,
+ },
+ # Don't include ChromeOS dirs
+ {
+ 'regexp' : '.*/chromeos/',
+ 'include' : 0,
+ },
+
+ # Groups
+ {
+ 'regexp' : '.*_test_mac\\.',
+ 'group' : 'test',
+ },
+
+ # Languages
+ {
+ 'regexp' : '.*\\.m$',
+ 'language' : 'ObjC',
+ },
+ {
+ 'regexp' : '.*\\.mm$',
+ 'language' : 'ObjC++',
+ },
+ ],
+}
diff --git a/build/mac/.svn/text-base/strip_from_xcode.svn-base b/build/mac/.svn/text-base/strip_from_xcode.svn-base
new file mode 100644
index 0000000..c26b9fb
--- /dev/null
+++ b/build/mac/.svn/text-base/strip_from_xcode.svn-base
@@ -0,0 +1,62 @@
+#!/bin/bash
+
+# Copyright (c) 2008 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 is a handy wrapper script that figures out how to call the strip
+# utility (strip_save_dsym in this case), if it even needs to be called at all,
+# and then does it. This script should be called by a post-link phase in
+# targets that might generate Mach-O executables, dynamic libraries, or
+# loadable bundles.
+#
+# An example "Strip If Needed" build phase placed after "Link Binary With
+# Libraries" would do:
+# exec "${XCODEPROJ_DEPTH}/build/mac/strip_from_xcode"
+
+if [ "${CONFIGURATION}" != "Release" ] ; then
+ # Only strip in release mode.
+ exit 0
+fi
+
+declare -a FLAGS
+
+# MACH_O_TYPE is not set for a command-line tool, so check PRODUCT_TYPE too.
+# Weird.
+if [ "${MACH_O_TYPE}" = "mh_execute" ] || \
+ [ "${PRODUCT_TYPE}" = "com.apple.product-type.tool" ] ; then
+ # Strip everything (no special flags). No-op.
+ true
+elif [ "${MACH_O_TYPE}" = "mh_dylib" ] || \
+ [ "${MACH_O_TYPE}" = "mh_bundle" ]; then
+ # Strip debugging symbols and local symbols
+ FLAGS[${#FLAGS[@]}]=-S
+ FLAGS[${#FLAGS[@]}]=-x
+elif [ "${MACH_O_TYPE}" = "staticlib" ] ; then
+ # Don't strip static libraries.
+ exit 0
+else
+ # Warn, but don't treat this as an error.
+ echo $0: warning: unrecognized MACH_O_TYPE ${MACH_O_TYPE}
+ exit 0
+fi
+
+if [ -n "${STRIPFLAGS}" ] ; then
+ # Pick up the standard STRIPFLAGS Xcode setting, used for "Additional Strip
+ # Flags".
+ for stripflag in "${STRIPFLAGS}" ; do
+ FLAGS[${#FLAGS[@]}]="${stripflag}"
+ done
+fi
+
+if [ -n "${CHROMIUM_STRIP_SAVE_FILE}" ] ; then
+ # An Xcode project can communicate a file listing symbols to saved in this
+ # environment variable by setting it as a build setting. This isn't a
+ # standard Xcode setting. It's used in preference to STRIPFLAGS to
+ # eliminate quoting ambiguity concerns.
+ FLAGS[${#FLAGS[@]}]=-s
+ FLAGS[${#FLAGS[@]}]="${CHROMIUM_STRIP_SAVE_FILE}"
+fi
+
+exec "$(dirname ${0})/strip_save_dsym" "${FLAGS[@]}" \
+ "${BUILT_PRODUCTS_DIR}/${EXECUTABLE_PATH}"
diff --git a/build/mac/.svn/text-base/strip_save_dsym.svn-base b/build/mac/.svn/text-base/strip_save_dsym.svn-base
new file mode 100644
index 0000000..3904c17
--- /dev/null
+++ b/build/mac/.svn/text-base/strip_save_dsym.svn-base
@@ -0,0 +1,341 @@
+#!/usr/bin/python
+
+# Copyright (c) 2008 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.
+
+# Usage: strip_save_dsym <whatever-arguments-you-would-pass-to-strip>
+#
+# strip_save_dsym is a wrapper around the standard strip utility. Given an
+# input Mach-O file, strip_save_dsym will save a copy of the file in a "fake"
+# .dSYM bundle for debugging, and then call strip to strip the Mach-O file.
+# Note that the .dSYM file is a "fake" in that it's not a self-contained
+# .dSYM bundle, it just contains a copy of the original (unstripped) Mach-O
+# file, and therefore contains references to object files on the filesystem.
+# The generated .dSYM bundle is therefore unsuitable for debugging in the
+# absence of these .o files.
+#
+# If a .dSYM already exists and has a newer timestamp than the Mach-O file,
+# this utility does nothing. That allows strip_save_dsym to be run on a file
+# that has already been stripped without trashing the .dSYM.
+#
+# Rationale: the "right" way to generate dSYM bundles, dsymutil, is incredibly
+# slow. On the other hand, doing a file copy (which is really all that
+# dsymutil does) is comparatively fast. Since we usually just want to strip
+# a release-mode executable but still be able to debug it, and we don't care
+# so much about generating a hermetic dSYM bundle, we'll prefer the file copy.
+# If a real dSYM is ever needed, it's still possible to create one by running
+# dsymutil and pointing it at the original Mach-O file inside the "fake"
+# bundle, provided that the object files are available.
+
+import errno
+import os
+import re
+import shutil
+import subprocess
+import sys
+import time
+
+# Returns a list of architectures contained in a Mach-O file. The file can be
+# a universal (fat) file, in which case there will be one list element for
+# each contained architecture, or it can be a thin single-architecture Mach-O
+# file, in which case the list will contain a single element identifying the
+# architecture. On error, returns an empty list. Determines the architecture
+# list by calling file.
+def macho_archs(macho):
+ macho_types = ["executable",
+ "dynamically linked shared library",
+ "bundle"]
+ macho_types_re = "Mach-O (?:64-bit )?(?:" + "|".join(macho_types) + ")"
+
+ file_cmd = subprocess.Popen(["/usr/bin/file", "-b", "--", macho],
+ stdout=subprocess.PIPE)
+
+ archs = []
+
+ type_line = file_cmd.stdout.readline()
+ type_match = re.match("^%s (.*)$" % macho_types_re, type_line)
+ if type_match:
+ archs.append(type_match.group(1))
+ return [type_match.group(1)]
+ else:
+ type_match = re.match("^Mach-O universal binary with (.*) architectures$",
+ type_line)
+ if type_match:
+ for i in range(0, int(type_match.group(1))):
+ arch_line = file_cmd.stdout.readline()
+ arch_match = re.match(
+ "^.* \(for architecture (.*)\):\t%s .*$" % macho_types_re,
+ arch_line)
+ if arch_match:
+ archs.append(arch_match.group(1))
+
+ if file_cmd.wait() != 0:
+ archs = []
+
+ if len(archs) == 0:
+ print >> sys.stderr, "No architectures in %s" % macho
+
+ return archs
+
+# Returns a dictionary mapping architectures contained in the file as returned
+# by macho_archs to the LC_UUID load command for that architecture.
+# Architectures with no LC_UUID load command are omitted from the dictionary.
+# Determines the UUID value by calling otool.
+def macho_uuids(macho):
+ uuids = {}
+
+ archs = macho_archs(macho)
+ if len(archs) == 0:
+ return uuids
+
+ for arch in archs:
+ if arch == "":
+ continue
+
+ otool_cmd = subprocess.Popen(["/usr/bin/otool", "-arch", arch, "-l", "-",
+ macho],
+ stdout=subprocess.PIPE)
+ # state 0 is when nothing UUID-related has been seen yet. State 1 is
+ # entered after a load command begins, but it may not be an LC_UUID load
+ # command. States 2, 3, and 4 are intermediate states while reading an
+ # LC_UUID command. State 5 is the terminal state for a successful LC_UUID
+ # read. State 6 is the error state.
+ state = 0
+ uuid = ""
+ for otool_line in otool_cmd.stdout:
+ if state == 0:
+ if re.match("^Load command .*$", otool_line):
+ state = 1
+ elif state == 1:
+ if re.match("^ cmd LC_UUID$", otool_line):
+ state = 2
+ else:
+ state = 0
+ elif state == 2:
+ if re.match("^ cmdsize 24$", otool_line):
+ state = 3
+ else:
+ state = 6
+ elif state == 3:
+ # The UUID display format changed in the version of otool shipping
+ # with the Xcode 3.2.2 prerelease. The new format is traditional:
+ # uuid 4D7135B2-9C56-C5F5-5F49-A994258E0955
+ # The old format, from cctools-750 and older's otool, breaks the UUID
+ # up into a sequence of bytes:
+ # uuid 0x4d 0x71 0x35 0xb2 0x9c 0x56 0xc5 0xf5
+ # 0x5f 0x49 0xa9 0x94 0x25 0x8e 0x09 0x55
+ new_uuid_match = re.match("^ uuid (.{8}-.{4}-.{4}-.{4}-.{12})$",
+ otool_line)
+ if new_uuid_match:
+ uuid = new_uuid_match.group(1)
+
+ # Skip state 4, there is no second line to read.
+ state = 5
+ else:
+ old_uuid_match = re.match("^ uuid 0x(..) 0x(..) 0x(..) 0x(..) "
+ "0x(..) 0x(..) 0x(..) 0x(..)$",
+ otool_line)
+ if old_uuid_match:
+ state = 4
+ uuid = old_uuid_match.group(1) + old_uuid_match.group(2) + \
+ old_uuid_match.group(3) + old_uuid_match.group(4) + "-" + \
+ old_uuid_match.group(5) + old_uuid_match.group(6) + "-" + \
+ old_uuid_match.group(7) + old_uuid_match.group(8) + "-"
+ else:
+ state = 6
+ elif state == 4:
+ old_uuid_match = re.match("^ 0x(..) 0x(..) 0x(..) 0x(..) "
+ "0x(..) 0x(..) 0x(..) 0x(..)$",
+ otool_line)
+ if old_uuid_match:
+ state = 5
+ uuid += old_uuid_match.group(1) + old_uuid_match.group(2) + "-" + \
+ old_uuid_match.group(3) + old_uuid_match.group(4) + \
+ old_uuid_match.group(5) + old_uuid_match.group(6) + \
+ old_uuid_match.group(7) + old_uuid_match.group(8)
+ else:
+ state = 6
+
+ if otool_cmd.wait() != 0:
+ state = 6
+
+ if state == 5:
+ uuids[arch] = uuid.upper()
+
+ if len(uuids) == 0:
+ print >> sys.stderr, "No UUIDs in %s" % macho
+
+ return uuids
+
+# Given a path to a Mach-O file and possible information from the environment,
+# determines the desired path to the .dSYM.
+def dsym_path(macho):
+ # If building a bundle, the .dSYM should be placed next to the bundle. Use
+ # WRAPPER_NAME to make this determination. If called from xcodebuild,
+ # WRAPPER_NAME will be set to the name of the bundle.
+ dsym = ""
+ if "WRAPPER_NAME" in os.environ:
+ if "BUILT_PRODUCTS_DIR" in os.environ:
+ dsym = os.path.join(os.environ["BUILT_PRODUCTS_DIR"],
+ os.environ["WRAPPER_NAME"])
+ else:
+ dsym = os.environ["WRAPPER_NAME"]
+ else:
+ dsym = macho
+
+ dsym += ".dSYM"
+
+ return dsym
+
+# Creates a fake .dSYM bundle at dsym for macho, a Mach-O image with the
+# architectures and UUIDs specified by the uuids map.
+def make_fake_dsym(macho, dsym):
+ uuids = macho_uuids(macho)
+ if len(uuids) == 0:
+ return False
+
+ dwarf_dir = os.path.join(dsym, "Contents", "Resources", "DWARF")
+ dwarf_file = os.path.join(dwarf_dir, os.path.basename(macho))
+ try:
+ os.makedirs(dwarf_dir)
+ except OSError, (err, error_string):
+ if err != errno.EEXIST:
+ raise
+ shutil.copyfile(macho, dwarf_file)
+
+ # info_template is the same as what dsymutil would have written, with the
+ # addition of the fake_dsym key.
+ info_template = \
+'''<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//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>CFBundleIdentifier</key>
+ <string>com.apple.xcode.dsym.%(root_name)s</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>dSYM</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>dSYM_UUID</key>
+ <dict>
+%(uuid_dict)s </dict>
+ <key>fake_dsym</key>
+ <true/>
+ </dict>
+</plist>
+'''
+
+ root_name = os.path.basename(dsym)[:-5] # whatever.dSYM without .dSYM
+ uuid_dict = ""
+ for arch in sorted(uuids):
+ uuid_dict += "\t\t\t<key>" + arch + "</key>\n"\
+ "\t\t\t<string>" + uuids[arch] + "</string>\n"
+ info_dict = {
+ "root_name": root_name,
+ "uuid_dict": uuid_dict,
+ }
+ info_contents = info_template % info_dict
+ info_file = os.path.join(dsym, "Contents", "Info.plist")
+ info_fd = open(info_file, "w")
+ info_fd.write(info_contents)
+ info_fd.close()
+
+ return True
+
+# For a Mach-O file, determines where the .dSYM bundle should be located. If
+# the bundle does not exist or has a modification time older than the Mach-O
+# file, calls make_fake_dsym to create a fake .dSYM bundle there, then strips
+# the Mach-O file and sets the modification time on the .dSYM bundle and Mach-O
+# file to be identical.
+def strip_and_make_fake_dsym(macho):
+ dsym = dsym_path(macho)
+ macho_stat = os.stat(macho)
+ dsym_stat = None
+ try:
+ dsym_stat = os.stat(dsym)
+ except OSError, (err, error_string):
+ if err != errno.ENOENT:
+ raise
+
+ if dsym_stat is None or dsym_stat.st_mtime < macho_stat.st_mtime:
+ # Make a .dSYM bundle
+ if not make_fake_dsym(macho, dsym):
+ return False
+
+ # Strip the Mach-O file
+ remove_dsym = True
+ try:
+ strip_path = ""
+ if "SYSTEM_DEVELOPER_BIN_DIR" in os.environ:
+ strip_path = os.environ["SYSTEM_DEVELOPER_BIN_DIR"]
+ else:
+ strip_path = "/usr/bin"
+ strip_path = os.path.join(strip_path, "strip")
+ strip_cmdline = [strip_path] + sys.argv[1:]
+ # Print the strip invocation so that it's obvious something is happening
+ print " ".join(strip_cmdline)
+ strip_cmd = subprocess.Popen(strip_cmdline)
+ if strip_cmd.wait() == 0:
+ remove_dsym = False
+ finally:
+ if remove_dsym:
+ shutil.rmtree(dsym)
+
+ # Update modification time on the Mach-O file and .dSYM bundle
+ now = time.time()
+ os.utime(macho, (now, now))
+ os.utime(dsym, (now, now))
+
+ return True
+
+def main(argv=None):
+ if argv is None:
+ argv = sys.argv
+
+ # This only supports operating on one file at a time. Look at the arguments
+ # to strip to figure out what the source to be stripped is. Arguments are
+ # processed in the same way that strip does, although to reduce complexity,
+ # this doesn't do all of the same checking as strip. For example, strip
+ # has no -Z switch and would treat -Z on the command line as an error. For
+ # the purposes this is needed for, that's fine.
+ macho = None
+ process_switches = True
+ ignore_argument = False
+ for arg in argv[1:]:
+ if ignore_argument:
+ ignore_argument = False
+ continue
+ if process_switches:
+ if arg == "-":
+ process_switches = False
+ # strip has these switches accept an argument:
+ if arg in ["-s", "-R", "-d", "-o", "-arch"]:
+ ignore_argument = True
+ if arg[0] == "-":
+ continue
+ if macho is None:
+ macho = arg
+ else:
+ print >> sys.stderr, "Too many things to strip"
+ return 1
+
+ if macho is None:
+ print >> sys.stderr, "Nothing to strip"
+ return 1
+
+ if not strip_and_make_fake_dsym(macho):
+ return 1
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main(sys.argv))
diff --git a/build/temp_gyp/.svn/all-wcprops b/build/temp_gyp/.svn/all-wcprops
new file mode 100644
index 0000000..08e4f77
--- /dev/null
+++ b/build/temp_gyp/.svn/all-wcprops
@@ -0,0 +1,23 @@
+K 25
+svn:wc:ra_dav:version-url
+V 44
+/svn/!svn/ver/52614/trunk/src/build/temp_gyp
+END
+README.chromium
+K 25
+svn:wc:ra_dav:version-url
+V 60
+/svn/!svn/ver/10380/trunk/src/build/temp_gyp/README.chromium
+END
+pdfsqueeze.gyp
+K 25
+svn:wc:ra_dav:version-url
+V 59
+/svn/!svn/ver/28089/trunk/src/build/temp_gyp/pdfsqueeze.gyp
+END
+googleurl.gyp
+K 25
+svn:wc:ra_dav:version-url
+V 58
+/svn/!svn/ver/52614/trunk/src/build/temp_gyp/googleurl.gyp
+END
diff --git a/build/temp_gyp/.svn/dir-prop-base b/build/temp_gyp/.svn/dir-prop-base
new file mode 100644
index 0000000..f69b131
--- /dev/null
+++ b/build/temp_gyp/.svn/dir-prop-base
@@ -0,0 +1,20 @@
+K 10
+svn:ignore
+V 279
+SConstruct
+googleurl.scons
+googleurl.sln
+googleurl.vcproj
+googleurl.xcodeproj
+googleurl_main.scons
+googleurl_unittests.scons
+googleurl_unittests.vcproj
+pdfsqueeze.xcodeproj
+googleurl.mk
+googleurl_unittests.mk
+googleurl.target.mk
+googleurl.Makefile
+googleurl_unittests.target.mk
+
+
+END
diff --git a/build/temp_gyp/.svn/entries b/build/temp_gyp/.svn/entries
new file mode 100644
index 0000000..d3a57b6
--- /dev/null
+++ b/build/temp_gyp/.svn/entries
@@ -0,0 +1,130 @@
+10
+
+dir
+70875
+http://src.chromium.org/svn/trunk/src/build/temp_gyp
+http://src.chromium.org/svn
+
+
+
+2010-07-16T05:44:08.289599Z
+52614
+victorw@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+
+README.chromium
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+3ff4aeeb56d937badeae5bc68e916561
+2009-02-25T21:26:55.507860Z
+10380
+mark@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+162
+
+pdfsqueeze.gyp
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+2d5427d2c6745523d4f4e513cfff54b8
+2009-10-06T03:02:38.090039Z
+28089
+sgk@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1397
+
+googleurl.gyp
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+55222cd4f4cee2d13c3826f75168c57f
+2010-07-16T05:44:08.289599Z
+52614
+victorw@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3757
+
diff --git a/build/temp_gyp/.svn/prop-base/README.chromium.svn-base b/build/temp_gyp/.svn/prop-base/README.chromium.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/temp_gyp/.svn/prop-base/README.chromium.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/temp_gyp/.svn/prop-base/googleurl.gyp.svn-base b/build/temp_gyp/.svn/prop-base/googleurl.gyp.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/temp_gyp/.svn/prop-base/googleurl.gyp.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/temp_gyp/.svn/prop-base/pdfsqueeze.gyp.svn-base b/build/temp_gyp/.svn/prop-base/pdfsqueeze.gyp.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/temp_gyp/.svn/prop-base/pdfsqueeze.gyp.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/temp_gyp/.svn/text-base/README.chromium.svn-base b/build/temp_gyp/.svn/text-base/README.chromium.svn-base
new file mode 100644
index 0000000..8045d61
--- /dev/null
+++ b/build/temp_gyp/.svn/text-base/README.chromium.svn-base
@@ -0,0 +1,3 @@
+This directory will be removed once the files in it are committed upstream and
+Chromium imports an upstream revision with these files. Contact mark for
+details.
diff --git a/build/temp_gyp/.svn/text-base/googleurl.gyp.svn-base b/build/temp_gyp/.svn/text-base/googleurl.gyp.svn-base
new file mode 100644
index 0000000..9a2eda3
--- /dev/null
+++ b/build/temp_gyp/.svn/text-base/googleurl.gyp.svn-base
@@ -0,0 +1,112 @@
+# Copyright (c) 2009 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.
+
+# TODO(mark): Upstream this file to googleurl.
+{
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'targets': [
+ {
+ 'target_name': 'googleurl',
+ 'type': '<(component)',
+ 'msvs_guid': 'EF5E94AB-B646-4E5B-A058-52EF07B8351C',
+ 'dependencies': [
+ '../../base/base.gyp:base',
+ '../../third_party/icu/icu.gyp:icudata',
+ '../../third_party/icu/icu.gyp:icui18n',
+ '../../third_party/icu/icu.gyp:icuuc',
+ ],
+ 'sources': [
+ '../../googleurl/src/gurl.cc',
+ '../../googleurl/src/gurl.h',
+ '../../googleurl/src/url_canon.h',
+ '../../googleurl/src/url_canon_etc.cc',
+ '../../googleurl/src/url_canon_fileurl.cc',
+ '../../googleurl/src/url_canon_host.cc',
+ '../../googleurl/src/url_canon_icu.cc',
+ '../../googleurl/src/url_canon_icu.h',
+ '../../googleurl/src/url_canon_internal.cc',
+ '../../googleurl/src/url_canon_internal.h',
+ '../../googleurl/src/url_canon_internal_file.h',
+ '../../googleurl/src/url_canon_ip.cc',
+ '../../googleurl/src/url_canon_ip.h',
+ '../../googleurl/src/url_canon_mailtourl.cc',
+ '../../googleurl/src/url_canon_path.cc',
+ '../../googleurl/src/url_canon_pathurl.cc',
+ '../../googleurl/src/url_canon_query.cc',
+ '../../googleurl/src/url_canon_relative.cc',
+ '../../googleurl/src/url_canon_stdstring.h',
+ '../../googleurl/src/url_canon_stdurl.cc',
+ '../../googleurl/src/url_file.h',
+ '../../googleurl/src/url_parse.cc',
+ '../../googleurl/src/url_parse.h',
+ '../../googleurl/src/url_parse_file.cc',
+ '../../googleurl/src/url_parse_internal.h',
+ '../../googleurl/src/url_util.cc',
+ '../../googleurl/src/url_util.h',
+ ],
+ 'direct_dependent_settings': {
+ 'include_dirs': [
+ '../..',
+ ],
+ },
+ 'conditions': [
+ ['OS=="win" and component=="shared_library"', {
+ 'defines': [
+ 'GURL_DLL',
+ 'GURL_IMPLEMENTATION=1',
+ ],
+ 'direct_dependent_settings': {
+ 'defines': [
+ 'GURL_DLL',
+ ],
+ },
+ }],
+ ],
+ },
+ {
+ 'target_name': 'googleurl_unittests',
+ 'dependencies': [
+ 'googleurl',
+ '../../testing/gtest.gyp:gtest',
+ '../../third_party/icu/icu.gyp:icuuc',
+ ],
+ 'sources': [
+ '../../googleurl/src/gurl_unittest.cc',
+ '../../googleurl/src/url_canon_unittest.cc',
+ '../../googleurl/src/url_parse_unittest.cc',
+ '../../googleurl/src/url_test_utils.h',
+ '../../googleurl/src/url_util_unittest.cc',
+ '../../googleurl/src/gurl_test_main.cc',
+ ],
+ 'conditions': [
+ ['OS=="linux" or OS=="freebsd"', {
+ 'conditions': [
+ ['linux_use_tcmalloc==1', {
+ 'dependencies': [
+ '../../base/allocator/allocator.gyp:allocator',
+ ],
+ }],
+ ],
+ }],
+ # TODO(victorw): The unittest code uses inline functions that access
+ # global variables, it also uses internal functions that we may not want
+ # to export, so skip building unittests for windows multi dll build.
+ # The googleurl functions are tested by the static library build.
+ ['OS=="win" and component=="shared_library"', {
+ 'type': 'none',
+ }, {
+ 'type': 'executable',
+ }],
+ ],
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/build/temp_gyp/.svn/text-base/pdfsqueeze.gyp.svn-base b/build/temp_gyp/.svn/text-base/pdfsqueeze.gyp.svn-base
new file mode 100644
index 0000000..d7a742c
--- /dev/null
+++ b/build/temp_gyp/.svn/text-base/pdfsqueeze.gyp.svn-base
@@ -0,0 +1,46 @@
+# Copyright (c) 2009 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'pdfsqueeze',
+ 'type': 'executable',
+ 'sources': [
+ '../../third_party/pdfsqueeze/pdfsqueeze.m',
+ ],
+ 'defines': [
+ # Use defines to map the full path names that will be used for
+ # the vars into the short forms expected by pdfsqueeze.m.
+ '______third_party_pdfsqueeze_ApplyGenericRGB_qfilter=ApplyGenericRGB_qfilter',
+ '______third_party_pdfsqueeze_ApplyGenericRGB_qfilter_len=ApplyGenericRGB_qfilter_len',
+ ],
+ 'include_dirs': [
+ '<(INTERMEDIATE_DIR)',
+ ],
+ 'libraries': [
+ '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
+ '$(SDKROOT)/System/Library/Frameworks/Quartz.framework',
+ ],
+ 'actions': [
+ {
+ 'action_name': 'Generate inline filter data',
+ 'inputs': [
+ '../../third_party/pdfsqueeze/ApplyGenericRGB.qfilter',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/ApplyGenericRGB.h',
+ ],
+ 'action': ['xxd', '-i', '<@(_inputs)', '<@(_outputs)'],
+ },
+ ],
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/build/util/.svn/all-wcprops b/build/util/.svn/all-wcprops
new file mode 100644
index 0000000..12ba8a0
--- /dev/null
+++ b/build/util/.svn/all-wcprops
@@ -0,0 +1,17 @@
+K 25
+svn:wc:ra_dav:version-url
+V 40
+/svn/!svn/ver/61526/trunk/src/build/util
+END
+lastchange.py
+K 25
+svn:wc:ra_dav:version-url
+V 54
+/svn/!svn/ver/61526/trunk/src/build/util/lastchange.py
+END
+build_util.gyp
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/39223/trunk/src/build/util/build_util.gyp
+END
diff --git a/build/util/.svn/dir-prop-base b/build/util/.svn/dir-prop-base
new file mode 100644
index 0000000..b3ca30d
--- /dev/null
+++ b/build/util/.svn/dir-prop-base
@@ -0,0 +1,16 @@
+K 10
+svn:ignore
+V 168
+build_util.xcodeproj
+build_util.sln
+lastchange.vcproj
+SConstruct
+build_util_main.scons
+lastchange.scons
+support
+lastchange.mk
+lastchange.target.mk
+build_util.Makefile
+
+
+END
diff --git a/build/util/.svn/entries b/build/util/.svn/entries
new file mode 100644
index 0000000..5949de0
--- /dev/null
+++ b/build/util/.svn/entries
@@ -0,0 +1,96 @@
+10
+
+dir
+70875
+http://src.chromium.org/svn/trunk/src/build/util
+http://src.chromium.org/svn
+
+
+
+2010-10-05T17:36:30.884599Z
+61526
+dilmah@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+
+lastchange.py
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+f40e1d7b2d611ca8962c82d86221874b
+2010-10-05T17:36:30.884599Z
+61526
+dilmah@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+3291
+
+build_util.gyp
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+a94ae655e906add9d2b69ed4c92013d7
+2010-02-17T16:49:27.514326Z
+39223
+mmoss@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+1195
+
diff --git a/build/util/.svn/prop-base/build_util.gyp.svn-base b/build/util/.svn/prop-base/build_util.gyp.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/util/.svn/prop-base/build_util.gyp.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/util/.svn/prop-base/lastchange.py.svn-base b/build/util/.svn/prop-base/lastchange.py.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/util/.svn/prop-base/lastchange.py.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/util/.svn/text-base/build_util.gyp.svn-base b/build/util/.svn/text-base/build_util.gyp.svn-base
new file mode 100644
index 0000000..a909177
--- /dev/null
+++ b/build/util/.svn/text-base/build_util.gyp.svn-base
@@ -0,0 +1,43 @@
+# Copyright (c) 2009 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'lastchange',
+ 'type': 'none',
+ 'variables': {
+ 'lastchange_out_path': '<(SHARED_INTERMEDIATE_DIR)/build/LASTCHANGE',
+ 'default_lastchange_path': '../LASTCHANGE.in',
+ },
+ 'actions': [
+ {
+ 'action_name': 'lastchange',
+ 'inputs': [
+ # Note: <(default_lastchange_path) is optional,
+ # so it doesn't show up in inputs.
+ './lastchange.py',
+ ],
+ 'outputs': [
+ '<(lastchange_out_path).always',
+ '<(lastchange_out_path)',
+ ],
+ 'action': [
+ 'python', '<@(_inputs)',
+ '-o', '<(lastchange_out_path)',
+ '-d', '<(default_lastchange_path)',
+ ],
+ 'message': 'Extracting last change to <(lastchange_out_path)',
+ 'process_outputs_as_sources': '1',
+ },
+ ],
+ },
+ ]
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/build/util/.svn/text-base/lastchange.py.svn-base b/build/util/.svn/text-base/lastchange.py.svn-base
new file mode 100644
index 0000000..00b275f
--- /dev/null
+++ b/build/util/.svn/text-base/lastchange.py.svn-base
@@ -0,0 +1,130 @@
+#!/usr/bin/env python
+# 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.
+
+"""
+lastchange.py -- Chromium revision fetching utility.
+"""
+
+import optparse
+import os
+import re
+import subprocess
+import sys
+
+
+def svn_fetch_revision():
+ """
+ Fetch the Subversion revision for the local tree.
+
+ Errors are swallowed.
+ """
+ try:
+ p = subprocess.Popen(['svn', 'info'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=(sys.platform=='win32'))
+ except OSError, e:
+ # 'svn' is apparently either not installed or not executable.
+ return None
+ revision = None
+ if p:
+ svn_re = re.compile('^Revision:\s+(\d+)', re.M)
+ m = svn_re.search(p.stdout.read())
+ if m:
+ revision = m.group(1)
+ return revision
+
+
+def git_fetch_id():
+ """
+ Fetch the GIT identifier for the local tree.
+
+ Errors are swallowed.
+ """
+ git_re = re.compile('^\s*git-svn-id:\s+(\S+)@(\d+)', re.M)
+ try:
+ proc = subprocess.Popen(['git', 'log', '-999'],
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE,
+ shell=(sys.platform=='win32'))
+ for line in proc.stdout:
+ match = git_re.search(line)
+ if match:
+ id = match.group(2)
+ if id:
+ proc.stdout.close() # Cut pipe.
+ return id
+ except OSError:
+ # 'git' is apparently either not installed or not executable.
+ pass
+ return None
+
+
+def fetch_change(default_lastchange):
+ """
+ Returns the last change, from some appropriate revision control system.
+ """
+ change = svn_fetch_revision()
+ if not change and sys.platform in ('linux2',):
+ change = git_fetch_id()
+ if not change:
+ if default_lastchange and os.path.exists(default_lastchange):
+ change = open(default_lastchange, 'r').read().strip()
+ else:
+ change = '0'
+ return change
+
+
+def write_if_changed(file_name, contents):
+ """
+ Writes the specified contents to the specified file_name
+ iff the contents are different than the current contents.
+ """
+ try:
+ old_contents = open(file_name, 'r').read()
+ except EnvironmentError:
+ pass
+ else:
+ if contents == old_contents:
+ return
+ os.unlink(file_name)
+ open(file_name, 'w').write(contents)
+
+
+def main(argv=None):
+ if argv is None:
+ argv = sys.argv
+
+ parser = optparse.OptionParser(usage="lastchange.py [-h] [[-o] FILE]")
+ parser.add_option("-d", "--default-lastchange", metavar="FILE",
+ help="default last change input FILE")
+ parser.add_option("-o", "--output", metavar="FILE",
+ help="write last change to FILE")
+ opts, args = parser.parse_args(argv[1:])
+
+ out_file = opts.output
+
+ while len(args) and out_file is None:
+ if out_file is None:
+ out_file = args.pop(0)
+ if args:
+ sys.stderr.write('Unexpected arguments: %r\n\n' % args)
+ parser.print_help()
+ sys.exit(2)
+
+ change = fetch_change(opts.default_lastchange)
+
+ contents = "LASTCHANGE=%s\n" % change
+
+ if out_file:
+ write_if_changed(out_file, contents)
+ else:
+ sys.stdout.write(contents)
+
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main())
diff --git a/build/util/support/.svn/all-wcprops b/build/util/support/.svn/all-wcprops
new file mode 100644
index 0000000..0c76434
--- /dev/null
+++ b/build/util/support/.svn/all-wcprops
@@ -0,0 +1,11 @@
+K 25
+svn:wc:ra_dav:version-url
+V 38
+/svn/!svn/ver/20411/trunk/deps/support
+END
+support.gyp
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/18977/trunk/deps/support/support.gyp
+END
diff --git a/build/util/support/.svn/dir-prop-base b/build/util/support/.svn/dir-prop-base
new file mode 100644
index 0000000..7d19edf
--- /dev/null
+++ b/build/util/support/.svn/dir-prop-base
@@ -0,0 +1,11 @@
+K 10
+svn:ignore
+V 89
+support.xcodeproj
+support.sln
+support.vcproj
+support.scons
+support_main.scons
+SConstruct
+
+END
diff --git a/build/util/support/.svn/entries b/build/util/support/.svn/entries
new file mode 100644
index 0000000..202a5d1
--- /dev/null
+++ b/build/util/support/.svn/entries
@@ -0,0 +1,62 @@
+10
+
+dir
+70887
+http://src.chromium.org/svn/trunk/deps/support
+http://src.chromium.org/svn
+
+
+
+2009-07-10T20:45:27.710843Z
+20411
+maruel@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+
+support.gyp
+file
+
+
+
+
+2011-05-16T13:47:41.000000Z
+9e82dfc26643f6910d7e89c93f3482ef
+2009-06-22T23:11:42.165255Z
+18977
+slightlyoff@chromium.org
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+411
+
diff --git a/build/util/support/.svn/text-base/support.gyp.svn-base b/build/util/support/.svn/text-base/support.gyp.svn-base
new file mode 100644
index 0000000..5840f80
--- /dev/null
+++ b/build/util/support/.svn/text-base/support.gyp.svn-base
@@ -0,0 +1,21 @@
+# Copyright (c) 2009 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.
+
+{
+ 'variables': {
+ 'chromium_code': 1,
+ },
+ 'includes': [
+ '../../common.gypi',
+ ],
+ 'targets': [
+ {
+ 'target_name': 'support',
+ 'type': 'none',
+ },
+ # TODO(slightlyoff)
+ ],
+}
+
+# vim: shiftwidth=2:et:ai:tabstop=2
diff --git a/build/win/.svn/all-wcprops b/build/win/.svn/all-wcprops
new file mode 100644
index 0000000..1302eea
--- /dev/null
+++ b/build/win/.svn/all-wcprops
@@ -0,0 +1,17 @@
+K 25
+svn:wc:ra_dav:version-url
+V 39
+/svn/!svn/ver/61430/trunk/src/build/win
+END
+chrome_win.croc
+K 25
+svn:wc:ra_dav:version-url
+V 55
+/svn/!svn/ver/61430/trunk/src/build/win/chrome_win.croc
+END
+system.gyp
+K 25
+svn:wc:ra_dav:version-url
+V 50
+/svn/!svn/ver/28089/trunk/src/build/win/system.gyp
+END
diff --git a/build/win/.svn/dir-prop-base b/build/win/.svn/dir-prop-base
new file mode 100644
index 0000000..d9a97b6
--- /dev/null
+++ b/build/win/.svn/dir-prop-base
@@ -0,0 +1,7 @@
+K 10
+svn:ignore
+V 25
+cygwin.vcproj
+system.sln
+
+END
diff --git a/build/win/.svn/entries b/build/win/.svn/entries
new file mode 100644
index 0000000..ff20a7b
--- /dev/null
+++ b/build/win/.svn/entries
@@ -0,0 +1,96 @@
+10
+
+dir
+70875
+http://src.chromium.org/svn/trunk/src/build/win
+http://src.chromium.org/svn
+
+
+
+2010-10-04T22:56:50.780169Z
+61430
+jrg@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+4ff67af0-8c30-449e-8e8b-ad334ec8d88c
+
+chrome_win.croc
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+543f11b337d8bfe217b8607213a6cfe0
+2010-10-04T22:56:50.780169Z
+61430
+jrg@chromium.org
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+532
+
+system.gyp
+file
+
+
+
+
+2011-05-16T13:12:11.000000Z
+3e1258608d17c81c63fb44b43bf93769
+2009-10-06T03:02:38.090039Z
+28089
+sgk@google.com
+has-props
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+832
+
diff --git a/build/win/.svn/prop-base/chrome_win.croc.svn-base b/build/win/.svn/prop-base/chrome_win.croc.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/win/.svn/prop-base/chrome_win.croc.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/win/.svn/prop-base/system.gyp.svn-base b/build/win/.svn/prop-base/system.gyp.svn-base
new file mode 100644
index 0000000..abd5821
--- /dev/null
+++ b/build/win/.svn/prop-base/system.gyp.svn-base
@@ -0,0 +1,5 @@
+K 13
+svn:eol-style
+V 2
+LF
+END
diff --git a/build/win/.svn/text-base/chrome_win.croc.svn-base b/build/win/.svn/text-base/chrome_win.croc.svn-base
new file mode 100644
index 0000000..e1e3bb7
--- /dev/null
+++ b/build/win/.svn/text-base/chrome_win.croc.svn-base
@@ -0,0 +1,26 @@
+# -*- python -*-
+# Crocodile config file for Chromium windows
+
+{
+ # List of rules, applied in order
+ 'rules' : [
+ # Specify inclusions before exclusions, since rules are in order.
+
+ # Don't include chromeos, posix, or linux specific files
+ {
+ 'regexp' : '.*(_|/)(chromeos|linux|posix)(\\.|_)',
+ 'include' : 0,
+ },
+ # Don't include ChromeOS dirs
+ {
+ 'regexp' : '.*/chromeos/',
+ 'include' : 0,
+ },
+
+ # Groups
+ {
+ 'regexp' : '.*_test_win\\.',
+ 'group' : 'test',
+ },
+ ],
+}
diff --git a/build/win/.svn/text-base/system.gyp.svn-base b/build/win/.svn/text-base/system.gyp.svn-base
new file mode 100644
index 0000000..0c06849
--- /dev/null
+++ b/build/win/.svn/text-base/system.gyp.svn-base
@@ -0,0 +1,33 @@
+# Copyright (c) 2009 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'cygwin',
+ 'type': 'none',
+ 'actions': [
+ {
+ 'action_name': 'setup_mount',
+ 'msvs_cygwin_shell': 0,
+ 'inputs': [
+ '../../third_party/cygwin/setup_mount.bat',
+ ],
+ # Visual Studio requires an output file, or else the
+ # custom build step won't run.
+ 'outputs': [
+ '../../third_party/cygwin/_always_run_setup_mount.marker',
+ ],
+ 'action': ['', '<@(_inputs)'],
+ },
+ ],
+ },
+ ],
+}
+
+# Local Variables:
+# tab-width:2
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=2 shiftwidth=2:
diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS
index a052a2d..1d4653b 100644
--- a/chrome/browser/DEPS
+++ b/chrome/browser/DEPS
@@ -8,6 +8,7 @@
"+chrome/tools/profiles", # For history unit tests.
"+chrome/views",
"+grit", # For generated headers
+ "+ppapi/c", # For various types.
"+ppapi/proxy",
"+rlz",
"+sandbox/linux",
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 5085859..69b7a4e 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -122,13 +122,6 @@
SINGLE_VALUE_TYPE(switches::kEnableVerticalTabs)
},
{
- "tabbed-options", // FLAGS:RECORD_UMA
- IDS_FLAGS_TABBED_OPTIONS_NAME,
- IDS_FLAGS_TABBED_OPTIONS_DESCRIPTION,
- kOsWin | kOsLinux | kOsMac, // Enabled by default on CrOS.
- SINGLE_VALUE_TYPE(switches::kEnableTabbedOptions)
- },
- {
"remoting", // FLAGS:RECORD_UMA
IDS_FLAGS_REMOTING_NAME,
#if defined(OS_WIN)
@@ -152,13 +145,6 @@
SINGLE_VALUE_TYPE(switches::kEnableXSSAuditor)
},
{
- "background-webapps", // FLAGS:RECORD_UMA
- IDS_FLAGS_BACKGROUND_WEBAPPS_NAME,
- IDS_FLAGS_BACKGROUND_WEBAPPS_DESCRIPTION,
- kOsLinux, // Enabled by default on windows and mac, not available on CrOS.
- SINGLE_VALUE_TYPE(switches::kEnableBackgroundMode)
- },
- {
"conflicting-modules-check", // FLAGS:RECORD_UMA
IDS_FLAGS_CONFLICTS_CHECK_NAME,
IDS_FLAGS_CONFLICTS_CHECK_DESCRIPTION,
diff --git a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
index 6844409..9fbd160 100644
--- a/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
+++ b/chrome/browser/accessibility/browser_views_accessibility_browsertest.cc
@@ -129,9 +129,9 @@
ASSERT_TRUE(NULL != acc_obj);
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
- std::wstring title =
- l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT,
- ASCIIToWide(chrome::kAboutBlankURL));
+ std::wstring title = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_BROWSER_WINDOW_TITLE_FORMAT,
+ ASCIIToUTF16(chrome::kAboutBlankURL)));
TestAccessibilityInfo(acc_obj, title, ROLE_SYSTEM_WINDOW);
}
@@ -142,7 +142,7 @@
GetBrowserView()->GetWindow()->GetNonClientView();
TestViewAccessibilityObject(non_client_view,
- l10n_util::GetString(IDS_PRODUCT_NAME),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)),
ROLE_SYSTEM_WINDOW);
}
@@ -153,25 +153,28 @@
views::View* browser_root_view =
GetBrowserView()->frame()->GetFrameView()->GetRootView();
- TestViewAccessibilityObject(browser_root_view,
- l10n_util::GetString(IDS_PRODUCT_NAME),
- ROLE_SYSTEM_APPLICATION);
+ TestViewAccessibilityObject(
+ browser_root_view,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)),
+ ROLE_SYSTEM_APPLICATION);
}
// Retrieve accessibility object for browser view and verify accessibility info.
IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestBrowserViewAccObj) {
// Verify root view MSAA name and role.
- TestViewAccessibilityObject(GetBrowserView(),
- l10n_util::GetString(IDS_PRODUCT_NAME),
- ROLE_SYSTEM_CLIENT);
+ TestViewAccessibilityObject(
+ GetBrowserView(),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)),
+ ROLE_SYSTEM_CLIENT);
}
// Retrieve accessibility object for toolbar view and verify accessibility info.
IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestToolbarViewAccObj) {
// Verify toolbar MSAA name and role.
- TestViewAccessibilityObject(GetToolbarView(),
- l10n_util::GetString(IDS_ACCNAME_TOOLBAR),
- ROLE_SYSTEM_TOOLBAR);
+ TestViewAccessibilityObject(
+ GetToolbarView(),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR)),
+ ROLE_SYSTEM_TOOLBAR);
}
// Retrieve accessibility object for Back button and verify accessibility info.
@@ -179,7 +182,8 @@
// Verify Back button MSAA name and role.
TestViewAccessibilityObject(
GetToolbarView()->GetViewByID(VIEW_ID_BACK_BUTTON),
- l10n_util::GetString(IDS_ACCNAME_BACK), ROLE_SYSTEM_BUTTONDROPDOWN);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_BACK)),
+ ROLE_SYSTEM_BUTTONDROPDOWN);
}
// Retrieve accessibility object for Forward button and verify accessibility
@@ -188,7 +192,8 @@
// Verify Forward button MSAA name and role.
TestViewAccessibilityObject(
GetToolbarView()->GetViewByID(VIEW_ID_FORWARD_BUTTON),
- l10n_util::GetString(IDS_ACCNAME_FORWARD), ROLE_SYSTEM_BUTTONDROPDOWN);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_FORWARD)),
+ ROLE_SYSTEM_BUTTONDROPDOWN);
}
// Retrieve accessibility object for Reload button and verify accessibility
@@ -197,7 +202,8 @@
// Verify Reload button MSAA name and role.
TestViewAccessibilityObject(
GetToolbarView()->GetViewByID(VIEW_ID_RELOAD_BUTTON),
- l10n_util::GetString(IDS_ACCNAME_RELOAD), ROLE_SYSTEM_PUSHBUTTON);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_RELOAD)),
+ ROLE_SYSTEM_PUSHBUTTON);
}
// Retrieve accessibility object for Home button and verify accessibility info.
@@ -205,7 +211,8 @@
// Verify Home button MSAA name and role.
TestViewAccessibilityObject(
GetToolbarView()->GetViewByID(VIEW_ID_HOME_BUTTON),
- l10n_util::GetString(IDS_ACCNAME_HOME), ROLE_SYSTEM_PUSHBUTTON);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_HOME)),
+ ROLE_SYSTEM_PUSHBUTTON);
}
// Retrieve accessibility object for Star button and verify accessibility info.
@@ -214,31 +221,35 @@
// Verify Star button MSAA name and role.
TestViewAccessibilityObject(
GetToolbarView()->GetViewByID(VIEW_ID_STAR_BUTTON),
- l10n_util::GetString(IDS_ACCNAME_STAR), ROLE_SYSTEM_PUSHBUTTON);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_STAR)),
+ ROLE_SYSTEM_PUSHBUTTON);
}
// Retrieve accessibility object for App menu button and verify accessibility
// info.
IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest, TestAppMenuAccObj) {
// Verify App menu button MSAA name and role.
- TestViewAccessibilityObject(GetToolbarView()->GetViewByID(VIEW_ID_APP_MENU),
- l10n_util::GetString(IDS_ACCNAME_APP),
- ROLE_SYSTEM_BUTTONMENU);
+ TestViewAccessibilityObject(
+ GetToolbarView()->GetViewByID(VIEW_ID_APP_MENU),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_APP)),
+ ROLE_SYSTEM_BUTTONMENU);
}
IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
TestBookmarkBarViewAccObj) {
- TestViewAccessibilityObject(GetBookmarkBarView(),
- l10n_util::GetString(IDS_ACCNAME_BOOKMARKS),
- ROLE_SYSTEM_TOOLBAR);
+ TestViewAccessibilityObject(
+ GetBookmarkBarView(),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS)),
+ ROLE_SYSTEM_TOOLBAR);
}
IN_PROC_BROWSER_TEST_F(BrowserViewsAccessibilityTest,
TestAboutChromeViewAccObj) {
// Firstly, test that the WindowDelegate got updated.
views::Window* aboutChromeWindow = GetBrowserView()->ShowAboutChromeDialog();
- EXPECT_STREQ(aboutChromeWindow->GetDelegate()->GetWindowTitle().c_str(),
- l10n_util::GetString(IDS_ABOUT_CHROME_TITLE).c_str());
+ EXPECT_STREQ(
+ aboutChromeWindow->GetDelegate()->GetWindowTitle().c_str(),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_TITLE)).c_str());
EXPECT_EQ(aboutChromeWindow->GetDelegate()->accessible_role(),
AccessibilityTypes::ROLE_DIALOG);
@@ -252,8 +263,10 @@
ASSERT_EQ(S_OK, hr);
ASSERT_TRUE(NULL != acc_obj);
- TestAccessibilityInfo(acc_obj, l10n_util::GetString(IDS_ABOUT_CHROME_TITLE),
- ROLE_SYSTEM_DIALOG);
+ TestAccessibilityInfo(
+ acc_obj,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_TITLE)),
+ ROLE_SYSTEM_DIALOG);
acc_obj->Release();
}
diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc
index 9273cd2..92ce3b8 100644
--- a/chrome/browser/aeropeek_manager.cc
+++ b/chrome/browser/aeropeek_manager.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,12 +7,15 @@
#include <dwmapi.h>
#include <shobjidl.h>
-#include "app/win_util.h"
+#include "app/win/hwnd_util.h"
+#include "app/win/window_impl.h"
+#include "app/win/shell.h"
#include "base/command_line.h"
#include "base/scoped_comptr_win.h"
-#include "base/scoped_handle_win.h"
#include "base/scoped_native_library.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/win/scoped_gdi_object.h"
+#include "base/win/scoped_hdc.h"
#include "base/win/windows_version.h"
#include "chrome/browser/app_icon_win.h"
#include "chrome/browser/browser_list.h"
@@ -31,7 +34,6 @@
#include "chrome/installer/util/browser_distribution.h"
#include "gfx/gdi_util.h"
#include "gfx/icon_util.h"
-#include "gfx/window_impl.h"
#include "skia/ext/image_operations.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -250,7 +252,7 @@
// browser icon in the taskbar.
// TODO(mattm): This should use ShellIntegration::GetChromiumAppId to work
// properly with multiple profiles.
- win_util::SetAppIdForWindow(
+ app::win::SetAppIdForWindow(
BrowserDistribution::GetDistribution()->GetBrowserAppId(), window_);
// Register this place-holder window to the taskbar as a child of
@@ -338,7 +340,7 @@
// Create a DIB, copy the resized image, and send the DIB to Windows.
// We can delete this DIB after sending it to Windows since Windows creates
// a copy of the DIB and use it.
- ScopedHDC hdc(CreateCompatibleDC(NULL));
+ base::win::ScopedHDC hdc(CreateCompatibleDC(NULL));
if (!hdc.Get()) {
LOG(ERROR) << "cannot create a memory DC: " << GetLastError();
return;
@@ -349,12 +351,13 @@
&header);
void* bitmap_data = NULL;
- ScopedBitmap bitmap(CreateDIBSection(hdc,
- reinterpret_cast<BITMAPINFO*>(&header),
- DIB_RGB_COLORS,
- &bitmap_data,
- NULL,
- 0));
+ base::win::ScopedBitmap bitmap(
+ CreateDIBSection(hdc,
+ reinterpret_cast<BITMAPINFO*>(&header),
+ DIB_RGB_COLORS,
+ &bitmap_data,
+ NULL,
+ 0));
if (!bitmap.Get() || !bitmap_data) {
LOG(ERROR) << "cannot create a bitmap: " << GetLastError();
@@ -452,7 +455,7 @@
// tab image into the DIB, and send it to Windows.
// We don't need to paste this tab image onto the frame image since Windows
// automatically pastes it for us.
- ScopedHDC hdc(CreateCompatibleDC(NULL));
+ base::win::ScopedHDC hdc(CreateCompatibleDC(NULL));
if (!hdc.Get()) {
LOG(ERROR) << "cannot create a memory DC: " << GetLastError();
return;
@@ -463,10 +466,11 @@
&header);
void* bitmap_data = NULL;
- ScopedBitmap bitmap(CreateDIBSection(hdc.Get(),
- reinterpret_cast<BITMAPINFO*>(&header),
- DIB_RGB_COLORS, &bitmap_data,
- NULL, 0));
+ base::win::ScopedBitmap bitmap(
+ CreateDIBSection(hdc.Get(),
+ reinterpret_cast<BITMAPINFO*>(&header),
+ DIB_RGB_COLORS, &bitmap_data,
+ NULL, 0));
if (!bitmap.Get() || !bitmap_data) {
LOG(ERROR) << "cannot create a bitmap: " << GetLastError();
return;
@@ -544,7 +548,7 @@
// * Translating received messages for TabStrip.
// This class is used by the AeroPeekManager class, which is a proxy
// between TabStrip and Windows 7.
-class AeroPeekWindow : public gfx::WindowImpl {
+class AeroPeekWindow : public app::win::WindowImpl {
public:
AeroPeekWindow(HWND frame_window,
AeroPeekWindowDelegate* delegate,
@@ -682,7 +686,7 @@
// The favicon for this tab.
SkBitmap favicon_bitmap_;
- ScopedHICON favicon_;
+ base::win::ScopedHICON favicon_;
// The icon used by the frame window.
// This icon is used when this tab doesn't have a favicon.
@@ -1012,7 +1016,7 @@
// flooding users with tab thumbnails.
const CommandLine* command_line = CommandLine::ForCurrentProcess();
return base::win::GetVersion() >= base::win::VERSION_WIN7 &&
- win_util::ShouldUseVistaFrame() &&
+ app::win::ShouldUseVistaFrame() &&
!command_line->HasSwitch(switches::kApp) &&
command_line->HasSwitch(switches::kEnableAeroPeekTabs);
}
diff --git a/chrome/browser/alternate_nav_url_fetcher.h b/chrome/browser/alternate_nav_url_fetcher.h
index 785f34a..7f573dd 100644
--- a/chrome/browser/alternate_nav_url_fetcher.h
+++ b/chrome/browser/alternate_nav_url_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -51,7 +51,7 @@
// URLFetcher::Delegate
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
@@ -67,7 +67,7 @@
// Sets |state_| to either SUCCEEDED or FAILED depending on the result of the
// fetch.
void SetStatusFromURLFetch(const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code);
// Displays the infobar if all conditions are met (the page has loaded and
diff --git a/chrome/browser/app_controller_mac.mm b/chrome/browser/app_controller_mac.mm
index 428f375..79579fe 100644
--- a/chrome/browser/app_controller_mac.mm
+++ b/chrome/browser/app_controller_mac.mm
@@ -9,7 +9,7 @@
#include "base/auto_reset.h"
#include "base/command_line.h"
#include "base/file_path.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/message_loop.h"
#include "base/string_number_conversions.h"
#include "base/sys_string_conversions.h"
@@ -995,7 +995,7 @@
static BOOL doneOnce = NO;
if (!doneOnce) {
doneOnce = YES;
- if (mac_util::WasLaunchedAsHiddenLoginItem()) {
+ if (base::mac::WasLaunchedAsHiddenLoginItem()) {
SessionService* sessionService =
[self defaultProfile]->GetSessionService();
if (sessionService &&
@@ -1120,7 +1120,7 @@
// visible.
- (IBAction)showPreferences:(id)sender {
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
- if (parsed_command_line.HasSwitch(switches::kEnableTabbedOptions)) {
+ if (!parsed_command_line.HasSwitch(switches::kDisableTabbedOptions)) {
if (Browser* browser = ActivateBrowser([self defaultProfile])) {
// Show options tab in the active browser window.
browser->ShowOptionsTab(chrome::kDefaultOptionsSubPage);
diff --git a/chrome/browser/appcache/appcache_dispatcher_host.h b/chrome/browser/appcache/appcache_dispatcher_host.h
index 3e2dbe9..1feca77 100644
--- a/chrome/browser/appcache/appcache_dispatcher_host.h
+++ b/chrome/browser/appcache/appcache_dispatcher_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -18,9 +18,12 @@
#include "webkit/appcache/appcache_backend_impl.h"
class ChromeAppCacheService;
-class URLRequestContext;
class URLRequestContextGetter;
+namespace net {
+class URLRequestContext;
+} // namespace net
+
// Handles appcache related messages sent to the main browser process from
// its child processes. There is a distinct host for each child process.
// Messages are handled on the IO thread. The BrowserRenderProcessHost and
@@ -28,7 +31,7 @@
class AppCacheDispatcherHost : public BrowserMessageFilter {
public:
// Constructor for use on the IO thread.
- AppCacheDispatcherHost(URLRequestContext* request_context,
+ AppCacheDispatcherHost(net::URLRequestContext* request_context,
int process_id);
// Constructor for use on the UI thread.
@@ -77,7 +80,7 @@
// Temporary until OnChannelConnected() can be called from the IO thread,
// which will extract the AppCacheService from the URLRequestContext.
- scoped_refptr<URLRequestContext> request_context_;
+ scoped_refptr<net::URLRequestContext> request_context_;
scoped_refptr<URLRequestContextGetter> request_context_getter_;
scoped_ptr<appcache::GetStatusCallback> get_status_callback_;
diff --git a/chrome/browser/autocomplete/autocomplete.cc b/chrome/browser/autocomplete/autocomplete.cc
index 6bb8ad2..dfbc3a6 100644
--- a/chrome/browser/autocomplete/autocomplete.cc
+++ b/chrome/browser/autocomplete/autocomplete.cc
@@ -958,18 +958,19 @@
if (history_contents_provider_->db_match_count() ==
history_contents_provider_->kMaxMatchCount) {
// History contents searcher has maxed out.
- match.contents = l10n_util::GetStringF(IDS_OMNIBOX_RECENT_HISTORY_MANY,
- input_.text(),
- &keyword_offset);
+ match.contents = UTF16ToWideHack(
+ l10n_util::GetStringFUTF16(IDS_OMNIBOX_RECENT_HISTORY_MANY,
+ WideToUTF16Hack(input_.text()),
+ &keyword_offset));
} else {
// We can report exact matches when there aren't too many.
std::vector<size_t> content_param_offsets;
- match.contents = l10n_util::GetStringF(
+ match.contents = UTF16ToWideHack(l10n_util::GetStringFUTF16(
IDS_OMNIBOX_RECENT_HISTORY,
- UTF16ToWide(base::FormatNumber(history_contents_provider_->
- db_match_count())),
- input_.text(),
- &content_param_offsets);
+ base::FormatNumber(history_contents_provider_->
+ db_match_count()),
+ WideToUTF16Hack(input_.text()),
+ &content_param_offsets));
// content_param_offsets is ordered based on supplied params, we expect
// that the second one contains the query (first is the number).
diff --git a/chrome/browser/autocomplete/autocomplete_accessibility.cc b/chrome/browser/autocomplete/autocomplete_accessibility.cc
index 0f622d7..747d8fe 100644
--- a/chrome/browser/autocomplete/autocomplete_accessibility.cc
+++ b/chrome/browser/autocomplete/autocomplete_accessibility.cc
@@ -91,7 +91,7 @@
return E_INVALIDARG;
}
- std::wstring temp_name = l10n_util::GetString(IDS_ACCNAME_LOCATION);
+ string16 temp_name = l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION);
if (!temp_name.empty()) {
// Return name retrieved.
diff --git a/chrome/browser/autocomplete/autocomplete_edit.cc b/chrome/browser/autocomplete/autocomplete_edit.cc
index 68cdc82..f08a2e4 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -186,6 +186,13 @@
return true;
#endif
+ // The value of input.initial_prevent_inline_autocomplete() is determined by
+ // following conditions:
+ // 1. If the caret is at the end of the text (checked below).
+ // 2. If it's in IME composition mode.
+ // As we use a separated widget for displaying the instant suggest, it won't
+ // interfere with IME composition, so we don't need to care about the value of
+ // input.initial_prevent_inline_autocomplete() here.
if (view_->DeleteAtEndPressed() || (popup_->selected_line() != 0) ||
just_deleted_text_)
return true;
@@ -422,10 +429,10 @@
// search engine, if applicable; see comments in template_url.h.
}
- controller_->OnAutocompleteWillAccept();
-
- if (disposition != NEW_BACKGROUND_TAB)
+ if (disposition != NEW_BACKGROUND_TAB) {
+ controller_->OnAutocompleteWillAccept();
view_->RevertAll(); // Revert the box to its unedited state
+ }
controller_->OnAutocompleteAccept(url, disposition, transition,
alternate_nav_url);
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit.h b/chrome/browser/autocomplete/autocomplete_edit.h
index da0625e..1a8da22 100644
--- a/chrome/browser/autocomplete/autocomplete_edit.h
+++ b/chrome/browser/autocomplete/autocomplete_edit.h
@@ -44,6 +44,8 @@
gfx::NativeView view_gaining_focus) = 0;
// Sent prior to OnAutoCompleteAccept and before the model has been reverted.
+ // This is only invoked if the popup is closed before invoking
+ // OnAutoCompleteAccept.
virtual void OnAutocompleteWillAccept() = 0;
// Commits the suggested text. |typed_text| is the current text showing in the
@@ -138,7 +140,8 @@
void SetPopupModel(AutocompletePopupModel* popup_model);
- // It should only be used by testing code.
+ // TODO: The edit and popup should be siblings owned by the LocationBarView,
+ // making this accessor unnecessary.
AutocompletePopupModel* popup_model() const { return popup_; }
// Invoked when the profile has changed.
diff --git a/chrome/browser/autocomplete/autocomplete_edit_unittest.cc b/chrome/browser/autocomplete/autocomplete_edit_unittest.cc
index 7dedb98..73c8ae9 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_unittest.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_unittest.cc
@@ -55,6 +55,15 @@
virtual gfx::NativeView GetNativeView() const { return 0; }
virtual CommandUpdater* GetCommandUpdater() { return NULL; }
+#if defined(TOOLKIT_VIEWS)
+ virtual views::View* AddToView(views::View* parent) { return NULL; }
+ virtual int TextWidth() const { return 0; }
+ virtual bool CommitInstantSuggestion(
+ const std::wstring& typed_text,
+ const std::wstring& suggested_text) { return false;}
+ virtual void SetInstantSuggestion(const string16& input) {}
+#endif
+
private:
DISALLOW_COPY_AND_ASSIGN(TestingAutocompleteEditView);
};
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view.h b/chrome/browser/autocomplete/autocomplete_edit_view.h
index 439b2ed..12c42a2 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view.h
@@ -24,6 +24,12 @@
class GURL;
class TabContents;
+#if defined(TOOLKIT_VIEWS)
+namespace views {
+class View;
+} // namespace views
+#endif
+
class AutocompleteEditView {
public:
// Used by the automation system for getting at the model from the view.
@@ -152,7 +158,23 @@
// Returns the command updater for this view.
virtual CommandUpdater* GetCommandUpdater() = 0;
- protected:
+#if defined(TOOLKIT_VIEWS)
+ // Adds the autocomplete edit view to view hierarchy and
+ // returns the views::View of the edit view.
+ virtual views::View* AddToView(views::View* parent) = 0;
+
+ // Commits the suggested text.
+ virtual bool CommitInstantSuggestion(const std::wstring& typed_text,
+ const std::wstring& suggested_text) = 0;
+
+ // Shows the instant suggestion text.
+ virtual void SetInstantSuggestion(const string16& input) = 0;
+
+ // Returns the width in pixels needed to display the current text. The
+ // returned value includes margins.
+ virtual int TextWidth() const = 0;
+#endif
+
virtual ~AutocompleteEditView() {}
};
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
index 3a5b68b..adbba71 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_browsertest.cc
@@ -110,6 +110,14 @@
g_free(selection_text);
return result;
}
+
+// Stores the given text to clipboard.
+void SetClipboardText(const char* text) {
+ GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
+ DCHECK(clipboard);
+
+ gtk_clipboard_set_text(clipboard, text, -1);
+}
#endif
} // namespace
@@ -296,13 +304,9 @@
// Test if ctrl-* accelerators are workable in omnibox.
// See http://crbug.com/19193: omnibox blocks ctrl-* commands
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_BrowserAccelerators DISABLED_BrowserAccelerators
-#else
-#define MAYBE_BrowserAccelerators BrowserAccelerators
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_BrowserAccelerators) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BrowserAccelerators) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
browser()->FocusLocationBar();
AutocompleteEditView* edit_view = NULL;
ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view));
@@ -355,13 +359,9 @@
#endif
}
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_PopupAccelerators DISABLED_PopupAccelerators
-#else
-#define MAYBE_PopupAccelerators PopupAccelerators
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_PopupAccelerators) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, PopupAccelerators) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
// Create a popup.
Browser* popup = CreateBrowserForPopup(browser()->profile());
AutocompleteEditView* edit_view = NULL;
@@ -408,13 +408,9 @@
#endif
}
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_BackspaceInKeywordMode DISABLED_BackspaceInKeywordMode
-#else
-#define MAYBE_BackspaceInKeywordMode BackspaceInKeywordMode
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_BackspaceInKeywordMode) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BackspaceInKeywordMode) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupComponents());
browser()->FocusLocationBar();
@@ -466,13 +462,9 @@
WideToUTF8(edit_view->GetText()));
}
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_Escape DISABLED_Escape
-#else
-#define MAYBE_Escape Escape
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_Escape) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, Escape) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupComponents());
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIHistoryURL));
browser()->FocusLocationBar();
@@ -494,13 +486,9 @@
EXPECT_TRUE(edit_view->IsSelectAll());
}
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_DesiredTLD DISABLED_DesiredTLD
-#else
-#define MAYBE_DesiredTLD DesiredTLD
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_DesiredTLD) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, DesiredTLD) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupComponents());
browser()->FocusLocationBar();
@@ -520,13 +508,9 @@
EXPECT_STREQ(kDesiredTLDHostname, url.host().c_str());
}
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_AltEnter DISABLED_AltEnter
-#else
-#define MAYBE_AltEnter AltEnter
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_AltEnter) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, AltEnter) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupComponents());
browser()->FocusLocationBar();
@@ -540,13 +524,9 @@
ASSERT_NO_FATAL_FAILURE(WaitForTabOpenOrClose(tab_count + 1));
}
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_EnterToSearch DISABLED_EnterToSearch
-#else
-#define MAYBE_EnterToSearch EnterToSearch
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_EnterToSearch) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToSearch) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupHostResolver());
ASSERT_NO_FATAL_FAILURE(SetupSearchEngine());
browser()->FocusLocationBar();
@@ -590,13 +570,9 @@
// See http://crbug.com/20934: Omnibox keyboard behavior wrong for
// "See recent pages in history"
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_EnterToOpenHistoryPage DISABLED_EnterToOpenHistoryPage
-#else
-#define MAYBE_EnterToOpenHistoryPage EnterToOpenHistoryPage
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_EnterToOpenHistoryPage) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EnterToOpenHistoryPage) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupComponents());
browser()->FocusLocationBar();
@@ -633,13 +609,9 @@
EXPECT_STREQ(kHistoryPageURL, url.spec().c_str());
}
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_EscapeToDefaultMatch DISABLED_EscapeToDefaultMatch
-#else
-#define MAYBE_EscapeToDefaultMatch EscapeToDefaultMatch
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_EscapeToDefaultMatch) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, EscapeToDefaultMatch) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupComponents());
browser()->FocusLocationBar();
@@ -678,13 +650,9 @@
EXPECT_EQ(old_selected_line, popup_model->selected_line());
}
-// Sometimes times out on Windows: http://crbug.com/57965
-#if defined(OS_WIN)
-#define MAYBE_BasicTextOperations DISABLED_BasicTextOperations
-#else
-#define MAYBE_BasicTextOperations BasicTextOperations
-#endif
-IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, MAYBE_BasicTextOperations) {
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, BasicTextOperations) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupComponents());
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
browser()->FocusLocationBar();
@@ -745,6 +713,8 @@
#if defined(OS_LINUX)
IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, UndoRedoLinux) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
ASSERT_NO_FATAL_FAILURE(SetupComponents());
ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL));
browser()->FocusLocationBar();
@@ -810,6 +780,8 @@
// See http://crbug.com/63860
IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, PrimarySelection) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
browser()->FocusLocationBar();
AutocompleteEditView* edit_view = NULL;
ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view));
@@ -837,6 +809,8 @@
// See http://crosbug.com/10306
IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest,
BackspaceDeleteHalfWidthKatakana) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
browser()->FocusLocationBar();
AutocompleteEditView* edit_view = NULL;
ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view));
@@ -850,4 +824,27 @@
ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_BACK, false, false, false));
EXPECT_EQ(UTF8ToWide("\357\276\200"), edit_view->GetText());
}
+
+// http://crbug.com/12316
+IN_PROC_BROWSER_TEST_F(AutocompleteEditViewTest, PasteReplacingAll) {
+ ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
+
+ ASSERT_NO_FATAL_FAILURE(SetupComponents());
+ browser()->FocusLocationBar();
+
+ AutocompleteEditView* edit_view = NULL;
+ ASSERT_NO_FATAL_FAILURE(GetAutocompleteEditView(&edit_view));
+ AutocompletePopupModel* popup_model = edit_view->model()->popup_model();
+ ASSERT_TRUE(popup_model);
+
+ SetClipboardText(kSearchText);
+
+ // Paste text.
+ ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_V, true, false, false));
+ ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
+ ASSERT_TRUE(popup_model->IsOpen());
+
+ // Inline autocomplete shouldn't be triggered.
+ ASSERT_EQ(L"abc", edit_view->GetText());
+}
#endif
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index e450e70..4de3d2c 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -10,7 +10,6 @@
#include <algorithm>
#include "app/l10n_util.h"
-#include "app/multi_animation.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -36,14 +35,17 @@
#include "grit/generated_resources.h"
#include "net/base/escape.h"
#include "third_party/undoview/undo_view.h"
+#include "ui/base/animation/multi_animation.h"
#if defined(TOOLKIT_VIEWS)
-#include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h"
-#include "chrome/browser/views/location_bar/location_bar_view.h"
+#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
+#include "chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h"
+#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#else
#include "chrome/browser/autocomplete/autocomplete_popup_view_gtk.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
#include "chrome/browser/gtk/location_bar_view_gtk.h"
+#include "views/controls/native/native_view_host.h"
#endif
namespace {
@@ -381,12 +383,12 @@
AdjustVerticalAlignmentOfInstantView();
- MultiAnimation::Parts parts;
- parts.push_back(MultiAnimation::Part(
- InstantController::kAutoCommitPauseTimeMS, Tween::ZERO));
- parts.push_back(MultiAnimation::Part(
- InstantController::kAutoCommitFadeInTimeMS, Tween::EASE_IN));
- instant_animation_.reset(new MultiAnimation(parts));
+ ui::MultiAnimation::Parts parts;
+ parts.push_back(ui::MultiAnimation::Part(
+ InstantController::kAutoCommitPauseTimeMS, ui::Tween::ZERO));
+ parts.push_back(ui::MultiAnimation::Part(
+ InstantController::kAutoCommitFadeInTimeMS, ui::Tween::EASE_IN));
+ instant_animation_.reset(new ui::MultiAnimation(parts));
instant_animation_->set_continuous(false);
#if !defined(TOOLKIT_VIEWS)
@@ -418,44 +420,6 @@
gtk_widget_grab_focus(text_view_);
}
-int AutocompleteEditViewGtk::TextWidth() {
- int horizontal_border_size =
- gtk_text_view_get_border_window_size(GTK_TEXT_VIEW(text_view_),
- GTK_TEXT_WINDOW_LEFT) +
- gtk_text_view_get_border_window_size(GTK_TEXT_VIEW(text_view_),
- GTK_TEXT_WINDOW_RIGHT) +
- gtk_text_view_get_left_margin(GTK_TEXT_VIEW(text_view_)) +
- gtk_text_view_get_right_margin(GTK_TEXT_VIEW(text_view_));
-
- GtkTextIter start, end;
- GdkRectangle first_char_bounds, last_char_bounds;
- gtk_text_buffer_get_start_iter(text_buffer_, &start);
-
- // Use the real end iterator here to take the width of instant suggestion
- // text into account, so that location bar can layout its children correctly.
- gtk_text_buffer_get_end_iter(text_buffer_, &end);
- gtk_text_view_get_iter_location(GTK_TEXT_VIEW(text_view_),
- &start, &first_char_bounds);
- gtk_text_view_get_iter_location(GTK_TEXT_VIEW(text_view_),
- &end, &last_char_bounds);
-
- gint first_char_start = first_char_bounds.x;
- gint first_char_end = first_char_start + first_char_bounds.width;
- gint last_char_start = last_char_bounds.x;
- gint last_char_end = last_char_start + last_char_bounds.width;
-
- // bounds width could be negative for RTL text.
- if (first_char_start > first_char_end)
- std::swap(first_char_start, first_char_end);
- if (last_char_start > last_char_end)
- std::swap(last_char_start, last_char_end);
-
- gint text_width = first_char_start < last_char_start ?
- last_char_end - first_char_start : first_char_end - last_char_start;
-
- return text_width + horizontal_border_size;
-}
-
int AutocompleteEditViewGtk::WidthOfTextAfterCursor() {
// Not used.
return -1;
@@ -689,12 +653,6 @@
}
void AutocompleteEditViewGtk::OnBeforePossibleChange() {
- // This method will be called in HandleKeyPress() method just before
- // handling a key press event. So we should prevent it from being called
- // when handling the key press event.
- if (handling_key_press_)
- return;
-
// If this change is caused by a paste clipboard action and all text is
// selected, then call model_->on_paste_replacing_all() to prevent inline
// autocomplete.
@@ -704,6 +662,12 @@
model_->on_paste_replacing_all();
}
+ // This method will be called in HandleKeyPress() method just before
+ // handling a key press event. So we should prevent it from being called
+ // when handling the key press event.
+ if (handling_key_press_)
+ return;
+
// Record our state.
text_before_change_ = GetText();
sel_before_change_ = GetSelection();
@@ -790,6 +754,102 @@
return command_updater_;
}
+#if defined(TOOLKIT_VIEWS)
+views::View* AutocompleteEditViewGtk::AddToView(views::View* parent) {
+ views::NativeViewHost* host = new views::NativeViewHost;
+ parent->AddChildView(host);
+ host->set_focus_view(parent);
+ host->Attach(GetNativeView());
+ return host;
+}
+
+bool AutocompleteEditViewGtk::CommitInstantSuggestion(
+ const std::wstring& typed_text,
+ const std::wstring& suggestion) {
+ return CommitInstantSuggestion();
+}
+
+void AutocompleteEditViewGtk::EnableAccessibility() {
+ accessible_widget_helper_.reset(
+ new AccessibleWidgetHelper(text_view(), model_->profile()));
+ accessible_widget_helper_->SetWidgetName(
+ text_view(), l10n_util::GetStringUTF8(IDS_ACCNAME_LOCATION));
+}
+
+void AutocompleteEditViewGtk::SetInstantSuggestion(const string16& suggestion) {
+ SetInstantSuggestion(UTF16ToUTF8(suggestion));
+}
+#endif
+
+int AutocompleteEditViewGtk::TextWidth() const {
+ int horizontal_border_size =
+ gtk_text_view_get_border_window_size(GTK_TEXT_VIEW(text_view_),
+ GTK_TEXT_WINDOW_LEFT) +
+ gtk_text_view_get_border_window_size(GTK_TEXT_VIEW(text_view_),
+ GTK_TEXT_WINDOW_RIGHT) +
+ gtk_text_view_get_left_margin(GTK_TEXT_VIEW(text_view_)) +
+ gtk_text_view_get_right_margin(GTK_TEXT_VIEW(text_view_));
+
+ GtkTextIter start, end;
+ GdkRectangle first_char_bounds, last_char_bounds;
+ gtk_text_buffer_get_start_iter(text_buffer_, &start);
+
+ // Use the real end iterator here to take the width of instant suggestion
+ // text into account, so that location bar can layout its children correctly.
+ gtk_text_buffer_get_end_iter(text_buffer_, &end);
+ gtk_text_view_get_iter_location(GTK_TEXT_VIEW(text_view_),
+ &start, &first_char_bounds);
+ gtk_text_view_get_iter_location(GTK_TEXT_VIEW(text_view_),
+ &end, &last_char_bounds);
+
+ gint first_char_start = first_char_bounds.x;
+ gint first_char_end = first_char_start + first_char_bounds.width;
+ gint last_char_start = last_char_bounds.x;
+ gint last_char_end = last_char_start + last_char_bounds.width;
+
+ // bounds width could be negative for RTL text.
+ if (first_char_start > first_char_end)
+ std::swap(first_char_start, first_char_end);
+ if (last_char_start > last_char_end)
+ std::swap(last_char_start, last_char_end);
+
+ gint text_width = first_char_start < last_char_start ?
+ last_char_end - first_char_start : first_char_end - last_char_start;
+
+ return text_width + horizontal_border_size;
+}
+
+#if defined(TOOLKIT_VIEWS)
+// static
+AutocompleteEditView* AutocompleteEditViewGtk::Create(
+ AutocompleteEditController* controller,
+ ToolbarModel* toolbar_model,
+ Profile* profile,
+ CommandUpdater* command_updater,
+ bool popup_window_mode,
+ const views::View* location_bar) {
+ AutocompleteEditViewGtk* autocomplete =
+ new AutocompleteEditViewGtk(controller,
+ toolbar_model,
+ profile,
+ command_updater,
+ popup_window_mode,
+ location_bar);
+ autocomplete->Init();
+
+ // Make all the children of the widget visible. NOTE: this won't display
+ // anything, it just toggles the visible flag.
+ gtk_widget_show_all(autocomplete->GetNativeView());
+ // Hide the widget. NativeViewHostGtk will make it visible again as
+ // necessary.
+ gtk_widget_hide(autocomplete->GetNativeView());
+
+ autocomplete->EnableAccessibility();
+
+ return autocomplete;
+}
+#endif
+
void AutocompleteEditViewGtk::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
@@ -798,15 +858,17 @@
SetBaseColor();
}
-void AutocompleteEditViewGtk::AnimationEnded(const Animation* animation) {
+void AutocompleteEditViewGtk::AnimationEnded(const ui::Animation* animation) {
controller_->OnCommitSuggestedText(GetText());
}
-void AutocompleteEditViewGtk::AnimationProgressed(const Animation* animation) {
+void AutocompleteEditViewGtk::AnimationProgressed(
+ const ui::Animation* animation) {
UpdateInstantViewColors();
}
-void AutocompleteEditViewGtk::AnimationCanceled(const Animation* animation) {
+void AutocompleteEditViewGtk::AnimationCanceled(
+ const ui::Animation* animation) {
UpdateInstantViewColors();
}
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
index dc09d91..2397d26 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h
@@ -11,7 +11,6 @@
#include <algorithm>
#include <string>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "app/gtk_signal_registrar.h"
#include "base/basictypes.h"
@@ -24,19 +23,24 @@
#include "chrome/common/notification_registrar.h"
#include "chrome/common/page_transition_types.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation_delegate.h"
#include "webkit/glue/window_open_disposition.h"
+class AccessibleWidgetHelper;
class AutocompleteEditController;
class AutocompleteEditModel;
class AutocompletePopupView;
-class MultiAnimation;
class Profile;
class TabContents;
-namespace gfx{
+namespace gfx {
class Font;
}
+namespace ui {
+class MultiAnimation;
+}
+
namespace views {
class View;
}
@@ -47,7 +51,7 @@
class AutocompleteEditViewGtk : public AutocompleteEditView,
public NotificationObserver,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
// Modeled like the Windows CHARRANGE. Represent a pair of cursor position
// offsets. Since GtkTextIters are invalid after the buffer is changed, we
@@ -71,19 +75,15 @@
CommandUpdater* command_updater,
bool popup_window_mode,
#if defined(TOOLKIT_VIEWS)
- const views::View* location_bar);
+ const views::View* location_bar
#else
- GtkWidget* location_bar);
+ GtkWidget* location_bar
#endif
- ~AutocompleteEditViewGtk();
+ );
+ virtual ~AutocompleteEditViewGtk();
// Initialize, create the underlying widgets, etc.
void Init();
-
- // Returns the width in pixels needed to display the current text. The
- // returned value includes margins.
- int TextWidth();
-
// Returns the width in pixels needed to display the text from one character
// before the caret to the end of the string. See comments in
// LocationBarView::Layout as to why this uses -1.
@@ -143,16 +143,37 @@
virtual bool OnAfterPossibleChange();
virtual gfx::NativeView GetNativeView() const;
virtual CommandUpdater* GetCommandUpdater();
+#if defined(TOOLKIT_VIEWS)
+ virtual views::View* AddToView(views::View* parent);
+ virtual bool CommitInstantSuggestion(const std::wstring& typed_text,
+ const std::wstring& suggested_text);
+ virtual void SetInstantSuggestion(const string16& suggestion);
+
+ // Enables accessibility on AutocompleteEditView.
+ void EnableAccessibility();
+
+ // A factory method to create an AutocompleteEditView instance initialized for
+ // linux_views. This currently returns an instance of
+ // AutocompleteEditViewGtk only, but AutocompleteEditViewViews will
+ // be added as an option when TextfieldViews is enabled.
+ static AutocompleteEditView* Create(AutocompleteEditController* controller,
+ ToolbarModel* toolbar_model,
+ Profile* profile,
+ CommandUpdater* command_updater,
+ bool popup_window_mode,
+ const views::View* location_bar);
+#endif
+ virtual int TextWidth() const;
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details);
- // Overridden from AnimationDelegate.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
// Sets the colors of the text view according to the theme.
void SetBaseColor();
@@ -366,7 +387,7 @@
GtkWidget* instant_view_;
// Animation from instant suggest (faded text) to autocomplete (selected
// text).
- scoped_ptr<MultiAnimation> instant_animation_;
+ scoped_ptr<ui::MultiAnimation> instant_animation_;
// A mark to split the content and the instant anchor. Wherever the end
// iterator of the text buffer is required, the iterator to this mark should
@@ -514,6 +535,10 @@
GtkSignalRegistrar signals_;
+#if defined(TOOLKIT_VIEWS)
+ scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
+#endif
+
DISALLOW_COPY_AND_ASSIGN(AutocompleteEditViewGtk);
};
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
index 284f30c..df2a8ba 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.cc
@@ -18,10 +18,10 @@
#include "app/l10n_util_win.h"
#include "app/os_exchange_data.h"
#include "app/os_exchange_data_provider_win.h"
-#include "app/win_util.h"
#include "app/win/drag_source.h"
#include "app/win/drop_target.h"
#include "app/win/iat_patch_function.h"
+#include "app/win/win_util.h"
#include "base/auto_reset.h"
#include "base/basictypes.h"
#include "base/i18n/rtl.h"
@@ -498,10 +498,6 @@
g_paint_patcher.Pointer()->DerefPatch();
}
-int AutocompleteEditViewWin::TextWidth() {
- return WidthNeededToDisplay(GetText());
-}
-
int AutocompleteEditViewWin::WidthOfTextAfterCursor() {
CHARRANGE selection;
GetSelection(selection);
@@ -913,6 +909,30 @@
return command_updater_;
}
+views::View* AutocompleteEditViewWin::AddToView(views::View* parent) {
+ views::NativeViewHost* host = new views::NativeViewHost;
+ parent->AddChildView(host);
+ host->set_focus_view(parent);
+ host->Attach(GetNativeView());
+ return host;
+}
+
+bool AutocompleteEditViewWin::CommitInstantSuggestion(
+ const std::wstring& typed_text,
+ const std::wstring& suggested_text) {
+ model_->FinalizeInstantQuery(typed_text, suggested_text);
+ return true;
+}
+
+void AutocompleteEditViewWin::SetInstantSuggestion(const string16& suggestion) {
+ // Win shows the suggestion in LocationBarView.
+ NOTREACHED();
+}
+
+int AutocompleteEditViewWin::TextWidth() const {
+ return WidthNeededToDisplay(GetText());
+}
+
void AutocompleteEditViewWin::PasteAndGo(const std::wstring& text) {
if (CanPasteAndGo(text))
model_->PasteAndGo();
@@ -924,7 +944,7 @@
// We don't process ALT + numpad digit as accelerators, they are used for
// entering special characters. We do translate alt-home.
if (e.IsAltDown() && (key != app::VKEY_HOME) &&
- win_util::IsNumPadDigit(key, e.IsExtendedKey()))
+ app::win::IsNumPadDigit(key, e.IsExtendedKey()))
return true;
// Skip accelerators for key combinations omnibox wants to crack. This list
@@ -1012,7 +1032,7 @@
std::wstring AutocompleteEditViewWin::GetLabelForCommandId(
int command_id) const {
DCHECK(command_id == IDS_PASTE_AND_GO);
- return l10n_util::GetString(model_->is_paste_and_search() ?
+ return l10n_util::GetStringUTF16(model_->is_paste_and_search() ?
IDS_PASTE_AND_SEARCH : IDS_PASTE_AND_GO);
}
@@ -1477,7 +1497,7 @@
// double_click_time_ from the current message's time even if the timer has
// wrapped in between.
const bool is_triple_click = tracking_double_click_ &&
- win_util::IsDoubleClick(double_click_point_, point,
+ app::win::IsDoubleClick(double_click_point_, point,
GetCurrentMessage()->time - double_click_time_);
tracking_double_click_ = false;
@@ -1577,7 +1597,7 @@
return;
}
- if (tracking_click_[kLeft] && !win_util::IsDrag(click_point_[kLeft], point))
+ if (tracking_click_[kLeft] && !app::win::IsDrag(click_point_[kLeft], point))
return;
tracking_click_[kLeft] = false;
@@ -2395,7 +2415,7 @@
}
void AutocompleteEditViewWin::StartDragIfNecessary(const CPoint& point) {
- if (initiated_drag_ || !win_util::IsDrag(click_point_[kLeft], point))
+ if (initiated_drag_ || !app::win::IsDrag(click_point_[kLeft], point))
return;
OSExchangeData data;
@@ -2551,7 +2571,7 @@
const CPoint& point) {
// When the user has clicked and released to give us focus, select all.
if (tracking_click_[button] &&
- !win_util::IsDrag(click_point_[button], point)) {
+ !app::win::IsDrag(click_point_[button], point)) {
// Select all in the reverse direction so as not to scroll the caret
// into view and shift the contents jarringly.
SelectAll(true);
@@ -2570,7 +2590,7 @@
}
}
-int AutocompleteEditViewWin::GetHorizontalMargin() {
+int AutocompleteEditViewWin::GetHorizontalMargin() const {
RECT rect;
GetRect(&rect);
RECT client_rect;
@@ -2578,7 +2598,8 @@
return (rect.left - client_rect.left) + (client_rect.right - rect.right);
}
-int AutocompleteEditViewWin::WidthNeededToDisplay(const std::wstring& text) {
+int AutocompleteEditViewWin::WidthNeededToDisplay(
+ const std::wstring& text) const {
// Use font_.GetStringWidth() instead of
// PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
// apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_win.h b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
index 0773843..7fc56a9 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_win.h
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_win.h
@@ -74,10 +74,6 @@
views::View* parent_view() const { return parent_view_; }
- // Returns the width in pixels needed to display the current text. The
- // returned value includes margins.
- int TextWidth();
-
// Returns the width in pixels needed to display the text from one character
// before the caret to the end of the string. See comments in
// LocationBarView::Layout as to why this uses -1.
@@ -137,6 +133,12 @@
virtual bool OnAfterPossibleChange();
virtual gfx::NativeView GetNativeView() const;
virtual CommandUpdater* GetCommandUpdater();
+ virtual views::View* AddToView(views::View* parent);
+ virtual bool CommitInstantSuggestion(const std::wstring& typed_text,
+ const std::wstring& suggested_text);
+ virtual void SetInstantSuggestion(const string16& suggestion);
+ virtual int TextWidth() const;
+
int GetPopupMaxYCoordinate();
// Exposes custom IAccessible implementation to the overall MSAA hierarchy.
@@ -401,10 +403,10 @@
void TrackMousePosition(MouseButton button, const CPoint& point);
// Returns the sum of the left and right margins.
- int GetHorizontalMargin();
+ int GetHorizontalMargin() const;
// Returns the width in pixels needed to display |text|.
- int WidthNeededToDisplay(const std::wstring& text);
+ int WidthNeededToDisplay(const std::wstring& text) const;
scoped_ptr<AutocompleteEditModel> model_;
diff --git a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
index 950cf08..d0b84e7 100644
--- a/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
+++ b/chrome/browser/autocomplete/autocomplete_popup_view_mac.mm
@@ -8,7 +8,6 @@
#include "app/resource_bundle.h"
#include "app/text_elider.h"
-#include "base/mac_util.h"
#include "base/stl_util-inl.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
diff --git a/chrome/browser/autocomplete/history_contents_provider_unittest.cc b/chrome/browser/autocomplete/history_contents_provider_unittest.cc
index b6c3208..6404ede 100644
--- a/chrome/browser/autocomplete/history_contents_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_contents_provider_unittest.cc
@@ -90,8 +90,10 @@
// ACProviderListener
virtual void OnProviderUpdate(bool updated_matches) {
- // When we quit, the test will get back control.
- MessageLoop::current()->Quit();
+ // We must quit the message loop (if running) to return control to the test.
+ // Note, calling Quit() directly will checkfail if the loop isn't running,
+ // so we post a task, which is safe for either case.
+ MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
}
MessageLoopForUI message_loop_;
@@ -184,7 +186,7 @@
// Run the message loop (needed for async history results).
MessageLoop::current()->Run();
- // We should two urls now, bookmark_url and http://www.google.com/3.
+ // We should have two urls now, bookmark_url and http://www.google.com/3.
const ACMatches& m3 = matches();
ASSERT_EQ(2U, m3.size());
if (bookmark_url == m3[0].destination_url) {
@@ -195,4 +197,49 @@
}
}
+// Tests that history is deleted properly.
+TEST_F(HistoryContentsProviderTest, DeleteMatch) {
+ AutocompleteInput input(L"bar", std::wstring(), true, false, true, false);
+ RunQuery(input, false);
+
+ // Query; the result should be the third page.
+ const ACMatches& m = matches();
+ ASSERT_EQ(1U, m.size());
+ EXPECT_EQ(test_entries[2].url, m[0].destination_url.spec());
+
+ // Now delete the match and ensure it was removed.
+ provider()->DeleteMatch(m[0]);
+ EXPECT_EQ(0U, matches().size());
+}
+
+// Tests deleting starred results from history, not affecting bookmarks/matches.
+TEST_F(HistoryContentsProviderTest, DeleteStarredMatch) {
+ profile()->CreateBookmarkModel(false);
+ profile()->BlockUntilBookmarkModelLoaded();
+
+ // Bookmark a history item.
+ GURL bookmark_url(test_entries[2].url);
+ profile()->GetBookmarkModel()->SetURLStarred(bookmark_url,
+ ASCIIToUTF16("bar"), true);
+
+ // Get the match to delete its history
+ AutocompleteInput input(L"bar", std::wstring(), true, false, true, false);
+ RunQuery(input, false);
+ const ACMatches& m = matches();
+ ASSERT_EQ(1U, m.size());
+
+ // Now delete the match and ensure it was *not* removed.
+ provider()->DeleteMatch(m[0]);
+ EXPECT_EQ(1U, matches().size());
+
+ // Run a query that would only match history (but the history is deleted)
+ AutocompleteInput you_input(L"you", std::wstring(), true, false, true, false);
+ RunQuery(you_input, false);
+ EXPECT_EQ(0U, matches().size());
+
+ // Run a query that matches the bookmark
+ RunQuery(input, false);
+ EXPECT_EQ(1U, matches().size());
+}
+
} // namespace
diff --git a/chrome/browser/autocomplete/history_provider.cc b/chrome/browser/autocomplete/history_provider.cc
index 100db04..cbcf691 100644
--- a/chrome/browser/autocomplete/history_provider.cc
+++ b/chrome/browser/autocomplete/history_provider.cc
@@ -43,9 +43,9 @@
for (ACMatches::iterator i(matches_.begin()); i != matches_.end(); ++i) {
if (i->destination_url == selected_url && i->type == match.type) {
found = true;
- if (i->is_history_what_you_typed_match) {
- // We can't get rid of the What You Typed match, but we can make it
- // look like it has no backing data.
+ if (i->is_history_what_you_typed_match || i->starred) {
+ // We can't get rid of What-You-Typed or Bookmarked matches,
+ // but we can make them look like they have no backing data.
i->deletable = false;
i->description.clear();
i->description_class.clear();
diff --git a/chrome/browser/autocomplete/history_provider.h b/chrome/browser/autocomplete/history_provider.h
index a1119a4..3cec58e 100644
--- a/chrome/browser/autocomplete/history_provider.h
+++ b/chrome/browser/autocomplete/history_provider.h
@@ -20,6 +20,9 @@
// This class is a base class for the history autocomplete providers and
// provides functions useful to all derived classes.
class HistoryProvider : public AutocompleteProvider {
+ public:
+ virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE;
+
protected:
enum MatchType {
NORMAL,
@@ -31,8 +34,6 @@
Profile* profile,
const char* name);
- virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE;
-
// Fixes up user URL input to make it more possible to match against. Among
// many other things, this takes care of the following:
// * Prepending file:// to file URLs
diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc
index 89ed06c..b0f3cbd 100644
--- a/chrome/browser/autocomplete/history_url_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc
@@ -13,9 +13,6 @@
#include "chrome/browser/history/history.h"
#include "chrome/test/testing_profile.h"
#include "testing/gtest/include/gtest/gtest.h"
-#if defined(OS_MACOSX)
-#include "base/mac_util.h"
-#endif
using base::Time;
using base::TimeDelta;
diff --git a/chrome/browser/autocomplete/keyword_provider.cc b/chrome/browser/autocomplete/keyword_provider.cc
index 5f2d430..71a8f40 100644
--- a/chrome/browser/autocomplete/keyword_provider.cc
+++ b/chrome/browser/autocomplete/keyword_provider.cc
@@ -318,9 +318,10 @@
if (element->url()->SupportsReplacement() &&
!element->IsExtensionKeyword()) {
// No query input; return a generic, no-destination placeholder.
- match->contents.assign(l10n_util::GetStringF(message_id,
- element->AdjustedShortNameForLocaleDirection(),
- l10n_util::GetString(IDS_EMPTY_KEYWORD_VALUE)));
+ match->contents.assign(UTF16ToWideHack(
+ l10n_util::GetStringFUTF16(message_id,
+ WideToUTF16Hack(element->AdjustedShortNameForLocaleDirection()),
+ l10n_util::GetStringUTF16(IDS_EMPTY_KEYWORD_VALUE))));
match->contents_class.push_back(
ACMatchClassification(0, ACMatchClassification::DIM));
} else {
@@ -341,10 +342,11 @@
*element, remaining_input, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
std::wstring()));
std::vector<size_t> content_param_offsets;
- match->contents.assign(l10n_util::GetStringF(message_id,
- element->short_name(),
- remaining_input,
- &content_param_offsets));
+ match->contents.assign(UTF16ToWideHack(
+ l10n_util::GetStringFUTF16(message_id,
+ WideToUTF16Hack(element->short_name()),
+ WideToUTF16Hack(remaining_input),
+ &content_param_offsets)));
if (content_param_offsets.size() == 2) {
AutocompleteMatch::ClassifyLocationInString(content_param_offsets[1],
remaining_input.length(), match->contents.length(),
@@ -420,15 +422,16 @@
// Create popup entry description based on the keyword name.
if (!element->IsExtensionKeyword()) {
- result.description.assign(l10n_util::GetStringF(
- IDS_AUTOCOMPLETE_KEYWORD_DESCRIPTION, keyword));
- static const std::wstring kKeywordDesc(
- l10n_util::GetString(IDS_AUTOCOMPLETE_KEYWORD_DESCRIPTION));
- AutocompleteMatch::ClassifyLocationInString(kKeywordDesc.find(L"%s"),
- prefix_length,
- result.description.length(),
- ACMatchClassification::DIM,
- &result.description_class);
+ result.description.assign(UTF16ToWideHack(l10n_util::GetStringFUTF16(
+ IDS_AUTOCOMPLETE_KEYWORD_DESCRIPTION, WideToUTF16Hack(keyword))));
+ string16 keyword_desc(
+ l10n_util::GetStringUTF16(IDS_AUTOCOMPLETE_KEYWORD_DESCRIPTION));
+ AutocompleteMatch::ClassifyLocationInString(
+ keyword_desc.find(ASCIIToUTF16("%s")),
+ prefix_length,
+ result.description.length(),
+ ACMatchClassification::DIM,
+ &result.description_class);
}
return result;
diff --git a/chrome/browser/autocomplete/search_provider.cc b/chrome/browser/autocomplete/search_provider.cc
index bd5a949..4c9da21 100644
--- a/chrome/browser/autocomplete/search_provider.cc
+++ b/chrome/browser/autocomplete/search_provider.cc
@@ -87,6 +87,16 @@
// destination_url for comparison as it varies depending upon the index passed
// to TemplateURL::ReplaceSearchTerms.
for (ACMatches::iterator i = matches_.begin(); i != matches_.end();) {
+ // Reset the description/description_class of all searches. We'll set the
+ // description of the new first match in the call to
+ // UpdateFirstSearchMatchDescription() below.
+ if ((i->type == AutocompleteMatch::SEARCH_HISTORY) ||
+ (i->type == AutocompleteMatch::SEARCH_SUGGEST) ||
+ (i->type == AutocompleteMatch::SEARCH_WHAT_YOU_TYPED)) {
+ i->description.clear();
+ i->description_class.clear();
+ }
+
if (((i->type == AutocompleteMatch::SEARCH_HISTORY) ||
(i->type == AutocompleteMatch::SEARCH_SUGGEST)) &&
(i->fill_into_edit == text)) {
@@ -109,6 +119,10 @@
input_.initial_prevent_inline_autocomplete(), &match_map);
DCHECK_EQ(1u, match_map.size());
matches_.push_back(match_map.begin()->second);
+ // Sort the results so that UpdateFirstSearchDescription does the right thing.
+ std::sort(matches_.begin(), matches_.end(), &AutocompleteMatch::MoreRelevant);
+
+ UpdateFirstSearchMatchDescription();
listener_->OnProviderUpdate(true);
}
@@ -161,15 +175,12 @@
if (default_provider) {
AutocompleteMatch match;
match.provider = this;
- match.contents.assign(l10n_util::GetString(IDS_EMPTY_KEYWORD_VALUE));
+ match.contents.assign(UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_EMPTY_KEYWORD_VALUE)));
match.contents_class.push_back(
ACMatchClassification(0, ACMatchClassification::NONE));
- match.description.assign(l10n_util::GetStringF(
- IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION,
- default_provider->AdjustedShortNameForLocaleDirection()));
- match.description_class.push_back(
- ACMatchClassification(0, ACMatchClassification::DIM));
matches_.push_back(match);
+ UpdateFirstSearchMatchDescription();
}
Stop();
return;
@@ -547,6 +558,8 @@
if (matches_.size() > max_total_matches)
matches_.erase(matches_.begin() + max_total_matches, matches_.end());
+ UpdateFirstSearchMatchDescription();
+
UpdateStarredStateOfMatches();
UpdateDone();
@@ -571,11 +584,24 @@
bool is_keyword,
int did_not_accept_suggestion,
MatchMap* map) {
+ int last_relevance = 0;
for (HistoryResults::const_iterator i(results.begin()); i != results.end();
++i) {
+ // History returns results sorted for us. We force the relevance to decrease
+ // so that the sort from history is honored. We should never end up with a
+ // match having a relevance greater than the previous, but they might be
+ // equal. If we didn't force the relevance to decrease and we ended up in a
+ // situation where the relevance was equal, then which was shown first would
+ // be random.
+ // This uses >= to handle the case where 3 or more results have the same
+ // relevance.
+ int relevance = CalculateRelevanceForHistory(i->time, is_keyword);
+ if (i != results.begin() && relevance >= last_relevance)
+ relevance = last_relevance - 1;
+ last_relevance = relevance;
AddMatchToMap(UTF16ToWide(i->term),
is_keyword ? keyword_input_text_ : input_.text(),
- CalculateRelevanceForHistory(i->time, is_keyword),
+ relevance,
AutocompleteMatch::SEARCH_HISTORY, did_not_accept_suggestion,
is_keyword, input_.initial_prevent_inline_autocomplete(),
map);
@@ -690,11 +716,11 @@
std::vector<size_t> content_param_offsets;
const TemplateURL& provider = is_keyword ? providers_.keyword_provider() :
providers_.default_provider();
+ match.contents.assign(query_string);
// We do intra-string highlighting for suggestions - the suggested segment
// will be highlighted, e.g. for input_text = "you" the suggestion may be
// "youtube", so we'll bold the "tube" section: you*tube*.
if (input_text != query_string) {
- match.contents.assign(query_string);
size_t input_position = match.contents.find(input_text);
if (input_position == std::wstring::npos) {
// The input text is not a substring of the query string, e.g. input
@@ -725,15 +751,9 @@
}
} else {
// Otherwise, we're dealing with the "default search" result which has no
- // completion, but has the search provider name as the description.
- match.contents.assign(query_string);
+ // completion.
match.contents_class.push_back(
ACMatchClassification(0, ACMatchClassification::NONE));
- match.description.assign(l10n_util::GetStringF(
- IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION,
- provider.AdjustedShortNameForLocaleDirection()));
- match.description_class.push_back(
- ACMatchClassification(0, ACMatchClassification::DIM));
}
// When the user forced a query, we need to make sure all the fill_into_edit
@@ -825,3 +845,29 @@
done_ = ((suggest_results_pending_ == 0) &&
(instant_finalized_ || !InstantController::IsEnabled(profile_)));
}
+
+void SearchProvider::UpdateFirstSearchMatchDescription() {
+ if (!providers_.valid_default_provider() || matches_.empty())
+ return;
+
+ for (ACMatches::iterator i = matches_.begin(); i != matches_.end(); ++i) {
+ AutocompleteMatch& match = *i;
+ switch (match.type) {
+ case AutocompleteMatch::SEARCH_WHAT_YOU_TYPED:
+ case AutocompleteMatch::SEARCH_HISTORY:
+ case AutocompleteMatch::SEARCH_SUGGEST:
+ match.description.assign(
+ UTF16ToWideHack(l10n_util::GetStringFUTF16(
+ IDS_AUTOCOMPLETE_SEARCH_DESCRIPTION,
+ WideToUTF16Hack(providers_.default_provider().
+ AdjustedShortNameForLocaleDirection()))));
+ match.description_class.push_back(
+ ACMatchClassification(0, ACMatchClassification::DIM));
+ // Only the first search match gets a description.
+ return;
+
+ default:
+ break;
+ }
+ }
+}
diff --git a/chrome/browser/autocomplete/search_provider.h b/chrome/browser/autocomplete/search_provider.h
index addd02e..9b83c3d 100644
--- a/chrome/browser/autocomplete/search_provider.h
+++ b/chrome/browser/autocomplete/search_provider.h
@@ -70,7 +70,7 @@
// URLFetcher::Delegate
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
@@ -268,6 +268,9 @@
// Updates the value of |done_| from the internal state.
void UpdateDone();
+ // Updates the description/description_class of the first search match.
+ void UpdateFirstSearchMatchDescription();
+
// Should we query for suggest results immediately? This is normally false,
// but may be set to true during testing.
static bool query_suggest_immediately_;
diff --git a/chrome/browser/autocomplete/search_provider_unittest.cc b/chrome/browser/autocomplete/search_provider_unittest.cc
index 6c20d55..7120a08 100644
--- a/chrome/browser/autocomplete/search_provider_unittest.cc
+++ b/chrome/browser/autocomplete/search_provider_unittest.cc
@@ -10,9 +10,11 @@
#include "chrome/browser/autocomplete/search_provider.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/history/history.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/net/test_url_fetcher_factory.h"
+#include "chrome/common/pref_names.h"
#include "chrome/test/testing_profile.h"
#include "net/url_request/url_request_status.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -61,6 +63,11 @@
void QueryForInput(const string16& text,
bool prevent_inline_autocomplete);
+ // Notifies the URLFetcher for the suggest query corresponding to the default
+ // search provider that it's done.
+ // Be sure and wrap calls to this in ASSERT_NO_FATAL_FAILURE.
+ void FinishDefaultSuggestQuery();
+
// See description above class for details of these fields.
TemplateURL* default_t_url_;
const string16 term1_;
@@ -194,6 +201,17 @@
return AutocompleteMatch(NULL, 1, false, AutocompleteMatch::HISTORY_URL);
}
+void SearchProviderTest::FinishDefaultSuggestQuery() {
+ TestURLFetcher* default_fetcher = test_factory_.GetFetcherByID(
+ SearchProvider::kDefaultProviderURLFetcherID);
+ ASSERT_TRUE(default_fetcher);
+
+ // Tell the SearchProvider the default suggest query is done.
+ default_fetcher->delegate()->OnURLFetchComplete(
+ default_fetcher, GURL(), URLRequestStatus(), 200, ResponseCookies(),
+ std::string());
+}
+
// Tests -----------------------------------------------------------------------
// Make sure we query history for the default provider and a URLFetcher is
@@ -224,8 +242,20 @@
// The SearchProvider is done. Make sure it has a result for the history
// term term1.
- AutocompleteMatch match = FindMatchWithDestination(term1_url_);
- ASSERT_TRUE(!match.destination_url.is_empty());
+ AutocompleteMatch term1_match = FindMatchWithDestination(term1_url_);
+ EXPECT_TRUE(!term1_match.destination_url.is_empty());
+ // Term1 should have a description.
+ EXPECT_FALSE(term1_match.description.empty());
+
+ GURL what_you_typed_url = GURL(default_t_url_->url()->ReplaceSearchTerms(
+ *default_t_url_, UTF16ToWide(term), 0, std::wstring()));
+ AutocompleteMatch what_you_typed_match =
+ FindMatchWithDestination(what_you_typed_url);
+ EXPECT_TRUE(!what_you_typed_match.destination_url.is_empty());
+ EXPECT_TRUE(what_you_typed_match.description.empty());
+
+ // The match for term1 should be more relevant than the what you typed result.
+ EXPECT_GT(term1_match.relevance, what_you_typed_match.relevance);
}
TEST_F(SearchProviderTest, HonorPreventInlineAutocomplete) {
@@ -314,3 +344,47 @@
RunTillProviderDone();
}
}
+
+// Make sure FinalizeInstantQuery works.
+TEST_F(SearchProviderTest, FinalizeInstantQuery) {
+ PrefService* service = profile_.GetPrefs();
+ service->SetBoolean(prefs::kInstantEnabled, true);
+
+ QueryForInput(ASCIIToUTF16("foo"), false);
+
+ // Wait until history and the suggest query complete.
+ profile_.BlockUntilHistoryProcessesPendingRequests();
+ ASSERT_NO_FATAL_FAILURE(FinishDefaultSuggestQuery());
+
+ // When instant is enabled the provider isn't done until it hears from
+ // instant.
+ EXPECT_FALSE(provider_->done());
+
+ // Tell the provider instant is done.
+ provider_->FinalizeInstantQuery(L"foo", L"bar");
+
+ // The provider should now be done.
+ EXPECT_TRUE(provider_->done());
+
+ // There should be two matches, one for what you typed, the other for
+ // 'foobar'.
+ EXPECT_EQ(2u, provider_->matches().size());
+ GURL instant_url = GURL(default_t_url_->url()->ReplaceSearchTerms(
+ *default_t_url_, L"foobar", 0, std::wstring()));
+ AutocompleteMatch instant_match = FindMatchWithDestination(instant_url);
+ EXPECT_TRUE(!instant_match.destination_url.is_empty());
+
+ // And the 'foobar' match should have a description.
+ EXPECT_FALSE(instant_match.description.empty());
+
+ // Make sure the what you typed match has no description.
+ GURL what_you_typed_url = GURL(default_t_url_->url()->ReplaceSearchTerms(
+ *default_t_url_, L"foo", 0, std::wstring()));
+ AutocompleteMatch what_you_typed_match =
+ FindMatchWithDestination(what_you_typed_url);
+ EXPECT_TRUE(!what_you_typed_match.destination_url.is_empty());
+ EXPECT_TRUE(what_you_typed_match.description.empty());
+
+ // The instant search should be more relevant.
+ EXPECT_GT(instant_match.relevance, what_you_typed_match.relevance);
+}
diff --git a/chrome/browser/autofill/address_field.cc b/chrome/browser/autofill/address_field.cc
index ecd96dd..ae4abaa 100644
--- a/chrome/browser/autofill/address_field.cc
+++ b/chrome/browser/autofill/address_field.cc
@@ -4,15 +4,20 @@
#include "chrome/browser/autofill/address_field.h"
+<<<<<<< HEAD
#ifdef ANDROID
#include "app/l10n_util.h"
#endif
+=======
+#include "app/l10n_util.h"
+>>>>>>> chromium.org at r10.0.634.0
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_field.h"
+#include "grit/autofill_resources.h"
bool AddressField::GetFieldInfo(FieldTypeMap* field_type_map) const {
AutoFillFieldType address_company;
@@ -210,7 +215,11 @@
if (!ParseText(iter, pattern, &address_field->address1_))
return false;
} else {
+<<<<<<< HEAD
string16 pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_LINE_1_RE);
+=======
+ pattern = l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_LINE_1_RE);
+>>>>>>> chromium.org at r10.0.634.0
string16 label_pattern =
l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESS_LINE_1_LABEL_RE);
@@ -320,8 +329,13 @@
// Look for a zip+4, whose field name will also often contain
// the substring "zip".
ParseText(iter,
+<<<<<<< HEAD
l10n_util::GetStringUTF16(IDS_AUTOFILL_ZIP_4_RE),
&address_field->zip4_);
+=======
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_ZIP_4_RE),
+ &address_field->zip4_);
+>>>>>>> chromium.org at r10.0.634.0
}
return true;
diff --git a/chrome/browser/autofill/autofill_address_sheet_controller_mac.mm b/chrome/browser/autofill/autofill_address_sheet_controller_mac.mm
index 80f0aac..d2f6938 100644
--- a/chrome/browser/autofill/autofill_address_sheet_controller_mac.mm
+++ b/chrome/browser/autofill/autofill_address_sheet_controller_mac.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h"
#include "app/l10n_util.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#import "chrome/browser/autofill/autofill_address_model_mac.h"
#import "chrome/browser/autofill/autofill_dialog_controller_mac.h"
@@ -18,7 +18,7 @@
- (id)initWithProfile:(const AutoFillProfile&)profile
mode:(AutoFillAddressMode)mode {
- NSString* nibPath = [mac_util::MainAppBundle()
+ NSString* nibPath = [base::mac::MainAppBundle()
pathForResource:@"AutoFillAddressSheet"
ofType:@"nib"];
self = [super initWithWindowNibPath:nibPath owner:self];
diff --git a/chrome/browser/autofill/autofill_common_test.cc b/chrome/browser/autofill/autofill_common_test.cc
index 050703c..6817dbb 100644
--- a/chrome/browser/autofill/autofill_common_test.cc
+++ b/chrome/browser/autofill/autofill_common_test.cc
@@ -55,6 +55,19 @@
check_and_set(profile, PHONE_FAX_WHOLE_NUMBER, fax);
}
+void SetProfileInfoWithGuid(AutoFillProfile* profile,
+ const char* guid, const char* first_name, const char* middle_name,
+ const char* last_name, const char* email, const char* company,
+ const char* address1, const char* address2, const char* city,
+ const char* state, const char* zipcode, const char* country,
+ const char* phone, const char* fax) {
+ if (guid)
+ profile->set_guid(guid);
+ SetProfileInfo(profile, NULL, first_name, middle_name, last_name, email,
+ company, address1, address2, city, state, zipcode, country,
+ phone, fax);
+}
+
void SetCreditCardInfo(CreditCard* credit_card,
const char* label, const char* name_on_card, const char* card_number,
const char* expiration_month, const char* expiration_year) {
diff --git a/chrome/browser/autofill/autofill_common_test.h b/chrome/browser/autofill/autofill_common_test.h
index dfb7ac6..fa5ca2c 100644
--- a/chrome/browser/autofill/autofill_common_test.h
+++ b/chrome/browser/autofill/autofill_common_test.h
@@ -34,6 +34,13 @@
const char* state, const char* zipcode, const char* country,
const char* phone, const char* fax);
+void SetProfileInfoWithGuid(AutoFillProfile* profile,
+ const char* guid, const char* first_name, const char* middle_name,
+ const char* last_name, const char* email, const char* company,
+ const char* address1, const char* address2, const char* city,
+ const char* state, const char* zipcode, const char* country,
+ const char* phone, const char* fax);
+
// A unit testing utility that is common to a number of the AutoFill unit
// tests. |SetCreditCardInfo| provides a quick way to populate a credit card
// with c-strings.
diff --git a/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.mm b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.mm
index 95eb140..ae72117 100644
--- a/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.mm
+++ b/chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/autofill/autofill_credit_card_sheet_controller_mac.h"
#include "app/l10n_util.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#import "chrome/browser/autofill/autofill_credit_card_model_mac.h"
#import "chrome/browser/autofill/autofill_dialog_controller_mac.h"
@@ -33,7 +33,7 @@
- (id)initWithCreditCard:(const CreditCard&)creditCard
mode:(AutoFillCreditCardMode)mode {
- NSString* nibPath = [mac_util::MainAppBundle()
+ NSString* nibPath = [base::mac::MainAppBundle()
pathForResource:@"AutoFillCreditCardSheet"
ofType:@"nib"];
self = [super initWithWindowNibPath:nibPath owner:self];
diff --git a/chrome/browser/autofill/autofill_dialog_controller_mac.mm b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
index 713c172..892160f 100644
--- a/chrome/browser/autofill/autofill_dialog_controller_mac.mm
+++ b/chrome/browser/autofill/autofill_dialog_controller_mac.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/lazy_instance.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#import "chrome/browser/autofill/autofill_address_model_mac.h"
#import "chrome/browser/autofill/autofill_address_sheet_controller_mac.h"
@@ -664,7 +664,7 @@
DCHECK(profile);
// Use initWithWindowNibPath: instead of initWithWindowNibName: so we
// can override it in a unit test.
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:@"AutoFillDialog"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/autofill/autofill_download.cc b/chrome/browser/autofill/autofill_download.cc
index 9e8504f..66d6459 100644
--- a/chrome/browser/autofill/autofill_download.cc
+++ b/chrome/browser/autofill/autofill_download.cc
@@ -194,12 +194,13 @@
return true;
}
-void AutoFillDownloadManager::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
+void AutoFillDownloadManager::OnURLFetchComplete(
+ const URLFetcher* source,
+ const GURL& url,
+ const net::URLRequestStatus& status,
+ int response_code,
+ const ResponseCookies& cookies,
+ const std::string& data) {
std::map<URLFetcher *, FormRequestData>::iterator it =
url_fetchers_.find(const_cast<URLFetcher*>(source));
if (it == url_fetchers_.end()) {
diff --git a/chrome/browser/autofill/autofill_download.h b/chrome/browser/autofill/autofill_download.h
index 2a8724c..01fda7f 100644
--- a/chrome/browser/autofill/autofill_download.h
+++ b/chrome/browser/autofill/autofill_download.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -113,7 +113,7 @@
// URLFetcher::Delegate implementation:
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc
index 2350607..05b7ade 100644
--- a/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc
+++ b/chrome/browser/autofill/autofill_ie_toolbar_import_win.cc
@@ -249,6 +249,9 @@
}
bool ImportAutofillDataWin(PersonalDataManager* pdm) {
+ // In incognito mode we do not have PDM - and we should not import anything.
+ if (!pdm)
+ return false;
AutoFillImporter *importer = new AutoFillImporter(pdm);
// importer will self delete.
return importer->ImportProfiles();
diff --git a/chrome/browser/autofill/autofill_resources.grd b/chrome/browser/autofill/autofill_resources.grd
new file mode 100644
index 0000000..90c2ec2
--- /dev/null
+++ b/chrome/browser/autofill/autofill_resources.grd
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grit latest_public_release="0" current_release="1">
+ <outputs>
+ <output filename="grit/autofill_resources.h" type="rc_header">
+ <emit emit_type='prepend'></emit>
+ </output>
+ <output filename="autofill_resources.pak" type="data_package" />
+ <output filename="autofill_resources.rc" type="rc_all" />
+ </outputs>
+ <release seq="1" allow_pseudo="false">
+ <messages fallback_to_english="true">
+ <message name="IDS_AUTOFILL_ADDRESS_LINE_1_RE">
+ address.?line|address1|addr1|street<!-- de-DE -->|strasse|straße|hausnummer|housenumber<!-- en-GB -->|house.?name<!-- es -->|direccion|dirección<!-- fr-FR -->|adresse<!-- it-IT -->|indirizzo<!-- ja-JP -->|住所1<!-- pt-BR, pt-PT -->|morada|endereço<!-- ru -->|Адрес<!-- zh-CN -->|地址
+ </message>
+ <message name="IDS_AUTOFILL_ADDRESS_LINE_1_LABEL_RE">
+ address<!-- fr-FR -->|adresse<!-- it-IT -->|indirizzo<!-- ja-JP -->|住所<!-- zh-CN -->|地址
+ </message>
+ <message name="IDS_AUTOFILL_ADDRESS_LINE_2_RE">
+ address.?line2|address2|addr2|street|suite|unit<!-- de-DE -->|adresszusatz|ergänzende.?angaben<!-- es -->|direccion2|colonia|adicional<!-- fr-FR -->|addresssuppl|complementnom|appartement<!-- it-IT -->|indirizzo2<!-- ja-JP -->|住所2<!-- pt-BR, pt-PT -->|complemento|addrcomplement<!-- ru -->|Улица<!-- zh-CN -->|地址2
+ </message>
+ <message name="IDS_AUTOFILL_ADDRESS_LINE_2_LABEL_RE">
+ address<!-- fr-FR -->|adresse<!-- it-IT -->|indirizzo<!-- zh-CN -->|地址
+ </message>
+ <message name="IDS_AUTOFILL_ADDRESS_LINE_3_RE">
+ address.?line3|address3|addr3|street|line3<!-- es -->|municipio<!-- fr-FR -->|batiment|residence<!-- it-IT -->|indirizzo3
+ </message>
+ <message name="IDS_AUTOFILL_COMPANY_RE">
+ company|business|organization|organisation|department<!-- de-DE -->|firma|firmenname<!-- es -->|empresa<!-- fr-FR -->|societe|société<!-- it-IT -->|ragione.?sociale<!-- ja-JP -->|会社<!-- ru -->|название.?компании<!-- zh-CN -->|单位|公司
+ </message>
+ <message name="IDS_AUTOFILL_ATTENTION_IGNORED_RE">
+ attention|attn
+ </message>
+ <message name="IDS_AUTOFILL_REGION_IGNORED_RE">
+ province|region|other<!-- es -->|provincia<!-- pt-BR, pt-PT -->|bairro|suburb
+ </message>
+ <message name="IDS_AUTOFILL_COUNTRY_RE">
+ country|location<!-- ja-JP -->|国<!-- zh-CN -->|国家
+ </message>
+ <message name="IDS_AUTOFILL_ZIP_CODE_RE">
+ zip|postal|post code|pcode|^1z$<!-- de-DE -->|postleitzahl<!-- es -->|cp<!-- fr-FR -->|cdp<!-- it-IT -->|cap<!-- ja-JP -->|郵便番号<!-- pt-BR, pt-PT -->|codigo|codpos|cep<!-- ru -->|Почтовый.?Индекс<!--zh-CN -->|邮政编码|邮编<!-- zh-TW -->|郵遞區號
+ </message>
+ <message name="IDS_AUTOFILL_ZIP_4_RE">
+ zip|^-$|post2<!-- pt-BR, pt-PT -->|codpos2
+ </message>
+ <message name="IDS_AUTOFILL_CITY_RE">
+ city|town<!-- de-DE -->|ort|stadt<!-- en-AU -->|suburb<!-- es -->|ciudad|provincia|localidad|poblacion<!-- fr-FR -->|ville|commune<!-- it-IT -->|localita<!-- ja-JP -->|市区町村<!-- pt-BR, pt-PT -->|cidade<!-- ru -->|Город<!-- zh-CN -->|市<!-- zh-TW -->|分區
+ </message>
+ <message name="IDS_AUTOFILL_STATE_RE">
+ state|county|region|province<!-- de-DE -->|land<!-- en-UK -->|county|principality<!-- ja-JP -->|都道府県<!-- pt-BR, pt-PT -->|estado|provincia<!-- ru -->|область<!-- zh-CN -->|省<!-- zh-TW -->|地區
+ </message>
+ <message name="IDS_AUTOFILL_ADDRESS_TYPE_SAME_AS_RE">
+ same as
+ </message>
+ <message name="IDS_AUTOFILL_ADDRESS_TYPE_USE_MY_RE">
+ use my
+ </message>
+ <message name="IDS_AUTOFILL_BILLING_DESIGNATOR_RE">
+ bill
+ </message>
+ <message name="IDS_AUTOFILL_SHIPPING_DESIGNATOR_RE">
+ ship
+ </message>
+ <message name="IDS_AUTOFILL_EMAIL_RE">
+ e.?mail<!-- ja-JP -->|メールアドレス<!-- ru -->|Электронной.?Почты<!-- zh-CN -->|邮件|邮箱<!-- zh-TW -->|電郵地址
+ </message>
+ <message name="IDS_AUTOFILL_NAME_ON_CARD_RE">
+ card.?holder|name.?on.?card|ccname|owner<!-- de-DE -->|name.?des.?karteninhabers<!-- zh-CN -->|信用卡开户名|开户名
+ </message>
+ <message name="IDS_AUTOFILL_NAME_ON_CARD_CONTEXTUAL_RE">
+ name
+ </message>
+ <message name="IDS_AUTOFILL_CARD_NUMBER_RE">
+ number|card.?#|card.?no|ccnum<!-- de-DE -->|kartennummer<!-- es -->|credito<!-- fr-FR -->|n.*de.*carte<!-- zh-CN -->|信用卡号
+ </message>
+ <message name="IDS_AUTOFILL_CARD_CVC_RE">
+ verification|card identification|cvn|security code|cvv code|cvc
+ </message>
+ <message name="IDS_AUTOFILL_EXPIRATION_MONTH_RE">
+ expir|exp.*month|exp.*date|ccmonth
+ </message>
+ <message name="IDS_AUTOFILL_EXPIRATION_DATE_RE">
+ exp|^/|year<!-- de-DE -->|ablaufdatum<!-- es -->|fecha.*de.*vencimiento
+ </message>
+ <message name="IDS_AUTOFILL_CARD_IGNORED_RE">
+ ^card
+ </message>
+ <message name="IDS_AUTOFILL_USERNAME_RE">
+ user.?name|user.?id<!-- de-DE -->|vollständiger.?name<!-- zh-CN -->|用户名
+ </message>
+ <message name="IDS_AUTOFILL_NAME_RE">
+ ^name|full.?name|your.?name|customer.?name|firstandlastname<!-- es -->|nombre.*y.*apellidos<!-- fr-FR -->|^nom<!-- ja-JP -->|お名前|氏名<!-- pt-BR, pt-PT -->|^nome<!-- zh-CN -->|姓名
+ </message>
+ <message name="IDS_AUTOFILL_NAME_SPECIFIC_RE">
+ ^name<!-- fr-FR -->|^nom<!-- pt-BR, pt-PT -->|^nome
+ </message>
+ <message name="IDS_AUTOFILL_FIRST_NAME_RE">
+ first.*name|initials|fname|first$<!-- de-DE -->|vorname<!-- es -->|nombre<!-- fr-FR -->|forename|prénom|prenom<!-- ja-JP -->|名<!-- pt-BR, pt-PT -->|nome<!-- ru -->|Имя
+ </message>
+ <message name="IDS_AUTOFILL_MIDDLE_INITIAL_RE">
+ middle.*initial|m\.i\.|mi$
+ </message>
+ <message name="IDS_AUTOFILL_MIDDLE_NAME_RE">
+ middle.*name|mname|middle$<!-- es -->|apellido.?materno|lastlastname
+ </message>
+ <message name="IDS_AUTOFILL_LAST_NAME_RE">
+ last.*name|lname|surname|last$<!-- de-DE -->|nachname<!-- es -->|apellidos<!-- fr-FR -->|famille|^nom<!-- it-IT -->|cognome<!-- ja-JP -->|姓<!-- pt-BR, pt-PT -->|morada|apelidos|surename|sobrenome<!-- ru -->|Фамилия
+ </message>
+ <message name="IDS_AUTOFILL_PHONE_RE">
+ phone<!-- de-DE -->|telefonnummer<!-- es -->|telefono|teléfono<!-- fr-FR -->|telfixe<!-- ja-JP -->|電話<!-- pt-BR, pt-PT -->|telefone|telemovel<!-- ru -->|телефон<!-- zh-CN -->|电话
+ </message>
+ <message name="IDS_AUTOFILL_AREA_CODE_RE">
+ area code
+ </message>
+ <message name="IDS_AUTOFILL_FAX_RE">
+ fax<!-- fr-FR -->|télécopie|telecopie<!-- ja-JP -->|ファックス<!-- ru -->|факс<!-- zh-CN -->|传真<!-- zh-TW -->|傳真
+ </message>
+ <message name="IDS_AUTOFILL_PHONE_PREFIX_RE">
+ ^-$|\)$|prefix<!-- fr-FR -->|preselection<!-- pt-BR, pt-PT -->|ddd
+ </message>
+ <message name="IDS_AUTOFILL_PHONE_SUFFIX_RE">
+ ^-$|suffix
+ </message>
+ <message name="IDS_AUTOFILL_PHONE_EXTENSION_RE">
+ ext<!-- pt-BR, pt-PT -->|ramal
+ </message>
+ </messages>
+ </release>
+</grit>
+
diff --git a/chrome/browser/autofill/credit_card.cc b/chrome/browser/autofill/credit_card.cc
index 5f81c7b..a24c629 100644
--- a/chrome/browser/autofill/credit_card.cc
+++ b/chrome/browser/autofill/credit_card.cc
@@ -31,18 +31,6 @@
const int kAutoFillCreditCardLength = arraysize(kAutoFillCreditCardTypes);
-// These values must match the values in WebKitClientImpl in webkit/glue. We
-// send these strings to WK, which then asks WebKitClientImpl to load the image
-// data.
-const char* const kAmericanExpressCard = "americanExpressCC";
-const char* const kDinersCard = "dinersCC";
-const char* const kDiscoverCard = "discoverCC";
-const char* const kGenericCard = "genericCC";
-const char* const kJCBCard = "jcbCC";
-const char* const kMasterCard = "masterCardCC";
-const char* const kSoloCard = "soloCC";
-const char* const kVisaCard = "visaCC";
-
std::string GetCreditCardType(const string16& number) {
// Credit card number specifications taken from:
// http://en.wikipedia.org/wiki/Credit_card_numbers and
@@ -651,3 +639,15 @@
<< UTF16ToUTF8(credit_card.GetFieldText(
AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)));
}
+
+// These values must match the values in WebKitClientImpl in webkit/glue. We
+// send these strings to WK, which then asks WebKitClientImpl to load the image
+// data.
+const char* const kAmericanExpressCard = "americanExpressCC";
+const char* const kDinersCard = "dinersCC";
+const char* const kDiscoverCard = "discoverCC";
+const char* const kGenericCard = "genericCC";
+const char* const kJCBCard = "jcbCC";
+const char* const kMasterCard = "masterCardCC";
+const char* const kSoloCard = "soloCC";
+const char* const kVisaCard = "visaCC";
diff --git a/chrome/browser/autofill/credit_card.h b/chrome/browser/autofill/credit_card.h
index ebb3161..2b2d089 100644
--- a/chrome/browser/autofill/credit_card.h
+++ b/chrome/browser/autofill/credit_card.h
@@ -152,4 +152,14 @@
// So we can compare CreditCards with EXPECT_EQ().
std::ostream& operator<<(std::ostream& os, const CreditCard& credit_card);
+// The string identifiers for credit card icon resources.
+extern const char* const kAmericanExpressCard;
+extern const char* const kDinersCard;
+extern const char* const kDiscoverCard;
+extern const char* const kGenericCard;
+extern const char* const kJCBCard;
+extern const char* const kMasterCard;
+extern const char* const kSoloCard;
+extern const char* const kVisaCard;
+
#endif // CHROME_BROWSER_AUTOFILL_CREDIT_CARD_H_
diff --git a/chrome/browser/autofill/credit_card_field.cc b/chrome/browser/autofill/credit_card_field.cc
index fe3031f..6cbe986 100644
--- a/chrome/browser/autofill/credit_card_field.cc
+++ b/chrome/browser/autofill/credit_card_field.cc
@@ -4,13 +4,18 @@
#include "chrome/browser/autofill/credit_card_field.h"
+<<<<<<< HEAD
#ifdef ANDROID
#include "app/l10n_util.h"
#endif
+=======
+#include "app/l10n_util.h"
+>>>>>>> chromium.org at r10.0.634.0
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_field.h"
+#include "grit/autofill_resources.h"
bool CreditCardField::GetFieldInfo(FieldTypeMap* field_type_map) const {
bool ok = Add(field_type_map, number_, AutoFillType(CREDIT_CARD_NUMBER));
diff --git a/chrome/browser/autofill/fax_field.cc b/chrome/browser/autofill/fax_field.cc
index 80e25cb..8475730 100644
--- a/chrome/browser/autofill/fax_field.cc
+++ b/chrome/browser/autofill/fax_field.cc
@@ -4,18 +4,23 @@
#include "chrome/browser/autofill/fax_field.h"
+#include "app/l10n_util.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_field.h"
+#include "grit/autofill_resources.h"
// static
FaxField* FaxField::Parse(std::vector<AutoFillField*>::const_iterator* iter) {
DCHECK(iter);
scoped_ptr<FaxField> fax_field(new FaxField);
- if (ParseText(iter, ASCIIToUTF16("fax"), &fax_field->number_))
+ if (ParseText(iter,
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_FAX_RE),
+ &fax_field->number_)) {
return fax_field.release();
+ }
return NULL;
}
diff --git a/chrome/browser/autofill/form_field.cc b/chrome/browser/autofill/form_field.cc
index 411f2db..902d2d8 100644
--- a/chrome/browser/autofill/form_field.cc
+++ b/chrome/browser/autofill/form_field.cc
@@ -4,9 +4,13 @@
#include "chrome/browser/autofill/form_field.h"
+<<<<<<< HEAD
#ifdef ANDROID
#include "app/l10n_util.h"
#endif
+=======
+#include "app/l10n_util.h"
+>>>>>>> chromium.org at r10.0.634.0
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/address_field.h"
@@ -17,6 +21,7 @@
#include "chrome/browser/autofill/phone_field.h"
#include "third_party/WebKit/WebKit/chromium/public/WebRegularExpression.h"
#include "third_party/WebKit/WebKit/chromium/public/WebString.h"
+#include "grit/autofill_resources.h"
// Field names from the ECML specification; see RFC 3106. We've
// made these names lowercase since we convert labels and field names to
diff --git a/chrome/browser/autofill/form_structure_browsertest.cc b/chrome/browser/autofill/form_structure_browsertest.cc
index ae38f7d..f6bda60 100644
--- a/chrome/browser/autofill/form_structure_browsertest.cc
+++ b/chrome/browser/autofill/form_structure_browsertest.cc
@@ -47,19 +47,13 @@
return std::string("data:text/html;charset=utf-8,") + html;
}
-// Compare |output_file_source| with |form_string|. Returns true when they are
-// identical.
-bool CompareText(const std::string& output_file_source,
- const std::string& form_string) {
- std::string output_file = output_file_source;
- std::string form = form_string;
-
- ReplaceSubstringsAfterOffset(&output_file, 0, "\r\n", " ");
- ReplaceSubstringsAfterOffset(&output_file, 0, "\r", " ");
- ReplaceSubstringsAfterOffset(&output_file, 0, "\n", " ");
- ReplaceSubstringsAfterOffset(&form, 0, "\n", " ");
-
- return (output_file == form);
+// Convert strings with platform end-of-line characters with spaces.
+const std::string NormalizeText(const std::string& text) {
+ std::string normalized = text;
+ ReplaceSubstringsAfterOffset(&normalized, 0, "\r\n", " ");
+ ReplaceSubstringsAfterOffset(&normalized, 0, "\r", " ");
+ ReplaceSubstringsAfterOffset(&normalized, 0, "\n", " ");
+ return normalized;
}
} // namespace
@@ -253,9 +247,9 @@
std::string output_file_source;
if (file_util::ReadFileToString(output_file_path, &output_file_source)) {
- ASSERT_TRUE(CompareText(
- output_file_source,
- FormStructureBrowserTest::FormStructuresToString(forms)));
+ ASSERT_EQ(NormalizeText(output_file_source),
+ NormalizeText(
+ FormStructureBrowserTest::FormStructuresToString(forms)));
} else {
ASSERT_TRUE(WriteFile(
diff --git a/chrome/browser/autofill/name_field.cc b/chrome/browser/autofill/name_field.cc
index ee7620c..1a5f4c3 100644
--- a/chrome/browser/autofill/name_field.cc
+++ b/chrome/browser/autofill/name_field.cc
@@ -4,14 +4,19 @@
#include "chrome/browser/autofill/name_field.h"
+<<<<<<< HEAD
#ifdef ANDROID
#include "app/l10n_util.h"
#endif
+=======
+#include "app/l10n_util.h"
+>>>>>>> chromium.org at r10.0.634.0
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_type.h"
+#include "grit/autofill_resources.h"
NameField* NameField::Parse(std::vector<AutoFillField*>::const_iterator* iter,
bool is_ecml) {
diff --git a/chrome/browser/autofill/phone_field.cc b/chrome/browser/autofill/phone_field.cc
index 62c21e1..61ce7bb 100644
--- a/chrome/browser/autofill/phone_field.cc
+++ b/chrome/browser/autofill/phone_field.cc
@@ -4,15 +4,20 @@
#include "chrome/browser/autofill/phone_field.h"
+<<<<<<< HEAD
#ifdef ANDROID
#include "app/l10n_util.h"
#endif
+=======
+#include "app/l10n_util.h"
+>>>>>>> chromium.org at r10.0.634.0
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autofill/autofill_field.h"
+#include "grit/autofill_resources.h"
// static
PhoneField* PhoneField::Parse(std::vector<AutoFillField*>::const_iterator* iter,
diff --git a/chrome/browser/automation/automation_provider.cc b/chrome/browser/automation/automation_provider.cc
index b782c2c..0c15995 100644
--- a/chrome/browser/automation/automation_provider.cc
+++ b/chrome/browser/automation/automation_provider.cc
@@ -19,11 +19,11 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autofill/autofill_manager.h"
#include "chrome/browser/automation/automation_autocomplete_edit_tracker.h"
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index 1b6973d..7703765 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -15,7 +15,7 @@
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/automation/automation_provider.h"
diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc
index 5d3ac14..5fce672 100644
--- a/chrome/browser/automation/automation_resource_message_filter.cc
+++ b/chrome/browser/automation/automation_resource_message_filter.cc
@@ -417,7 +417,7 @@
void AutomationResourceMessageFilter::OnGetFilteredInetHitCount(
int* hit_count) {
- *hit_count = URLRequestFilter::GetInstance()->hit_count();
+ *hit_count = net::URLRequestFilter::GetInstance()->hit_count();
}
void AutomationResourceMessageFilter::OnRecordHistograms(
diff --git a/chrome/browser/automation/automation_resource_message_filter.h b/chrome/browser/automation/automation_resource_message_filter.h
index 82081ec..89357e6 100644
--- a/chrome/browser/automation/automation_resource_message_filter.h
+++ b/chrome/browser/automation/automation_resource_message_filter.h
@@ -11,7 +11,6 @@
#include "base/atomicops.h"
#include "base/lazy_instance.h"
#include "base/lock.h"
-#include "base/platform_thread.h"
#include "ipc/ipc_channel_proxy.h"
#include "net/base/completion_callback.h"
#include "net/base/cookie_store.h"
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
index 103225b..d25c07c 100644
--- a/chrome/browser/automation/testing_automation_provider.cc
+++ b/chrome/browser/automation/testing_automation_provider.cc
@@ -13,7 +13,7 @@
#include "base/process.h"
#include "base/process_util.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
diff --git a/chrome/browser/automation/ui_controls_win.cc b/chrome/browser/automation/ui_controls_win.cc
index 25469ad..b03c97b 100644
--- a/chrome/browser/automation/ui_controls_win.cc
+++ b/chrome/browser/automation/ui_controls_win.cc
@@ -8,7 +8,6 @@
#include "app/keyboard_codes.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/win_util.h"
#include "base/ref_counted.h"
#include "base/task.h"
#include "views/view.h"
diff --git a/chrome/browser/automation/url_request_automation_job.h b/chrome/browser/automation/url_request_automation_job.h
index 9256a77..f1e1aa1 100644
--- a/chrome/browser/automation/url_request_automation_job.h
+++ b/chrome/browser/automation/url_request_automation_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
// This class simulates what wininet does when a dns lookup fails.
@@ -83,7 +83,7 @@
// IPC message handlers.
void OnRequestStarted(int id, const AutomationURLResponse& response);
void OnDataAvailable(int id, const std::string& bytes);
- void OnRequestEnd(int id, const URLRequestStatus& status);
+ void OnRequestEnd(int id, const net::URLRequestStatus& status);
private:
virtual ~URLRequestAutomationJob();
diff --git a/chrome/browser/background_mode_manager.cc b/chrome/browser/background_mode_manager.cc
index 74c0df6..3af5779 100644
--- a/chrome/browser/background_mode_manager.cc
+++ b/chrome/browser/background_mode_manager.cc
@@ -364,16 +364,14 @@
const CommandLine* command_line) {
// Background mode is disabled if the appropriate flag is passed, or if
- // extensions are disabled.
+ // extensions are disabled. It's always disabled on chromeos since chrome
+ // is always running on that platform, making it superfluous.
+#if defined(OS_CHROMEOS)
+ return false;
+#else
bool background_mode_enabled =
!command_line->HasSwitch(switches::kDisableBackgroundMode) &&
!command_line->HasSwitch(switches::kDisableExtensions);
-#if !(defined(OS_WIN) || defined(OS_MACOSX))
- // BackgroundMode is enabled by default on windows and mac. On other
- // platforms, it is enabled via about:flags.
- background_mode_enabled = background_mode_enabled &&
- command_line->HasSwitch(switches::kEnableBackgroundMode);
-#endif
-
return background_mode_enabled;
+#endif
}
diff --git a/chrome/browser/background_mode_manager_mac.mm b/chrome/browser/background_mode_manager_mac.mm
index cc6ab4b..40b958d 100644
--- a/chrome/browser/background_mode_manager_mac.mm
+++ b/chrome/browser/background_mode_manager_mac.mm
@@ -4,7 +4,7 @@
#include "app/l10n_util.h"
#include "base/command_line.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/browser/background_mode_manager.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/common/app_mode_common_mac.h"
@@ -40,18 +40,18 @@
// Check if Chrome is not a login Item, or is a Login Item but w/o 'hidden'
// flag - most likely user has modified the setting, don't override it.
bool is_hidden = false;
- if (!mac_util::CheckLoginItemStatus(&is_hidden) || !is_hidden)
+ if (!base::mac::CheckLoginItemStatus(&is_hidden) || !is_hidden)
return;
- mac_util::RemoveFromLoginItems();
+ base::mac::RemoveFromLoginItems();
}
void EnableLaunchOnStartupTask::Run() {
// Return if Chrome is already a Login Item (avoid overriding user choice).
- if (mac_util::CheckLoginItemStatus(NULL))
+ if (base::mac::CheckLoginItemStatus(NULL))
return;
- mac_util::AddToLoginItems(true); // Hide on startup.
+ base::mac::AddToLoginItems(true); // Hide on startup.
CFPreferencesSetAppValue(kLaunchOnStartupResetAllowedPrefsKey,
kCFBooleanTrue,
app_mode::kAppPrefsID);
diff --git a/chrome/browser/background_mode_manager_unittest.cc b/chrome/browser/background_mode_manager_unittest.cc
index 989c72d..d47d8e0 100644
--- a/chrome/browser/background_mode_manager_unittest.cc
+++ b/chrome/browser/background_mode_manager_unittest.cc
@@ -21,7 +21,6 @@
~BackgroundModeManagerTest() {}
void SetUp() {
command_line_.reset(new CommandLine(CommandLine::NO_PROGRAM));
- command_line_->AppendSwitch(switches::kEnableBackgroundMode);
}
scoped_ptr<CommandLine> command_line_;
};
diff --git a/chrome/browser/bookmarks/bookmark_model.cc b/chrome/browser/bookmarks/bookmark_model.cc
index 848527a..9a58709 100644
--- a/chrome/browser/bookmarks/bookmark_model.cc
+++ b/chrome/browser/bookmarks/bookmark_model.cc
@@ -102,9 +102,8 @@
// Types are the same, compare the names.
if (!collator_)
return n1->GetTitle() < n2->GetTitle();
- return l10n_util::CompareStringWithCollator(collator_,
- UTF16ToWideHack(n1->GetTitle()), UTF16ToWideHack(n2->GetTitle())) ==
- UCOL_LESS;
+ return l10n_util::CompareString16WithCollator(
+ collator_, n1->GetTitle(), n2->GetTitle()) == UCOL_LESS;
}
// Types differ, sort such that folders come first.
return n1->is_folder();
diff --git a/chrome/browser/bookmarks/bookmark_model.h b/chrome/browser/bookmarks/bookmark_model.h
index 09a3cff..3155103 100644
--- a/chrome/browser/bookmarks/bookmark_model.h
+++ b/chrome/browser/bookmarks/bookmark_model.h
@@ -15,7 +15,7 @@
#include "base/lock.h"
#include "base/observer_list.h"
#include "base/string16.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/bookmarks/bookmark_model_observer.h"
#include "chrome/browser/bookmarks/bookmark_service.h"
#include "chrome/browser/cancelable_request.h"
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 715f460..3de80ac 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -16,13 +16,12 @@
#include "base/metrics/histogram.h"
#include "base/metrics/stats_table.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/singleton.h"
#include "base/stringprintf.h"
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/tracked_objects.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/about_flags.h"
@@ -851,7 +850,9 @@
child_data->Append(child);
BindProcessMetrics(child, info);
- std::string child_label(ChildProcessInfo::GetTypeNameInEnglish(info->type));
+ std::string child_label(
+ ChildProcessInfo::GetFullTypeNameInEnglish(info->type,
+ info->renderer_type));
if (info->is_diagnostics)
child_label.append(" (diagnostics)");
child->SetString("child_name", child_label);
@@ -1078,14 +1079,8 @@
if (chrome_about_handler::WillHandle(*url))
return false;
- // Anything else requires our special handler, make sure its initialized.
- // We only need to register the AboutSource once and it is kept globally.
- // There is currently no way to remove a data source.
- static bool initialized = false;
- if (!initialized) {
- about_source = new AboutSource();
- initialized = true;
- }
+ // Anything else requires our special handler; make sure it's initialized.
+ InitializeAboutDataSource();
// Special case about:memory to go through a redirect before ending up on
// the final page. See GetAboutMemoryRedirectResponse above for why.
@@ -1103,6 +1098,16 @@
return true;
}
+void InitializeAboutDataSource() {
+ // We only need to register the AboutSource once and it is kept globally.
+ // There is currently no way to remove a data source.
+ static bool initialized = false;
+ if (!initialized) {
+ about_source = new AboutSource();
+ initialized = true;
+ }
+}
+
// This function gets called with the fixed-up chrome: URLs, so we have to
// compare against those instead of "about:blah".
bool HandleNonNavigationAboutURL(const GURL& url) {
diff --git a/chrome/browser/browser_about_handler.h b/chrome/browser/browser_about_handler.h
index e0a0dbf..46ae100 100644
--- a/chrome/browser/browser_about_handler.h
+++ b/chrome/browser/browser_about_handler.h
@@ -26,6 +26,10 @@
// This is used by BrowserURLHandler.
bool WillHandleBrowserAboutURL(GURL* url, Profile* profile);
+// Register the data source for chrome://about URLs.
+// Safe to call multiple times.
+void InitializeAboutDataSource();
+
// We have a few magic commands that don't cause navigations, but rather pop up
// dialogs. This function handles those cases, and returns true if so. In this
// case, normal tab navigation should be skipped.
diff --git a/chrome/browser/browser_browsertest.cc b/chrome/browser/browser_browsertest.cc
index ae52bac..b286711 100644
--- a/chrome/browser/browser_browsertest.cc
+++ b/chrome/browser/browser_browsertest.cc
@@ -65,14 +65,18 @@
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
// On Mac or ChromeOS, we don't want to suffix the page title with
// the application name.
- if (page_title.empty())
- return l10n_util::GetString(IDS_BROWSER_WINDOW_MAC_TAB_UNTITLED);
+ if (page_title.empty()) {
+ return UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_BROWSER_WINDOW_MAC_TAB_UNTITLED));
+ }
return page_title;
#else
if (page_title.empty())
- return l10n_util::GetString(IDS_PRODUCT_NAME);
+ return UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
- return l10n_util::GetStringF(IDS_BROWSER_WINDOW_TITLE_FORMAT, page_title);
+ return UTF16ToWideHack(
+ l10n_util::GetStringFUTF16(IDS_BROWSER_WINDOW_TITLE_FORMAT,
+ WideToUTF16Hack(page_title)));
#endif
}
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc
index 0be8a42..b8dc0e7 100644
--- a/chrome/browser/browser_focus_uitest.cc
+++ b/chrome/browser/browser_focus_uitest.cc
@@ -196,7 +196,8 @@
ASSERT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
}
-IN_PROC_BROWSER_TEST_F(BrowserFocusTest, BrowsersRememberFocus) {
+// Flaky, http://crbug.com/69034.
+IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FLAKY_BrowsersRememberFocus) {
ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
ASSERT_TRUE(test_server()->Start());
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index 030e1ee..6b12dfc 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -21,14 +21,14 @@
#include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/process_util.h"
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -129,7 +129,7 @@
#include <shellapi.h>
#include "app/l10n_util_win.h"
-#include "app/win_util.h"
+#include "app/win/scoped_com_initializer.h"
#include "chrome/browser/browser_trial.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/url_fixer_upper.h"
@@ -480,7 +480,7 @@
void BrowserMainParts::InitializeMainThread() {
const char* kThreadName = "CrBrowserMain";
- PlatformThread::SetName(kThreadName);
+ base::PlatformThread::SetName(kThreadName);
main_message_loop().set_thread_name(kThreadName);
// Register the main thread by instantiating it, but don't call any methods.
@@ -1315,8 +1315,8 @@
case ProcessSingleton::PROCESS_NOTIFIED:
#if defined(OS_POSIX) && !defined(OS_MACOSX)
- printf("%s\n", base::SysWideToNativeMB(
- l10n_util::GetString(IDS_USED_EXISTING_BROWSER)).c_str());
+ printf("%s\n", base::SysWideToNativeMB(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_USED_EXISTING_BROWSER))).c_str());
#endif
return ResultCodes::NORMAL_EXIT;
@@ -1487,7 +1487,7 @@
preconnect_enabled);
#if defined(OS_WIN)
- win_util::ScopedCOMInitializer com_initializer;
+ app::win::ScopedCOMInitializer com_initializer;
#if defined(GOOGLE_CHROME_BUILD)
// Init the RLZ library. This just binds the dll and schedules a task on the
diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm
index 619be2d..fa88bc8 100644
--- a/chrome/browser/browser_main_mac.mm
+++ b/chrome/browser/browser_main_mac.mm
@@ -12,7 +12,7 @@
#include "base/command_line.h"
#include "base/debug/debugger.h"
#include "base/file_path.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/nss_util.h"
#include "base/path_service.h"
#include "base/scoped_nsobject.h"
@@ -70,7 +70,7 @@
virtual void PreEarlyInitialization() {
BrowserMainPartsPosix::PreEarlyInitialization();
- if (mac_util::WasLaunchedAsHiddenLoginItem()) {
+ if (base::mac::WasLaunchedAsHiddenLoginItem()) {
CommandLine* singleton_command_line = CommandLine::ForCurrentProcess();
singleton_command_line->AppendSwitch(switches::kNoStartupWindow);
}
@@ -113,7 +113,7 @@
// Now load the nib (from the right bundle).
scoped_nsobject<NSNib>
nib([[NSNib alloc] initWithNibNamed:@"MainMenu"
- bundle:mac_util::MainAppBundle()]);
+ bundle:base::mac::MainAppBundle()]);
// TODO(viettrungluu): crbug.com/20504 - This currently leaks, so if you
// change this, you'll probably need to change the Valgrind suppression.
[nib instantiateNibWithOwner:NSApp topLevelObjects:nil];
diff --git a/chrome/browser/browser_main_posix.cc b/chrome/browser/browser_main_posix.cc
index 9736c66..02319c7 100644
--- a/chrome/browser/browser_main_posix.cc
+++ b/chrome/browser/browser_main_posix.cc
@@ -12,6 +12,7 @@
#include "base/eintr_wrapper.h"
#include "base/logging.h"
#include "base/string_number_conversions.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/common/chrome_switches.h"
@@ -70,7 +71,7 @@
GracefulShutdownHandler(signal);
}
-class ShutdownDetector : public PlatformThread::Delegate {
+class ShutdownDetector : public base::PlatformThread::Delegate {
public:
explicit ShutdownDetector(int shutdown_fd);
@@ -88,7 +89,7 @@
}
void ShutdownDetector::ThreadMain() {
- PlatformThread::SetName("CrShutdownDetector");
+ base::PlatformThread::SetName("CrShutdownDetector");
int signal;
size_t bytes_read = 0;
@@ -211,9 +212,9 @@
const size_t kShutdownDetectorThreadStackSize = 4096;
// TODO(viettrungluu,willchan): crbug.com/29675 - This currently leaks, so
// if you change this, you'll probably need to change the suppression.
- if (!PlatformThread::CreateNonJoinable(
- kShutdownDetectorThreadStackSize,
- new ShutdownDetector(g_shutdown_pipe_read_fd))) {
+ if (!base::PlatformThread::CreateNonJoinable(
+ kShutdownDetectorThreadStackSize,
+ new ShutdownDetector(g_shutdown_pipe_read_fd))) {
LOG(DFATAL) << "Failed to create shutdown detector task.";
}
}
diff --git a/chrome/browser/browser_main_win.cc b/chrome/browser/browser_main_win.cc
index bd5573a..2c763c7 100644
--- a/chrome/browser/browser_main_win.cc
+++ b/chrome/browser/browser_main_win.cc
@@ -12,7 +12,7 @@
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/i18n/rtl.h"
@@ -54,10 +54,10 @@
void WarnAboutMinimumSystemRequirements() {
if (base::win::GetVersion() < base::win::VERSION_XP) {
// Display a warning message if the user is running chrome on Windows 2000.
- const std::wstring text =
- l10n_util::GetString(IDS_UNSUPPORTED_OS_PRE_WIN_XP);
- const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
- win_util::MessageBox(NULL, text, caption,
+ const string16 text =
+ l10n_util::GetStringUTF16(IDS_UNSUPPORTED_OS_PRE_WIN_XP);
+ const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
+ app::win::MessageBox(NULL, text, caption,
MB_OK | MB_ICONWARNING | MB_TOPMOST);
}
}
@@ -72,10 +72,10 @@
}
void ShowCloseBrowserFirstMessageBox() {
- const std::wstring text = l10n_util::GetString(IDS_UNINSTALL_CLOSE_APP);
- const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
+ const string16 text = l10n_util::GetStringUTF16(IDS_UNINSTALL_CLOSE_APP);
+ const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
const UINT flags = MB_OK | MB_ICONWARNING | MB_TOPMOST;
- win_util::MessageBox(NULL, text, caption, flags);
+ app::win::MessageBox(NULL, text, caption, flags);
}
int DoUninstallTasks(bool chrome_still_running) {
@@ -153,7 +153,7 @@
// functionality so we just ask the users if they want to uninstall Chrome.
int HandleIconsCommands(const CommandLine &parsed_command_line) {
if (parsed_command_line.HasSwitch(switches::kHideIcons)) {
- std::wstring cp_applet;
+ string16 cp_applet;
base::win::Version version = base::win::GetVersion();
if (version >= base::win::VERSION_VISTA) {
cp_applet.assign(L"Programs and Features"); // Windows Vista and later.
@@ -163,11 +163,11 @@
return ResultCodes::UNSUPPORTED_PARAM; // Not supported
}
- const std::wstring msg = l10n_util::GetStringF(IDS_HIDE_ICONS_NOT_SUPPORTED,
- cp_applet);
- const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
+ const string16 msg =
+ l10n_util::GetStringFUTF16(IDS_HIDE_ICONS_NOT_SUPPORTED, cp_applet);
+ const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
const UINT flags = MB_OKCANCEL | MB_ICONWARNING | MB_TOPMOST;
- if (IDOK == win_util::MessageBox(NULL, msg, caption, flags))
+ if (IDOK == app::win::MessageBox(NULL, msg, caption, flags))
ShellExecute(NULL, NULL, L"appwiz.cpl", NULL, NULL, SW_SHOWNORMAL);
return ResultCodes::NORMAL_EXIT; // Exit as we are not launching browser.
}
@@ -190,11 +190,11 @@
std::wstring exe = exe_path.value();
FilePath user_exe_path(installer::GetChromeInstallPath(false, dist));
if (FilePath::CompareEqualIgnoreCase(exe, user_exe_path.value())) {
- const std::wstring text =
- l10n_util::GetString(IDS_MACHINE_LEVEL_INSTALL_CONFLICT);
- const std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
+ const string16 text =
+ l10n_util::GetStringUTF16(IDS_MACHINE_LEVEL_INSTALL_CONFLICT);
+ const string16 caption = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
const UINT flags = MB_OK | MB_ICONERROR | MB_TOPMOST;
- win_util::MessageBox(NULL, text, caption, flags);
+ app::win::MessageBox(NULL, text, caption, flags);
FilePath uninstall_path(InstallUtil::GetChromeUninstallCmd(false, dist));
CommandLine uninstall_cmd(uninstall_path);
if (!uninstall_cmd.GetProgram().value().empty()) {
diff --git a/chrome/browser/browser_process.h b/chrome/browser/browser_process.h
index b9510a8..409771a 100644
--- a/chrome/browser/browser_process.h
+++ b/chrome/browser/browser_process.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -50,6 +50,10 @@
class PrintPreviewTabController;
}
+namespace policy {
+class ConfigurationPolicyProviderKeeper;
+}
+
// NOT THREAD SAFE, call only from the main thread.
// These functions shouldn't return NULL unless otherwise noted.
class BrowserProcess {
@@ -107,6 +111,9 @@
virtual base::Thread* background_x11_thread() = 0;
#endif
+ virtual policy::ConfigurationPolicyProviderKeeper*
+ configuration_policy_provider_keeper() = 0;
+
virtual IconManager* icon_manager() = 0;
virtual ThumbnailGenerator* GetThumbnailGenerator() = 0;
diff --git a/chrome/browser/browser_process_impl.cc b/chrome/browser/browser_process_impl.cc
index d60b672..222ee28 100644
--- a/chrome/browser/browser_process_impl.cc
+++ b/chrome/browser/browser_process_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,9 +12,9 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/task.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/appcache/chrome_appcache_service.h"
#include "chrome/browser/automation/automation_provider_list.h"
#include "chrome/browser/browser_child_process_host.h"
@@ -40,6 +40,7 @@
#include "chrome/browser/plugin_data_remover.h"
#include "chrome/browser/plugin_service.h"
#include "chrome/browser/plugin_updater.h"
+#include "chrome/browser/policy/configuration_policy_provider_keeper.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/print_preview_tab_controller.h"
@@ -100,6 +101,7 @@
created_debugger_wrapper_(false),
created_devtools_manager_(false),
created_sidebar_manager_(false),
+ created_configuration_policy_provider_keeper_(false),
created_notification_ui_manager_(false),
created_safe_browsing_detection_service_(false),
module_ref_count_(0),
@@ -175,6 +177,10 @@
resource_dispatcher_host()->Shutdown();
}
+ // The policy providers managed by |configuration_policy_provider_keeper_|
+ // need to shut down while the file thread is still alive.
+ configuration_policy_provider_keeper_.reset();
+
#if defined(USE_X11)
// The IO thread must outlive the BACKGROUND_X11 thread.
background_x11_thread_.reset();
@@ -414,6 +420,18 @@
return notification_ui_manager_.get();
}
+policy::ConfigurationPolicyProviderKeeper*
+ BrowserProcessImpl::configuration_policy_provider_keeper() {
+ DCHECK(CalledOnValidThread());
+ if (!created_configuration_policy_provider_keeper_) {
+ DCHECK(configuration_policy_provider_keeper_.get() == NULL);
+ created_configuration_policy_provider_keeper_ = true;
+ configuration_policy_provider_keeper_.reset(
+ new policy::ConfigurationPolicyProviderKeeper());
+ }
+ return configuration_policy_provider_keeper_.get();
+}
+
IconManager* BrowserProcessImpl::icon_manager() {
DCHECK(CalledOnValidThread());
if (!created_icon_manager_)
@@ -752,7 +770,8 @@
void BrowserProcessImpl::CreateNotificationUIManager() {
DCHECK(notification_ui_manager_.get() == NULL);
- notification_ui_manager_.reset(NotificationUIManager::Create());
+ notification_ui_manager_.reset(NotificationUIManager::Create(local_state()));
+
created_notification_ui_manager_ = true;
}
diff --git a/chrome/browser/browser_process_impl.h b/chrome/browser/browser_process_impl.h
index c763d31..8ec6f81 100644
--- a/chrome/browser/browser_process_impl.h
+++ b/chrome/browser/browser_process_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -15,7 +15,7 @@
#include "base/basictypes.h"
#include "base/message_loop.h"
-#include "base/non_thread_safe.h"
+#include "base/threading/non_thread_safe.h"
#include "base/timer.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/browser_process.h"
@@ -36,7 +36,7 @@
// Real implementation of BrowserProcess that creates and returns the services.
class BrowserProcessImpl : public BrowserProcess,
- public NonThreadSafe,
+ public base::NonThreadSafe,
public NotificationObserver {
public:
explicit BrowserProcessImpl(const CommandLine& command_line);
@@ -61,6 +61,8 @@
virtual SidebarManager* sidebar_manager();
virtual Clipboard* clipboard();
virtual NotificationUIManager* notification_ui_manager();
+ virtual policy::ConfigurationPolicyProviderKeeper*
+ configuration_policy_provider_keeper();
virtual IconManager* icon_manager();
virtual ThumbnailGenerator* GetThumbnailGenerator();
virtual AutomationProviderList* InitAutomationProviderList();
@@ -179,6 +181,10 @@
bool created_sidebar_manager_;
scoped_refptr<SidebarManager> sidebar_manager_;
+ bool created_configuration_policy_provider_keeper_;
+ scoped_ptr<policy::ConfigurationPolicyProviderKeeper>
+ configuration_policy_provider_keeper_;
+
scoped_refptr<printing::PrintPreviewTabController>
print_preview_tab_controller_;
diff --git a/chrome/browser/browser_resources.grd b/chrome/browser/browser_resources.grd
index af317b1..3d03dbf 100644
--- a/chrome/browser/browser_resources.grd
+++ b/chrome/browser/browser_resources.grd
@@ -61,12 +61,15 @@
<include name="IDR_SSL_ERROR_HTML" file="security\resources\ssl_error.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_SSL_ROAD_BLOCK_HTML" file="security\resources\ssl_roadblock.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_SYNC_CONFIGURE_HTML" file="sync\resources\configure.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_SYNC_ENCRYPTION_LOGIN_HTML" file="sync\resources\encryption_login.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_SYNC_PASSPHRASE_HTML" file="sync\resources\passphrase.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_SYNC_FIRST_PASSPHRASE_HTML" file="sync\resources\firstpassphrase.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_SYNC_SETTING_UP_HTML" file="sync\resources\setting_up.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_SYNC_SETUP_DONE_HTML" file="sync\resources\setup_done.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_SYNC_SETUP_FLOW_HTML" file="sync\resources\setup_flow.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_REMOTING_SETUP_FLOW_HTML" file="remoting\resources\remoting_setup_flow.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_REMOTING_SETUP_DONE_HTML" file="remoting\resources\remoting_setup_done.html" flattenhtml="true" type="BINDATA" />
+ <include name="IDR_REMOTING_SETUP_ERROR_HTML" file="remoting\resources\remoting_setup_error.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_CLOUD_PRINT_SETUP_FLOW_HTML" file="printing\cloud_print\resources\cloud_print_setup_flow.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_CLOUD_PRINT_SETUP_LOGIN_HTML" file="printing\cloud_print\resources\cloud_print_setup_login.html" flattenhtml="true" type="BINDATA" />
<include name="IDR_CLOUD_PRINT_SETUP_DONE_HTML" file="printing\cloud_print\resources\cloud_print_setup_done.html" flattenhtml="true" type="BINDATA" />
diff --git a/chrome/browser/browser_shutdown.cc b/chrome/browser/browser_shutdown.cc
index a312523..72c0350 100644
--- a/chrome/browser/browser_shutdown.cc
+++ b/chrome/browser/browser_shutdown.cc
@@ -15,8 +15,8 @@
#include "base/process_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "build/build_config.h"
#include "chrome/browser/about_flags.h"
@@ -48,6 +48,7 @@
#include "chrome/browser/chromeos/boot_times_loader.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
+#include "chrome/browser/chromeos/wm_ipc.h"
#endif
using base::Time;
@@ -251,6 +252,7 @@
UnregisterURLRequestChromeJob();
#if defined(OS_CHROMEOS)
+ chromeos::WmIpc::instance()->NotifyAboutSignout();
if (chromeos::CrosLibrary::Get()->EnsureLoaded()) {
chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession("");
}
diff --git a/chrome/browser/browser_thread.cc b/chrome/browser/browser_thread.cc
index e6edfd0..60d4450 100644
--- a/chrome/browser/browser_thread.cc
+++ b/chrome/browser/browser_thread.cc
@@ -6,7 +6,7 @@
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
// Friendly names for the well-known threads.
static const char* browser_thread_names[BrowserThread::ID_COUNT] = {
diff --git a/chrome/browser/browser_thread.h b/chrome/browser/browser_thread.h
index f6a022e..ce3c295 100644
--- a/chrome/browser/browser_thread.h
+++ b/chrome/browser/browser_thread.h
@@ -8,7 +8,7 @@
#include "base/lock.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
namespace base {
class MessageLoopProxy;
diff --git a/chrome/browser/browsing_instance.cc b/chrome/browser/browsing_instance.cc
index de6a677..72c121b 100644
--- a/chrome/browser/browsing_instance.cc
+++ b/chrome/browser/browsing_instance.cc
@@ -6,6 +6,7 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "chrome/browser/dom_ui/dom_ui_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/common/chrome_switches.h"
@@ -28,27 +29,17 @@
if (command_line.HasSwitch(switches::kProcessPerSite))
return true;
- if (url.SchemeIs(chrome::kExtensionScheme)) {
- // Always consolidate extensions regardless of the command line, because
- // they will break if split into multiple processes.
+ // We want to consolidate particular sites like extensions and DOMUI whether
+ // it is in process-per-tab or process-per-site-instance.
+ // Note that --single-process may have been specified, but that affects the
+ // process creation logic in RenderProcessHost, so we do not need to worry
+ // about it here.
+
+ if (url.SchemeIs(chrome::kExtensionScheme))
return true;
- }
- if (!command_line.HasSwitch(switches::kProcessPerTab)) {
- // We are not in process-per-site or process-per-tab, so we must be in the
- // default (process-per-site-instance). Only use the process-per-site
- // logic for particular sites that we want to consolidate.
- // Note that --single-process may have been specified, but that affects the
- // process creation logic in RenderProcessHost, so we do not need to worry
- // about it here.
- if (url.SchemeIs(chrome::kChromeUIScheme))
- // Always consolidate instances of the new tab page (and instances of any
- // other internal resource urls.
- return true;
-
- // TODO(creis): List any other special cases that we want to limit to a
- // single process for all instances.
- }
+ if (DOMUIFactory::UseDOMUIForURL(profile_, url))
+ return true;
// In all other cases, don't use process-per-site logic.
return false;
diff --git a/chrome/browser/bug_report_util.h b/chrome/browser/bug_report_util.h
index 61835d6..3bb9ee3 100644
--- a/chrome/browser/bug_report_util.h
+++ b/chrome/browser/bug_report_util.h
@@ -9,18 +9,16 @@
#include <string>
#include "base/basictypes.h"
-#if defined(OS_MACOSX)
-#include "base/mac_util.h"
-#include "base/sys_info.h"
-#elif defined(OS_WIN)
-#include "base/win/windows_version.h"
-#endif
#include "chrome/browser/userfeedback/proto/common.pb.h"
#include "chrome/browser/userfeedback/proto/extension.pb.h"
#include "chrome/browser/userfeedback/proto/math.pb.h"
#include "gfx/rect.h"
-#if defined(OS_CHROMEOS)
+#if defined(OS_MACOSX)
+#include "base/sys_info.h"
+#elif defined(OS_WIN)
+#include "base/win/windows_version.h"
+#elif defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cros/syslogs_library.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#endif
diff --git a/chrome/browser/cancelable_request.cc b/chrome/browser/cancelable_request.cc
index 4ed58f8..3fdb482 100644
--- a/chrome/browser/cancelable_request.cc
+++ b/chrome/browser/cancelable_request.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,7 +13,7 @@
// deleted, or do other bad things. This can occur on shutdown (or profile
// destruction) when a request is scheduled, completed (but not dispatched),
// then the Profile is deleted.
- AutoLock lock(pending_request_lock_);
+ base::AutoLock lock(pending_request_lock_);
while (!pending_requests_.empty())
CancelRequestLocked(pending_requests_.begin());
}
@@ -23,7 +23,7 @@
CancelableRequestConsumerBase* consumer) {
Handle handle;
{
- AutoLock lock(pending_request_lock_);
+ base::AutoLock lock(pending_request_lock_);
handle = next_handle_;
pending_requests_[next_handle_] = request;
@@ -37,7 +37,7 @@
}
void CancelableRequestProvider::CancelRequest(Handle handle) {
- AutoLock lock(pending_request_lock_);
+ base::AutoLock lock(pending_request_lock_);
CancelRequestLocked(pending_requests_.find(handle));
}
@@ -57,7 +57,7 @@
void CancelableRequestProvider::RequestCompleted(Handle handle) {
CancelableRequestConsumerBase* consumer = NULL;
{
- AutoLock lock(pending_request_lock_);
+ base::AutoLock lock(pending_request_lock_);
CancelableRequestMap::iterator i = pending_requests_.find(handle);
if (i == pending_requests_.end()) {
diff --git a/chrome/browser/cancelable_request.h b/chrome/browser/cancelable_request.h
index 3ad7261..5f2b1c7 100644
--- a/chrome/browser/cancelable_request.h
+++ b/chrome/browser/cancelable_request.h
@@ -92,12 +92,12 @@
#include "base/basictypes.h"
#include "base/callback.h"
-#include "base/cancellation_flag.h"
#include "base/lock.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/synchronization/cancellation_flag.h"
#include "base/task.h"
#include "build/build_config.h"
@@ -148,7 +148,7 @@
friend class CancelableRequestBase;
- Lock pending_request_lock_;
+ base::Lock pending_request_lock_;
// Lists all outstanding requests. Protected by the |lock_|.
CancelableRequestMap pending_requests_;
diff --git a/chrome/browser/character_encoding.cc b/chrome/browser/character_encoding.cc
index 80bfc6b..4b0f92f 100644
--- a/chrome/browser/character_encoding.cc
+++ b/chrome/browser/character_encoding.cc
@@ -293,9 +293,9 @@
CharacterEncoding::EncodingInfo::EncodingInfo(int id)
: encoding_id(id) {
- encoding_category_name = UTF8ToWide(GetEncodingCategoryStringByCommandId(id));
- encoding_display_name = UTF16ToWideHack(
- GetCanonicalEncodingDisplayNameByCommandId(id));
+ encoding_category_name =
+ UTF8ToUTF16(GetEncodingCategoryStringByCommandId(id));
+ encoding_display_name = GetCanonicalEncodingDisplayNameByCommandId(id);
}
// Static.
diff --git a/chrome/browser/character_encoding.h b/chrome/browser/character_encoding.h
index ae1a6f1..7aa98a3 100644
--- a/chrome/browser/character_encoding.h
+++ b/chrome/browser/character_encoding.h
@@ -25,14 +25,14 @@
// l10n_util::SortVectorWithStringKey to sort the encoding menu items
// by current locale character sequence. We need to keep the order within
// encoding category name, that's why we use category name as key.
- const std::wstring& GetStringKey() const { return encoding_category_name; }
+ const string16& GetStringKey() const { return encoding_category_name; }
// Encoding command id.
int encoding_id;
// Encoding display name.
- std::wstring encoding_display_name;
+ string16 encoding_display_name;
// Encoding category name.
- std::wstring encoding_category_name;
+ string16 encoding_category_name;
};
// Return canonical encoding name according to the command ID.
diff --git a/chrome/browser/child_process_launcher.cc b/chrome/browser/child_process_launcher.cc
index 8ba6941..6058cc8 100644
--- a/chrome/browser/child_process_launcher.cc
+++ b/chrome/browser/child_process_launcher.cc
@@ -10,7 +10,7 @@
#include "base/lock.h"
#include "base/logging.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/common/chrome_descriptors.h"
#include "chrome/common/chrome_switches.h"
diff --git a/chrome/browser/chrome_plugin_browsing_context.cc b/chrome/browser/chrome_plugin_browsing_context.cc
index 3ff4729..a252bbf 100644
--- a/chrome/browser/chrome_plugin_browsing_context.cc
+++ b/chrome/browser/chrome_plugin_browsing_context.cc
@@ -23,17 +23,18 @@
}
CPBrowsingContext CPBrowsingContextManager::Allocate(
- URLRequestContext* context) {
+ net::URLRequestContext* context) {
int32 map_id = map_.Add(context);
return static_cast<CPBrowsingContext>(map_id);
}
-URLRequestContext* CPBrowsingContextManager::ToURLRequestContext(
+net::URLRequestContext* CPBrowsingContextManager::ToURLRequestContext(
CPBrowsingContext id) {
return map_.Lookup(static_cast<int32>(id));
}
-CPBrowsingContext CPBrowsingContextManager::Lookup(URLRequestContext* context) {
+CPBrowsingContext CPBrowsingContextManager::Lookup(
+ net::URLRequestContext* context) {
ReverseMap::const_iterator it = reverse_map_.find(context);
if (it == reverse_map_.end()) {
CPBrowsingContext id = Allocate(context);
@@ -49,7 +50,8 @@
const NotificationDetails& details) {
DCHECK(type == NotificationType::URL_REQUEST_CONTEXT_RELEASED);
- URLRequestContext* context = Source<URLRequestContext>(source).ptr();
+ net::URLRequestContext* context =
+ Source<net::URLRequestContext>(source).ptr();
// Multiple CPBrowsingContexts may refer to the same URLRequestContext.
for (Map::iterator it(&map_); !it.IsAtEnd(); it.Advance()) {
diff --git a/chrome/browser/chrome_plugin_browsing_context.h b/chrome/browser/chrome_plugin_browsing_context.h
index 45d24f3..9f0eb8f 100644
--- a/chrome/browser/chrome_plugin_browsing_context.h
+++ b/chrome/browser/chrome_plugin_browsing_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,7 +13,9 @@
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+namespace net {
class URLRequestContext;
+} // namespace net
// This class manages the mapping between CPBrowsingContexts and
// URLRequestContexts. It observes when URLRequestContexts go away, and
@@ -33,16 +35,16 @@
// Generate a new unique CPBrowsingContext ID from the given
// URLRequestContext. Multiple CPBrowsingContexts can map to the same
// URLRequestContext.
- CPBrowsingContext Allocate(URLRequestContext* context);
+ CPBrowsingContext Allocate(net::URLRequestContext* context);
// Return the URLRequestContext that this CPBrowsingContext refers to, or NULL
// if not found.
- URLRequestContext* ToURLRequestContext(CPBrowsingContext id);
+ net::URLRequestContext* ToURLRequestContext(CPBrowsingContext id);
// Return a CPBrowsingContext ID that corresponds to the given
// URLRequestContext. This function differs from Allocate in that calling
// this multiple times with the same argument gives the same ID.
- CPBrowsingContext Lookup(URLRequestContext* context);
+ CPBrowsingContext Lookup(net::URLRequestContext* context);
private:
// NotificationObserver
@@ -50,8 +52,8 @@
const NotificationSource& source,
const NotificationDetails& details);
- typedef IDMap<URLRequestContext> Map;
- typedef std::map<URLRequestContext*, CPBrowsingContext> ReverseMap;
+ typedef IDMap<net::URLRequestContext> Map;
+ typedef std::map<net::URLRequestContext*, CPBrowsingContext> ReverseMap;
NotificationRegistrar registrar_;
diff --git a/chrome/browser/chromeos/boot_times_loader.cc b/chrome/browser/chromeos/boot_times_loader.cc
index b405057..9656639 100644
--- a/chrome/browser/chromeos/boot_times_loader.cc
+++ b/chrome/browser/chromeos/boot_times_loader.cc
@@ -16,8 +16,8 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/chromeos/cros/input_method_library.cc b/chrome/browser/chromeos/cros/input_method_library.cc
index 9b5316f..c62c3fd 100644
--- a/chrome/browser/chromeos/cros/input_method_library.cc
+++ b/chrome/browser/chromeos/cros/input_method_library.cc
@@ -63,6 +63,9 @@
should_change_input_method_(false),
ibus_daemon_process_id_(0),
candidate_window_process_id_(0) {
+ // TODO(yusukes): Using both CreateFallbackInputMethodDescriptors and
+ // chromeos::GetHardwareKeyboardLayoutName doesn't look clean. Probably
+ // we should unify these APIs.
scoped_ptr<InputMethodDescriptors> input_method_descriptors(
CreateFallbackInputMethodDescriptors());
current_input_method_ = input_method_descriptors->at(0);
@@ -148,19 +151,22 @@
return false;
}
- bool GetImeConfig(const char* section, const char* config_name,
+ bool GetImeConfig(const std::string& section, const std::string& config_name,
ImeConfigValue* out_value) {
bool success = false;
if (EnsureLoadedAndStarted()) {
success = chromeos::GetImeConfig(input_method_status_connection_,
- section, config_name, out_value);
+ section.c_str(),
+ config_name.c_str(),
+ out_value);
}
return success;
}
- bool SetImeConfig(const char* section, const char* config_name,
+ bool SetImeConfig(const std::string& section, const std::string& config_name,
const ImeConfigValue& value) {
- MaybeStartOrStopInputMethodProcesses(section, config_name, value);
+ // Before calling FlushImeConfig(), start input method process if necessary.
+ MaybeStartInputMethodProcesses(section, config_name, value);
const ConfigKeyType key = std::make_pair(section, config_name);
current_config_values_[key] = value;
@@ -168,6 +174,9 @@
pending_config_requests_[key] = value;
FlushImeConfig();
}
+
+ // Stop input method process if necessary.
+ MaybeStopInputMethodProcesses(section, config_name, value);
return pending_config_requests_.empty();
}
@@ -183,24 +192,52 @@
}
private:
- // Starts or stops the input method processes based on the current state.
- void MaybeStartOrStopInputMethodProcesses(
- const char* section,
- const char* config_name,
- const ImeConfigValue& value) {
- if (!strcmp(language_prefs::kGeneralSectionName, section) &&
- !strcmp(language_prefs::kPreloadEnginesConfigName, config_name)) {
+ // Starts input method processes based on the |defer_ime_startup_| flag and
+ // input method configuration being updated. |section| is a section name of
+ // the input method configuration (e.g. "general", "general/hotkey").
+ // |config_name| is a name of the configuration (e.g. "preload_engines",
+ // "previous_engine"). |value| is the configuration value to be set.
+ void MaybeStartInputMethodProcesses(const std::string& section,
+ const std::string& config_name,
+ const ImeConfigValue& value) {
+ if (section == language_prefs::kGeneralSectionName &&
+ config_name == language_prefs::kPreloadEnginesConfigName) {
if (EnsureLoadedAndStarted()) {
- // If there are no input methods other than one for the hardware
- // keyboard, we'll stop the input method processes.
+ const std::string hardware_layout_name =
+ chromeos::GetHardwareKeyboardLayoutName(); // e.g. "xkb:us::eng"
+ if (!(value.type == ImeConfigValue::kValueTypeStringList &&
+ value.string_list_value.size() == 1 &&
+ value.string_list_value[0] == hardware_layout_name) &&
+ !defer_ime_startup_) {
+ // If there are no input methods other than one for the hardware
+ // keyboard, we don't start the input method processes.
+ // When |defer_ime_startup_| is true, we don't start it either.
+ StartInputMethodProcesses();
+ }
+ chromeos::SetActiveInputMethods(input_method_status_connection_, value);
+ }
+ }
+ }
+
+ // Stops input method processes based on the |enable_auto_ime_shutdown_| flag
+ // and input method configuration being updated.
+ // See also: MaybeStartInputMethodProcesses().
+ void MaybeStopInputMethodProcesses(const std::string& section,
+ const std::string& config_name,
+ const ImeConfigValue& value) {
+ if (section == language_prefs::kGeneralSectionName &&
+ config_name == language_prefs::kPreloadEnginesConfigName) {
+ if (EnsureLoadedAndStarted()) {
+ const std::string hardware_layout_name =
+ chromeos::GetHardwareKeyboardLayoutName(); // e.g. "xkb:us::eng"
if (value.type == ImeConfigValue::kValueTypeStringList &&
value.string_list_value.size() == 1 &&
- value.string_list_value[0] ==
- chromeos::GetHardwareKeyboardLayoutName()) {
- if (enable_auto_ime_shutdown_)
- StopInputMethodProcesses();
- } else if (!defer_ime_startup_) {
- StartInputMethodProcesses();
+ value.string_list_value[0] == hardware_layout_name &&
+ enable_auto_ime_shutdown_) {
+ // If there are no input methods other than one for the hardware
+ // keyboard, and |enable_auto_ime_shutdown_| is true, we'll stop the
+ // input method processes.
+ StopInputMethodProcesses();
}
chromeos::SetActiveInputMethods(input_method_status_connection_, value);
}
@@ -290,12 +327,35 @@
this, &InputMethodLibraryImpl::FlushImeConfig);
}
+ // Notify the current input method and the number of active input methods to
+ // the UI so that the UI could determine e.g. if it should show/hide the
+ // input method indicator, etc. We have to call FOR_EACH_OBSERVER here since
+ // updating "preload_engine" does not necessarily trigger a DBus signal such
+ // as "global-engine-changed". For example,
+ // 1) If we change the preload_engine from "xkb:us:intl:eng" (i.e. the
+ // indicator is hidden) to "xkb:us:intl:eng,mozc", we have to update UI
+ // so it shows the indicator, but no signal is sent from ibus-daemon
+ // because the current input method is not changed.
+ // 2) If we change the preload_engine from "xkb:us::eng,mozc" (i.e. the
+ // indicator is shown and ibus-daemon is started) to "xkb:us::eng", we
+ // have to update UI so it hides the indicator, but we should not expect
+ // that ibus-daemon could send a DBus signal since the daemon is killed
+ // right after this FlushImeConfig() call.
if (active_input_methods_are_changed) {
+ scoped_ptr<InputMethodDescriptor> current_input_method(
+ chromeos::GetCurrentInputMethod(input_method_status_connection_));
+ // The |current_input_method_| member variable should not be used since
+ // the variable might be stale. SetImeConfig("preload_engine") call above
+ // might change the current input method in ibus-daemon, but the variable
+ // is not updated until InputMethodChangedHandler(), which is the handler
+ // for the global-engine-changed DBus signal, is called.
const size_t num_active_input_methods = GetNumActiveInputMethods();
- FOR_EACH_OBSERVER(Observer, observers_,
- ActiveInputMethodsChanged(this,
- current_input_method_,
- num_active_input_methods));
+ if (current_input_method.get()) {
+ FOR_EACH_OBSERVER(Observer, observers_,
+ ActiveInputMethodsChanged(this,
+ *current_input_method.get(),
+ num_active_input_methods));
+ }
}
}
@@ -304,7 +364,7 @@
const chromeos::InputMethodDescriptor& current_input_method) {
// The handler is called when the input method method change is
// notified via a DBus connection. Since the DBus notificatiosn are
- // handled in the UI thread, we can assume that this functionalways
+ // handled in the UI thread, we can assume that this function always
// runs on the UI thread, but just in case.
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
LOG(ERROR) << "Not on UI thread";
@@ -586,6 +646,8 @@
// If true, we'll defer the startup until a non-default method is
// activated.
bool defer_ime_startup_;
+ // True if we should stop input method processes when there are no input
+ // methods other than one for the hardware keyboard.
bool enable_auto_ime_shutdown_;
// The ID of the current input method (ex. "mozc").
std::string current_input_method_id_;
@@ -637,14 +699,14 @@
return true;
}
- bool GetImeConfig(const char* section,
- const char* config_name,
+ bool GetImeConfig(const std::string& section,
+ const std::string& config_name,
ImeConfigValue* out_value) {
return false;
}
- bool SetImeConfig(const char* section,
- const char* config_name,
+ bool SetImeConfig(const std::string& section,
+ const std::string& config_name,
const ImeConfigValue& value) {
return false;
}
diff --git a/chrome/browser/chromeos/cros/input_method_library.h b/chrome/browser/chromeos/cros/input_method_library.h
index c30db2f..0c62ead 100644
--- a/chrome/browser/chromeos/cros/input_method_library.h
+++ b/chrome/browser/chromeos/cros/input_method_library.h
@@ -84,9 +84,9 @@
// |out_value|. Returns true if |out_value| is successfully updated.
// When you would like to retrieve 'panel/custom_font', |section| should
// be "panel", and |config_name| should be "custom_font".
- virtual bool GetImeConfig(
- const char* section, const char* config_name,
- ImeConfigValue* out_value) = 0;
+ virtual bool GetImeConfig(const std::string& section,
+ const std::string& config_name,
+ ImeConfigValue* out_value) = 0;
// Updates a configuration of ibus-daemon or IBus engines with |value|.
// Returns true if the configuration (and all pending configurations, if any)
@@ -97,8 +97,8 @@
// Notice: This function might call the Observer::ActiveInputMethodsChanged()
// callback function immediately, before returning from the SetImeConfig
// function. See also http://crosbug.com/5217.
- virtual bool SetImeConfig(const char* section,
- const char* config_name,
+ virtual bool SetImeConfig(const std::string& section,
+ const std::string& config_name,
const ImeConfigValue& value) = 0;
// Sets the IME state to enabled, and launches its processes if needed.
diff --git a/chrome/browser/chromeos/cros/mock_input_method_library.h b/chrome/browser/chromeos/cros/mock_input_method_library.h
index c4284e8..dc4f3ac 100644
--- a/chrome/browser/chromeos/cros/mock_input_method_library.h
+++ b/chrome/browser/chromeos/cros/mock_input_method_library.h
@@ -27,8 +27,9 @@
MOCK_METHOD1(ChangeInputMethod, void(const std::string&));
MOCK_METHOD2(SetImePropertyActivated, void(const std::string&, bool));
MOCK_METHOD1(InputMethodIsActivated, bool(const std::string&));
- MOCK_METHOD3(GetImeConfig, bool(const char*, const char*, ImeConfigValue*));
- MOCK_METHOD3(SetImeConfig, bool(const char*, const char*,
+ MOCK_METHOD3(GetImeConfig, bool(const std::string&, const std::string&,
+ ImeConfigValue*));
+ MOCK_METHOD3(SetImeConfig, bool(const std::string&, const std::string&,
const ImeConfigValue&));
MOCK_CONST_METHOD0(previous_input_method, const InputMethodDescriptor&(void));
MOCK_CONST_METHOD0(current_input_method, const InputMethodDescriptor&(void));
diff --git a/chrome/browser/chromeos/cros/network_library.h b/chrome/browser/chromeos/cros/network_library.h
index 99780e2..0a78cd4 100644
--- a/chrome/browser/chromeos/cros/network_library.h
+++ b/chrome/browser/chromeos/cros/network_library.h
@@ -11,7 +11,6 @@
#include "base/gtest_prod_util.h"
#include "base/observer_list.h"
-#include "base/platform_thread.h"
#include "base/scoped_vector.h"
#include "base/singleton.h"
#include "base/string16.h"
diff --git a/chrome/browser/chromeos/cros_settings.h b/chrome/browser/chromeos/cros_settings.h
index 79428d2..c8446c5 100644
--- a/chrome/browser/chromeos/cros_settings.h
+++ b/chrome/browser/chromeos/cros_settings.h
@@ -10,9 +10,9 @@
#include <vector>
#include "base/hash_tables.h"
-#include "base/non_thread_safe.h"
#include "base/observer_list.h"
#include "base/singleton.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/browser/chromeos/cros_settings_names.h"
#include "chrome/common/notification_observer.h"
@@ -27,7 +27,7 @@
class CrosSettingsProvider;
// A class manages per-device/global settings.
-class CrosSettings : public NonThreadSafe {
+class CrosSettings : public base::NonThreadSafe {
public:
// Class factory.
static CrosSettings* Get();
diff --git a/chrome/browser/chromeos/dom_ui/imageburner_ui.cc b/chrome/browser/chromeos/dom_ui/imageburner_ui.cc
index 24fc64a..bd08dd3 100644
--- a/chrome/browser/chromeos/dom_ui/imageburner_ui.cc
+++ b/chrome/browser/chromeos/dom_ui/imageburner_ui.cc
@@ -295,7 +295,7 @@
chromeos::BurnEventType event) {
DictionaryValue progress_value;
progress_value.SetString("progress_status_text",
- WideToUTF16Hack(GetBurnProgressText(total_burnt, image_size)));
+ GetBurnProgressText(total_burnt, image_size));
if (event == chromeos::BURN_UPDATED)
progress_value.SetString("state", "IN_PROGRESS");
else if (event == chromeos::BURN_CANCELED)
@@ -309,26 +309,24 @@
dom_ui_->CallJavascriptFunction(L"burnProgressUpdated", progress_value);
}
-std::wstring ImageBurnHandler::GetBurnProgressText(int64 total_burnt,
- int64 image_size) {
+string16 ImageBurnHandler::GetBurnProgressText(int64 total_burnt,
+ int64 image_size) {
DataUnits amount_units = GetByteDisplayUnits(total_burnt);
- std::wstring burnt_size =
- UTF16ToWideHack(FormatBytes(total_burnt, amount_units, true));
+ string16 burnt_size = FormatBytes(total_burnt, amount_units, true);
base::i18n::AdjustStringForLocaleDirection(&burnt_size);
if (image_size) {
amount_units = GetByteDisplayUnits(image_size);
- std::wstring total_text =
- UTF16ToWideHack(FormatBytes(image_size, amount_units, true));
+ string16 total_text = FormatBytes(image_size, amount_units, true);
base::i18n::AdjustStringForLocaleDirection(&total_text);
- return l10n_util::GetStringF(IDS_IMAGEBURN_BURN_PROGRESS,
- burnt_size,
- total_text);
+ return l10n_util::GetStringFUTF16(IDS_IMAGEBURN_BURN_PROGRESS,
+ burnt_size,
+ total_text);
} else {
- return l10n_util::GetStringF(IDS_IMAGEBURN_BURN_PROGRESS_SIZE_UNKNOWN,
- burnt_size);
+ return l10n_util::GetStringFUTF16(IDS_IMAGEBURN_BURN_PROGRESS_SIZE_UNKNOWN,
+ burnt_size);
}
}
diff --git a/chrome/browser/chromeos/dom_ui/imageburner_ui.h b/chrome/browser/chromeos/dom_ui/imageburner_ui.h
index 44041e5..97624ac 100644
--- a/chrome/browser/chromeos/dom_ui/imageburner_ui.h
+++ b/chrome/browser/chromeos/dom_ui/imageburner_ui.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,6 +13,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/scoped_ptr.h"
+#include "base/string16.h"
#include "base/values.h"
#include "chrome/browser/chromeos/cros/burn_library.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
@@ -113,7 +114,7 @@
void UpdateBurnProgress(int64 total_burnt, int64 image_size,
const std::string& path, chromeos::BurnEventType evt);
- std::wstring GetBurnProgressText(int64 total_burnt, int64 image_size);
+ string16 GetBurnProgressText(int64 total_burnt, int64 image_size);
// helper functions
void CreateImageUrl();
diff --git a/chrome/browser/chromeos/dom_ui/language_options_handler.cc b/chrome/browser/chromeos/dom_ui/language_options_handler.cc
index cd81ada..b4c1b19 100644
--- a/chrome/browser/chromeos/dom_ui/language_options_handler.cc
+++ b/chrome/browser/chromeos/dom_ui/language_options_handler.cc
@@ -196,18 +196,18 @@
// In theory, we should be able to create a map that is sorted by
// display names using ICU comparator, but doing it is hard, thus we'll
// use an auxiliary vector to achieve the same result.
- typedef std::pair<std::string, std::wstring> LanguagePair;
- typedef std::map<std::wstring, LanguagePair> LanguageMap;
+ typedef std::pair<std::string, string16> LanguagePair;
+ typedef std::map<string16, LanguagePair> LanguageMap;
LanguageMap language_map;
// The auxiliary vector mentioned above.
- std::vector<std::wstring> display_names;
+ std::vector<string16> display_names;
// Build the list of display names, and build the language map.
for (std::set<std::string>::const_iterator iter = language_codes.begin();
iter != language_codes.end(); ++iter) {
- const std::wstring display_name =
+ const string16 display_name =
input_method::GetLanguageDisplayNameFromCode(*iter);
- const std::wstring native_display_name =
+ const string16 native_display_name =
input_method::GetLanguageNativeDisplayNameFromCode(*iter);
display_names.push_back(display_name);
language_map[display_name] =
@@ -216,8 +216,8 @@
DCHECK_EQ(display_names.size(), language_map.size());
// Sort display names using locale specific sorter.
- l10n_util::SortStrings(g_browser_process->GetApplicationLocale(),
- &display_names);
+ l10n_util::SortStrings16(g_browser_process->GetApplicationLocale(),
+ &display_names);
// Build the language list from the language map.
ListValue* language_list = new ListValue();
@@ -225,8 +225,8 @@
const LanguagePair& pair = language_map[display_names[i]];
DictionaryValue* dictionary = new DictionaryValue();
dictionary->SetString("code", pair.first);
- dictionary->SetString("displayName", WideToUTF16Hack(display_names[i]));
- dictionary->SetString("nativeDisplayName", WideToUTF16Hack(pair.second));
+ dictionary->SetString("displayName", display_names[i]);
+ dictionary->SetString("nativeDisplayName", pair.second);
language_list->Append(dictionary);
}
diff --git a/chrome/browser/chromeos/dom_ui/system_info_ui.cc b/chrome/browser/chromeos/dom_ui/system_info_ui.cc
index 857c560..71f9865 100644
--- a/chrome/browser/chromeos/dom_ui/system_info_ui.cc
+++ b/chrome/browser/chromeos/dom_ui/system_info_ui.cc
@@ -11,7 +11,7 @@
#include "base/path_service.h"
#include "base/string_piece.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
diff --git a/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc b/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc
index fcf69fa..547615e 100644
--- a/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc
+++ b/chrome/browser/chromeos/dom_ui/wrench_menu_ui.cc
@@ -37,12 +37,12 @@
config->SetInteger("IDC_ZOOM_PLUS", IDC_ZOOM_PLUS);
config->SetInteger("IDC_FULLSCREEN", IDC_FULLSCREEN);
- config->SetString("IDS_EDIT2", WideToUTF8(l10n_util::GetString(IDS_EDIT2)));
+ config->SetString("IDS_EDIT2", l10n_util::GetStringUTF8(IDS_EDIT2));
config->SetString("IDS_ZOOM_MENU2",
- WideToUTF8(l10n_util::GetString(IDS_ZOOM_MENU2)));
- config->SetString("IDS_CUT", WideToUTF8(l10n_util::GetString(IDS_CUT)));
- config->SetString("IDS_COPY", WideToUTF8(l10n_util::GetString(IDS_COPY)));
- config->SetString("IDS_PASTE", WideToUTF8(l10n_util::GetString(IDS_PASTE)));
+ l10n_util::GetStringUTF8(IDS_ZOOM_MENU2));
+ config->SetString("IDS_CUT", l10n_util::GetStringUTF8(IDS_CUT));
+ config->SetString("IDS_COPY", l10n_util::GetStringUTF8(IDS_COPY));
+ config->SetString("IDS_PASTE", l10n_util::GetStringUTF8(IDS_PASTE));
}
};
diff --git a/chrome/browser/chromeos/external_protocol_dialog.cc b/chrome/browser/chromeos/external_protocol_dialog.cc
index 928508f..a6b280d 100644
--- a/chrome/browser/chromeos/external_protocol_dialog.cc
+++ b/chrome/browser/chromeos/external_protocol_dialog.cc
@@ -54,11 +54,12 @@
std::wstring ExternalProtocolDialog::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
- return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT));
}
std::wstring ExternalProtocolDialog::GetWindowTitle() const {
- return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_TITLE));
}
void ExternalProtocolDialog::DeleteDelegate() {
@@ -90,17 +91,17 @@
gfx::ElideString(ASCIIToWide(url.possibly_invalid_spec()),
kMaxUrlWithoutSchemeSize, &elided_url_without_scheme);
- std::wstring message_text = l10n_util::GetStringF(
+ std::wstring message_text = UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_EXTERNAL_PROTOCOL_INFORMATION,
- ASCIIToWide(url.scheme() + ":"),
- elided_url_without_scheme) + L"\n\n";
+ ASCIIToUTF16(url.scheme() + ":"),
+ WideToUTF16(elided_url_without_scheme)) + ASCIIToUTF16("\n\n"));
message_box_view_ = new MessageBoxView(MessageBoxFlags::kIsConfirmMessageBox,
message_text,
std::wstring(),
kMessageWidth);
- message_box_view_->SetCheckBoxLabel(
- l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT));
+ message_box_view_->SetCheckBoxLabel(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)));
gfx::NativeWindow parent_window;
if (tab_contents) {
diff --git a/chrome/browser/chromeos/google_update_chromeos.cc b/chrome/browser/chromeos/google_update_chromeos.cc
index 88a63d9..fb3030b 100644
--- a/chrome/browser/chromeos/google_update_chromeos.cc
+++ b/chrome/browser/chromeos/google_update_chromeos.cc
@@ -8,7 +8,7 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc
index 67fcb5b..ced79ea 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -349,11 +349,11 @@
// efficient, but acceptable as the function is cheap, and the language
// list is short (about 40 at most).
bool operator()(const std::string& s1, const std::string& s2) const {
- const std::wstring key1 =
+ const string16 key1 =
chromeos::input_method::GetLanguageDisplayNameFromCode(s1);
- const std::wstring key2 =
+ const string16 key2 =
chromeos::input_method::GetLanguageDisplayNameFromCode(s2);
- return l10n_util::StringComparator<std::wstring>(collator_)(key1, key2);
+ return l10n_util::StringComparator<string16>(collator_)(key1, key2);
}
private:
@@ -578,18 +578,17 @@
kDefaultDisplayName : iter->second;
}
-std::wstring GetLanguageDisplayNameFromCode(const std::string& language_code) {
+string16 GetLanguageDisplayNameFromCode(const std::string& language_code) {
if (!g_browser_process) {
- return L"";
+ return string16();
}
- return UTF16ToWide(l10n_util::GetDisplayNameForLocale(
- language_code, g_browser_process->GetApplicationLocale(), true));
+ return l10n_util::GetDisplayNameForLocale(
+ language_code, g_browser_process->GetApplicationLocale(), true);
}
-std::wstring GetLanguageNativeDisplayNameFromCode(
+string16 GetLanguageNativeDisplayNameFromCode(
const std::string& language_code) {
- return UTF16ToWide(l10n_util::GetDisplayNameForLocale(
- language_code, language_code, true));
+ return l10n_util::GetDisplayNameForLocale(language_code, language_code, true);
}
void SortLanguageCodesByNames(std::vector<std::string>* language_codes) {
diff --git a/chrome/browser/chromeos/input_method/input_method_util.h b/chrome/browser/chromeos/input_method/input_method_util.h
index a4bea55..66ba95f 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.h
+++ b/chrome/browser/chromeos/input_method/input_method_util.h
@@ -105,14 +105,13 @@
// internally.
// Examples: "fi" => "Finnish"
// "en-US" => "English (United States)"
-std::wstring GetLanguageDisplayNameFromCode(const std::string& language_code);
+string16 GetLanguageDisplayNameFromCode(const std::string& language_code);
// Converts a language code to a language native display name.
// MaybeRewriteLanguageName() is called internally.
// Examples: "fi" => "suomi" (rather than Finnish)
// "en-US" => "English (United States)"
-std::wstring GetLanguageNativeDisplayNameFromCode(
- const std::string& language_code);
+string16 GetLanguageNativeDisplayNameFromCode(const std::string& language_code);
// Sorts the given language codes by their corresponding language names,
// using the unicode string comparator. Uses unstable sorting.
diff --git a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc
index 7d4c246..55cf34b 100644
--- a/chrome/browser/chromeos/input_method/input_method_util_unittest.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util_unittest.cc
@@ -212,11 +212,11 @@
}
TEST(InputMethodUtilTest, GetLanguageDisplayNameFromCode) {
- EXPECT_EQ(L"Finnish", GetLanguageDisplayNameFromCode("fi"));
+ EXPECT_EQ(UTF8ToUTF16("Finnish"), GetLanguageDisplayNameFromCode("fi"));
}
TEST(InputMethodUtilTest, GetLanguageNativeDisplayNameFromCode) {
- EXPECT_EQ(L"suomi", GetLanguageNativeDisplayNameFromCode("fi"));
+ EXPECT_EQ(UTF8ToUTF16("suomi"), GetLanguageNativeDisplayNameFromCode("fi"));
}
TEST(InputMethodUtilTest, SortLanguageCodesByNames) {
diff --git a/chrome/browser/chromeos/login/account_screen_browsertest.cc b/chrome/browser/chromeos/login/account_screen_browsertest.cc
index 309d8bc..7b9e8cf 100644
--- a/chrome/browser/chromeos/login/account_screen_browsertest.cc
+++ b/chrome/browser/chromeos/login/account_screen_browsertest.cc
@@ -81,9 +81,9 @@
IN_PROC_BROWSER_TEST_F(AccountScreenTest, DISABLED_TestSchemeInspector) {
ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme(
chrome::kCrosScheme);
- URLRequestFilter::GetInstance()->AddHostnameHandler(chrome::kCrosScheme,
- "inspector",
- &InspectorHook);
+ net::URLRequestFilter::GetInstance()->AddHostnameHandler(chrome::kCrosScheme,
+ "inspector",
+ &InspectorHook);
EXPECT_FALSE(inspector_called);
ui_test_utils::RunMessageLoop();
EXPECT_TRUE(inspector_called);
diff --git a/chrome/browser/chromeos/login/apply_services_customization.cc b/chrome/browser/chromeos/login/apply_services_customization.cc
index b778a5e..58e8e1d 100644
--- a/chrome/browser/chromeos/login/apply_services_customization.cc
+++ b/chrome/browser/chromeos/login/apply_services_customization.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -104,7 +104,7 @@
void ApplyServicesCustomization::OnURLFetchComplete(
const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data) {
diff --git a/chrome/browser/chromeos/login/apply_services_customization.h b/chrome/browser/chromeos/login/apply_services_customization.h
index 32e7d9a..757ce7c 100644
--- a/chrome/browser/chromeos/login/apply_services_customization.h
+++ b/chrome/browser/chromeos/login/apply_services_customization.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -43,7 +43,7 @@
// Overriden from URLFetcher::Delegate:
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/chromeos/login/authenticator.cc b/chrome/browser/chromeos/login/authenticator.cc
index 07f4560..1b2a42c 100644
--- a/chrome/browser/chromeos/login/authenticator.cc
+++ b/chrome/browser/chromeos/login/authenticator.cc
@@ -14,6 +14,9 @@
namespace chromeos {
class LoginStatusConsumer;
+// static
+const char Authenticator::kSpecialCaseDomain[] = "gmail.com";
+
Authenticator::Authenticator(LoginStatusConsumer* consumer)
: consumer_(consumer) {
}
@@ -26,7 +29,11 @@
char at = '@';
base::SplitString(email_address, at, &parts);
DCHECK_EQ(parts.size(), 2U) << "email_address should have only one @";
- RemoveChars(parts[0], ".", &parts[0]);
+ if (parts[1] == kSpecialCaseDomain) // only strip '.' for gmail accounts.
+ RemoveChars(parts[0], ".", &parts[0]);
+ // Technically the '+' handling here could be removed, as the google
+ // account servers do not tolerate them, so we don't need to either.
+ // TODO(cmasone): remove this, unless this code becomes obsolete altogether.
if (parts[0].find('+') != std::string::npos)
parts[0].erase(parts[0].find('+'));
std::string new_email = StringToLowerASCII(JoinString(parts, at));
diff --git a/chrome/browser/chromeos/login/authenticator.h b/chrome/browser/chromeos/login/authenticator.h
index 039411c..4096b1f 100644
--- a/chrome/browser/chromeos/login/authenticator.h
+++ b/chrome/browser/chromeos/login/authenticator.h
@@ -23,6 +23,9 @@
// consumer_->OnPasswordChangeDetected() on the UI thread.
class Authenticator : public base::RefCountedThreadSafe<Authenticator> {
public:
+ // A domain which requires special-case parsing in canonicalization.
+ static const char kSpecialCaseDomain[];
+
explicit Authenticator(LoginStatusConsumer* consumer);
virtual ~Authenticator();
diff --git a/chrome/browser/chromeos/login/authenticator_unittest.cc b/chrome/browser/chromeos/login/authenticator_unittest.cc
index 48ab378..d6bd149 100644
--- a/chrome/browser/chromeos/login/authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/authenticator_unittest.cc
@@ -23,19 +23,29 @@
Authenticator::Canonicalize("UsEr@what.COM"));
}
-TEST(AuthenticatorTest, EmailAddressIgnoreOneUsernameDot) {
- EXPECT_EQ(Authenticator::Canonicalize("us.er@what.com"),
+TEST(AuthenticatorTest, EmailAddressRejectOneUsernameDot) {
+ EXPECT_NE(Authenticator::Canonicalize("u.ser@what.com"),
Authenticator::Canonicalize("UsEr@what.com"));
}
-TEST(AuthenticatorTest, EmailAddressIgnoreManyUsernameDots) {
+TEST(AuthenticatorTest, EmailAddressMatchWithOneUsernameDot) {
EXPECT_EQ(Authenticator::Canonicalize("u.ser@what.com"),
- Authenticator::Canonicalize("Us.E.r@what.com"));
+ Authenticator::Canonicalize("U.sEr@what.com"));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnoreOneUsernameDot) {
+ EXPECT_EQ(Authenticator::Canonicalize("us.er@gmail.com"),
+ Authenticator::Canonicalize("UsEr@gmail.com"));
+}
+
+TEST(AuthenticatorTest, EmailAddressIgnoreManyUsernameDots) {
+ EXPECT_EQ(Authenticator::Canonicalize("u.ser@gmail.com"),
+ Authenticator::Canonicalize("Us.E.r@gmail.com"));
}
TEST(AuthenticatorTest, EmailAddressIgnoreConsecutiveUsernameDots) {
- EXPECT_EQ(Authenticator::Canonicalize("use.r@what.com"),
- Authenticator::Canonicalize("Us....E.r@what.com"));
+ EXPECT_EQ(Authenticator::Canonicalize("use.r@gmail.com"),
+ Authenticator::Canonicalize("Us....E.r@gmail.com"));
}
TEST(AuthenticatorTest, EmailAddressDifferentOnesRejected) {
diff --git a/chrome/browser/chromeos/login/camera.cc b/chrome/browser/chromeos/login/camera.cc
index 59e77d3..bfc8136 100644
--- a/chrome/browser/chromeos/login/camera.cc
+++ b/chrome/browser/chromeos/login/camera.cc
@@ -22,7 +22,7 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "chrome/browser/browser_thread.h"
#include "gfx/size.h"
diff --git a/chrome/browser/chromeos/login/camera.h b/chrome/browser/chromeos/login/camera.h
index a82f197..c30f2df 100644
--- a/chrome/browser/chromeos/login/camera.h
+++ b/chrome/browser/chromeos/login/camera.h
@@ -11,7 +11,7 @@
#include "base/lock.h"
#include "base/ref_counted.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "third_party/skia/include/core/SkBitmap.h"
class Task;
diff --git a/chrome/browser/chromeos/login/captcha_view.cc b/chrome/browser/chromeos/login/captcha_view.cc
index de66b3e..ca2438f 100644
--- a/chrome/browser/chromeos/login/captcha_view.cc
+++ b/chrome/browser/chromeos/login/captcha_view.cc
@@ -90,7 +90,7 @@
}
std::wstring CaptchaView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_LOGIN_CAPTCHA_DIALOG_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_CAPTCHA_DIALOG_TITLE));
}
void CaptchaView::SetCaptchaURL(const GURL& captcha_url) {
@@ -120,10 +120,10 @@
captcha_textfield_->RequestFocus();
}
-bool CaptchaView::HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke) {
+bool CaptchaView::HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
if (sender == captcha_textfield_ &&
- keystroke.GetKeyboardCode() == app::VKEY_RETURN) {
+ key_event.GetKeyCode() == app::VKEY_RETURN) {
if (is_standalone_) {
Accept();
} else {
@@ -162,8 +162,8 @@
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
views::GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, column_view_set_id);
- Label* label =
- new views::Label(l10n_util::GetString(IDS_LOGIN_CAPTCHA_INSTRUCTIONS));
+ Label* label = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_CAPTCHA_INSTRUCTIONS)));
label->SetMultiLine(true);
layout->AddView(label);
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
@@ -182,15 +182,16 @@
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, column_view_set_id);
- label = new views::Label(
- l10n_util::GetString(IDS_SYNC_GAIA_CAPTCHA_CASE_INSENSITIVE_TIP));
+ label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SYNC_GAIA_CAPTCHA_CASE_INSENSITIVE_TIP)));
label->SetMultiLine(true);
layout->AddView(label);
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
if (is_standalone_) {
layout->StartRow(0, column_view_set_id);
- ok_button_ = new WideTextButton(this, l10n_util::GetString(IDS_OK));
+ ok_button_ = new WideTextButton(
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK)));
ok_button_->set_alignment(views::TextButton::ALIGN_CENTER);
ok_button_->SetFocusable(true);
ok_button_->SetNormalHasBorder(true);
diff --git a/chrome/browser/chromeos/login/captcha_view.h b/chrome/browser/chromeos/login/captcha_view.h
index 37de9f9..65682e0 100644
--- a/chrome/browser/chromeos/login/captcha_view.h
+++ b/chrome/browser/chromeos/login/captcha_view.h
@@ -57,8 +57,8 @@
// views::Textfield::Controller implementation:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents) {}
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event);
// Overriden from ImageDownloader::Delegate:
virtual void OnImageDecoded(const SkBitmap& decoded_image);
diff --git a/chrome/browser/chromeos/login/cookie_fetcher.h b/chrome/browser/chromeos/login/cookie_fetcher.h
index 660a164..f9290f7 100644
--- a/chrome/browser/chromeos/login/cookie_fetcher.h
+++ b/chrome/browser/chromeos/login/cookie_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -47,7 +47,7 @@
// Overloaded from URLFetcher::Delegate.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/chromeos/login/eula_view.cc b/chrome/browser/chromeos/login/eula_view.cc
index b7c688a..c23a89a 100644
--- a/chrome/browser/chromeos/login/eula_view.cc
+++ b/chrome/browser/chromeos/login/eula_view.cc
@@ -104,7 +104,8 @@
// views::View overrides:
virtual std::wstring GetWindowTitle() const {
- return l10n_util::GetString(IDS_EULA_SYSTEM_SECURITY_SETTING);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING));
}
gfx::Size GetPreferredSize() {
@@ -135,16 +136,16 @@
column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1,
views::GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, 0);
- views::Label* label = new views::Label(
- l10n_util::GetString(IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION));
+ views::Label* label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION)));
label->SetMultiLine(true);
label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->AddView(label);
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, 0);
- label = new views::Label(
- l10n_util::GetString(IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION_KEY));
+ label = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_EULA_SYSTEM_SECURITY_SETTING_DESCRIPTION_KEY)));
label->SetMultiLine(true);
label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->AddView(label);
@@ -181,7 +182,8 @@
throbber_ = chromeos::CreateDefaultThrobber();
throbber_->Start();
layout->AddView(throbber_);
- busy_label_ = new views::Label(l10n_util::GetString(IDS_EULA_TPM_BUSY));
+ busy_label_ = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_TPM_BUSY)));
layout->AddView(busy_label_);
layout->AddPaddingRow(0, kRelatedControlHorizontalSpacing);
@@ -414,26 +416,26 @@
// Set tooltip for usage statistics checkbox if the metric is unmanaged.
if (!usage_statistics_checkbox_->IsEnabled()) {
usage_statistics_checkbox_->SetTooltipText(
- l10n_util::GetString(IDS_OPTION_DISABLED_BY_POLICY));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTION_DISABLED_BY_POLICY)));
}
// Set tooltip for system security settings link if TPM is disabled.
if (!system_security_settings_link_->IsEnabled()) {
system_security_settings_link_->SetTooltipText(
- l10n_util::GetString(IDS_EULA_TPM_DISABLED));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_TPM_DISABLED)));
}
// Load other labels from resources.
usage_statistics_checkbox_->SetLabel(
- l10n_util::GetString(IDS_EULA_CHECKBOX_ENABLE_LOGGING));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_CHECKBOX_ENABLE_LOGGING)));
learn_more_link_->SetText(
- l10n_util::GetString(IDS_LEARN_MORE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE)));
system_security_settings_link_->SetText(
- l10n_util::GetString(IDS_EULA_SYSTEM_SECURITY_SETTING));
- continue_button_->SetLabel(
- l10n_util::GetString(IDS_EULA_ACCEPT_AND_CONTINUE_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_SYSTEM_SECURITY_SETTING)));
+ continue_button_->SetLabel(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EULA_ACCEPT_AND_CONTINUE_BUTTON)));
back_button_->SetLabel(
- l10n_util::GetString(IDS_EULA_BACK_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EULA_BACK_BUTTON)));
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc
index 83aa156..1b906e0 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.cc
+++ b/chrome/browser/chromeos/login/existing_user_controller.cc
@@ -48,7 +48,10 @@
// Max number of users we'll show. The true max is the min of this and the
// number of windows that fit on the screen.
-const size_t kMaxUsers = 5;
+const size_t kMaxUsers = 6;
+
+// Minimum number of users we'll show (including Guest and New User pods).
+const size_t kMinUsers = 3;
// Used to indicate no user has been selected.
const size_t kNotSelected = -1;
@@ -131,36 +134,39 @@
if (delete_scheduled_instance_)
delete_scheduled_instance_->Delete();
- // Caclulate the max number of users from available screen size.
+ // Calculate the max number of users from available screen size.
+ bool show_guest = UserCrosSettingsProvider::cached_allow_guest();
+ bool show_new_user = true;
if (UserCrosSettingsProvider::cached_show_users_on_signin()) {
size_t max_users = kMaxUsers;
int screen_width = background_bounds.width();
if (screen_width > 0) {
- max_users = std::max(static_cast<size_t>(2), std::min(kMaxUsers,
- static_cast<size_t>((screen_width - login::kUserImageSize)
- / (UserController::kUnselectedSize +
- UserController::kPadding))));
+ size_t users_per_screen = (screen_width - login::kUserImageSize)
+ / (UserController::kUnselectedSize + UserController::kPadding);
+ max_users = std::max(kMinUsers, std::min(kMaxUsers, users_per_screen));
}
- size_t visible_users_count = std::min(users.size(), max_users - 1);
+ size_t visible_users_count = std::min(users.size(), max_users -
+ static_cast<int>(show_guest) - static_cast<int>(show_new_user));
for (size_t i = 0; i < users.size(); ++i) {
- if (controllers_.size() == visible_users_count)
- break;
-
// TODO(xiyuan): Clean user profile whose email is not in whitelist.
if (UserCrosSettingsProvider::cached_allow_new_user() ||
UserCrosSettingsProvider::IsEmailInCachedWhitelist(
users[i].email())) {
- controllers_.push_back(new UserController(this, users[i]));
+ UserController* user_controller = new UserController(this, users[i]);
+ if (controllers_.size() < visible_users_count)
+ controllers_.push_back(user_controller);
+ else
+ invisible_controllers_.push_back(user_controller);
}
}
}
- if (!controllers_.empty() && UserCrosSettingsProvider::cached_allow_guest())
+ if (!controllers_.empty() && show_guest)
controllers_.push_back(new UserController(this, true));
- // Add the view representing the new user.
- controllers_.push_back(new UserController(this, false));
+ if (show_new_user)
+ controllers_.push_back(new UserController(this, false));
}
void ExistingUserController::Init() {
@@ -240,6 +246,7 @@
WmMessageListener::GetInstance()->RemoveObserver(this);
STLDeleteElements(&controllers_);
+ STLDeleteElements(&invisible_controllers_);
}
void ExistingUserController::Delete() {
@@ -387,6 +394,33 @@
new RemoveAttempt(source->user().email());
// We need to unmap entry windows, the windows will be unmapped in destructor.
delete source;
+
+ // Nothing to insert.
+ if (invisible_controllers_.empty())
+ return;
+
+ // Insert just before guest or add new user pods if any.
+ int insert_position = new_size;
+ while (insert_position > 0 &&
+ (controllers_[insert_position - 1]->is_new_user() ||
+ controllers_[insert_position - 1]->is_guest()))
+ --insert_position;
+
+ controllers_.insert(controllers_.begin() + insert_position,
+ invisible_controllers_[0]);
+ invisible_controllers_.erase(invisible_controllers_.begin());
+
+ // Update counts for exiting pods.
+ new_size = static_cast<int>(controllers_.size());
+ for (int i = 0; i < new_size; ++i) {
+ if (i != insert_position)
+ controllers_[i]->UpdateUserCount(i, new_size);
+ }
+
+ // And initialize new one that was invisible.
+ controllers_[insert_position]->Init(insert_position, new_size, false);
+
+ EnableTooltipsIfNeeded(controllers_);
}
void ExistingUserController::SelectUser(int index) {
@@ -455,13 +489,13 @@
void ExistingUserController::ShowError(int error_id,
const std::string& details) {
ClearErrors();
- std::wstring error_text;
+ string16 error_text;
// GetStringF fails on debug build if there's no replacement in the string.
if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) {
- error_text = l10n_util::GetStringF(
- error_id, l10n_util::GetString(IDS_PRODUCT_OS_NAME));
+ error_text = l10n_util::GetStringFUTF16(
+ error_id, l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME));
} else {
- error_text = l10n_util::GetString(error_id);
+ error_text = l10n_util::GetStringUTF16(error_id);
}
// TODO(dpolukhin): show detailed error info. |details| string contains
// low level error info that is not localized and even is not user friendly.
@@ -478,11 +512,11 @@
bounds.set_width(kCursorOffset * 2);
arrow = BubbleBorder::BOTTOM_LEFT;
}
- std::wstring help_link;
+ string16 help_link;
if (error_id == IDS_LOGIN_ERROR_AUTHENTICATING_HOSTED) {
- help_link = l10n_util::GetString(IDS_LEARN_MORE);
+ help_link = l10n_util::GetStringUTF16(IDS_LEARN_MORE);
} else if (num_login_attempts_ > static_cast<size_t>(1)) {
- help_link = l10n_util::GetString(IDS_CANT_ACCESS_ACCOUNT_BUTTON);
+ help_link = l10n_util::GetStringUTF16(IDS_CANT_ACCESS_ACCOUNT_BUTTON);
}
bubble_ = MessageBubble::Show(
@@ -490,8 +524,8 @@
bounds,
arrow,
ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING),
- error_text,
- help_link,
+ UTF16ToWide(error_text),
+ UTF16ToWide(help_link),
this);
}
diff --git a/chrome/browser/chromeos/login/existing_user_controller.h b/chrome/browser/chromeos/login/existing_user_controller.h
index 61e941a..f648b22 100644
--- a/chrome/browser/chromeos/login/existing_user_controller.h
+++ b/chrome/browser/chromeos/login/existing_user_controller.h
@@ -136,9 +136,12 @@
views::Widget* background_window_;
BackgroundView* background_view_;
- // The set of UserControllers.
+ // The set of visible UserControllers.
std::vector<UserController*> controllers_;
+ // The set of invisible UserControllers.
+ std::vector<UserController*> invisible_controllers_;
+
// Used to execute login operations.
scoped_ptr<LoginPerformer> login_performer_;
diff --git a/chrome/browser/chromeos/login/existing_user_view.cc b/chrome/browser/chromeos/login/existing_user_view.cc
index ed9ac4e..2c3176e 100644
--- a/chrome/browser/chromeos/login/existing_user_view.cc
+++ b/chrome/browser/chromeos/login/existing_user_view.cc
@@ -102,10 +102,9 @@
return false;
}
-bool ExistingUserView::HandleKeystroke(
- views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke) {
- if (keystroke.GetKeyboardCode() == app::VKEY_RETURN) {
+bool ExistingUserView::HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
+ if (key_event.GetKeyCode() == app::VKEY_RETURN) {
if (!password_field_->text().empty())
user_controller_->OnLogin("", UTF16ToUTF8(password_field_->text()));
} else {
diff --git a/chrome/browser/chromeos/login/existing_user_view.h b/chrome/browser/chromeos/login/existing_user_view.h
index 9d3dff8..5212429 100644
--- a/chrome/browser/chromeos/login/existing_user_view.h
+++ b/chrome/browser/chromeos/login/existing_user_view.h
@@ -33,8 +33,8 @@
// Overriden from Textfield::Controller:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& keystroke);
// Overriden from UserInput:
virtual void EnableInputControls(bool enabled);
diff --git a/chrome/browser/chromeos/login/google_authenticator.cc b/chrome/browser/chromeos/login/google_authenticator.cc
index 4fa405d..b3d6311 100644
--- a/chrome/browser/chromeos/login/google_authenticator.cc
+++ b/chrome/browser/chromeos/login/google_authenticator.cc
@@ -9,11 +9,11 @@
#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/lock.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/sha2.h"
#include "base/string_util.h"
+#include "base/synchronization/lock.h"
#include "base/third_party/nss/blapi.h"
#include "base/third_party/nss/sha256.h"
#include "chrome/browser/browser_thread.h"
@@ -315,7 +315,7 @@
void GoogleAuthenticator::CheckLocalaccount(const LoginFailure& error) {
{
- AutoLock for_this_block(localaccount_lock_);
+ base::AutoLock for_this_block(localaccount_lock_);
VLOG(1) << "Checking localaccount";
if (!checked_for_localaccount_) {
BrowserThread::PostDelayedTask(
@@ -401,7 +401,7 @@
void GoogleAuthenticator::LoadLocalaccount(const std::string& filename) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
{
- AutoLock for_this_block(localaccount_lock_);
+ base::AutoLock for_this_block(localaccount_lock_);
if (checked_for_localaccount_)
return;
}
@@ -423,7 +423,7 @@
void GoogleAuthenticator::SetLocalaccount(const std::string& new_name) {
localaccount_ = new_name;
{ // extra braces for clarity about AutoLock scope.
- AutoLock for_this_block(localaccount_lock_);
+ base::AutoLock for_this_block(localaccount_lock_);
checked_for_localaccount_ = true;
}
}
diff --git a/chrome/browser/chromeos/login/google_authenticator.h b/chrome/browser/chromeos/login/google_authenticator.h
index d0651fa..a91c73c 100644
--- a/chrome/browser/chromeos/login/google_authenticator.h
+++ b/chrome/browser/chromeos/login/google_authenticator.h
@@ -20,11 +20,14 @@
// Authenticates a Chromium OS user against the Google Accounts ClientLogin API.
-class Lock;
class Profile;
class GoogleServiceAuthError;
class LoginFailure;
+namespace base {
+class Lock;
+}
+
namespace chromeos {
class GoogleAuthenticatorTest;
@@ -194,8 +197,8 @@
bool try_again_; // True if we're willing to retry the login attempt.
std::string localaccount_;
- bool checked_for_localaccount_; // needed because empty localaccount_ is ok.
- Lock localaccount_lock_; // a lock around checked_for_localaccount_.
+ bool checked_for_localaccount_; // Needed because empty localaccount_ is ok.
+ base::Lock localaccount_lock_; // A lock around checked_for_localaccount_.
friend class GoogleAuthenticatorTest;
FRIEND_TEST_ALL_PREFIXES(GoogleAuthenticatorTest, SaltToAscii);
diff --git a/chrome/browser/chromeos/login/guest_user_view.cc b/chrome/browser/chromeos/login/guest_user_view.cc
index c83d897..0fcc48d 100644
--- a/chrome/browser/chromeos/login/guest_user_view.cc
+++ b/chrome/browser/chromeos/login/guest_user_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/login/guest_user_view.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/login/user_controller.h"
#include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
#include "grit/generated_resources.h"
@@ -64,7 +65,7 @@
submit_button_ = new UserEntryButton(
this,
user_controller_,
- l10n_util::GetString(IDS_ENTER_GUEST_SESSION_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ENTER_GUEST_SESSION_BUTTON)));
AddChildView(submit_button_);
Layout();
SchedulePaint();
diff --git a/chrome/browser/chromeos/login/help_app_launcher.cc b/chrome/browser/chromeos/login/help_app_launcher.cc
index 0fabd79..988e015 100644
--- a/chrome/browser/chromeos/login/help_app_launcher.cc
+++ b/chrome/browser/chromeos/login/help_app_launcher.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "base/file_util.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/login/help_app_launcher.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
@@ -73,7 +74,8 @@
dialog_.reset(new LoginHtmlDialog(
this,
parent_window_,
- l10n_util::GetString(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE),
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE)),
topic_url,
LoginHtmlDialog::STYLE_BUBBLE));
} else {
diff --git a/chrome/browser/chromeos/login/helper.cc b/chrome/browser/chromeos/login/helper.cc
index 2cfc600..14fc92b 100644
--- a/chrome/browser/chromeos/login/helper.cc
+++ b/chrome/browser/chromeos/login/helper.cc
@@ -18,6 +18,7 @@
#include "views/painter.h"
#include "views/screen.h"
#include "views/widget/widget.h"
+#include "views/widget/widget_gtk.h"
namespace chromeos {
@@ -79,23 +80,38 @@
void ThrobberHostView::StartThrobber() {
StopThrobber();
- views::Widget* widget = host_view_->GetWidget();
- if (widget) {
- views::SmoothedThrobber* throbber = CreateDefaultSmoothedThrobber();
- throbber->set_stop_delay_ms(0);
- gfx::Rect throbber_bounds = CalculateThrobberBounds(throbber);
- throbber_widget_ =
- views::Widget::CreatePopupWidget(views::Widget::Transparent,
- views::Widget::NotAcceptEvents,
- views::Widget::DeleteOnDestroy,
- views::Widget::DontMirrorOriginInRTL);
- throbber_bounds.Offset(host_view_->GetScreenBounds().origin());
- throbber_widget_->InitWithWidget(widget, throbber_bounds);
- throbber_widget_->SetContentsView(throbber);
- throbber_widget_->Show();
- throbber->Start();
+ views::Widget* host_widget = host_view_->GetWidget();
+ if (!host_widget) {
+ LOG(WARNING) << "Failed to start the throbber: no Widget";
+ return;
}
+
+ GtkWidget* host_gtk_window = host_widget->GetNativeView();
+ while (host_gtk_window && !GTK_IS_WINDOW(host_gtk_window))
+ host_gtk_window = gtk_widget_get_parent(host_gtk_window);
+ if (!host_gtk_window) {
+ LOG(WARNING) << "Failed to start the throbber: no GtkWindow";
+ return;
+ }
+
+ views::SmoothedThrobber* throbber = CreateDefaultSmoothedThrobber();
+ throbber->set_stop_delay_ms(0);
+ gfx::Rect throbber_bounds = CalculateThrobberBounds(throbber);
+
+ views::WidgetGtk* widget_gtk =
+ new views::WidgetGtk(views::WidgetGtk::TYPE_WINDOW);
+ widget_gtk->make_transient_to_parent();
+ widget_gtk->MakeTransparent();
+ throbber_widget_ = widget_gtk;
+
+ throbber_bounds.Offset(host_view_->GetScreenBounds().origin());
+ throbber_widget_->Init(host_gtk_window, throbber_bounds);
+ throbber_widget_->SetContentsView(throbber);
+ throbber_widget_->Show();
+ // WM can ignore bounds before widget is shown.
+ throbber_widget_->SetBounds(throbber_bounds);
+ throbber->Start();
}
void ThrobberHostView::StopThrobber() {
diff --git a/chrome/browser/chromeos/login/image_downloader.cc b/chrome/browser/chromeos/login/image_downloader.cc
index 943b9e9..4a6c0b5 100644
--- a/chrome/browser/chromeos/login/image_downloader.cc
+++ b/chrome/browser/chromeos/login/image_downloader.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -40,7 +40,7 @@
void ImageDownloader::OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data) {
diff --git a/chrome/browser/chromeos/login/image_downloader.h b/chrome/browser/chromeos/login/image_downloader.h
index 06193bf..31ab2a7 100644
--- a/chrome/browser/chromeos/login/image_downloader.h
+++ b/chrome/browser/chromeos/login/image_downloader.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -31,7 +31,7 @@
// Overriden from URLFetcher::Delegate:
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/chromeos/login/keyboard_switch_menu.cc b/chrome/browser/chromeos/login/keyboard_switch_menu.cc
index ff11bee..62a37cc 100644
--- a/chrome/browser/chromeos/login/keyboard_switch_menu.cc
+++ b/chrome/browser/chromeos/login/keyboard_switch_menu.cc
@@ -49,11 +49,11 @@
input_method_menu().RunMenuAt(new_pt, views::Menu2::ALIGN_TOPLEFT);
}
-std::wstring KeyboardSwitchMenu::GetCurrentKeyboardName() const {
+string16 KeyboardSwitchMenu::GetCurrentKeyboardName() const {
const int count = GetItemCount();
for (int i = 0; i < count; ++i) {
if (IsItemCheckedAt(i))
- return UTF16ToWide(GetLabelAt(i));
+ return GetLabelAt(i);
}
VLOG(1) << "The input method menu is not ready yet. Show a language name "
"that matches the hardware keyboard layout";
diff --git a/chrome/browser/chromeos/login/keyboard_switch_menu.h b/chrome/browser/chromeos/login/keyboard_switch_menu.h
index 48c0982..d2692fc 100644
--- a/chrome/browser/chromeos/login/keyboard_switch_menu.h
+++ b/chrome/browser/chromeos/login/keyboard_switch_menu.h
@@ -35,7 +35,7 @@
virtual void RunMenu(views::View* source, const gfx::Point& pt);
// Returns current keyboard name to be placed on the keyboard menu-button.
- std::wstring GetCurrentKeyboardName() const;
+ string16 GetCurrentKeyboardName() const;
private:
DISALLOW_COPY_AND_ASSIGN(KeyboardSwitchMenu);
diff --git a/chrome/browser/chromeos/login/language_switch_menu.cc b/chrome/browser/chromeos/login/language_switch_menu.cc
index 5e25f23..595515a 100644
--- a/chrome/browser/chromeos/login/language_switch_menu.cc
+++ b/chrome/browser/chromeos/login/language_switch_menu.cc
@@ -47,8 +47,7 @@
// Fill menu items with updated items.
for (int line = 0; line != kLanguageMainMenuSize; line++) {
- menu_model_.AddItem(
- line, WideToUTF16(language_list_->GetLanguageNameAt(line)));
+ menu_model_.AddItem(line, language_list_->GetLanguageNameAt(line));
}
menu_model_.AddSeparator();
menu_model_.AddSubMenuWithStringId(kMoreLanguagesSubMenu,
@@ -57,14 +56,14 @@
for (int line = kLanguageMainMenuSize;
line != language_list_->get_languages_count(); line++) {
menu_model_submenu_.AddItem(
- line, WideToUTF16(language_list_->GetLanguageNameAt(line)));
+ line, language_list_->GetLanguageNameAt(line));
}
// Initialize menu here so it appears fast when called.
menu_.reset(new views::Menu2(&menu_model_));
}
-std::wstring LanguageSwitchMenu::GetCurrentLocaleName() const {
+string16 LanguageSwitchMenu::GetCurrentLocaleName() const {
DCHECK(g_browser_process);
const std::string locale = g_browser_process->GetApplicationLocale();
int index = language_list_->GetIndexFromLocale(locale);
diff --git a/chrome/browser/chromeos/login/language_switch_menu.h b/chrome/browser/chromeos/login/language_switch_menu.h
index cbb562d..6455a1a 100644
--- a/chrome/browser/chromeos/login/language_switch_menu.h
+++ b/chrome/browser/chromeos/login/language_switch_menu.h
@@ -36,7 +36,7 @@
}
// Returns current locale name to be placed on the language menu-button.
- std::wstring GetCurrentLocaleName() const;
+ string16 GetCurrentLocaleName() const;
// Sets the minimum width of the first level menu to be shown.
void SetFirstLevelMenuWidth(int width);
diff --git a/chrome/browser/chromeos/login/login_performer.cc b/chrome/browser/chromeos/login/login_performer.cc
index c37c404..d6ea7d9 100644
--- a/chrome/browser/chromeos/login/login_performer.cc
+++ b/chrome/browser/chromeos/login/login_performer.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/chromeos/boot_times_loader.h"
@@ -373,7 +374,7 @@
<< "ScreenLocker instance doesn't exist.";
DCHECK(last_login_failure_.reason() == LoginFailure::NETWORK_AUTH_FAILED);
- std::wstring msg;
+ string16 msg;
bool sign_out_only = false;
DVLOG(1) << "auth_error: " << last_login_failure_.error().state();
@@ -392,22 +393,22 @@
return;
case GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS:
// Password change detected.
- msg = l10n_util::GetString(IDS_LOGIN_ERROR_PASSWORD_CHANGED);
+ msg = l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_PASSWORD_CHANGED);
break;
case GoogleServiceAuthError::USER_NOT_SIGNED_UP:
case GoogleServiceAuthError::ACCOUNT_DELETED:
case GoogleServiceAuthError::ACCOUNT_DISABLED:
// Access not granted. User has to sign out.
// Show error message using existing screen lock.
- msg = l10n_util::GetString(IDS_LOGIN_ERROR_RESTRICTED);
+ msg = l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_RESTRICTED);
sign_out_only = true;
break;
case GoogleServiceAuthError::CAPTCHA_REQUIRED:
// User is requested to enter CAPTCHA challenge.
- msg = l10n_util::GetString(IDS_LOGIN_ERROR_PASSWORD_CHANGED);
+ msg = l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_PASSWORD_CHANGED);
ScreenLocker::default_screen_locker()->ShowCaptchaAndErrorMessage(
last_login_failure_.error().captcha().image_url,
- msg);
+ UTF16ToWide(msg));
return;
default:
// Unless there's new GoogleServiceAuthError state has been added.
@@ -415,7 +416,8 @@
break;
}
- ScreenLocker::default_screen_locker()->ShowErrorMessage(msg, sign_out_only);
+ ScreenLocker::default_screen_locker()->ShowErrorMessage(UTF16ToWide(msg),
+ sign_out_only);
}
void LoginPerformer::ResolveScreenLocked() {
diff --git a/chrome/browser/chromeos/login/login_screen.cc b/chrome/browser/chromeos/login/login_screen.cc
index 5270b5b..515b7be 100644
--- a/chrome/browser/chromeos/login/login_screen.cc
+++ b/chrome/browser/chromeos/login/login_screen.cc
@@ -124,7 +124,7 @@
void LoginScreen::ShowError(int error_id, const std::string& details) {
ClearErrors();
- std::wstring error_text = l10n_util::GetString(error_id);
+ std::wstring error_text = UTF16ToWide(l10n_util::GetStringUTF16(error_id));
// TODO(dpolukhin): show detailed error info. |details| string contains
// low level error info that is not localized and even is not user friendly.
// For now just ignore it because error_text contains all required information
@@ -135,7 +135,7 @@
BubbleBorder::LEFT_TOP,
ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING),
error_text,
- l10n_util::GetString(IDS_CANT_ACCESS_ACCOUNT_BUTTON),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANT_ACCESS_ACCOUNT_BUTTON)),
this);
}
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 82d8e13..708f2e4 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -366,7 +366,6 @@
switches::kEnableGView,
switches::kNoFirstRun,
switches::kLoginProfile,
- switches::kEnableTabbedOptions,
switches::kCompressSystemFeedback,
switches::kDisableSeccompSandbox,
#if defined(HAVE_XINPUT2)
diff --git a/chrome/browser/chromeos/login/mock_auth_response_handler.h b/chrome/browser/chromeos/login/mock_auth_response_handler.h
index db4651a..7b82cb8 100644
--- a/chrome/browser/chromeos/login/mock_auth_response_handler.h
+++ b/chrome/browser/chromeos/login/mock_auth_response_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -28,7 +28,7 @@
class MockAuthResponseHandler : public AuthResponseHandler {
public:
MockAuthResponseHandler(const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const int code,
const std::string& data);
virtual ~MockAuthResponseHandler() {}
@@ -41,13 +41,13 @@
private:
const GURL remote_;
- const URLRequestStatus status_;
+ const net::URLRequestStatus status_;
const int http_response_code_;
const std::string data_;
static void CompleteFetch(URLFetcher::Delegate* delegate,
const GURL remote,
- const URLRequestStatus status,
+ const net::URLRequestStatus status,
const int http_response_code,
const std::string data);
diff --git a/chrome/browser/chromeos/login/network_screen.cc b/chrome/browser/chromeos/login/network_screen.cc
index 3812181..579687e 100644
--- a/chrome/browser/chromeos/login/network_screen.cc
+++ b/chrome/browser/chromeos/login/network_screen.cc
@@ -157,10 +157,12 @@
network_control->GetScreenBounds(),
BubbleBorder::LEFT_TOP,
ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING),
- l10n_util::GetStringF(IDS_NETWORK_SELECTION_ERROR,
- l10n_util::GetString(IDS_PRODUCT_OS_NAME),
- UTF16ToWide(network_id_)),
- l10n_util::GetString(IDS_NETWORK_SELECTION_ERROR_HELP),
+ UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_NETWORK_SELECTION_ERROR,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME),
+ network_id_)),
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_ERROR_HELP)),
this);
network_control->RequestFocus();
}
diff --git a/chrome/browser/chromeos/login/network_selection_view.cc b/chrome/browser/chromeos/login/network_selection_view.cc
index 6a31e6f..f4eb223 100644
--- a/chrome/browser/chromeos/login/network_selection_view.cc
+++ b/chrome/browser/chromeos/login/network_selection_view.cc
@@ -331,18 +331,19 @@
void NetworkSelectionView::UpdateLocalizedStrings() {
languages_menubutton_->SetText(
- delegate_->language_switch_menu()->GetCurrentLocaleName());
+ UTF16ToWide(delegate_->language_switch_menu()->GetCurrentLocaleName()));
keyboards_menubutton_->SetText(
- delegate_->keyboard_switch_menu()->GetCurrentKeyboardName());
- welcome_label_->SetText(l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE));
+ UTF16ToWide(delegate_->keyboard_switch_menu()->GetCurrentKeyboardName()));
+ welcome_label_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE)));
select_language_label_->SetText(
- l10n_util::GetString(IDS_LANGUAGE_SELECTION_SELECT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LANGUAGE_SELECTION_SELECT)));
select_keyboard_label_->SetText(
- l10n_util::GetString(IDS_KEYBOARD_SELECTION_SELECT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_KEYBOARD_SELECTION_SELECT)));
select_network_label_->SetText(
- l10n_util::GetString(IDS_NETWORK_SELECTION_SELECT));
- proxy_settings_link_->SetText(
- l10n_util::GetString(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_SELECT)));
+ proxy_settings_link_->SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)));
RecreateNativeControls();
UpdateConnectingNetworkLabel();
network_dropdown_->Refresh();
@@ -448,13 +449,14 @@
delete continue_button_;
continue_button_ = new login::WideButton(
delegate_,
- l10n_util::GetString(IDS_NETWORK_SELECTION_CONTINUE_BUTTON));
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_CONTINUE_BUTTON)));
continue_button_->SetEnabled(is_continue_enabled);
}
void NetworkSelectionView::UpdateConnectingNetworkLabel() {
- connecting_network_label_->SetText(l10n_util::GetStringF(
- IDS_NETWORK_SELECTION_CONNECTING, UTF16ToWide(network_id_)));
+ connecting_network_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_NETWORK_SELECTION_CONNECTING, network_id_)));
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/new_user_view.cc b/chrome/browser/chromeos/login/new_user_view.cc
index d340a0b..cd2508c 100644
--- a/chrome/browser/chromeos/login/new_user_view.cc
+++ b/chrome/browser/chromeos/login/new_user_view.cc
@@ -63,14 +63,20 @@
// views::Textfield overrides:
virtual void WillLoseFocus() {
- if (!text().empty()) {
- std::string username = UTF16ToUTF8(text());
+ string16 user_input;
+ bool was_trim = TrimWhitespace(text(), TRIM_ALL, &user_input) != TRIM_NONE;
+ if (!user_input.empty()) {
+ std::string username = UTF16ToUTF8(user_input);
if (username.find('@') == std::string::npos) {
username += kDefaultDomain;
SetText(UTF8ToUTF16(username));
+ was_trim = false;
}
}
+
+ if (was_trim)
+ SetText(user_input);
}
// Overridden from views::View:
@@ -271,23 +277,27 @@
}
void NewUserView::UpdateLocalizedStrings() {
- title_label_->SetText(l10n_util::GetString(IDS_LOGIN_TITLE));
- title_hint_label_->SetText(l10n_util::GetString(IDS_LOGIN_TITLE_HINT));
+ title_label_->SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LOGIN_TITLE)));
+ title_hint_label_->SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LOGIN_TITLE_HINT)));
username_field_->set_text_to_display_when_empty(
l10n_util::GetStringUTF16(IDS_LOGIN_USERNAME));
password_field_->set_text_to_display_when_empty(
l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD));
- sign_in_button_->SetLabel(l10n_util::GetString(IDS_LOGIN_BUTTON));
+ sign_in_button_->SetLabel(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LOGIN_BUTTON)));
if (need_create_account_) {
create_account_link_->SetText(
- l10n_util::GetString(IDS_CREATE_ACCOUNT_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_BUTTON)));
}
if (need_guest_link_) {
- guest_link_->SetText(
- l10n_util::GetString(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON));
+ guest_link_->SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_BUTTON)));
}
delegate_->ClearErrors();
- languages_menubutton_->SetText(language_switch_menu_.GetCurrentLocaleName());
+ languages_menubutton_->SetText(
+ UTF16ToWide(language_switch_menu_.GetCurrentLocaleName()));
}
void NewUserView::OnLocaleChanged() {
@@ -515,12 +525,12 @@
return username_field_->GetScreenBounds();
}
-bool NewUserView::HandleKeystroke(views::Textfield* s,
- const views::Textfield::Keystroke& keystroke) {
+bool NewUserView::HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
if (!CrosLibrary::Get()->EnsureLoaded() || login_in_process_)
return false;
- if (keystroke.GetKeyboardCode() == app::VKEY_RETURN) {
+ if (key_event.GetKeyCode() == app::VKEY_RETURN) {
if (!username_field_->text().empty() && !password_field_->text().empty())
Login();
// Return true so that processing ends
diff --git a/chrome/browser/chromeos/login/new_user_view.h b/chrome/browser/chromeos/login/new_user_view.h
index ee0fd99..d749035 100644
--- a/chrome/browser/chromeos/login/new_user_view.h
+++ b/chrome/browser/chromeos/login/new_user_view.h
@@ -95,8 +95,8 @@
// Overridden from views::Textfield::Controller
// Not thread-safe, by virtue of using SetupSession().
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& keystroke);
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
diff --git a/chrome/browser/chromeos/login/oobe_progress_bar.cc b/chrome/browser/chromeos/login/oobe_progress_bar.cc
index 8fddc40..82b50de 100644
--- a/chrome/browser/chromeos/login/oobe_progress_bar.cc
+++ b/chrome/browser/chromeos/login/oobe_progress_bar.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "gfx/canvas_skia.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -110,7 +111,7 @@
next_x - ix, line_->height());
}
- std::wstring str = l10n_util::GetString(steps_[i]);
+ std::wstring str = UTF16ToWide(l10n_util::GetStringUTF16(steps_[i]));
canvas->DrawStringInt(str, font_, color,
x + kTextPadding, y + dot->height() + kTextPadding,
(next_x - x - 2 * kTextPadding),
diff --git a/chrome/browser/chromeos/login/parallel_authenticator.cc b/chrome/browser/chromeos/login/parallel_authenticator.cc
index 9cb025c..e8bd65a 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator.cc
+++ b/chrome/browser/chromeos/login/parallel_authenticator.cc
@@ -9,11 +9,11 @@
#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/lock.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/sha2.h"
#include "base/string_util.h"
+#include "base/synchronization/lock.h"
#include "base/third_party/nss/blapi.h"
#include "base/third_party/nss/sha256.h"
#include "chrome/browser/browser_thread.h"
@@ -139,7 +139,7 @@
NotificationService::AllSources(),
Details<AuthenticationNotificationDetails>(&details));
{
- AutoLock for_this_block(success_lock_);
+ base::AutoLock for_this_block(success_lock_);
already_reported_success_ = true;
}
consumer_->OnLoginSuccess(current_state_->username,
@@ -167,7 +167,7 @@
void ParallelAuthenticator::CheckLocalaccount(const LoginFailure& error) {
{
- AutoLock for_this_block(localaccount_lock_);
+ base::AutoLock for_this_block(localaccount_lock_);
VLOG(2) << "Checking localaccount";
if (!checked_for_localaccount_) {
BrowserThread::PostDelayedTask(
@@ -335,7 +335,7 @@
// the 'changed password' path when we know doing so won't succeed.
case NEED_NEW_PW:
{
- AutoLock for_this_block(success_lock_);
+ base::AutoLock for_this_block(success_lock_);
if (!already_reported_success_) {
// This allows us to present the same behavior for "online:
// fail, offline: ok", regardless of the order in which we
@@ -548,7 +548,7 @@
void ParallelAuthenticator::LoadLocalaccount(const std::string& filename) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
{
- AutoLock for_this_block(localaccount_lock_);
+ base::AutoLock for_this_block(localaccount_lock_);
if (checked_for_localaccount_)
return;
}
@@ -570,7 +570,7 @@
void ParallelAuthenticator::SetLocalaccount(const std::string& new_name) {
localaccount_ = new_name;
{ // extra braces for clarity about AutoLock scope.
- AutoLock for_this_block(localaccount_lock_);
+ base::AutoLock for_this_block(localaccount_lock_);
checked_for_localaccount_ = true;
}
}
diff --git a/chrome/browser/chromeos/login/parallel_authenticator.h b/chrome/browser/chromeos/login/parallel_authenticator.h
index 997f252..4db578f 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator.h
+++ b/chrome/browser/chromeos/login/parallel_authenticator.h
@@ -24,10 +24,13 @@
#include "chrome/common/net/gaia/gaia_auth_consumer.h"
class GaiaAuthFetcher;
-class Lock;
class LoginFailure;
class Profile;
+namespace base {
+class Lock;
+}
+
namespace chromeos {
class LoginStatusConsumer;
@@ -256,12 +259,12 @@
// This allows us to present the same behavior to the caller, regardless
// of the order in which we receive these results.
bool already_reported_success_;
- Lock success_lock_; // a lock around already_reported_success_.
+ base::Lock success_lock_; // A lock around already_reported_success_.
// Status relating to the local "backdoor" account.
std::string localaccount_;
- bool checked_for_localaccount_; // needed because empty localaccount_ is ok.
- Lock localaccount_lock_; // a lock around checked_for_localaccount_.
+ bool checked_for_localaccount_; // Needed because empty localaccount_ is ok.
+ base::Lock localaccount_lock_; // A lock around checked_for_localaccount_.
friend class ResolveChecker;
friend class ParallelAuthenticatorTest;
diff --git a/chrome/browser/chromeos/login/password_changed_view.cc b/chrome/browser/chromeos/login/password_changed_view.cc
index 5a1d2d0..3c3b835 100644
--- a/chrome/browser/chromeos/login/password_changed_view.cc
+++ b/chrome/browser/chromeos/login/password_changed_view.cc
@@ -59,7 +59,8 @@
}
std::wstring PasswordChangedView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_DIALOG_BOX_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_DIALOG_BOX_TITLE));
}
gfx::Size PasswordChangedView::GetPreferredSize() {
@@ -86,22 +87,26 @@
// Create controls
title_label_ = new Label();
title_label_->SetFont(title_font);
- title_label_->SetText(l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_TITLE));
+ title_label_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_TITLE)));
title_label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
description_label_ = new Label();
description_label_->SetText(
- l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_DESC));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_DESC)));
description_label_->SetMultiLine(true);
description_label_->SetHorizontalAlignment(Label::ALIGN_LEFT);
full_sync_radio_ = new RadioButton(
- l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_RESET), 0);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_RESET)),
+ 0);
full_sync_radio_->set_listener(this);
full_sync_radio_->SetMultiLine(true);
delta_sync_radio_ = new RadioButton(
- l10n_util::GetString(IDS_LOGIN_PASSWORD_CHANGED_MIGRATE), 0);
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LOGIN_PASSWORD_CHANGED_MIGRATE)),
+ 0);
delta_sync_radio_->set_listener(this);
delta_sync_radio_->SetMultiLine(true);
diff --git a/chrome/browser/chromeos/login/password_changed_view.h b/chrome/browser/chromeos/login/password_changed_view.h
index 706e53b..32de8fa 100644
--- a/chrome/browser/chromeos/login/password_changed_view.h
+++ b/chrome/browser/chromeos/login/password_changed_view.h
@@ -62,8 +62,8 @@
const views::Event& event);
// views::Textfield::Controller overrides:
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke) {
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& keystroke) {
return false;
}
virtual void ContentsChanged(views::Textfield* sender,
diff --git a/chrome/browser/chromeos/login/registration_screen.cc b/chrome/browser/chromeos/login/registration_screen.cc
index 2cc4325..617d5b6 100644
--- a/chrome/browser/chromeos/login/registration_screen.cc
+++ b/chrome/browser/chromeos/login/registration_screen.cc
@@ -43,7 +43,7 @@
ChildProcessSecurityPolicy::GetInstance()->RegisterWebSafeScheme(
chrome::kCrosScheme);
- URLRequestFilter::GetInstance()->AddHostnameHandler(
+ net::URLRequestFilter::GetInstance()->AddHostnameHandler(
chrome::kCrosScheme,
kRegistrationHostnameUrl,
&RegistrationScreen::Factory);
diff --git a/chrome/browser/chromeos/login/registration_screen.h b/chrome/browser/chromeos/login/registration_screen.h
index 0ae0b71..ed9279e 100644
--- a/chrome/browser/chromeos/login/registration_screen.h
+++ b/chrome/browser/chromeos/login/registration_screen.h
@@ -76,7 +76,7 @@
// Sets the url for registration host page. Used in tests.
static void set_registration_host_page_url(const GURL& url);
- // Handler factory for URLRequestFilter::AddHostnameHandler.
+ // Handler factory for net::URLRequestFilter::AddHostnameHandler.
static net::URLRequestJob* Factory(net::URLRequest* request,
const std::string& scheme);
diff --git a/chrome/browser/chromeos/login/screen_lock_view.cc b/chrome/browser/chromeos/login/screen_lock_view.cc
index 7b3f4ea..0e9aa50 100644
--- a/chrome/browser/chromeos/login/screen_lock_view.cc
+++ b/chrome/browser/chromeos/login/screen_lock_view.cc
@@ -187,11 +187,11 @@
screen_locker_->Signout();
}
-bool ScreenLockView::HandleKeystroke(
+bool ScreenLockView::HandleKeyEvent(
views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke) {
+ const views::KeyEvent& key_event) {
screen_locker_->ClearErrors();
- if (keystroke.GetKeyboardCode() == app::VKEY_RETURN) {
+ if (key_event.GetKeyCode() == app::VKEY_RETURN) {
screen_locker_->Authenticate(password_field_->text());
return true;
}
diff --git a/chrome/browser/chromeos/login/screen_lock_view.h b/chrome/browser/chromeos/login/screen_lock_view.h
index 1e3916e..d57b30c 100644
--- a/chrome/browser/chromeos/login/screen_lock_view.h
+++ b/chrome/browser/chromeos/login/screen_lock_view.h
@@ -60,8 +60,8 @@
// views::Textfield::Controller implementation:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents) {}
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& keystroke);
// UserView::Delegate implementation:
virtual void OnSignout();
diff --git a/chrome/browser/chromeos/login/screen_locker.cc b/chrome/browser/chromeos/login/screen_locker.cc
index 0a3ef83..09de9ef 100644
--- a/chrome/browser/chromeos/login/screen_locker.cc
+++ b/chrome/browser/chromeos/login/screen_locker.cc
@@ -759,17 +759,18 @@
// Don't enable signout button here as we're showing
// MessageBubble.
- std::wstring msg = l10n_util::GetString(IDS_LOGIN_ERROR_AUTHENTICATING);
+ string16 msg = l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_AUTHENTICATING);
const std::string error_text = error.GetErrorString();
if (!error_text.empty())
- msg += L"\n" + ASCIIToWide(error_text);
+ msg += ASCIIToUTF16("\n") + ASCIIToUTF16(error_text);
InputMethodLibrary* input_method_library =
CrosLibrary::Get()->GetInputMethodLibrary();
if (input_method_library->GetNumActiveInputMethods() > 1)
- msg += L"\n" + l10n_util::GetString(IDS_LOGIN_ERROR_KEYBOARD_SWITCH_HINT);
+ msg += ASCIIToUTF16("\n") +
+ l10n_util::GetStringUTF16(IDS_LOGIN_ERROR_KEYBOARD_SWITCH_HINT);
- ShowErrorBubble(msg, BubbleBorder::BOTTOM_LEFT);
+ ShowErrorBubble(UTF16ToWide(msg), BubbleBorder::BOTTOM_LEFT);
}
void ScreenLocker::OnLoginSuccess(
@@ -872,6 +873,7 @@
void ScreenLocker::Signout() {
if (!error_info_) {
UserMetrics::RecordAction(UserMetricsAction("ScreenLocker_Signout"));
+ WmIpc::instance()->NotifyAboutSignout();
if (CrosLibrary::Get()->EnsureLoaded()) {
CrosLibrary::Get()->GetLoginLibrary()->StopSession("");
}
diff --git a/chrome/browser/chromeos/login/screen_locker_tester.cc b/chrome/browser/chromeos/login/screen_locker_tester.cc
index d139fda..387dbe2 100644
--- a/chrome/browser/chromeos/login/screen_locker_tester.cc
+++ b/chrome/browser/chromeos/login/screen_locker_tester.cc
@@ -46,9 +46,8 @@
event->key.keyval = GDK_Return;
views::KeyEvent key_event(&event->key);
- views::Textfield::Keystroke ret(&key_event);
- ScreenLocker::screen_locker_->screen_lock_view_->HandleKeystroke(pass, ret);
-
+ ScreenLocker::screen_locker_->screen_lock_view_->HandleKeyEvent(
+ pass, key_event);
gdk_event_free(event);
}
diff --git a/chrome/browser/chromeos/login/signed_settings.cc b/chrome/browser/chromeos/login/signed_settings.cc
index 8e400e4..58bce4b 100644
--- a/chrome/browser/chromeos/login/signed_settings.cc
+++ b/chrome/browser/chromeos/login/signed_settings.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
+#include "chrome/browser/chromeos/login/authenticator.h"
#include "chrome/browser/chromeos/login/ownership_service.h"
#include "chrome/browser/chromeos/login/signed_settings_temp_storage.h"
@@ -108,7 +109,7 @@
const std::string& email,
SignedSettings::Delegate<bool>* d) {
DCHECK(d != NULL);
- return new CheckWhitelistOp(email, d);
+ return new CheckWhitelistOp(Authenticator::Canonicalize(email), d);
}
// static
@@ -117,7 +118,9 @@
bool add_to_whitelist,
SignedSettings::Delegate<bool>* d) {
DCHECK(d != NULL);
- return new WhitelistOp(email, add_to_whitelist, d);
+ return new WhitelistOp(Authenticator::Canonicalize(email),
+ add_to_whitelist,
+ d);
}
// static
@@ -169,8 +172,10 @@
return;
}
if (return_code == OwnerManager::SUCCESS) {
+ VLOG(2) << "Whitelist check was successful.";
d_->OnSettingsOpCompleted(SUCCESS, true);
} else {
+ VLOG(2) << "Whitelist check failed.";
d_->OnSettingsOpCompleted(SignedSettings::MapKeyOpCode(return_code), false);
}
}
diff --git a/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc b/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc
index df8ad6c..e760d78 100644
--- a/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc
+++ b/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc
@@ -39,7 +39,7 @@
public SignedSettingsHelper::TestDelegate {
public:
SignedSettingsHelperTest()
- : fake_email_("fakey"),
+ : fake_email_("fakey@example.com"),
fake_prop_("prop_name"),
fake_value_("stub"),
message_loop_(MessageLoop::TYPE_UI),
diff --git a/chrome/browser/chromeos/login/signed_settings_unittest.cc b/chrome/browser/chromeos/login/signed_settings_unittest.cc
index f3d4a13..d7c8a18 100644
--- a/chrome/browser/chromeos/login/signed_settings_unittest.cc
+++ b/chrome/browser/chromeos/login/signed_settings_unittest.cc
@@ -63,7 +63,7 @@
class SignedSettingsTest : public ::testing::Test {
public:
SignedSettingsTest()
- : fake_email_("fakey"),
+ : fake_email_("fakey@example.com"),
fake_prop_("prop_name"),
fake_value_("stub"),
message_loop_(MessageLoop::TYPE_UI),
diff --git a/chrome/browser/chromeos/login/update_view.cc b/chrome/browser/chromeos/login/update_view.cc
index fc07489..7a56be2 100644
--- a/chrome/browser/chromeos/login/update_view.cc
+++ b/chrome/browser/chromeos/login/update_view.cc
@@ -8,6 +8,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
#include "chrome/browser/chromeos/login/update_screen.h"
@@ -105,12 +106,15 @@
}
void UpdateView::UpdateLocalizedStrings() {
- installing_updates_label_->SetText(
- l10n_util::GetStringF(IDS_INSTALLING_UPDATE,
- l10n_util::GetString(IDS_PRODUCT_OS_NAME)));
- reboot_label_->SetText(l10n_util::GetString(IDS_INSTALLING_UPDATE_DESC));
- manual_reboot_label_->SetText(l10n_util::GetString(IDS_UPDATE_COMPLETED));
- checking_label_->SetText(l10n_util::GetString(IDS_CHECKING_FOR_UPDATES));
+ installing_updates_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_INSTALLING_UPDATE,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME))));
+ reboot_label_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTALLING_UPDATE_DESC)));
+ manual_reboot_label_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPDATE_COMPLETED)));
+ checking_label_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CHECKING_FOR_UPDATES)));
}
void UpdateView::AddProgress(int ticks) {
diff --git a/chrome/browser/chromeos/login/user_controller.cc b/chrome/browser/chromeos/login/user_controller.cc
index 888803a..d5d14dd 100644
--- a/chrome/browser/chromeos/login/user_controller.cc
+++ b/chrome/browser/chromeos/login/user_controller.cc
@@ -192,9 +192,9 @@
std::wstring UserController::GetNameTooltip() const {
if (is_new_user_)
- return l10n_util::GetString(IDS_ADD_USER);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_ADD_USER));
if (is_guest_)
- return l10n_util::GetString(IDS_GO_INCOGNITO_BUTTON);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_GO_INCOGNITO_BUTTON));
// Tooltip contains user's display name and his email domain to distinguish
// this user from the other one with the same display name.
@@ -415,12 +415,12 @@
kUnselectedUsernameFontDelta, gfx::Font::BOLD);
std::wstring text;
if (is_guest_) {
- text = l10n_util::GetString(IDS_GUEST);
+ text = UTF16ToWide(l10n_util::GetStringUTF16(IDS_GUEST));
} else if (is_new_user_) {
// Add user should have label only in activated state.
// When new user is the only, label is not needed.
if (type == WM_IPC_WINDOW_LOGIN_LABEL && index != 0)
- text = l10n_util::GetString(IDS_ADD_USER);
+ text = UTF16ToWide(l10n_util::GetStringUTF16(IDS_ADD_USER));
} else {
text = UTF8ToWide(user_.GetDisplayName());
}
diff --git a/chrome/browser/chromeos/login/user_controller_unittest.cc b/chrome/browser/chromeos/login/user_controller_unittest.cc
index 379e4fe..3cf7ce4 100644
--- a/chrome/browser/chromeos/login/user_controller_unittest.cc
+++ b/chrome/browser/chromeos/login/user_controller_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/chromeos/login/user_controller.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/login/user_manager.h"
#include "grit/generated_resources.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -13,11 +14,11 @@
TEST(UserControllerTest, GetNameTooltip) {
UserController guest_user_controller(NULL, false);
- EXPECT_EQ(l10n_util::GetString(IDS_ADD_USER),
+ EXPECT_EQ(UTF16ToWide(l10n_util::GetStringUTF16(IDS_ADD_USER)),
guest_user_controller.GetNameTooltip());
UserController new_user_controller(NULL, true);
- EXPECT_EQ(l10n_util::GetString(IDS_GO_INCOGNITO_BUTTON),
+ EXPECT_EQ(UTF16ToWide(l10n_util::GetStringUTF16(IDS_GO_INCOGNITO_BUTTON)),
new_user_controller.GetNameTooltip());
UserManager::User existing_user;
diff --git a/chrome/browser/chromeos/login/user_image_downloader.cc b/chrome/browser/chromeos/login/user_image_downloader.cc
index 2efa796..b3da66a 100644
--- a/chrome/browser/chromeos/login/user_image_downloader.cc
+++ b/chrome/browser/chromeos/login/user_image_downloader.cc
@@ -57,12 +57,13 @@
UserImageDownloader::~UserImageDownloader() {
}
-void UserImageDownloader::OnURLFetchComplete(const URLFetcher* source,
- const GURL& url,
- const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) {
+void UserImageDownloader::OnURLFetchComplete(
+ const URLFetcher* source,
+ const GURL& url,
+ const net::URLRequestStatus& status,
+ int response_code,
+ const ResponseCookies& cookies,
+ const std::string& data) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
if (response_code != 200) {
LOG(ERROR) << "Response code is " << response_code;
diff --git a/chrome/browser/chromeos/login/user_image_downloader.h b/chrome/browser/chromeos/login/user_image_downloader.h
index 5eba206..d5dacc4 100644
--- a/chrome/browser/chromeos/login/user_image_downloader.h
+++ b/chrome/browser/chromeos/login/user_image_downloader.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -37,7 +37,7 @@
// Overriden from URLFetcher::Delegate:
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/chromeos/login/user_image_screen.h b/chrome/browser/chromeos/login/user_image_screen.h
index c17a585..9a3fef8 100644
--- a/chrome/browser/chromeos/login/user_image_screen.h
+++ b/chrome/browser/chromeos/login/user_image_screen.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_CHROMEOS_LOGIN_USER_IMAGE_SCREEN_H_
#pragma once
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/chromeos/login/camera.h"
#include "chrome/browser/chromeos/login/user_image_view.h"
#include "chrome/browser/chromeos/login/view_screen.h"
diff --git a/chrome/browser/chromeos/login/user_image_view.cc b/chrome/browser/chromeos/login/user_image_view.cc
index 5ef45a6..b8545cf 100644
--- a/chrome/browser/chromeos/login/user_image_view.cc
+++ b/chrome/browser/chromeos/login/user_image_view.cc
@@ -9,6 +9,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/callback.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
#include "chrome/browser/chromeos/login/wizard_accessibility_helper.h"
@@ -87,7 +88,7 @@
void SetErrorState() {
HideThrobber();
- SetMessage(l10n_util::GetString(IDS_USER_IMAGE_NO_VIDEO));
+ SetMessage(UTF16ToWide(l10n_util::GetStringUTF16(IDS_USER_IMAGE_NO_VIDEO)));
SetImage(
ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_USER_IMAGE_NO_VIDEO));
@@ -168,8 +169,8 @@
&BorderDefinition::kScreenBorder);
set_background(views::Background::CreateBackgroundPainter(true, painter));
- title_label_ =
- new views::Label(l10n_util::GetString(IDS_USER_IMAGE_SCREEN_TITLE));
+ title_label_ = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_USER_IMAGE_SCREEN_TITLE)));
title_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
title_label_->SetMultiLine(true);
CorrectLabelFontSize(title_label_);
@@ -188,10 +189,12 @@
ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_USER_IMAGE_CAPTURE_DISABLED));
- ok_button_ = new login::WideButton(this, l10n_util::GetString(IDS_OK));
+ ok_button_ = new login::WideButton(
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK)));
ok_button_->SetEnabled(!is_capturing_);
- skip_button_ = new login::WideButton(this, l10n_util::GetString(IDS_SKIP));
+ skip_button_ = new login::WideButton(
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_SKIP)));
skip_button_->SetEnabled(true);
InitLayout();
diff --git a/chrome/browser/chromeos/login/user_view.cc b/chrome/browser/chromeos/login/user_view.cc
index e359251..980f107 100644
--- a/chrome/browser/chromeos/login/user_view.cc
+++ b/chrome/browser/chromeos/login/user_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
#include "chrome/browser/chromeos/login/rounded_view.h"
@@ -75,12 +76,12 @@
const gfx::Font& font = rb.GetFont(ResourceBundle::SmallFont);
active_user_label_ = new views::Label(
- l10n_util::GetString(IDS_SCREEN_LOCK_ACTIVE_USER));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_ACTIVE_USER)));
active_user_label_->SetFont(font);
active_user_label_->SetColor(kTextColor);
signout_link_ = new views::Link(
- l10n_util::GetString(IDS_SCREEN_LOCK_SIGN_OUT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_SCREEN_LOCK_SIGN_OUT)));
signout_link_->SetController(link_controller);
signout_link_->SetFont(font);
signout_link_->SetColor(kTextColor);
@@ -282,7 +283,7 @@
remove_button_ = new RemoveButton(
this,
*rb.GetBitmapNamed(IDR_CLOSE_BAR_H),
- l10n_util::GetString(IDS_LOGIN_REMOVE),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_REMOVE)),
gfx::Point(kUserImageSize - kRemoveButtonPadding, kRemoveButtonPadding));
remove_button_->SetVisible(false);
AddChildView(remove_button_);
@@ -332,7 +333,8 @@
}
void UserView::OnLocaleChanged() {
- remove_button_->SetText(l10n_util::GetString(IDS_LOGIN_REMOVE));
+ remove_button_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOGIN_REMOVE)));
}
} // namespace chromeos
diff --git a/chrome/browser/chromeos/login/web_page_view.cc b/chrome/browser/chromeos/login/web_page_view.cc
index 2d5e4de..1bd24ac 100644
--- a/chrome/browser/chromeos/login/web_page_view.cc
+++ b/chrome/browser/chromeos/login/web_page_view.cc
@@ -10,6 +10,7 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/chromeos/login/helper.h"
#include "chrome/browser/chromeos/login/rounded_rect_painter.h"
@@ -116,7 +117,8 @@
AddChildView(throbber_);
connecting_label_ = new views::Label();
- connecting_label_->SetText(l10n_util::GetString(IDS_LOAD_STATE_CONNECTING));
+ connecting_label_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LOAD_STATE_CONNECTING)));
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
connecting_label_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
connecting_label_->SetVisible(false);
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
index 7d8121b..af8301a 100644
--- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
+++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/login/account_screen.h"
#include "chrome/browser/chromeos/login/eula_view.h"
@@ -80,13 +81,15 @@
EXPECT_EQ("en-US", g_browser_process->GetApplicationLocale());
EXPECT_STREQ("en", icu::Locale::getDefault().getLanguage());
EXPECT_FALSE(base::i18n::IsRTL());
- const std::wstring en_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE);
+ const std::wstring en_str =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE));
chromeos::LanguageSwitchMenu::SwitchLanguage("fr");
EXPECT_EQ("fr", g_browser_process->GetApplicationLocale());
EXPECT_STREQ("fr", icu::Locale::getDefault().getLanguage());
EXPECT_FALSE(base::i18n::IsRTL());
- const std::wstring fr_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE);
+ const std::wstring fr_str =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE));
EXPECT_NE(en_str, fr_str);
@@ -94,7 +97,8 @@
EXPECT_EQ("ar", g_browser_process->GetApplicationLocale());
EXPECT_STREQ("ar", icu::Locale::getDefault().getLanguage());
EXPECT_TRUE(base::i18n::IsRTL());
- const std::wstring ar_str = l10n_util::GetString(IDS_NETWORK_SELECTION_TITLE);
+ const std::wstring ar_str =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_TITLE));
EXPECT_NE(fr_str, ar_str);
}
diff --git a/chrome/browser/chromeos/notifications/balloon_collection_impl.h b/chrome/browser/chromeos/notifications/balloon_collection_impl.h
index 03496df..320bfd6 100644
--- a/chrome/browser/chromeos/notifications/balloon_collection_impl.h
+++ b/chrome/browser/chromeos/notifications/balloon_collection_impl.h
@@ -66,6 +66,7 @@
virtual void RemoveAll();
virtual bool HasSpace() const;
virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size);
+ virtual void SetPositionPreference(PositionPreference position) {}
virtual void DisplayChanged() {}
virtual void OnBalloonClosed(Balloon* source);
virtual const Balloons& GetActiveBalloons() { return base_.balloons(); }
diff --git a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc
index 377828b..9a77680 100644
--- a/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc
+++ b/chrome/browser/chromeos/notifications/desktop_notifications_unittest.cc
@@ -7,6 +7,7 @@
#include "base/stringprintf.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/render_messages_params.h"
+#include "chrome/test/testing_pref_service.h"
namespace chromeos {
@@ -77,7 +78,8 @@
void DesktopNotificationsTest::SetUp() {
profile_.reset(new TestingProfile());
balloon_collection_ = new MockBalloonCollection();
- ui_manager_.reset(new NotificationUIManager());
+ ui_manager_.reset(
+ new NotificationUIManager(profile_->GetTestingPrefService()));
ui_manager_->Initialize(balloon_collection_);
balloon_collection_->set_space_change_listener(ui_manager_.get());
service_.reset(new DesktopNotificationService(profile(), ui_manager_.get()));
@@ -86,8 +88,8 @@
void DesktopNotificationsTest::TearDown() {
service_.reset(NULL);
- profile_.reset(NULL);
ui_manager_.reset(NULL);
+ profile_.reset(NULL);
}
ViewHostMsg_ShowNotification_Params
diff --git a/chrome/browser/chromeos/options/internet_page_view.cc b/chrome/browser/chromeos/options/internet_page_view.cc
index bf5d77e..880ac05 100644
--- a/chrome/browser/chromeos/options/internet_page_view.cc
+++ b/chrome/browser/chromeos/options/internet_page_view.cc
@@ -179,28 +179,28 @@
if (button_flags & FORGET_BUTTON) {
views::NativeButton* button = new views::NativeButton(this,
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_FORGET));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_FORGET)));
button->set_tag(id + kButtonIdOffset * FORGET_BUTTON);
layout_->AddView(button, 1, 2);
}
if (button_flags & DISCONNECT_BUTTON) {
- views::NativeButton* button = new views::NativeButton(this,
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_DISCONNECT));
+ views::NativeButton* button = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_DISCONNECT)));
button->set_tag(id + kButtonIdOffset * DISCONNECT_BUTTON);
layout_->AddView(button, 1, 2);
}
if (button_flags & CONNECT_BUTTON) {
views::NativeButton* button = new views::NativeButton(this,
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_CONNECT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_CONNECT)));
button->set_tag(id + kButtonIdOffset * CONNECT_BUTTON);
layout_->AddView(button, 1, 2);
}
if (button_flags & OPTIONS_BUTTON) {
views::NativeButton* button = new views::NativeButton(this,
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_OPTIONS));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OPTIONS)));
button->set_tag(id + kButtonIdOffset * OPTIONS_BUTTON);
layout_->AddView(button, 1, 2);
}
@@ -254,8 +254,8 @@
*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED));
}
- std::wstring name =
- l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET);
+ std::wstring name = UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET));
int s = IDS_STATUSBAR_NETWORK_DEVICE_DISABLED;
if (cros->ethernet_connecting())
@@ -264,7 +264,7 @@
s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED;
else if (cros->ethernet_enabled())
s = IDS_STATUSBAR_NETWORK_DEVICE_DISCONNECTED;
- std::wstring status = l10n_util::GetString(s);
+ std::wstring status = UTF16ToWide(l10n_util::GetStringUTF16(s));
int flags = cros->ethernet_connected() ? OPTIONS_BUTTON : 0;
bool bold = cros->ethernet_connected() ? true : false;
@@ -399,7 +399,7 @@
s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTING;
else if (connected)
s = IDS_STATUSBAR_NETWORK_DEVICE_CONNECTED;
- std::wstring status = l10n_util::GetString(s);
+ std::wstring status = UTF16ToWide(l10n_util::GetStringUTF16(s));
int flags = 0;
if (connected) {
diff --git a/chrome/browser/chromeos/options/language_chewing_config_view.cc b/chrome/browser/chromeos/options/language_chewing_config_view.cc
index 0d1f31a..4aae92d 100644
--- a/chrome/browser/chromeos/options/language_chewing_config_view.cc
+++ b/chrome/browser/chromeos/options/language_chewing_config_view.cc
@@ -115,14 +115,14 @@
std::wstring LanguageChewingConfigView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_OK);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK));
}
return L"";
}
std::wstring LanguageChewingConfigView::GetWindowTitle() const {
- return l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTINGS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_CHEWING_SETTINGS_TITLE));
}
gfx::Size LanguageChewingConfigView::GetPreferredSize() {
@@ -153,8 +153,8 @@
for (size_t i = 0; i < language_prefs::kNumChewingBooleanPrefs; ++i) {
chewing_boolean_checkboxes_[i] = new views::Checkbox(
- l10n_util::GetString(
- language_prefs::kChewingBooleanPrefs[i].message_id));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ language_prefs::kChewingBooleanPrefs[i].message_id)));
chewing_boolean_checkboxes_[i]->set_listener(this);
chewing_boolean_checkboxes_[i]->set_tag(i);
}
@@ -185,8 +185,8 @@
for (size_t i = 0; i < language_prefs::kNumChewingIntegerPrefs; ++i) {
layout->StartRow(0, kColumnSetId);
layout->AddView(new views::Label(
- l10n_util::GetString(
- language_prefs::kChewingIntegerPrefs[i].message_id)));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ language_prefs::kChewingIntegerPrefs[i].message_id))));
layout->AddView(chewing_integer_sliders_[i]);
}
NotifyPrefChanged();
diff --git a/chrome/browser/chromeos/options/language_config_model.cc b/chrome/browser/chromeos/options/language_config_model.cc
index 0335fa2..cd400e5 100644
--- a/chrome/browser/chromeos/options/language_config_model.cc
+++ b/chrome/browser/chromeos/options/language_config_model.cc
@@ -38,7 +38,7 @@
return l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX);
}
- return WideToUTF16Hack(GetLanguageNameAt(GetLanguageIndex(index)));
+ return GetLanguageNameAt(GetLanguageIndex(index));
}
int AddLanguageComboboxModel::GetLanguageIndex(int index) const {
diff --git a/chrome/browser/chromeos/options/language_config_util.h b/chrome/browser/chromeos/options/language_config_util.h
index 6f262cf..808fefc 100644
--- a/chrome/browser/chromeos/options/language_config_util.h
+++ b/chrome/browser/chromeos/options/language_config_util.h
@@ -51,7 +51,7 @@
// Gets a label for the combobox like "Input mode". This function is NOT part
// of the ComboboxModel interface.
std::wstring GetLabel() const {
- return l10n_util::GetString(pref_data_->label_message_id);
+ return UTF16ToWide(l10n_util::GetStringUTF16(pref_data_->label_message_id));
}
// Gets a config value for the ibus configuration daemon (e.g. "KUTEN_TOUTEN",
diff --git a/chrome/browser/chromeos/options/language_config_view.cc b/chrome/browser/chromeos/options/language_config_view.cc
index d4b1f62..5e6716a 100644
--- a/chrome/browser/chromeos/options/language_config_view.cc
+++ b/chrome/browser/chromeos/options/language_config_view.cc
@@ -180,14 +180,14 @@
std::wstring LanguageConfigView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_DONE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE));
}
return L"";
}
std::wstring LanguageConfigView::GetWindowTitle() const {
- return l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_LANGUAGES_DIALOG_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_DIALOG_TITLE));
}
void LanguageConfigView::Layout() {
@@ -236,14 +236,14 @@
right_container_->Layout();
}
-std::wstring LanguageConfigView::GetText(int row, int column_id) {
+string16 LanguageConfigView::GetText(int row, int column_id) {
if (row >= 0 && row < static_cast<int>(
model_.num_preferred_language_codes())) {
return input_method::GetLanguageDisplayNameFromCode(
model_.preferred_language_code_at(row));
}
NOTREACHED();
- return L"";
+ return string16();
}
void LanguageConfigView::SetObserver(TableModelObserver* observer) {
@@ -413,7 +413,7 @@
// Create the language table.
std::vector<TableColumn> columns;
TableColumn column(0,
- l10n_util::GetString(
+ l10n_util::GetStringUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_LANGUAGES),
TableColumn::LEFT, -1, 0);
columns.push_back(column);
@@ -466,8 +466,8 @@
// Create the remove button.
remove_language_button_ = new views::NativeButton(
- this, l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_LANGUAGES_REMOVE_BUTTON));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_REMOVE_BUTTON)));
remove_language_button_->set_tag(kRemoveLanguageButton);
// Add the add and remove buttons.
@@ -530,14 +530,14 @@
if (application_locale == language_code) {
layout->AddView(
new views::Label(
- l10n_util::GetStringF(
+ UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_IS_DISPLAYED_IN_THIS_LANGUAGE,
- l10n_util::GetString(IDS_PRODUCT_OS_NAME))));
+ l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME)))));
} else {
UiLanguageButton* button = new UiLanguageButton(
- this, l10n_util::GetStringF(
+ this, UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_OPTIONS_SETTINGS_LANGUAGES_DISPLAY_IN_THIS_LANGUAGE,
- l10n_util::GetString(IDS_PRODUCT_OS_NAME)),
+ l10n_util::GetStringUTF16(IDS_PRODUCT_OS_NAME))),
language_code);
button->set_tag(kChangeUiLanguageButton);
layout->AddView(button);
@@ -549,8 +549,8 @@
views::GridLayout* layout) {
// Create the input method title label.
views::Label* input_method_title_label = new views::Label(
- l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_LANGUAGES_INPUT_METHOD));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_INPUT_METHOD)));
input_method_title_label->SetFont(
input_method_title_label->font().DeriveFont(0, gfx::Font::BOLD));
@@ -587,7 +587,8 @@
if (input_method_config_view_map_.count(input_method_id) > 0) {
InputMethodButton* button = new InputMethodButton(
this,
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_CONFIGURE),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_CONFIGURE)),
input_method_id);
button->set_tag(kConfigureInputMethodButton);
layout->AddView(button);
diff --git a/chrome/browser/chromeos/options/language_config_view.h b/chrome/browser/chromeos/options/language_config_view.h
index a7dd980..f625f03 100644
--- a/chrome/browser/chromeos/options/language_config_view.h
+++ b/chrome/browser/chromeos/options/language_config_view.h
@@ -11,6 +11,7 @@
#include <string>
#include "app/table_model.h"
+#include "base/compiler_specific.h"
#include "chrome/browser/chromeos/options/language_config_model.h"
#include "chrome/browser/views/options/options_page_view.h"
#include "views/controls/button/native_button.h"
@@ -64,9 +65,9 @@
// LanguageConfigView class, rather than a separate class.
// TODO(satorux): Implement TableModel as a separate class once the bug
// is fixed.
- virtual std::wstring GetText(int row, int column_id);
- virtual void SetObserver(TableModelObserver* observer);
- virtual int RowCount();
+ virtual string16 GetText(int row, int column_id) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
+ virtual int RowCount() OVERRIDE;
// views::Combobox::Listener overrides:
virtual void ItemChanged(views::Combobox* combobox,
diff --git a/chrome/browser/chromeos/options/language_hangul_config_view.cc b/chrome/browser/chromeos/options/language_hangul_config_view.cc
index e65569b..a7f0b70 100644
--- a/chrome/browser/chromeos/options/language_hangul_config_view.cc
+++ b/chrome/browser/chromeos/options/language_hangul_config_view.cc
@@ -111,14 +111,14 @@
std::wstring LanguageHangulConfigView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_OK);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK));
}
return L"";
}
std::wstring LanguageHangulConfigView::GetWindowTitle() const {
- return l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_HANGUL_SETTINGS_TITLE));
}
gfx::Size LanguageHangulConfigView::GetPreferredSize() {
@@ -150,8 +150,8 @@
layout->StartRow(0, kColumnSetId);
// Settings for the Hangul IME.
- layout->AddView(new views::Label(
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_KEYBOARD_LAYOUT_TEXT)));
+ layout->AddView(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_KEYBOARD_LAYOUT_TEXT))));
hangul_keyboard_combobox_
= new views::Combobox(hangul_keyboard_combobox_model_.get());
diff --git a/chrome/browser/chromeos/options/language_mozc_config_view.cc b/chrome/browser/chromeos/options/language_mozc_config_view.cc
index 13d5267..16ffe1c 100644
--- a/chrome/browser/chromeos/options/language_mozc_config_view.cc
+++ b/chrome/browser/chromeos/options/language_mozc_config_view.cc
@@ -122,14 +122,14 @@
std::wstring LanguageMozcConfigView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_OK);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK));
}
return L"";
}
std::wstring LanguageMozcConfigView::GetWindowTitle() const {
- return l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SETTINGS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_SETTINGS_TITLE));
}
gfx::Size LanguageMozcConfigView::GetPreferredSize() {
@@ -166,8 +166,9 @@
for (size_t i = 0; i < language_prefs::kNumMozcBooleanPrefs; ++i) {
MozcPrefAndAssociatedCheckbox& current = prefs_and_checkboxes_[i];
- current.checkbox = new views::Checkbox(
- l10n_util::GetString(language_prefs::kMozcBooleanPrefs[i].message_id));
+ current.checkbox = new views::Checkbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(
+ language_prefs::kMozcBooleanPrefs[i].message_id)));
current.checkbox->set_listener(this);
current.checkbox->set_tag(i);
}
@@ -190,8 +191,8 @@
NotifyPrefChanged(); // Sync the comboboxes with current Chrome prefs.
reset_to_defaults_button_ = new views::NativeButton(
- this, l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_RESET_TO_DEFAULTS_BUTTON));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_MOZC_RESET_TO_DEFAULTS_BUTTON)));
reset_to_defaults_button_->set_tag(kResetToDefaultsButton);
layout->StartRow(0, kColumnSetId);
layout->AddView(reset_to_defaults_button_);
@@ -213,8 +214,8 @@
const MozcPrefAndAssociatedSlider& current = prefs_and_sliders_[i];
layout->StartRow(0, kColumnSetId);
layout->AddView(new views::Label(
- l10n_util::GetString(
- language_prefs::kMozcIntegerPrefs[i].message_id)));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ language_prefs::kMozcIntegerPrefs[i].message_id))));
layout->AddView(current.slider);
}
NotifyPrefChanged(); // Sync the slider with current Chrome prefs.
diff --git a/chrome/browser/chromeos/options/language_pinyin_config_view.cc b/chrome/browser/chromeos/options/language_pinyin_config_view.cc
index 881d31a..ce627b0 100644
--- a/chrome/browser/chromeos/options/language_pinyin_config_view.cc
+++ b/chrome/browser/chromeos/options/language_pinyin_config_view.cc
@@ -76,14 +76,14 @@
std::wstring LanguagePinyinConfigView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_OK);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK));
}
return L"";
}
std::wstring LanguagePinyinConfigView::GetWindowTitle() const {
- return l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTINGS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_PINYIN_SETTINGS_TITLE));
}
gfx::Size LanguagePinyinConfigView::GetPreferredSize() {
@@ -115,8 +115,8 @@
for (size_t i = 0; i < language_prefs::kNumPinyinBooleanPrefs; ++i) {
pinyin_boolean_checkboxes_[i] = new views::Checkbox(
- l10n_util::GetString(
- language_prefs::kPinyinBooleanPrefs[i].message_id));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ language_prefs::kPinyinBooleanPrefs[i].message_id)));
pinyin_boolean_checkboxes_[i]->set_listener(this);
pinyin_boolean_checkboxes_[i]->set_tag(i);
}
diff --git a/chrome/browser/chromeos/options/network_config_view.cc b/chrome/browser/chromeos/options/network_config_view.cc
index c35be1a..45c1ec3 100644
--- a/chrome/browser/chromeos/options/network_config_view.cc
+++ b/chrome/browser/chromeos/options/network_config_view.cc
@@ -31,7 +31,8 @@
NetworkConfigView::NetworkConfigView()
: browser_mode_(true),
- title_(l10n_util::GetString(IDS_OPTIONS_SETTINGS_OTHER_NETWORKS)),
+ title_(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_OTHER_NETWORKS))),
wificonfig_view_(new WifiConfigView(this)),
delegate_(NULL) {
}
@@ -43,7 +44,7 @@
std::wstring NetworkConfigView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK)
- return l10n_util::GetString(IDS_OPTIONS_SETTINGS_CONNECT);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_CONNECT));
return std::wstring();
}
diff --git a/chrome/browser/chromeos/options/options_window_view.cc b/chrome/browser/chromeos/options/options_window_view.cc
index 087a09a..320bec6 100644
--- a/chrome/browser/chromeos/options/options_window_view.cc
+++ b/chrome/browser/chromeos/options/options_window_view.cc
@@ -213,8 +213,9 @@
// OptionsWindowView, views::DialogDelegate implementation:
std::wstring OptionsWindowView::GetWindowTitle() const {
- return l10n_util::GetStringF(IDS_OPTIONS_DIALOG_TITLE,
- l10n_util::GetString(IDS_PRODUCT_NAME));
+ return UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_DIALOG_TITLE,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
}
void OptionsWindowView::WindowClosing() {
@@ -300,30 +301,35 @@
system_page->set_background(views::Background::CreateSolidBackground(
SK_ColorWHITE));
tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_OPTIONS_SYSTEM_TAB_LABEL),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SYSTEM_TAB_LABEL)),
system_page, false);
InternetPageView* internet_page = new InternetPageView(profile_);
internet_page->set_background(views::Background::CreateSolidBackground(
SK_ColorWHITE));
tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_OPTIONS_INTERNET_TAB_LABEL),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_INTERNET_TAB_LABEL)),
internet_page, false);
tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_OPTIONS_GENERAL_TAB_LABEL),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_GENERAL_TAB_LABEL)),
new GtkPreferencePageHost(
general_page_.get_page_widget()),
false);
tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_OPTIONS_CONTENT_TAB_LABEL),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CONTENT_TAB_LABEL)),
new GtkPreferencePageHost(
content_page_.get_page_widget()),
false);
tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_OPTIONS_ADVANCED_TAB_LABEL),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_ADVANCED_TAB_LABEL)),
new GtkPreferencePageHost(
advanced_page_.get_page_widget()),
false);
diff --git a/chrome/browser/chromeos/options/settings_page_view.cc b/chrome/browser/chromeos/options/settings_page_view.cc
index 84d9654..b4b9d73 100644
--- a/chrome/browser/chromeos/options/settings_page_view.cc
+++ b/chrome/browser/chromeos/options/settings_page_view.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "gfx/skia_utils_gtk.h"
#include "views/controls/label.h"
#include "views/fill_layout.h"
@@ -66,7 +67,7 @@
layout->StartRow(0, single_column_layout_id);
views::Label* title_label = new views::Label(
- l10n_util::GetString(title_msg_id_));
+ UTF16ToWide(l10n_util::GetStringUTF16(title_msg_id_)));
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
gfx::Font title_font =
rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD);
diff --git a/chrome/browser/chromeos/options/system_page_view.cc b/chrome/browser/chromeos/options/system_page_view.cc
index 5920f82..a314679 100644
--- a/chrome/browser/chromeos/options/system_page_view.cc
+++ b/chrome/browser/chromeos/options/system_page_view.cc
@@ -192,8 +192,8 @@
timezone_combobox_->set_listener(this);
layout->StartRow(0, double_column_view_set_id());
- layout->AddView(new views::Label(
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION)));
+ layout->AddView(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SETTINGS_TIMEZONE_DESCRIPTION))));
layout->AddView(timezone_combobox_);
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
@@ -265,8 +265,9 @@
}
void TouchpadSection::InitContents(GridLayout* layout) {
- enable_tap_to_click_checkbox_ = new views::Checkbox(l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_TAP_TO_CLICK_ENABLED_DESCRIPTION));
+ enable_tap_to_click_checkbox_ =
+ new views::Checkbox(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_TAP_TO_CLICK_ENABLED_DESCRIPTION)));
enable_tap_to_click_checkbox_->set_listener(this);
enable_tap_to_click_checkbox_->SetMultiLine(true);
// Create sensitivity slider with values between 1 and 5 step 1
@@ -277,8 +278,8 @@
this);
layout->StartRow(0, double_column_view_set_id());
- layout->AddView(new views::Label(
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_SENSITIVITY_DESCRIPTION)));
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_SENSITIVITY_DESCRIPTION))));
layout->AddView(sensitivity_slider_);
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, single_column_view_set_id());
@@ -359,7 +360,8 @@
layout->StartRow(0, double_column_view_set_id());
views::NativeButton* customize_languages_button = new views::NativeButton(
this,
- l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_CUSTOMIZE));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_CUSTOMIZE)));
customize_languages_button->set_tag(kCustomizeLanguagesButton);
xkb_modifier_combobox_ = new views::Combobox(&xkb_modifier_combobox_model_);
@@ -474,8 +476,9 @@
}
void AccessibilitySection::InitContents(GridLayout* layout) {
- accessibility_checkbox_ = new views::Checkbox(l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION));
+ accessibility_checkbox_ =
+ new views::Checkbox(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_ACCESSIBILITY_DESCRIPTION)));
accessibility_checkbox_->set_listener(this);
accessibility_checkbox_->SetMultiLine(true);
diff --git a/chrome/browser/chromeos/options/wifi_config_view.cc b/chrome/browser/chromeos/options/wifi_config_view.cc
index 91473c6..9b8fdd8 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.cc
+++ b/chrome/browser/chromeos/options/wifi_config_view.cc
@@ -137,7 +137,7 @@
id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_BAD_CREDENTIALS;
}
if (id != kNoError) {
- error_label_->SetText(l10n_util::GetString(id));
+ error_label_->SetText(UTF16ToWide(l10n_util::GetStringUTF16(id)));
error_label_->SetVisible(true);
} else {
error_label_->SetVisible(false);
@@ -149,11 +149,10 @@
UpdateCanLogin();
}
-bool WifiConfigView::HandleKeystroke(
- views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke) {
+bool WifiConfigView::HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
if (sender == passphrase_textfield_ &&
- keystroke.GetKeyboardCode() == app::VKEY_RETURN) {
+ key_event.GetKeyCode() == app::VKEY_RETURN) {
parent_->GetDialogClientView()->AcceptWindow();
}
return false;
@@ -300,8 +299,8 @@
// SSID input
layout->StartRow(0, column_view_set_id);
- layout->AddView(new views::Label(l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID)));
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_NETWORK_ID))));
if (!wifi_.get()) {
ssid_textfield_ = new views::Textfield(views::Textfield::STYLE_DEFAULT);
ssid_textfield_->SetController(this);
@@ -326,8 +325,8 @@
if (wifi_.get() && wifi_->encrypted() &&
wifi_->encryption() == SECURITY_8021X) {
layout->StartRow(0, column_view_set_id);
- layout->AddView(new views::Label(l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY)));
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_IDENTITY))));
identity_textfield_ = new views::Textfield(
views::Textfield::STYLE_DEFAULT);
identity_textfield_->SetController(this);
@@ -336,15 +335,15 @@
layout->AddView(identity_textfield_);
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, column_view_set_id);
- layout->AddView(new views::Label(l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT)));
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT))));
if (!wifi_->cert_path().empty()) {
certificate_path_ = wifi_->cert_path();
certificate_loaded = wifi_->IsCertificateLoaded();
}
if (certificate_loaded) {
- std::wstring label = l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_INSTALLED);
+ std::wstring label = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_INSTALLED));
views::Label* cert_text = new views::Label(label);
cert_text->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->AddView(cert_text);
@@ -353,8 +352,8 @@
if (!certificate_path_.empty())
label = UTF8ToWide(certificate_path_);
else
- label = l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_BUTTON);
+ label = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_CERT_BUTTON));
certificate_browse_button_ = new views::NativeButton(this, label);
layout->AddView(certificate_browse_button_);
}
@@ -364,8 +363,8 @@
// Security select
if (!wifi_.get()) {
layout->StartRow(0, column_view_set_id);
- layout->AddView(new views::Label(l10n_util::GetString(
- IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY)));
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_SECURITY))));
security_combobox_ = new views::Combobox(new SecurityComboboxModel());
security_combobox_->set_listener(this);
layout->AddView(security_combobox_);
@@ -381,7 +380,8 @@
} else {
label_text_id = IDS_OPTIONS_SETTINGS_INTERNET_OPTIONS_PASSPHRASE;
}
- layout->AddView(new views::Label(l10n_util::GetString(label_text_id)));
+ layout->AddView(new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(label_text_id))));
passphrase_textfield_ = new views::Textfield(
views::Textfield::STYLE_PASSWORD);
passphrase_textfield_->SetController(this);
diff --git a/chrome/browser/chromeos/options/wifi_config_view.h b/chrome/browser/chromeos/options/wifi_config_view.h
index beeb5af..6dbe70e 100644
--- a/chrome/browser/chromeos/options/wifi_config_view.h
+++ b/chrome/browser/chromeos/options/wifi_config_view.h
@@ -41,8 +41,8 @@
// views::Textfield::Controller methods.
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event);
// views::ButtonListener
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
diff --git a/chrome/browser/chromeos/panels/panel_scroller.cc b/chrome/browser/chromeos/panels/panel_scroller.cc
index a568341..b2c5b3c 100644
--- a/chrome/browser/chromeos/panels/panel_scroller.cc
+++ b/chrome/browser/chromeos/panels/panel_scroller.cc
@@ -1,6 +1,6 @@
-// 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.
+// 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 "chrome/browser/chromeos/panels/panel_scroller.h"
@@ -27,7 +27,7 @@
ALLOW_THIS_IN_INITIALIZER_LIST(animation_(this)),
animated_scroll_begin_(0),
animated_scroll_end_(0) {
- animation_.SetTweenType(Tween::EASE_IN_OUT);
+ animation_.SetTweenType(ui::Tween::EASE_IN_OUT);
animation_.SetSlideDuration(300);
Panel* panel = new Panel;
@@ -238,7 +238,7 @@
animation_.Show();
}
-void PanelScroller::AnimationProgressed(const Animation* animation) {
+void PanelScroller::AnimationProgressed(const ui::Animation* animation) {
scroll_pos_ = static_cast<int>(
static_cast<double>(animated_scroll_end_ - animated_scroll_begin_) *
animation_.GetCurrentValue()) + animated_scroll_begin_;
diff --git a/chrome/browser/chromeos/panels/panel_scroller.h b/chrome/browser/chromeos/panels/panel_scroller.h
index 366bc5a..e4d7eab 100644
--- a/chrome/browser/chromeos/panels/panel_scroller.h
+++ b/chrome/browser/chromeos/panels/panel_scroller.h
@@ -8,14 +8,14 @@
#include <vector>
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "base/basictypes.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/view.h"
class PanelScrollerHeader;
-class PanelScroller : public views::View, public AnimationDelegate {
+class PanelScroller : public views::View, public ui::AnimationDelegate {
public:
PanelScroller();
~PanelScroller();
@@ -39,8 +39,8 @@
private:
struct Panel;
- // AnimationDelegate overrides.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate overrides.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Scrolls to the panel at the given index. It will be moved to the top.
void ScrollToPanel(int index);
@@ -56,7 +56,7 @@
// The current scroll position.
int scroll_pos_;
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
// When animating a scroll, these indicate the beginning and ending of the
// scroll. The scroll_pos_ always indicates the current one.
diff --git a/chrome/browser/chromeos/pulse_audio_mixer.h b/chrome/browser/chromeos/pulse_audio_mixer.h
index 33f7c1c..f01e738 100644
--- a/chrome/browser/chromeos/pulse_audio_mixer.h
+++ b/chrome/browser/chromeos/pulse_audio_mixer.h
@@ -10,7 +10,7 @@
#include "base/callback.h"
#include "base/lock.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
struct pa_context;
struct pa_cvolume;
diff --git a/chrome/browser/chromeos/setting_level_bubble.cc b/chrome/browser/chromeos/setting_level_bubble.cc
index 22aeced..8395673 100644
--- a/chrome/browser/chromeos/setting_level_bubble.cc
+++ b/chrome/browser/chromeos/setting_level_bubble.cc
@@ -67,7 +67,7 @@
view_(NULL),
animation_(this) {
animation_.SetSlideDuration(kAnimationDurationMs);
- animation_.SetTweenType(Tween::LINEAR);
+ animation_.SetTweenType(ui::Tween::LINEAR);
}
void SettingLevelBubble::ShowBubble(int percent) {
@@ -136,16 +136,16 @@
view_ = NULL;
}
-void SettingLevelBubble::AnimationEnded(const Animation* animation) {
+void SettingLevelBubble::AnimationEnded(const ui::Animation* animation) {
previous_percent_ = current_percent_;
}
-void SettingLevelBubble::AnimationProgressed(const Animation* animation) {
+void SettingLevelBubble::AnimationProgressed(const ui::Animation* animation) {
if (view_) {
view_->Update(
- Tween::ValueBetween(animation->GetCurrentValue(),
- previous_percent_,
- current_percent_));
+ ui::Tween::ValueBetween(animation->GetCurrentValue(),
+ previous_percent_,
+ current_percent_));
}
}
diff --git a/chrome/browser/chromeos/setting_level_bubble.h b/chrome/browser/chromeos/setting_level_bubble.h
index 262bbdc..9cc43d9 100644
--- a/chrome/browser/chromeos/setting_level_bubble.h
+++ b/chrome/browser/chromeos/setting_level_bubble.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_CHROMEOS_SETTING_LEVEL_BUBBLE_H_
#pragma once
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "base/basictypes.h"
#include "base/timer.h"
#include "chrome/browser/views/info_bubble.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
class SkBitmap;
@@ -21,7 +21,7 @@
// Singleton class controlling a bubble displaying a level-based setting like
// volume or brightness.
class SettingLevelBubble : public InfoBubbleDelegate,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
void ShowBubble(int percent);
void HideBubble();
@@ -41,9 +41,9 @@
virtual bool CloseOnEscape() { return true; }
virtual bool FadeInOnShow() { return false; }
- // Overridden from AnimationDelegate.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Previous and current percentages, or -1 if not yet shown.
int previous_percent_;
@@ -61,7 +61,7 @@
// Its contents view, owned by InfoBubble.
SettingLevelBubbleView* view_;
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
base::OneShotTimer<SettingLevelBubble> timeout_timer_;
DISALLOW_COPY_AND_ASSIGN(SettingLevelBubble);
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.cc b/chrome/browser/chromeos/status/network_dropdown_button.cc
index 3b74333..8244df4 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.cc
+++ b/chrome/browser/chromeos/status/network_dropdown_button.cc
@@ -26,14 +26,15 @@
NetworkDropdownButton::NetworkDropdownButton(bool browser_mode,
gfx::NativeWindow parent_window)
: DropDownButton(NULL,
- l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_STATUSBAR_NO_NETWORKS_MESSAGE)),
this,
true),
browser_mode_(browser_mode),
ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)),
parent_window_(parent_window) {
animation_connecting_.SetThrobDuration(kThrobDuration);
- animation_connecting_.SetTweenType(Tween::EASE_IN_OUT);
+ animation_connecting_.SetTweenType(ui::Tween::EASE_IN_OUT);
CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this);
// The initial state will be updated on Refresh.
// See network_selection_view.cc.
@@ -44,9 +45,10 @@
}
////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, AnimationDelegate implementation:
+// NetworkMenuButton, ui::AnimationDelegate implementation:
-void NetworkDropdownButton::AnimationProgressed(const Animation* animation) {
+void NetworkDropdownButton::AnimationProgressed(
+ const ui::Animation* animation) {
if (animation == &animation_connecting_) {
SetIcon(IconForNetworkConnecting(animation_connecting_.GetCurrentValue(),
true));
@@ -79,7 +81,8 @@
animation_connecting_.Stop();
if (active_network->type() == TYPE_ETHERNET) {
SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED));
- SetText(l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET));
+ SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)));
} else if (active_network->type() == TYPE_WIFI) {
const WifiNetwork* wifi =
static_cast<const WifiNetwork*>(active_network);
@@ -108,12 +111,14 @@
if (!cros->Connected() && !cros->Connecting()) {
animation_connecting_.Stop();
SetIcon(SkBitmap());
- SetText(l10n_util::GetString(IDS_NETWORK_SELECTION_NONE));
+ SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_NETWORK_SELECTION_NONE)));
}
} else {
animation_connecting_.Stop();
SetIcon(SkBitmap());
- SetText(l10n_util::GetString(IDS_STATUSBAR_NO_NETWORKS_MESSAGE));
+ SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_STATUSBAR_NO_NETWORKS_MESSAGE)));
}
SchedulePaint();
diff --git a/chrome/browser/chromeos/status/network_dropdown_button.h b/chrome/browser/chromeos/status/network_dropdown_button.h
index 68ac84f..8a9ac7a 100644
--- a/chrome/browser/chromeos/status/network_dropdown_button.h
+++ b/chrome/browser/chromeos/status/network_dropdown_button.h
@@ -6,11 +6,11 @@
#define CHROME_BROWSER_CHROMEOS_STATUS_NETWORK_DROPDOWN_BUTTON_H_
#pragma once
-#include "app/animation_delegate.h"
-#include "app/throb_animation.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/status/network_menu.h"
#include "chrome/browser/chromeos/views/dropdown_button.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/throb_animation.h"
namespace chromeos {
@@ -25,8 +25,8 @@
NetworkDropdownButton(bool browser_mode, gfx::NativeWindow parent_window);
virtual ~NetworkDropdownButton();
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// NetworkLibrary::NetworkManagerObserver implementation.
virtual void OnNetworkManagerChanged(NetworkLibrary* obj);
@@ -45,7 +45,7 @@
bool browser_mode_;
// The throb animation that does the wifi connecting animation.
- ThrobAnimation animation_connecting_;
+ ui::ThrobAnimation animation_connecting_;
// The duration of the icon throbbing in milliseconds.
static const int kThrobDuration;
diff --git a/chrome/browser/chromeos/status/network_menu.cc b/chrome/browser/chromeos/status/network_menu.cc
index 9d206cd..c09594d 100644
--- a/chrome/browser/chromeos/status/network_menu.cc
+++ b/chrome/browser/chromeos/status/network_menu.cc
@@ -82,8 +82,8 @@
NetworkMenu::NetworkMenu()
: min_width_(-1) {
- use_settings_ui_ = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions);
+ use_settings_ui_ = !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions);
network_menu_.reset(NetworkMenuUI::CreateMenu2(this));
}
diff --git a/chrome/browser/chromeos/status/network_menu_button.cc b/chrome/browser/chromeos/status/network_menu_button.cc
index 2beb02a..7e7bdd0 100644
--- a/chrome/browser/chromeos/status/network_menu_button.cc
+++ b/chrome/browser/chromeos/status/network_menu_button.cc
@@ -33,7 +33,7 @@
host_(host),
ALLOW_THIS_IN_INITIALIZER_LIST(animation_connecting_(this)) {
animation_connecting_.SetThrobDuration(kThrobDuration);
- animation_connecting_.SetTweenType(Tween::EASE_IN_OUT);
+ animation_connecting_.SetTweenType(ui::Tween::EASE_IN_OUT);
OnNetworkManagerChanged(CrosLibrary::Get()->GetNetworkLibrary());
CrosLibrary::Get()->GetNetworkLibrary()->AddNetworkManagerObserver(this);
CrosLibrary::Get()->GetNetworkLibrary()->AddCellularDataPlanObserver(this);
@@ -47,9 +47,9 @@
}
////////////////////////////////////////////////////////////////////////////////
-// NetworkMenuButton, AnimationDelegate implementation:
+// NetworkMenuButton, ui::AnimationDelegate implementation:
-void NetworkMenuButton::AnimationProgressed(const Animation* animation) {
+void NetworkMenuButton::AnimationProgressed(const ui::Animation* animation) {
if (animation == &animation_connecting_) {
SetIcon(IconForNetworkConnecting(animation_connecting_.GetCurrentValue(),
false));
@@ -121,8 +121,8 @@
if (!cros || !CrosLibrary::Get()->EnsureLoaded()) {
SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0));
SetBadge(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_WARNING));
- SetTooltipText(l10n_util::GetString(
- IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP));
+ SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP)));
return;
}
@@ -130,8 +130,8 @@
animation_connecting_.Stop();
SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_BARS0));
SetBadge(*rb.GetBitmapNamed(IDR_STATUSBAR_NETWORK_DISCONNECTED));
- SetTooltipText(l10n_util::GetString(
- IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP));
+ SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_STATUSBAR_NETWORK_NO_NETWORK_TOOLTIP)));
return;
}
@@ -150,11 +150,10 @@
wireless = cros->cellular_network();
SetBadge(BadgeForNetworkTechnology(cros->cellular_network()));
}
- SetTooltipText(
- l10n_util::GetStringF(wireless->configuring() ?
- IDS_STATUSBAR_NETWORK_CONFIGURING_TOOLTIP :
- IDS_STATUSBAR_NETWORK_CONNECTING_TOOLTIP,
- UTF8ToWide(wireless->name())));
+ SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16(
+ wireless->configuring() ? IDS_STATUSBAR_NETWORK_CONFIGURING_TOOLTIP
+ : IDS_STATUSBAR_NETWORK_CONNECTING_TOOLTIP,
+ UTF8ToUTF16(wireless->name()))));
} else {
// Stop connecting animation since we are not connecting.
animation_connecting_.Stop();
@@ -164,24 +163,25 @@
SetIcon(*rb.GetBitmapNamed(IDR_STATUSBAR_WIRED));
SetBadge(SkBitmap());
SetTooltipText(
- l10n_util::GetStringF(
+ UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP,
- l10n_util::GetString(IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET)));
+ l10n_util::GetStringUTF16(
+ IDS_STATUSBAR_NETWORK_DEVICE_ETHERNET))));
} else if (network->type() == TYPE_WIFI) {
const WifiNetwork* wifi = static_cast<const WifiNetwork*>(network);
SetIcon(IconForNetworkStrength(wifi, false));
SetBadge(SkBitmap());
- SetTooltipText(l10n_util::GetStringF(
+ SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP,
- UTF8ToWide(wifi->name())));
+ UTF8ToUTF16(wifi->name()))));
} else if (network->type() == TYPE_CELLULAR) {
const CellularNetwork* cellular =
static_cast<const CellularNetwork*>(network);
SetIcon(IconForNetworkStrength(cellular, false));
SetBadge(BadgeForNetworkTechnology(cellular));
- SetTooltipText(l10n_util::GetStringF(
+ SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_STATUSBAR_NETWORK_CONNECTED_TOOLTIP,
- UTF8ToWide(cellular->name())));
+ UTF8ToUTF16(cellular->name()))));
}
}
}
diff --git a/chrome/browser/chromeos/status/network_menu_button.h b/chrome/browser/chromeos/status/network_menu_button.h
index 76c3dce..12ae6c2 100644
--- a/chrome/browser/chromeos/status/network_menu_button.h
+++ b/chrome/browser/chromeos/status/network_menu_button.h
@@ -8,11 +8,11 @@
#include <string>
-#include "app/throb_animation.h"
#include "base/timer.h"
#include "chrome/browser/chromeos/cros/network_library.h"
#include "chrome/browser/chromeos/status/network_menu.h"
#include "chrome/browser/chromeos/status/status_area_button.h"
+#include "ui/base/animation/throb_animation.h"
namespace gfx {
class Canvas;
@@ -55,8 +55,8 @@
explicit NetworkMenuButton(StatusAreaHost* host);
virtual ~NetworkMenuButton();
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// NetworkLibrary::NetworkManagerObserver implementation.
virtual void OnNetworkManagerChanged(NetworkLibrary* cros);
@@ -93,7 +93,7 @@
SkBitmap badge_;
// The throb animation that does the wifi connecting animation.
- ThrobAnimation animation_connecting_;
+ ui::ThrobAnimation animation_connecting_;
// The duration of the icon throbbing in milliseconds.
static const int kThrobDuration;
diff --git a/chrome/browser/chromeos/system_key_event_listener.cc b/chrome/browser/chromeos/system_key_event_listener.cc
index 2df12dd..8e5bd41 100644
--- a/chrome/browser/chromeos/system_key_event_listener.cc
+++ b/chrome/browser/chromeos/system_key_event_listener.cc
@@ -10,6 +10,7 @@
#include "chrome/browser/chromeos/audio_handler.h"
#include "chrome/browser/chromeos/brightness_bubble.h"
#include "chrome/browser/chromeos/volume_bubble.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "third_party/cros/chromeos_wm_ipc_enums.h"
namespace chromeos {
@@ -89,14 +90,20 @@
if (!(xevent->xkey.state & (Mod1Mask | ShiftMask | ControlMask))) {
if ((keycode == listener->key_f8_) ||
(keycode == listener->key_volume_mute_)) {
+ if (keycode == listener->key_f8_)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_VolumeMute_F8"));
listener->OnVolumeMute();
return GDK_FILTER_REMOVE;
} else if ((keycode == listener->key_f9_) ||
keycode == listener->key_volume_down_) {
+ if (keycode == listener->key_f9_)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_VolumeDown_F9"));
listener->OnVolumeDown();
return GDK_FILTER_REMOVE;
} else if ((keycode == listener->key_f10_) ||
(keycode == listener->key_volume_up_)) {
+ if (keycode == listener->key_f10_)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_VolumeUp_F10"));
listener->OnVolumeUp();
return GDK_FILTER_REMOVE;
}
diff --git a/chrome/browser/chromeos/version_loader.cc b/chrome/browser/chromeos/version_loader.cc
index 2e0bb11..3cb8eb3 100644
--- a/chrome/browser/chromeos/version_loader.cc
+++ b/chrome/browser/chromeos/version_loader.cc
@@ -11,7 +11,7 @@
#include "base/message_loop.h"
#include "base/string_split.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/chromeos/wm_ipc.cc b/chrome/browser/chromeos/wm_ipc.cc
index aa09dd7..3e856f3 100644
--- a/chrome/browser/chromeos/wm_ipc.cc
+++ b/chrome/browser/chromeos/wm_ipc.cc
@@ -163,6 +163,11 @@
values);
}
+void WmIpc::NotifyAboutSignout() {
+ Message msg(chromeos::WM_IPC_MESSAGE_WM_NOTIFY_SIGNING_OUT);
+ SendMessage(msg);
+}
+
WmIpc::WmIpc() {
scoped_array<char*> names(new char*[kNumAtoms]);
scoped_array<Atom> atoms(new Atom[kNumAtoms]);
diff --git a/chrome/browser/chromeos/wm_ipc.h b/chrome/browser/chromeos/wm_ipc.h
index a0c8abd..a8bfeb5 100644
--- a/chrome/browser/chromeos/wm_ipc.h
+++ b/chrome/browser/chromeos/wm_ipc.h
@@ -115,6 +115,9 @@
// the user is currently logged in or not.
void SetLoggedInProperty(bool logged_in);
+ // Sends a message to the window manager notifying it that we're signing out.
+ void NotifyAboutSignout();
+
private:
friend struct base::DefaultLazyInstanceTraits<WmIpc>;
diff --git a/chrome/browser/chromeos/wm_overview_controller.h b/chrome/browser/chromeos/wm_overview_controller.h
index d5999b5..f5f5348 100644
--- a/chrome/browser/chromeos/wm_overview_controller.h
+++ b/chrome/browser/chromeos/wm_overview_controller.h
@@ -20,7 +20,6 @@
class Widget;
}
-class Animation;
class Browser;
class RenderWidgetHost;
diff --git a/chrome/browser/content_exceptions_table_model.cc b/chrome/browser/content_exceptions_table_model.cc
index ee92157..6eecfaa 100644
--- a/chrome/browser/content_exceptions_table_model.cc
+++ b/chrome/browser/content_exceptions_table_model.cc
@@ -100,23 +100,23 @@
return static_cast<int>(entries_.size() + off_the_record_entries_.size());
}
-std::wstring ContentExceptionsTableModel::GetText(int row, int column_id) {
+string16 ContentExceptionsTableModel::GetText(int row, int column_id) {
HostContentSettingsMap::PatternSettingPair entry = entry_at(row);
switch (column_id) {
case IDS_EXCEPTIONS_PATTERN_HEADER:
- return UTF8ToWide(entry.first.AsString());
+ return UTF8ToUTF16(entry.first.AsString());
case IDS_EXCEPTIONS_ACTION_HEADER:
switch (entry.second) {
case CONTENT_SETTING_ALLOW:
- return l10n_util::GetString(IDS_EXCEPTIONS_ALLOW_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON);
case CONTENT_SETTING_BLOCK:
- return l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON);
case CONTENT_SETTING_ASK:
- return l10n_util::GetString(IDS_EXCEPTIONS_ASK_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ASK_BUTTON);
case CONTENT_SETTING_SESSION_ONLY:
- return l10n_util::GetString(IDS_EXCEPTIONS_SESSION_ONLY_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_SESSION_ONLY_BUTTON);
default:
NOTREACHED();
}
@@ -126,7 +126,7 @@
NOTREACHED();
}
- return std::wstring();
+ return string16();
}
void ContentExceptionsTableModel::SetObserver(TableModelObserver* observer) {
diff --git a/chrome/browser/content_exceptions_table_model.h b/chrome/browser/content_exceptions_table_model.h
index e01250b..a8371fe 100644
--- a/chrome/browser/content_exceptions_table_model.h
+++ b/chrome/browser/content_exceptions_table_model.h
@@ -9,6 +9,7 @@
#include <string>
#include "app/table_model.h"
+#include "base/compiler_specific.h"
#include "base/ref_counted.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_types.h"
@@ -53,9 +54,9 @@
bool is_off_the_record);
// TableModel overrides:
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
- virtual void SetObserver(TableModelObserver* observer);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column_id) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
private:
HostContentSettingsMap* map(bool is_off_the_record) {
diff --git a/chrome/browser/crash_handler_host_linux.cc b/chrome/browser/crash_handler_host_linux.cc
index 196352a..a22ff95 100644
--- a/chrome/browser/crash_handler_host_linux.cc
+++ b/chrome/browser/crash_handler_host_linux.cc
@@ -22,7 +22,7 @@
#include "base/singleton.h"
#include "base/string_util.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "breakpad/src/client/linux/handler/exception_handler.h"
#include "breakpad/src/client/linux/minidump_writer/linux_dumper.h"
#include "breakpad/src/client/linux/minidump_writer/minidump_writer.h"
diff --git a/chrome/browser/custom_home_pages_table_model.cc b/chrome/browser/custom_home_pages_table_model.cc
index f7c9a92..f63cf79 100644
--- a/chrome/browser/custom_home_pages_table_model.cc
+++ b/chrome/browser/custom_home_pages_table_model.cc
@@ -30,7 +30,7 @@
GURL url;
// Page title. If this is empty, we'll display the URL as the entry.
- std::wstring title;
+ string16 title;
// Icon for the page.
SkBitmap icon;
@@ -130,7 +130,7 @@
return static_cast<int>(entries_.size());
}
-std::wstring CustomHomePagesTableModel::GetText(int row, int column_id) {
+string16 CustomHomePagesTableModel::GetText(int row, int column_id) {
DCHECK(column_id == 0);
DCHECK(row >= 0 && row < RowCount());
return entries_[row].title.empty() ? FormattedURL(row) : entries_[row].title;
@@ -141,10 +141,10 @@
return entries_[row].icon.isNull() ? *default_favicon_ : entries_[row].icon;
}
-std::wstring CustomHomePagesTableModel::GetTooltip(int row) {
- return entries_[row].title.empty() ? std::wstring() :
- l10n_util::GetStringF(IDS_OPTIONS_STARTUP_PAGE_TOOLTIP,
- entries_[row].title, FormattedURL(row));
+string16 CustomHomePagesTableModel::GetTooltip(int row) {
+ return entries_[row].title.empty() ? string16() :
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_STARTUP_PAGE_TOOLTIP,
+ entries_[row].title, FormattedURL(row));
}
void CustomHomePagesTableModel::SetObserver(TableModelObserver* observer) {
@@ -181,7 +181,7 @@
}
entry->title_handle = 0;
if (found_url && !row->title().empty()) {
- entry->title = UTF16ToWide(row->title());
+ entry->title = row->title();
if (observer_)
observer_->OnItemsChanged(static_cast<int>(entry_index), 1);
}
@@ -232,10 +232,10 @@
return NULL;
}
-std::wstring CustomHomePagesTableModel::FormattedURL(int row) const {
+string16 CustomHomePagesTableModel::FormattedURL(int row) const {
std::string languages =
profile_->GetPrefs()->GetString(prefs::kAcceptLanguages);
string16 url = net::FormatUrl(entries_[row].url, languages);
url = base::i18n::GetDisplayStringInLTRDirectionality(url);
- return UTF16ToWide(url);
+ return url;
}
diff --git a/chrome/browser/custom_home_pages_table_model.h b/chrome/browser/custom_home_pages_table_model.h
index 4115daa..6699fc1 100644
--- a/chrome/browser/custom_home_pages_table_model.h
+++ b/chrome/browser/custom_home_pages_table_model.h
@@ -10,6 +10,7 @@
#include <vector>
#include "app/table_model.h"
+#include "base/compiler_specific.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/favicon_service.h"
@@ -43,11 +44,11 @@
std::vector<GURL> GetURLs();
// TableModel overrides:
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
- virtual SkBitmap GetIcon(int row);
- virtual std::wstring GetTooltip(int row);
- virtual void SetObserver(TableModelObserver* observer);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column_id) OVERRIDE;
+ virtual SkBitmap GetIcon(int row) OVERRIDE;
+ virtual string16 GetTooltip(int row) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
private:
// Each item in the model is represented as an Entry. Entry stores the URL,
@@ -84,7 +85,7 @@
int* entry_index);
// Returns the URL for a particular row, formatted for display to the user.
- std::wstring FormattedURL(int row) const;
+ string16 FormattedURL(int row) const;
// Set of entries we're showing.
std::vector<Entry> entries_;
diff --git a/chrome/browser/debugger/devtools_http_protocol_handler.cc b/chrome/browser/debugger/devtools_http_protocol_handler.cc
index 1aaf18b..6f2deb4 100644
--- a/chrome/browser/debugger/devtools_http_protocol_handler.cc
+++ b/chrome/browser/debugger/devtools_http_protocol_handler.cc
@@ -8,7 +8,7 @@
#include "base/logging.h"
#include "base/message_loop_proxy.h"
#include "base/string_number_conversions.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket.cc b/chrome/browser/debugger/devtools_remote_listen_socket.cc
index 3ac15ae..c5804d5 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket.cc
+++ b/chrome/browser/debugger/devtools_remote_listen_socket.cc
@@ -22,8 +22,8 @@
#include "base/compiler_specific.h"
#include "base/eintr_wrapper.h"
-#include "base/platform_thread.h"
#include "base/string_number_conversions.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/debugger/devtools_remote.h"
#include "chrome/browser/debugger/devtools_remote_message.h"
@@ -252,7 +252,7 @@
send_buf += sent;
len_left -= sent;
}
- PlatformThread::YieldCurrentThread();
+ base::PlatformThread::YieldCurrentThread();
}
}
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
index 4c1884f..84cc4a6 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
+++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc
@@ -11,6 +11,7 @@
#include "base/eintr_wrapper.h"
#include "base/test/test_timeouts.h"
+#include "base/threading/platform_thread.h"
#include "net/base/net_util.h"
#include "testing/platform_test.h"
@@ -160,7 +161,7 @@
return false;
while (true) {
int result = sem_trywait(semaphore_);
- PlatformThread::Sleep(1); // 1MS sleep
+ base::PlatformThread::Sleep(1); // 1MS sleep
timeout--;
if (timeout <= 0)
return false;
@@ -193,7 +194,7 @@
if (len == SOCKET_ERROR) {
if (errno == EWOULDBLOCK || errno == EAGAIN) {
#endif
- PlatformThread::Sleep(1);
+ base::PlatformThread::Sleep(1);
time_out++;
if (time_out > 10)
break;
@@ -261,7 +262,7 @@
{
ASSERT_TRUE(Send(test_socket_, kSimpleMessagePart1));
// sleep for 10ms to test message split between \r and \n
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
ASSERT_TRUE(Send(test_socket_, kSimpleMessagePart2));
ASSERT_TRUE(NextAction(TestTimeouts::action_timeout_ms()));
ASSERT_EQ(ACTION_READ_MESSAGE, last_action_.type());
@@ -312,7 +313,7 @@
// of the time. I could fix this by making the socket blocking, but then
// this test might hang in the case of errors. It would be nice to do
// something that felt more reliable here.
- PlatformThread::Sleep(10); // sleep for 10ms
+ base::PlatformThread::Sleep(10); // sleep for 10ms
const int buf_len = 200;
char buf[buf_len+1];
int recv_len = HANDLE_EINTR(recv(test_socket_, buf, buf_len, 0));
diff --git a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h
index 56835eb..6bba3ba 100644
--- a/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h
+++ b/chrome/browser/debugger/devtools_remote_listen_socket_unittest.h
@@ -20,12 +20,12 @@
#include <arpa/inet.h>
#endif
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/basictypes.h"
#include "base/message_loop.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/debugger/devtools_remote.h"
#include "chrome/browser/debugger/devtools_remote_listen_socket.h"
#include "chrome/browser/debugger/devtools_remote_message.h"
diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc
index 458be02..caf3db3 100644
--- a/chrome/browser/debugger/devtools_sanity_unittest.cc
+++ b/chrome/browser/debugger/devtools_sanity_unittest.cc
@@ -274,7 +274,8 @@
#endif // defined(OS_LINUX)
// Tests profiler panel.
-IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestProfilerTab) {
+// Disabled, http://crbug.com/68447.
+IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, DISABLED_TestProfilerTab) {
RunTest("testProfilerTab", kJsPage);
}
diff --git a/chrome/browser/default_encoding_combo_model.cc b/chrome/browser/default_encoding_combo_model.cc
index 67dc183..22746ac 100644
--- a/chrome/browser/default_encoding_combo_model.cc
+++ b/chrome/browser/default_encoding_combo_model.cc
@@ -33,7 +33,7 @@
string16 DefaultEncodingComboboxModel::GetItemAt(int index) {
DCHECK(index >= 0 && index < GetItemCount());
- return WideToUTF16Hack(sorted_encoding_list_[index].encoding_display_name);
+ return sorted_encoding_list_[index].encoding_display_name;
}
std::string DefaultEncodingComboboxModel::GetEncodingCharsetByIndex(int index) {
diff --git a/chrome/browser/device_orientation/provider_impl.cc b/chrome/browser/device_orientation/provider_impl.cc
index dfe994a..330740d 100644
--- a/chrome/browser/device_orientation/provider_impl.cc
+++ b/chrome/browser/device_orientation/provider_impl.cc
@@ -9,7 +9,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/device_orientation/orientation.h"
#include "chrome/browser/device_orientation/provider_impl.h"
diff --git a/chrome/browser/diagnostics/diagnostics_main.cc b/chrome/browser/diagnostics/diagnostics_main.cc
index 2f654c2..059dd59 100644
--- a/chrome/browser/diagnostics/diagnostics_main.cc
+++ b/chrome/browser/diagnostics/diagnostics_main.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -204,9 +204,14 @@
public:
// The |console| must be valid and properly initialized. This
// class does not own it.
- explicit TestWriter(SimpleConsole* console) : console_(console) {
+ explicit TestWriter(SimpleConsole* console)
+ : console_(console),
+ failures_(0) {
}
+ // How many tests reported failure.
+ int failures() { return failures_; }
+
// Write an informational line of text in white over black.
bool WriteInfoText(const std::wstring& txt) {
console_->SetColor(SimpleConsole::DEFAULT);
@@ -224,6 +229,7 @@
} else {
console_->SetColor(SimpleConsole::RED);
console_->Write(L"[FAIL] ");
+ failures_++;
}
WriteInfoText(name + L"\n");
std::wstring second_line(L" ");
@@ -235,6 +241,9 @@
SimpleConsole* console_;
+ // Keeps track of how many tests reported failure.
+ int failures_;
+
DISALLOW_COPY_AND_ASSIGN(TestWriter);
};
@@ -290,7 +299,12 @@
}
virtual void OnDoneAll(DiagnosticsModel* model) {
- writer_->WriteInfoText(L"DONE\n\n");
+ if (writer_->failures() > 0) {
+ writer_->WriteInfoText(StringPrintf(L"DONE. %d failure(s)\n\n",
+ writer_->failures()));
+ } else {
+ writer_->WriteInfoText(L"DONE\n\n");
+ }
}
private:
diff --git a/chrome/browser/diagnostics/diagnostics_model.cc b/chrome/browser/diagnostics/diagnostics_model.cc
index b71f337..209e342 100644
--- a/chrome/browser/diagnostics/diagnostics_model.cc
+++ b/chrome/browser/diagnostics/diagnostics_model.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -83,6 +83,7 @@
public:
DiagnosticsModelWin() {
tests_.push_back(MakeOperatingSystemTest());
+ tests_.push_back(MakeConflictingDllsTest());
tests_.push_back(MakeInstallTypeTest());
tests_.push_back(MakeVersionTest());
tests_.push_back(MakeUserDirTest());
diff --git a/chrome/browser/diagnostics/diagnostics_model.h b/chrome/browser/diagnostics/diagnostics_model.h
index 45c46e9..9b1e08a 100644
--- a/chrome/browser/diagnostics/diagnostics_model.h
+++ b/chrome/browser/diagnostics/diagnostics_model.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,7 +12,7 @@
// The chrome diagnostics system is a model-view-controller system. The Model
// responsible for holding and running the individual tests and providing a
-// uniform interface for quering the outcome.
+// uniform interface for querying the outcome.
// TODO(cpu): The view and the controller are not yet built.
class DiagnosticsModel {
public:
@@ -33,7 +33,7 @@
public:
virtual ~Observer() {}
// Called once upon test start with |percent| = 0 and periodically as the
- // test progresses. There is no cancelation method.
+ // test progresses. There is no cancellation method.
virtual void OnProgress(int id, int percent, DiagnosticsModel* model) = 0;
// Called if the test in question cannot be run.
virtual void OnSkipped(int id, DiagnosticsModel* model) = 0;
@@ -62,7 +62,7 @@
virtual int GetTestRunCount() = 0;
// Returns how many tests are available. This value never changes.
virtual int GetTestAvailableCount() =0;
- // Runs all the availabe tests, the |observer| callbacks will be called as
+ // Runs all the available tests, the |observer| callbacks will be called as
// the test progress and thus cannot be null.
virtual void RunAll(DiagnosticsModel::Observer* observer) = 0;
// Get the information for a particular test. Do not keep a pointer to the
diff --git a/chrome/browser/diagnostics/diagnostics_model_unittest.cc b/chrome/browser/diagnostics/diagnostics_model_unittest.cc
index ee80a09..823ef9d 100644
--- a/chrome/browser/diagnostics/diagnostics_model_unittest.cc
+++ b/chrome/browser/diagnostics/diagnostics_model_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -78,7 +78,7 @@
// We currently have more tests operational on windows.
#if defined(OS_WIN)
-const int kDiagnosticsTestCount = 18;
+const int kDiagnosticsTestCount = 19;
#elif defined(OS_MACOSX)
const int kDiagnosticsTestCount = 16;
#elif defined(OS_POSIX)
diff --git a/chrome/browser/diagnostics/diagnostics_test.h b/chrome/browser/diagnostics/diagnostics_test.h
index 70d7eb7..298d5a2 100644
--- a/chrome/browser/diagnostics/diagnostics_test.h
+++ b/chrome/browser/diagnostics/diagnostics_test.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -16,7 +16,7 @@
// It also Implements the TestInfo interface providing the storage
// for the outcome of the test.
// Specific tests need (minimally) only to:
-// 1- override ExecuteImpl() to imnplement the test.
+// 1- override ExecuteImpl() to implement the test.
// 2- call RecordStopFailure() or RecordFailure() or RecordSuccess()
// at the end of the test.
// 3- Optionally call observer->OnProgress() if the test is long.
@@ -58,7 +58,7 @@
static FilePath GetUserDefaultProfileDir();
protected:
- // The id needs to be overriden by derived classes and must uniquely
+ // The id needs to be overridden by derived classes and must uniquely
// identify this test so other test can refer to it.
virtual int GetId() = 0;
// Derived classes override this method do perform the actual test.
diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc
index f657fef..2cacd86 100644
--- a/chrome/browser/diagnostics/recon_diagnostics.cc
+++ b/chrome/browser/diagnostics/recon_diagnostics.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -22,6 +22,7 @@
#if defined(OS_WIN)
#include "base/win/windows_version.h"
+#include "chrome/browser/enumerate_modules_model_win.h"
#include "chrome/installer/util/install_util.h"
#endif
@@ -29,7 +30,7 @@
// diagnostic tests. Here we check for the existence of critical files.
// TODO(cpu): Define if it makes sense to localize strings.
-// TODO(cpu): There are a few maxium file sizes hardcoded in this file
+// TODO(cpu): There are a few maximum file sizes hardcoded in this file
// that have little or no theoretical or experimental ground. Find a way
// to justify them.
@@ -61,7 +62,7 @@
return false;
}
#else
- // TODO(port): define the OS criteria for linux and mac.
+ // TODO(port): define the OS criteria for Linux and Mac.
#endif // defined(OS_WIN)
RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s (%d [%d:%d])",
base::SysInfo::OperatingSystemName().c_str(),
@@ -74,6 +75,60 @@
DISALLOW_COPY_AND_ASSIGN(OperatingSystemTest);
};
+// Check if any conflicting DLLs are loaded.
+class ConflictingDllsTest : public DiagnosticTest {
+ public:
+ ConflictingDllsTest() : DiagnosticTest(ASCIIToUTF16("Conflicting modules")) {}
+
+ virtual int GetId() { return 0; }
+
+ virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) {
+#if defined(OS_WIN)
+ EnumerateModulesModel* model = EnumerateModulesModel::GetInstance();
+ model->set_limited_mode(true);
+ model->ScanNow();
+ ListValue* list = model->GetModuleList();
+ if (!model->confirmed_bad_modules_detected() &&
+ !model->suspected_bad_modules_detected()) {
+ RecordSuccess(ASCIIToUTF16("No conflicting modules found"));
+ return true;
+ }
+
+ string16 failures = ASCIIToUTF16("Possibly conflicting modules:");
+ DictionaryValue* dictionary;
+ for (size_t i = 0; i < list->GetSize(); ++i) {
+ list->GetDictionary(i, &dictionary);
+ int status;
+ string16 location;
+ string16 name;
+ if (!dictionary->GetInteger("status", &status))
+ RecordFailure(ASCIIToUTF16("No 'status' field found"));
+ if (status < ModuleEnumerator::SUSPECTED_BAD)
+ continue;
+
+ if (!dictionary->GetString("location", &location)) {
+ RecordFailure(ASCIIToUTF16("No 'location' field found"));
+ return true;
+ }
+ if (!dictionary->GetString("name", &name)) {
+ RecordFailure(ASCIIToUTF16("No 'name' field found"));
+ return true;
+ }
+
+ failures += ASCIIToUTF16("\n") + location + name;
+ }
+ RecordFailure(failures);
+ return true;
+#else
+ RecordFailure(ASCIIToUTF16("Not implemented"));
+ return true;
+#endif // defined(OS_WIN)
+ }
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ConflictingDllsTest);
+};
+
// Check if it is system install or per-user install.
class InstallTypeTest : public DiagnosticTest {
public:
@@ -163,9 +218,9 @@
true, false, false, 0}
};
-// Check that the user's data directory exists and the paths are writeable.
-// If it is a systemwide install some paths are not expected to be writeable.
-// This test depends on |InstallTypeTest| having run succesfuly.
+// Check that the user's data directory exists and the paths are writable.
+// If it is a systemwide install some paths are not expected to be writable.
+// This test depends on |InstallTypeTest| having run successfully.
class PathTest : public DiagnosticTest {
public:
explicit PathTest(const TestPathInfo& path_info)
@@ -227,7 +282,7 @@
};
// Check that the disk space in the volume where the user data dir normally
-// lives is not dangerosly low.
+// lives is not dangerously low.
class DiskSpaceTest : public DiagnosticTest {
public:
DiskSpaceTest() : DiagnosticTest(ASCIIToUTF16("Disk Space")) {}
@@ -337,6 +392,10 @@
return new OperatingSystemTest();
}
+DiagnosticTest* MakeConflictingDllsTest() {
+ return new ConflictingDllsTest();
+}
+
DiagnosticTest* MakeInstallTypeTest() {
return new InstallTypeTest();
}
diff --git a/chrome/browser/diagnostics/recon_diagnostics.h b/chrome/browser/diagnostics/recon_diagnostics.h
index d7c52e9..8a20d4d 100644
--- a/chrome/browser/diagnostics/recon_diagnostics.h
+++ b/chrome/browser/diagnostics/recon_diagnostics.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,6 +9,7 @@
#include "chrome/browser/diagnostics/diagnostics_test.h"
DiagnosticTest* MakeOperatingSystemTest();
+DiagnosticTest* MakeConflictingDllsTest();
DiagnosticTest* MakeInstallTypeTest();
DiagnosticTest* MakeVersionTest();
DiagnosticTest* MakeUserDirTest();
diff --git a/chrome/browser/dom_ui/app_launcher_handler.cc b/chrome/browser/dom_ui/app_launcher_handler.cc
index 64d128a..aba23f1 100644
--- a/chrome/browser/dom_ui/app_launcher_handler.cc
+++ b/chrome/browser/dom_ui/app_launcher_handler.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/dom_ui/app_launcher_handler.h"
-#include "app/animation.h"
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
@@ -32,6 +31,7 @@
#include "gfx/rect.h"
#include "grit/browser_resources.h"
#include "grit/generated_resources.h"
+#include "ui/base/animation/animation.h"
namespace {
@@ -193,15 +193,10 @@
dictionary->SetBoolean("disableCreateAppShortcut", true);
#endif
- // We always show the launcher on Chrome OS. On Desktop Chrome, only show it
- // if we've installed our default apps.
-#if defined(OS_CHROMEOS)
- dictionary->SetBoolean("showLauncher", true);
-#else
dictionary->SetBoolean(
"showLauncher",
- extensions_service_->default_apps()->GetDefaultAppsInstalled());
-#endif
+ extensions_service_->default_apps()->ShouldShowAppLauncher(
+ extensions_service_->GetAppIds()));
}
void AppLauncherHandler::HandleGetApps(const ListValue* args) {
@@ -217,7 +212,7 @@
// b) Conceptually, it doesn't really make sense to count a
// prefchange-triggered refresh as a promo 'view'.
DefaultApps* default_apps = extensions_service_->default_apps();
- if (default_apps->CheckShouldShowPromo(extensions_service_->GetAppIds())) {
+ if (default_apps->ShouldShowPromo(extensions_service_->GetAppIds())) {
dictionary.SetBoolean("showPromo", true);
default_apps->DidShowPromo();
promo_active_ = true;
@@ -335,12 +330,11 @@
UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppsPromoHistogram,
extension_misc::PROMO_CLOSE,
extension_misc::PROMO_BUCKET_BOUNDARY);
- DefaultApps* default_apps = extensions_service_->default_apps();
- const ExtensionIdSet* app_ids = default_apps->GetDefaultApps();
- DCHECK(*app_ids == extensions_service_->GetAppIds());
- for (ExtensionIdSet::const_iterator iter = app_ids->begin();
- iter != app_ids->end(); ++iter) {
+ DefaultApps* default_apps = extensions_service_->default_apps();
+ const ExtensionIdSet& app_ids = default_apps->default_apps();
+ for (ExtensionIdSet::const_iterator iter = app_ids.begin();
+ iter != app_ids.end(); ++iter) {
if (extensions_service_->GetExtensionById(*iter, true))
extensions_service_->UninstallExtension(*iter, false);
}
@@ -416,7 +410,7 @@
const gfx::Rect& rect) {
// We make this check for the case of minimized windows, unit tests, etc.
if (platform_util::IsVisible(dom_ui_->tab_contents()->GetNativeView()) &&
- Animation::ShouldRenderRichAnimation()) {
+ ui::Animation::ShouldRenderRichAnimation()) {
#if defined(OS_WIN)
AppLaunchedAnimation::Show(extension, rect);
#else
diff --git a/chrome/browser/dom_ui/bug_report_ui.cc b/chrome/browser/dom_ui/bug_report_ui.cc
index 4c92c73..dc75bad 100644
--- a/chrome/browser/dom_ui/bug_report_ui.cc
+++ b/chrome/browser/dom_ui/bug_report_ui.cc
@@ -39,9 +39,9 @@
#if defined(USE_X11)
#include "app/x11_util.h"
#elif defined(OS_MACOSX)
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#elif defined(OS_WIN)
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#endif
#if defined(TOOLKIT_VIEWS)
@@ -51,7 +51,7 @@
#if defined(OS_CHROMEOS)
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/syslogs_library.h"
#include "chrome/browser/chromeos/login/user_manager.h"
@@ -173,9 +173,9 @@
#if defined(USE_X11)
x11_util::GrabWindowSnapshot(window, last_screenshot_png);
#elif defined(OS_MACOSX)
- mac_util::GrabWindowSnapshot(window, last_screenshot_png, &width, &height);
+ base::mac::GrabWindowSnapshot(window, last_screenshot_png, &width, &height);
#elif defined(OS_WIN)
- win_util::GrabWindowSnapshot(window, last_screenshot_png);
+ app::win::GrabWindowSnapshot(window, last_screenshot_png);
#endif
screen_size.set_width(width);
@@ -653,6 +653,11 @@
void BugReportHandler::HandleSendReport(const ListValue* list_value) {
+ if (!bug_report_) {
+ LOG(ERROR) << "Bug report hasn't been intialized yet.";
+ return;
+ }
+
ListValue::const_iterator i = list_value->begin();
if (i == list_value->end()) {
LOG(ERROR) << "Incorrect data passed to sendReport.";
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index 42af812..5b69fe5 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.cc
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc
@@ -12,7 +12,7 @@
#include "base/ref_counted_memory.h"
#include "base/singleton.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/values.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
diff --git a/chrome/browser/dom_ui/conflicts_ui.cc b/chrome/browser/dom_ui/conflicts_ui.cc
index ed51f21..9f4df7d 100644
--- a/chrome/browser/dom_ui/conflicts_ui.cc
+++ b/chrome/browser/dom_ui/conflicts_ui.cc
@@ -79,8 +79,8 @@
l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_SIGNED_BY));
localized_strings.SetString("headerLocation",
l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_LOCATION));
- localized_strings.SetString("headerWarning",
- l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_WARNING));
+ localized_strings.SetString("headerVersion",
+ l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_VERSION));
localized_strings.SetString("headerHelpTip",
l10n_util::GetStringUTF16(IDS_CONFLICTS_HEADER_HELP_TIP));
@@ -108,7 +108,7 @@
//
////////////////////////////////////////////////////////////////////////////////
-// The handler for Javascript messages for the about:flags page.
+// The handler for JavaScript messages for the about:flags page.
class ConflictsDOMHandler : public DOMMessageHandler,
public NotificationObserver {
public:
diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc
index 6f7eaaf..3ef5f5b 100644
--- a/chrome/browser/dom_ui/dom_ui_factory.cc
+++ b/chrome/browser/dom_ui/dom_ui_factory.cc
@@ -96,7 +96,7 @@
if (url.host() == chrome::kChromeUIDialogHost)
return &NewDOMUI<ConstrainedHtmlUI>;
- ExtensionService* service = profile->GetExtensionService();
+ ExtensionService* service = profile ? profile->GetExtensionService() : NULL;
if (service && service->ExtensionBindingsAllowed(url))
return &NewDOMUI<ExtensionDOMUI>;
@@ -200,8 +200,8 @@
return &NewDOMUI<chromeos::NetworkMenuUI>;
#else
if (url.host() == chrome::kChromeUISettingsHost) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
return &NewDOMUI<OptionsUI>;
}
}
diff --git a/chrome/browser/dom_ui/dom_ui_screenshot_source.cc b/chrome/browser/dom_ui/dom_ui_screenshot_source.cc
index 110a52e..7efbae8 100644
--- a/chrome/browser/dom_ui/dom_ui_screenshot_source.cc
+++ b/chrome/browser/dom_ui/dom_ui_screenshot_source.cc
@@ -9,8 +9,8 @@
#include "base/path_service.h"
#include "base/ref_counted_memory.h"
#include "base/task.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/url_constants.h"
diff --git a/chrome/browser/dom_ui/downloads_dom_handler.cc b/chrome/browser/dom_ui/downloads_dom_handler.cc
index 07ca6fc..c6a22ec 100644
--- a/chrome/browser/dom_ui/downloads_dom_handler.cc
+++ b/chrome/browser/dom_ui/downloads_dom_handler.cc
@@ -11,7 +11,7 @@
#include "base/callback.h"
#include "base/singleton.h"
#include "base/string_piece.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/dom_ui/downloads_ui.cc b/chrome/browser/dom_ui/downloads_ui.cc
index 9c033ea..2ef2656 100644
--- a/chrome/browser/dom_ui/downloads_ui.cc
+++ b/chrome/browser/dom_ui/downloads_ui.cc
@@ -8,7 +8,7 @@
#include "app/resource_bundle.h"
#include "base/singleton.h"
#include "base/string_piece.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/values.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/defaults.h"
diff --git a/chrome/browser/dom_ui/filebrowse_ui.cc b/chrome/browser/dom_ui/filebrowse_ui.cc
index 41ab3c2..833341c 100644
--- a/chrome/browser/dom_ui/filebrowse_ui.cc
+++ b/chrome/browser/dom_ui/filebrowse_ui.cc
@@ -15,7 +15,7 @@
#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
diff --git a/chrome/browser/dom_ui/foreign_session_handler.cc b/chrome/browser/dom_ui/foreign_session_handler.cc
index 21fc142..cdc66a2 100644
--- a/chrome/browser/dom_ui/foreign_session_handler.cc
+++ b/chrome/browser/dom_ui/foreign_session_handler.cc
@@ -4,24 +4,31 @@
#include "chrome/browser/dom_ui/foreign_session_handler.h"
+#include <algorithm>
#include <string>
-
+#include <vector>
#include "base/scoped_vector.h"
+#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
-#include "chrome/browser/dom_ui/value_helper.h"
+#include "base/values.h"
+#include "chrome/browser/dom_ui/new_tab_ui.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_restore.h"
-#include "chrome/browser/sessions/tab_restore_service.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
+#include "chrome/common/url_constants.h"
namespace browser_sync {
+// Maximum number of session we're going to display on the NTP
static const int kMaxSessionsToShow = 10;
+// Invalid value, used to note that we don't have a tab or window number.
+static const int kInvalidId = -1;
+
ForeignSessionHandler::ForeignSessionHandler() {
Init();
}
@@ -30,9 +37,9 @@
dom_ui_->RegisterMessageCallback("getForeignSessions",
NewCallback(this,
&ForeignSessionHandler::HandleGetForeignSessions));
- dom_ui_->RegisterMessageCallback("reopenForeignSession",
+ dom_ui_->RegisterMessageCallback("openForeignSession",
NewCallback(this,
- &ForeignSessionHandler::HandleReopenForeignSession));
+ &ForeignSessionHandler::HandleOpenForeignSession));
}
void ForeignSessionHandler::Init() {
@@ -81,71 +88,34 @@
void ForeignSessionHandler::HandleGetForeignSessions(const ListValue* args) {
SessionModelAssociator* associator = GetModelAssociator();
- if (associator)
- GetForeignSessions(associator);
-}
+ std::vector<const ForeignSession*> sessions;
-void ForeignSessionHandler::HandleReopenForeignSession(
- const ListValue* args) {
- // Extract the machine tag and use it to obtain the id for the node we are
- // looking for. Send it along with a valid associator to OpenForeignSessions.
- std::string session_string_value = WideToUTF8(ExtractStringValue(args));
- SessionModelAssociator* associator = GetModelAssociator();
- if (associator && !session_string_value.empty()) {
- int64 id = associator->GetSyncIdFromChromeId(session_string_value);
- OpenForeignSession(associator, id);
+ if (associator == NULL) {
+ // Called before associator created, exit.
+ return;
}
-}
-void ForeignSessionHandler::OpenForeignSession(
- SessionModelAssociator* associator, int64 id) {
- // Obtain the session windows for the foreign session.
- // We don't have a ForeignSessionHandler in off the record mode, so we
- // expect the ProfileSyncService to exist.
- sync_api::ReadTransaction trans(dom_ui_->GetProfile()->
- GetProfileSyncService()->backend()->GetUserShareHandle());
- ScopedVector<ForeignSession> session;
- associator->AppendForeignSessionWithID(id, &session.get(), &trans);
-
- DCHECK_EQ(1U, session.size());
- std::vector<SessionWindow*> windows = (*session.begin())->windows;
- SessionRestore::RestoreForeignSessionWindows(dom_ui_->GetProfile(), &windows);
-}
-
-void ForeignSessionHandler::GetForeignSessions(
- SessionModelAssociator* associator) {
- ScopedVector<ForeignSession> clients;
- if (!associator->GetSessionData(&clients.get())) {
+ // Note: we don't own the ForeignSessions themselves.
+ if (!associator->GetAllForeignSessions(&sessions)) {
LOG(ERROR) << "ForeignSessionHandler failed to get session data from"
"SessionModelAssociator.";
return;
}
int added_count = 0;
- ListValue client_list;
- for (std::vector<ForeignSession*>::const_iterator i =
- clients->begin(); i != clients->end() &&
+ ListValue session_list;
+ for (std::vector<const ForeignSession*>::const_iterator i =
+ sessions.begin(); i != sessions.end() &&
added_count < kMaxSessionsToShow; ++i) {
- ForeignSession* foreign_session = *i;
- std::vector<TabRestoreService::Entry*> entries;
- dom_ui_->GetProfile()->GetTabRestoreService()->CreateEntriesFromWindows(
- &foreign_session->windows, &entries);
+ const ForeignSession* foreign_session = *i;
scoped_ptr<ListValue> window_list(new ListValue());
- for (std::vector<TabRestoreService::Entry*>::const_iterator it =
- entries.begin(); it != entries.end(); ++it) {
- TabRestoreService::Entry* entry = *it;
+ for (std::vector<SessionWindow*>::const_iterator it =
+ foreign_session->windows.begin(); it != foreign_session->windows.end();
+ ++it) {
+ SessionWindow* window = *it;
scoped_ptr<DictionaryValue> window_data(new DictionaryValue());
- if (entry->type == TabRestoreService::WINDOW &&
- ValueHelper::WindowToValue(
- *static_cast<TabRestoreService::Window*>(entry),
- window_data.get())) {
- // The javascript checks if the session id is a valid session id,
- // when rendering session information to the new tab page, and it
- // sends the sessionTag back when we need to restore a session.
-
- // TODO(zea): sessionTag is per client, it might be better per window.
+ if (SessionWindowToValue(*window, window_data.get())) {
window_data->SetString("sessionTag",
foreign_session->foreign_session_tag);
- window_data->SetInteger("sessionId", entry->id);
// Give ownership to |list_value|.
window_list->Append(window_data.release());
@@ -153,10 +123,121 @@
}
added_count++;
- // Give ownership to |client_list|
- client_list.Append(window_list.release());
+ // Give ownership to |session_list|
+ session_list.Append(window_list.release());
}
- dom_ui_->CallJavascriptFunction(L"foreignSessions", client_list);
+ dom_ui_->CallJavascriptFunction(L"foreignSessions", session_list);
+}
+
+void ForeignSessionHandler::HandleOpenForeignSession(
+ const ListValue* args) {
+ size_t num_args = args->GetSize();
+ if (num_args > 3U || num_args == 0) {
+ LOG(ERROR) << "openForeignWindow called with only " << args->GetSize()
+ << " arguments.";
+ return;
+ }
+
+ // Extract the machine tag (always provided)
+ std::string session_string_value;
+ if (!args->GetString(0, &session_string_value)) {
+ LOG(ERROR) << "Failed to extract session tag.";
+ return;
+ }
+
+ // Extract window number.
+ std::string window_num_str;
+ int window_num = kInvalidId;
+ if (num_args >= 2 && (!args->GetString(1, &window_num_str) ||
+ !base::StringToInt(window_num_str, &window_num))) {
+ LOG(ERROR) << "Failed to extract window number.";
+ return;
+ }
+
+ // Extract tab id.
+ std::string tab_id_str;
+ SessionID::id_type tab_id = kInvalidId;
+ if (num_args == 3 && (!args->GetString(2, &tab_id_str) ||
+ !base::StringToInt(tab_id_str, &tab_id))) {
+ LOG(ERROR) << "Failed to extract tab SessionID.";
+ return;
+ }
+
+ SessionModelAssociator* associator = GetModelAssociator();
+
+ if (tab_id != kInvalidId) {
+ // We don't actually care about |window_num|, this is just a sanity check.
+ DCHECK_LT(kInvalidId, window_num);
+ const SessionTab* tab;
+ if (!associator->GetForeignTab(session_string_value, tab_id, &tab)) {
+ LOG(ERROR) << "Failed to load foreign tab.";
+ return;
+ }
+ SessionRestore::RestoreForeignSessionTab(dom_ui_->GetProfile(), *tab);
+ } else {
+ std::vector<SessionWindow*> windows;
+ // Note: we don't own the ForeignSessions themselves.
+ if (!associator->GetForeignSession(session_string_value, &windows)) {
+ LOG(ERROR) << "ForeignSessionHandler failed to get session data from"
+ "SessionModelAssociator.";
+ return;
+ }
+ std::vector<SessionWindow*>::const_iterator iter_begin = windows.begin() +
+ ((window_num == kInvalidId) ? 0 : window_num);
+ std::vector<SessionWindow*>::const_iterator iter_end =
+ ((window_num == kInvalidId) ?
+ std::vector<SessionWindow*>::const_iterator(windows.end()) :
+ iter_begin+1);
+ SessionRestore::RestoreForeignSessionWindows(dom_ui_->GetProfile(),
+ iter_begin,
+ iter_end);
+ }
+}
+
+bool ForeignSessionHandler::SessionTabToValue(
+ const SessionTab& tab,
+ DictionaryValue* dictionary) {
+ if (tab.navigations.empty())
+ return false;
+ int selected_index = tab.current_navigation_index;
+ selected_index = std::max(
+ 0,
+ std::min(selected_index,
+ static_cast<int>(tab.navigations.size() - 1)));
+ const TabNavigation& current_navigation =
+ tab.navigations.at(selected_index);
+ if (current_navigation.virtual_url() == GURL(chrome::kChromeUINewTabURL))
+ return false;
+ NewTabUI::SetURLTitleAndDirection(dictionary, current_navigation.title(),
+ current_navigation.virtual_url());
+ dictionary->SetString("type", "tab");
+ dictionary->SetReal("timestamp",
+ static_cast<double>(tab.timestamp.ToInternalValue()));
+ dictionary->SetInteger("sessionId", tab.tab_id.id());
+ return true;
+}
+
+bool ForeignSessionHandler::SessionWindowToValue(
+ const SessionWindow& window,
+ DictionaryValue* dictionary) {
+ if (window.tabs.empty()) {
+ NOTREACHED();
+ return false;
+ }
+ scoped_ptr<ListValue> tab_values(new ListValue());
+ for (size_t i = 0; i < window.tabs.size(); ++i) {
+ scoped_ptr<DictionaryValue> tab_value(new DictionaryValue());
+ if (SessionTabToValue(*window.tabs[i], tab_value.get()))
+ tab_values->Append(tab_value.release());
+ }
+ if (tab_values->GetSize() == 0)
+ return false;
+ dictionary->SetString("type", "window");
+ dictionary->SetReal("timestamp",
+ static_cast<double>(window.timestamp.ToInternalValue()));
+ dictionary->SetInteger("sessionId", window.window_id.id());
+ dictionary->Set("tabs", tab_values.release());
+ return true;
}
} // namespace browser_sync
diff --git a/chrome/browser/dom_ui/foreign_session_handler.h b/chrome/browser/dom_ui/foreign_session_handler.h
index 8532d10..f6c00ec 100644
--- a/chrome/browser/dom_ui/foreign_session_handler.h
+++ b/chrome/browser/dom_ui/foreign_session_handler.h
@@ -37,21 +37,20 @@
// Returns a pointer to the current session model associator or NULL.
SessionModelAssociator* GetModelAssociator();
+ // Determines which session is to be opened, and then calls
+ // OpenForeignSession, to begin the process of opening a new browser window.
+ // This is a javascript callback handler.
+ void HandleOpenForeignSession(const ListValue* args);
+
// Determines whether foreign sessions should be obtained from the sync model.
// This is a javascript callback handler, and it is also called when the sync
// model has changed and the new tab page needs to reflect the changes.
void HandleGetForeignSessions(const ListValue* args);
- // Helper for reopening a foreign session in a new browser window.
- void OpenForeignSession(SessionModelAssociator* associator, int64 id);
-
- // Helper for listing the foreign sessions on the new tab page.
- void GetForeignSessions(SessionModelAssociator* associator);
-
- // Determines which session is to be opened, and then calls
- // OpenForeignSession, to begin the process of opening a new browser window.
- // This is a javascript callback handler.
- void HandleReopenForeignSession(const ListValue* args);
+ // Helper methods to create JSON compatible objects from Session objects.
+ bool SessionTabToValue(const SessionTab& tab, DictionaryValue* dictionary);
+ bool SessionWindowToValue(const SessionWindow& window,
+ DictionaryValue* dictionary);
// The Registrar used to register ForeignSessionHandler for notifications.
NotificationRegistrar registrar_;
diff --git a/chrome/browser/dom_ui/history2_ui.cc b/chrome/browser/dom_ui/history2_ui.cc
index faf00cb..89b3b7c 100644
--- a/chrome/browser/dom_ui/history2_ui.cc
+++ b/chrome/browser/dom_ui/history2_ui.cc
@@ -17,7 +17,7 @@
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
#include "base/utf_string_conversions.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
diff --git a/chrome/browser/dom_ui/history_ui.cc b/chrome/browser/dom_ui/history_ui.cc
index fa7c332..c599a76 100644
--- a/chrome/browser/dom_ui/history_ui.cc
+++ b/chrome/browser/dom_ui/history_ui.cc
@@ -16,7 +16,7 @@
#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/string_piece.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
diff --git a/chrome/browser/dom_ui/mediaplayer_ui.cc b/chrome/browser/dom_ui/mediaplayer_ui.cc
index 85c53f6..2f1cec7 100644
--- a/chrome/browser/dom_ui/mediaplayer_ui.cc
+++ b/chrome/browser/dom_ui/mediaplayer_ui.cc
@@ -12,7 +12,7 @@
#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/values.h"
#include "base/weak_ptr.h"
diff --git a/chrome/browser/dom_ui/most_visited_handler.cc b/chrome/browser/dom_ui/most_visited_handler.cc
index 798a600..d4f724c 100644
--- a/chrome/browser/dom_ui/most_visited_handler.cc
+++ b/chrome/browser/dom_ui/most_visited_handler.cc
@@ -15,7 +15,7 @@
#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/values.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
diff --git a/chrome/browser/dom_ui/net_internals_ui.cc b/chrome/browser/dom_ui/net_internals_ui.cc
index 0cea72a..07109ba 100644
--- a/chrome/browser/dom_ui/net_internals_ui.cc
+++ b/chrome/browser/dom_ui/net_internals_ui.cc
@@ -54,6 +54,11 @@
namespace {
+// Delay between when an event occurs and when it is passed to the Javascript
+// page. All events that occur during this period are grouped together and
+// sent to the page at once, which reduces context switching and CPU usage.
+const int kNetLogEventDelayMilliseconds = 100;
+
// Returns the HostCache for |context|'s primary HostResolver, or NULL if
// there is none.
net::HostCache* GetHostResolverCache(URLRequestContext* context) {
@@ -245,8 +250,18 @@
// Helper that executes |function_name| in the attached renderer.
// The function takes ownership of |arg|. Note that this can be called from
// any thread.
- void CallJavascriptFunction(const std::wstring& function_name,
- Value* arg);
+ void CallJavascriptFunction(const std::wstring& function_name, Value* arg);
+
+ // Adds |entry| to the queue of pending log entries to be sent to the page via
+ // Javascript. Must be called on the IO Thread. Also creates a delayed task
+ // that will call PostPendingEntries, if there isn't one already.
+ void AddEntryToQueue(Value* entry);
+
+ // Sends all pending entries to the page via Javascript, and clears the list
+ // of pending entries. Sending multiple entries at once results in a
+ // significant reduction of CPU usage when a lot of events are happening.
+ // Must be called on the IO Thread.
+ void PostPendingEntries();
// Pointer to the UI-thread message handler. Only access this from
// the UI thread.
@@ -271,6 +286,11 @@
// True if we have attached an observer to the NetLog already.
bool is_observing_log_;
friend class base::RefCountedThreadSafe<IOThreadImpl>;
+
+ // Log entries that have yet to be passed along to Javascript page. Non-NULL
+ // when and only when there is a pending delayed task to call
+ // PostPendingEntries. Read and written to exclusively on the IO Thread.
+ scoped_ptr<ListValue> pending_entries_;
};
// Helper class for a DOMUI::MessageCallback which when excuted calls
@@ -951,10 +971,31 @@
const net::NetLog::Source& source,
net::NetLog::EventPhase phase,
net::NetLog::EventParameters* params) {
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ NewRunnableMethod(
+ this, &IOThreadImpl::AddEntryToQueue,
+ net::NetLog::EntryToDictionaryValue(type, time, source, phase,
+ params, false)));
+}
+
+void NetInternalsMessageHandler::IOThreadImpl::AddEntryToQueue(Value* entry) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+ if (!pending_entries_.get()) {
+ pending_entries_.reset(new ListValue());
+ BrowserThread::PostDelayedTask(
+ BrowserThread::IO, FROM_HERE,
+ NewRunnableMethod(this, &IOThreadImpl::PostPendingEntries),
+ kNetLogEventDelayMilliseconds);
+ }
+ pending_entries_->Append(entry);
+}
+
+void NetInternalsMessageHandler::IOThreadImpl::PostPendingEntries() {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
CallJavascriptFunction(
- L"g_browser.receivedLogEntry",
- net::NetLog::EntryToDictionaryValue(type, time, source, phase, params,
- false));
+ L"g_browser.receivedLogEntries",
+ pending_entries_.release());
}
void NetInternalsMessageHandler::IOThreadImpl::OnStartConnectionTestSuite() {
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
index c075793..d7a5543 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.cc
@@ -90,6 +90,8 @@
switch (type) {
case sync_ui_util::SYNC_ERROR:
return SYNC_ERROR;
+ case sync_ui_util::SYNC_PROMO:
+ return SYNC_PROMO;
case sync_ui_util::PRE_SYNCED:
case sync_ui_util::SYNCED:
default:
@@ -155,6 +157,13 @@
if (!sync_service_->IsSyncEnabled())
return;
if (sync_service_->HasSyncSetupCompleted()) {
+ if (sync_service_->observed_passphrase_required()) {
+ if (sync_service_->IsUsingSecondaryPassphrase())
+ sync_service_->PromptForExistingPassphrase(NULL);
+ else
+ sync_service_->SigninForPassphrase(dom_ui_->tab_contents());
+ return;
+ }
if (sync_service_->GetAuthError().state() ==
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS ||
sync_service_->GetAuthError().state() ==
@@ -164,8 +173,7 @@
sync_service_->GetAuthError().state() ==
GoogleServiceAuthError::ACCOUNT_DISABLED ||
sync_service_->GetAuthError().state() ==
- GoogleServiceAuthError::SERVICE_UNAVAILABLE ||
- sync_service_->observed_passphrase_required()) {
+ GoogleServiceAuthError::SERVICE_UNAVAILABLE) {
sync_service_->ShowLoginDialog(NULL);
return;
}
@@ -196,12 +204,16 @@
std::string title;
std::string linkurl;
- // If there is no message to show, we should hide the sync section
- // altogether.
- if (type == HIDE || msg.empty()) {
+ // If there is nothing to show, we should hide the sync section altogether.
+ if (type == HIDE || (msg.empty() && linktext.empty())) {
value.SetBoolean("syncsectionisvisible", false);
- } else { // type == SYNC_ERROR
- title = l10n_util::GetStringUTF8(IDS_SYNC_NTP_SYNC_SECTION_ERROR_TITLE);
+ } else {
+ if (type == SYNC_ERROR)
+ title = l10n_util::GetStringUTF8(IDS_SYNC_NTP_SYNC_SECTION_ERROR_TITLE);
+ else if (type == SYNC_PROMO)
+ title = l10n_util::GetStringUTF8(IDS_SYNC_NTP_SYNC_SECTION_PROMO_TITLE);
+ else
+ NOTREACHED();
value.SetBoolean("syncsectionisvisible", true);
value.SetString("msg", msg);
diff --git a/chrome/browser/dom_ui/new_tab_page_sync_handler.h b/chrome/browser/dom_ui/new_tab_page_sync_handler.h
index 9db005b..99c817e 100644
--- a/chrome/browser/dom_ui/new_tab_page_sync_handler.h
+++ b/chrome/browser/dom_ui/new_tab_page_sync_handler.h
@@ -38,6 +38,7 @@
enum MessageType {
HIDE,
SYNC_ERROR,
+ SYNC_PROMO
};
// Helper to invoke the |syncMessageChanged| JS function on the new tab page.
void SendSyncMessageToPage(MessageType type,
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index c75bdf0..c43a8f5 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -15,7 +15,7 @@
#include "base/metrics/histogram.h"
#include "base/singleton.h"
#include "base/string_number_conversions.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/dom_ui/app_launcher_handler.h"
diff --git a/chrome/browser/dom_ui/new_tab_ui_uitest.cc b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
index 51d2b05..5b3bd0d 100644
--- a/chrome/browser/dom_ui/new_tab_ui_uitest.cc
+++ b/chrome/browser/dom_ui/new_tab_ui_uitest.cc
@@ -22,11 +22,11 @@
dom_automation_enabled_ = true;
// Set home page to the empty string so that we can set the home page using
// preferences.
- homepage_ = "";
+ set_homepage("");
// Setup the DEFAULT_THEME profile (has fake history entries).
set_template_user_data(UITest::ComputeTypicalUserDataSource(
- UITest::DEFAULT_THEME));
+ ProxyLauncher::DEFAULT_THEME));
}
};
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc
index 6c9edac..8cca8b4 100644
--- a/chrome/browser/dom_ui/ntp_resource_cache.cc
+++ b/chrome/browser/dom_ui/ntp_resource_cache.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include <vector>
-#include "app/animation.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "app/theme_provider.h"
@@ -41,6 +40,7 @@
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/animation.h"
#if defined(OS_WIN) || defined(TOOLKIT_VIEWS)
#include "chrome/browser/views/bookmark_bar_view.h"
@@ -352,7 +352,7 @@
// Control fade and resize animations.
std::string anim =
- Animation::ShouldRenderRichAnimation() ? "true" : "false";
+ ui::Animation::ShouldRenderRichAnimation() ? "true" : "false";
localized_strings.SetString("anim", anim);
// Pass the shown_sections pref early so that we can prevent flicker.
diff --git a/chrome/browser/dom_ui/options/about_page_handler.cc b/chrome/browser/dom_ui/options/about_page_handler.cc
index 71f994f..8100392 100644
--- a/chrome/browser/dom_ui/options/about_page_handler.cc
+++ b/chrome/browser/dom_ui/options/about_page_handler.cc
@@ -17,6 +17,7 @@
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/google/google_util.h"
#include "chrome/browser/platform_util.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/url_constants.h"
@@ -43,16 +44,20 @@
// These are used as placeholder text around the links in the text in the
// license.
-const wchar_t kBeginLink[] = L"BEGIN_LINK";
-const wchar_t kEndLink[] = L"END_LINK";
-const wchar_t kBeginLinkChr[] = L"BEGIN_LINK_CHR";
-const wchar_t kBeginLinkOss[] = L"BEGIN_LINK_OSS";
-const wchar_t kEndLinkChr[] = L"END_LINK_CHR";
-const wchar_t kEndLinkOss[] = L"END_LINK_OSS";
+const char kBeginLink[] = "BEGIN_LINK";
+const char kEndLink[] = "END_LINK";
+const char kBeginLinkChr[] = "BEGIN_LINK_CHR";
+const char kBeginLinkOss[] = "BEGIN_LINK_OSS";
+const char kEndLinkChr[] = "END_LINK_CHR";
+const char kEndLinkOss[] = "END_LINK_OSS";
+#if defined(OS_CHROMEOS)
+const char kBeginLinkCrosOss[] = "BEGIN_LINK_CROS_OSS";
+const char kEndLinkCrosOss[] = "END_LINK_CROS_OSS";
+#endif
// Returns a substring [start, end) from |text|.
-std::wstring StringSubRange(const std::wstring& text, size_t start,
- size_t end) {
+std::string StringSubRange(const std::string& text, size_t start,
+ size_t end) {
DCHECK(end > start);
return text.substr(start, end - start);
}
@@ -160,46 +165,67 @@
// license
- std::wstring text = l10n_util::GetString(IDS_ABOUT_VERSION_LICENSE);
+ std::string text = l10n_util::GetStringUTF8(IDS_ABOUT_VERSION_LICENSE);
bool chromium_url_appears_first =
text.find(kBeginLinkChr) < text.find(kBeginLinkOss);
size_t link1 = text.find(kBeginLink);
- DCHECK(link1 != std::wstring::npos);
+ DCHECK(link1 != std::string::npos);
size_t link1_end = text.find(kEndLink, link1);
- DCHECK(link1_end != std::wstring::npos);
+ DCHECK(link1_end != std::string::npos);
size_t link2 = text.find(kBeginLink, link1_end);
- DCHECK(link2 != std::wstring::npos);
+ DCHECK(link2 != std::string::npos);
size_t link2_end = text.find(kEndLink, link2);
- DCHECK(link1_end != std::wstring::npos);
+ DCHECK(link2_end != std::string::npos);
- localized_strings->SetString("license_content_0",
- WideToUTF16Hack(text.substr(0, link1)));
+ localized_strings->SetString("license_content_0", text.substr(0, link1));
localized_strings->SetString("license_content_1",
- WideToUTF16Hack(StringSubRange(text, link1_end + wcslen(kEndLinkOss),
- link2)));
+ StringSubRange(text, link1_end + strlen(kEndLinkOss), link2));
localized_strings->SetString("license_content_2",
- WideToUTF16Hack(text.substr(link2_end + wcslen(kEndLinkOss))));
+ text.substr(link2_end + strlen(kEndLinkOss)));
// The Chromium link within the main text of the dialog.
localized_strings->SetString(chromium_url_appears_first ?
"license_link_content_0" : "license_link_content_1",
- WideToUTF16Hack(StringSubRange(text,
- text.find(kBeginLinkChr) + wcslen(kBeginLinkChr),
- text.find(kEndLinkChr))));
+ StringSubRange(text,
+ text.find(kBeginLinkChr) + strlen(kBeginLinkChr),
+ text.find(kEndLinkChr)));
+ GURL url = google_util::AppendGoogleLocaleParam(
+ GURL(chrome::kChromiumProjectURL));
localized_strings->SetString(chromium_url_appears_first ?
- "license_link_0" : "license_link_1",
- l10n_util::GetStringUTF16(IDS_CHROMIUM_PROJECT_URL));
+ "license_link_0" : "license_link_1", url.spec());
- // The Open Source link within the main text of the dialog.
+ // The Open Source link within the main text of the dialog. We need to use
+ // the chrome:// variant instead of about:credits; the latter will get
+ // rewritten to about:blank.
localized_strings->SetString(chromium_url_appears_first ?
"license_link_content_1" : "license_link_content_0",
- WideToUTF16Hack(StringSubRange(text,
- text.find(kBeginLinkOss) + wcslen(kBeginLinkOss),
- text.find(kEndLinkOss))));
+ StringSubRange(text,
+ text.find(kBeginLinkOss) + strlen(kBeginLinkOss),
+ text.find(kEndLinkOss)));
localized_strings->SetString(chromium_url_appears_first ?
- "license_link_1" : "license_link_0", chrome::kAboutCreditsURL);
+ "license_link_1" : "license_link_0", chrome::kChromeUIAboutCreditsURL);
+
+#if defined(OS_CHROMEOS)
+ std::string cros_text =
+ l10n_util::GetStringUTF8(IDS_ABOUT_CROS_VERSION_LICENSE);
+
+ size_t cros_link = cros_text.find(kBeginLinkCrosOss);
+ DCHECK(cros_link != std::string::npos);
+ size_t cros_link_end = cros_text.find(kEndLinkCrosOss, cros_link);
+ DCHECK(cros_link_end != std::string::npos);
+
+ localized_strings->SetString("cros_license_content_0",
+ cros_text.substr(0, cros_link));
+ localized_strings->SetString("cros_license_content_1",
+ cros_text.substr(cros_link_end + strlen(kEndLinkCrosOss)));
+ localized_strings->SetString("cros_license_link_content_0",
+ StringSubRange(cros_text, cros_link + strlen(kBeginLinkCrosOss),
+ cros_link_end));
+ localized_strings->SetString("cros_license_link_0",
+ chrome::kChromeUIAboutOSCreditsURL);
+#endif
// webkit
@@ -332,9 +358,8 @@
int progress = static_cast<int>(status.download_progress * 100.0);
if (progress != progress_) {
progress_ = progress;
- // TODO(viettrungluu): need UTF-16 convenience form to eliminate hack.
- message = WideToUTF16Hack(
- l10n_util::GetStringF(IDS_UPDATE_DOWNLOADING, progress_));
+ message = l10n_util::GetStringFUTF16Int(IDS_UPDATE_DOWNLOADING,
+ progress_);
}
started_ = true;
}
diff --git a/chrome/browser/dom_ui/options/add_startup_page_handler.cc b/chrome/browser/dom_ui/options/add_startup_page_handler.cc
index e76da33..33b2326 100644
--- a/chrome/browser/dom_ui/options/add_startup_page_handler.cc
+++ b/chrome/browser/dom_ui/options/add_startup_page_handler.cc
@@ -75,10 +75,9 @@
ListValue pages;
for (int i = 0; i < url_table_model_->RowCount(); ++i) {
DictionaryValue* dict = new DictionaryValue();
- dict->SetString("title", WideToUTF16Hack(url_table_model_->GetText(
- i, IDS_ASI_PAGE_COLUMN)));
- dict->SetString("displayURL", WideToUTF16Hack(url_table_model_->GetText(
- i, IDS_ASI_URL_COLUMN)));
+ dict->SetString("title", url_table_model_->GetText(i, IDS_ASI_PAGE_COLUMN));
+ dict->SetString("displayURL",
+ url_table_model_->GetText(i, IDS_ASI_URL_COLUMN));
dict->SetString("url", url_table_model_->GetURL(i).spec());
pages.Append(dict);
}
diff --git a/chrome/browser/dom_ui/options/advanced_options_handler.cc b/chrome/browser/dom_ui/options/advanced_options_handler.cc
index 9531d84..9d66ee9 100644
--- a/chrome/browser/dom_ui/options/advanced_options_handler.cc
+++ b/chrome/browser/dom_ui/options/advanced_options_handler.cc
@@ -23,6 +23,7 @@
#include "chrome/browser/printing/cloud_print/cloud_print_setup_flow.h"
#include "chrome/browser/printing/cloud_print/cloud_print_url.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/remoting/setup_flow.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/ui/options/options_util.h"
@@ -181,6 +182,12 @@
localized_strings->SetString("cloudPrintProxyEnablingButton",
l10n_util::GetStringUTF16(IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLING_BUTTON));
#endif
+#if defined(ENABLE_REMOTING)
+ localized_strings->SetString("advancedSectionTitleRemoting",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_ADVANCED_SECTION_TITLE_REMOTING));
+ localized_strings->SetString("remotingSetupButton",
+ l10n_util::GetStringUTF16(IDS_OPTIONS_REMOTING_SETUP_BUTTON));
+#endif
localized_strings->SetString("enableLogging",
l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_LOGGING));
localized_strings->SetString("improveBrowsingExperience",
@@ -205,8 +212,17 @@
if (cloud_print_proxy_ui_enabled_) {
SetupCloudPrintProxySection();
RefreshCloudPrintStatusFromService();
+ } else {
+ RemoveCloudPrintProxySection();
}
#endif
+#if defined(ENABLE_REMOTING)
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableRemoting)) {
+ RemoveRemotingSection();
+ }
+#endif
+
banner_handler_.reset(
new OptionsManagedBannerHandler(dom_ui_,
ASCIIToUTF16("AdvancedOptions"),
@@ -279,7 +295,11 @@
NewCallback(this,
&AdvancedOptionsHandler::ShowNetworkProxySettings));
#endif
-
+#if defined(ENABLE_REMOTING)
+ dom_ui_->RegisterMessageCallback("showRemotingSetupDialog",
+ NewCallback(this,
+ &AdvancedOptionsHandler::ShowRemotingSetupDialog));
+#endif
#if defined(OS_WIN)
// Setup Windows specific callbacks.
dom_ui_->RegisterMessageCallback("checkRevocationCheckboxAction",
@@ -470,8 +490,7 @@
void AdvancedOptionsHandler::SetupCloudPrintProxySection() {
if (NULL == dom_ui_->GetProfile()->GetCloudPrintProxyService()) {
cloud_print_proxy_ui_enabled_ = false;
- dom_ui_->CallJavascriptFunction(
- L"options.AdvancedOptions.HideCloudPrintProxySection");
+ RemoveCloudPrintProxySection();
return;
}
@@ -495,6 +514,23 @@
L"options.AdvancedOptions.SetupCloudPrintProxySection",
disabled, label);
}
+
+void AdvancedOptionsHandler::RemoveCloudPrintProxySection() {
+ dom_ui_->CallJavascriptFunction(
+ L"options.AdvancedOptions.RemoveCloudPrintProxySection");
+}
+
+#endif
+
+#if defined(ENABLE_REMOTING)
+void AdvancedOptionsHandler::RemoveRemotingSection() {
+ dom_ui_->CallJavascriptFunction(
+ L"options.AdvancedOptions.RemoveRemotingSection");
+}
+
+void AdvancedOptionsHandler::ShowRemotingSetupDialog(const ListValue* args) {
+ remoting::SetupFlow::OpenSetupDialog(dom_ui_->GetProfile());
+}
#endif
void AdvancedOptionsHandler::SetupMetricsReportingCheckbox() {
diff --git a/chrome/browser/dom_ui/options/advanced_options_handler.h b/chrome/browser/dom_ui/options/advanced_options_handler.h
index 0de52ab..59ad1db 100644
--- a/chrome/browser/dom_ui/options/advanced_options_handler.h
+++ b/chrome/browser/dom_ui/options/advanced_options_handler.h
@@ -113,6 +113,19 @@
// Setup the enabled or disabled state of the cloud print proxy
// management UI.
void SetupCloudPrintProxySection();
+
+ // Remove cloud print proxy section if cloud print proxy management UI is
+ // disabled.
+ void RemoveCloudPrintProxySection();
+
+#endif
+
+#if defined(ENABLE_REMOTING)
+ // Removes remoting section. Called if remoting is not enabled.
+ void RemoveRemotingSection();
+
+ // Callback for Setup Remoting button.
+ void ShowRemotingSetupDialog(const ListValue* args);
#endif
// Setup the checked state for the metrics reporting checkbox.
diff --git a/chrome/browser/dom_ui/options/advanced_options_utils_gtk.cc b/chrome/browser/dom_ui/options/advanced_options_utils_gtk.cc
index 66dbe27..3c1a871 100644
--- a/chrome/browser/dom_ui/options/advanced_options_utils_gtk.cc
+++ b/chrome/browser/dom_ui/options/advanced_options_utils_gtk.cc
@@ -13,6 +13,7 @@
#include "base/string_tokenizer.h"
#include "base/nix/xdg_util.h"
#include "chrome/browser/browser_list.h"
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/process_watcher.h"
@@ -33,8 +34,12 @@
const char** argv;
};
-static bool SearchPATH(ProxyConfigCommand* commands, size_t ncommands,
- size_t* index) {
+namespace {
+
+// Search $PATH to find one of the commands. Store the full path to
+// it in the |binary| field and the command array index in in |index|.
+bool SearchPATH(ProxyConfigCommand* commands, size_t ncommands, size_t* index) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
const char* path = getenv("PATH");
if (!path)
return false;
@@ -56,7 +61,21 @@
return false;
}
-static void StartProxyConfigUtil(const ProxyConfigCommand& command) {
+// Show the proxy config URL in the given tab.
+void ShowLinuxProxyConfigUrl(TabContents* tab_contents) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ const char* name = base::nix::GetDesktopEnvironmentName(env.get());
+ if (name)
+ LOG(ERROR) << "Could not find " << name << " network settings in $PATH";
+ tab_contents->OpenURL(GURL(kLinuxProxyConfigUrl), GURL(),
+ NEW_FOREGROUND_TAB, PageTransition::LINK);
+}
+
+// Start the given proxy configuration utility.
+void StartProxyConfigUtil(TabContents* tab_contents,
+ const ProxyConfigCommand& command) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
std::vector<std::string> argv;
argv.push_back(command.binary);
for (size_t i = 1; command.argv[i]; i++)
@@ -65,16 +84,17 @@
base::ProcessHandle handle;
if (!base::LaunchApp(argv, no_files, false, &handle)) {
LOG(ERROR) << "StartProxyConfigUtil failed to start " << command.binary;
- BrowserList::GetLastActive()->
- OpenURL(GURL(kLinuxProxyConfigUrl), GURL(), NEW_FOREGROUND_TAB,
- PageTransition::LINK);
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(&ShowLinuxProxyConfigUrl, tab_contents));
return;
}
ProcessWatcher::EnsureProcessGetsReaped(handle);
}
-void AdvancedOptionsUtilities::ShowNetworkProxySettings(
- TabContents* tab_contents) {
+// Detect, and if possible, start the appropriate proxy config utility. On
+// failure to do so, show the Linux proxy config URL in a new tab instead.
+void DetectAndStartProxyConfigUtil(TabContents* tab_contents) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
scoped_ptr<base::Environment> env(base::Environment::Create());
ProxyConfigCommand command;
@@ -107,14 +127,19 @@
}
if (found_command) {
- StartProxyConfigUtil(command);
+ StartProxyConfigUtil(tab_contents, command);
} else {
- const char* name = base::nix::GetDesktopEnvironmentName(env.get());
- if (name)
- LOG(ERROR) << "Could not find " << name << " network settings in $PATH";
- tab_contents->OpenURL(GURL(kLinuxProxyConfigUrl), GURL(),
- NEW_FOREGROUND_TAB, PageTransition::LINK);
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(&ShowLinuxProxyConfigUrl, tab_contents));
}
}
+} // anonymous namespace
+
+void AdvancedOptionsUtilities::ShowNetworkProxySettings(
+ TabContents* tab_contents) {
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ NewRunnableFunction(&DetectAndStartProxyConfigUtil, tab_contents));
+}
+
#endif // !defined(OS_CHROMEOS)
diff --git a/chrome/browser/dom_ui/options/advanced_options_utils_win.cc b/chrome/browser/dom_ui/options/advanced_options_utils_win.cc
index 0bb0a8a..7cf6f45 100644
--- a/chrome/browser/dom_ui/options/advanced_options_utils_win.cc
+++ b/chrome/browser/dom_ui/options/advanced_options_utils_win.cc
@@ -11,7 +11,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
diff --git a/chrome/browser/dom_ui/options/autofill_options_handler.cc b/chrome/browser/dom_ui/options/autofill_options_handler.cc
index 1e09fd2..9e95ece 100644
--- a/chrome/browser/dom_ui/options/autofill_options_handler.cc
+++ b/chrome/browser/dom_ui/options/autofill_options_handler.cc
@@ -10,12 +10,43 @@
#include "base/logging.h"
#include "base/string16.h"
#include "base/string_number_conversions.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
+#include "chrome/browser/dom_ui/dom_ui_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/guid.h"
#include "grit/generated_resources.h"
+#include "grit/webkit_resources.h"
+
+namespace {
+
+// Converts a credit card type to the appropriate resource ID of the CC icon.
+int CreditCardTypeToResourceID(const string16& type16) {
+ std::string type = UTF16ToUTF8(type16);
+ if (type == kAmericanExpressCard)
+ return IDR_AUTOFILL_CC_AMEX;
+ else if (type == kDinersCard)
+ return IDR_AUTOFILL_CC_DINERS;
+ else if (type == kDiscoverCard)
+ return IDR_AUTOFILL_CC_DISCOVER;
+ else if (type == kGenericCard)
+ return IDR_AUTOFILL_CC_GENERIC;
+ else if (type == kJCBCard)
+ return IDR_AUTOFILL_CC_JCB;
+ else if (type == kMasterCard)
+ return IDR_AUTOFILL_CC_MASTERCARD;
+ else if (type == kSoloCard)
+ return IDR_AUTOFILL_CC_SOLO;
+ else if (type == kVisaCard)
+ return IDR_AUTOFILL_CC_VISA;
+
+ NOTREACHED();
+ return 0;
+}
+
+} // namespace
AutoFillOptionsHandler::AutoFillOptionsHandler()
: personal_data_(NULL) {
@@ -66,11 +97,17 @@
void AutoFillOptionsHandler::RegisterMessages() {
dom_ui_->RegisterMessageCallback(
- "removeAutoFillProfile",
- NewCallback(this, &AutoFillOptionsHandler::RemoveAutoFillProfile));
+ "removeAddress",
+ NewCallback(this, &AutoFillOptionsHandler::RemoveAddress));
dom_ui_->RegisterMessageCallback(
- "loadProfileEditor",
- NewCallback(this, &AutoFillOptionsHandler::LoadProfileEditor));
+ "removeCreditCard",
+ NewCallback(this, &AutoFillOptionsHandler::RemoveCreditCard));
+ dom_ui_->RegisterMessageCallback(
+ "loadAddressEditor",
+ NewCallback(this, &AutoFillOptionsHandler::LoadAddressEditor));
+ dom_ui_->RegisterMessageCallback(
+ "loadCreditCardEditor",
+ NewCallback(this, &AutoFillOptionsHandler::LoadCreditCardEditor));
dom_ui_->RegisterMessageCallback(
"setAddress",
NewCallback(this, &AutoFillOptionsHandler::SetAddress));
@@ -155,6 +192,9 @@
ListValue* entry = new ListValue();
entry->Append(new StringValue((*i)->guid()));
entry->Append(new StringValue((*i)->PreviewSummary()));
+ int res = CreditCardTypeToResourceID((*i)->type());
+ entry->Append(
+ new StringValue(dom_ui_util::GetImageDataUrlFromResource(res)));
credit_cards.Append(entry);
}
@@ -162,7 +202,7 @@
credit_cards);
}
-void AutoFillOptionsHandler::RemoveAutoFillProfile(const ListValue* args) {
+void AutoFillOptionsHandler::RemoveAddress(const ListValue* args) {
DCHECK(personal_data_->IsDataLoaded());
std::string guid;
@@ -171,18 +211,10 @@
return;
}
- // |guid| is the GUID of either an address or a credit card. Try to load the
- // corresponding address. If it exists, then remove that address; otherwise,
- // the GUID identifies a credit card, so remove the credit card.
- // TODO(jhawkins): Make RemoveProfile return true/false depending on whether
- // the profile was removed or not.
- if (personal_data_->GetProfileByGUID(guid) != NULL)
- personal_data_->RemoveProfile(guid);
- else
- personal_data_->RemoveCreditCard(guid);
+ personal_data_->RemoveProfile(guid);
}
-void AutoFillOptionsHandler::LoadProfileEditor(const ListValue* args) {
+void AutoFillOptionsHandler::RemoveCreditCard(const ListValue* args) {
DCHECK(personal_data_->IsDataLoaded());
std::string guid;
@@ -191,13 +223,89 @@
return;
}
- // |guid| is the GUID of either an address or a credit card. Try to load the
- // corresponding address. If it exists, then edit that address; otherwise, the
- // GUID identifies a credit card, so load the credit card editor.
- if (personal_data_->GetProfileByGUID(guid) != NULL)
- EditAddress(guid);
- else
- EditCreditCard(guid);
+ personal_data_->RemoveCreditCard(guid);
+}
+
+void AutoFillOptionsHandler::LoadAddressEditor(const ListValue* args) {
+ DCHECK(personal_data_->IsDataLoaded());
+
+ std::string guid;
+ if (!args->GetString(0, &guid)) {
+ NOTREACHED();
+ return;
+ }
+
+ AutoFillProfile* profile = personal_data_->GetProfileByGUID(guid);
+ DCHECK(profile);
+
+ // TODO(jhawkins): This is hacky because we can't send DictionaryValue
+ // directly to CallJavascriptFunction().
+ ListValue addressList;
+ DictionaryValue* address = new DictionaryValue();
+ address->SetString("guid", profile->guid());
+ address->SetString("fullName",
+ profile->GetFieldText(AutoFillType(NAME_FULL)));
+ address->SetString("companyName",
+ profile->GetFieldText(AutoFillType(COMPANY_NAME)));
+ address->SetString("addrLine1",
+ profile->GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)));
+ address->SetString("addrLine2",
+ profile->GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)));
+ address->SetString("city",
+ profile->GetFieldText(AutoFillType(ADDRESS_HOME_CITY)));
+ address->SetString("state",
+ profile->GetFieldText(AutoFillType(ADDRESS_HOME_STATE)));
+ address->SetString("zipCode",
+ profile->GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)));
+ address->SetString("country",
+ profile->GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)));
+ address->SetString(
+ "phone",
+ profile->GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER)));
+ address->SetString(
+ "fax",
+ profile->GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER)));
+ address->SetString("email",
+ profile->GetFieldText(AutoFillType(EMAIL_ADDRESS)));
+ addressList.Append(address);
+
+ dom_ui_->CallJavascriptFunction(L"AutoFillOptions.editAddress",
+ addressList);
+}
+
+void AutoFillOptionsHandler::LoadCreditCardEditor(const ListValue* args) {
+ DCHECK(personal_data_->IsDataLoaded());
+
+ std::string guid;
+ if (!args->GetString(0, &guid)) {
+ NOTREACHED();
+ return;
+ }
+
+ CreditCard* credit_card = personal_data_->GetCreditCardByGUID(guid);
+ DCHECK(credit_card);
+
+ // TODO(jhawkins): This is hacky because we can't send DictionaryValue
+ // directly to CallJavascriptFunction().
+ ListValue credit_card_list;
+ DictionaryValue* credit_card_data = new DictionaryValue();
+ credit_card_data->SetString("guid", credit_card->guid());
+ credit_card_data->SetString(
+ "nameOnCard",
+ credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NAME)));
+ credit_card_data->SetString(
+ "creditCardNumber",
+ credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NUMBER)));
+ credit_card_data->SetString(
+ "expirationMonth",
+ credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)));
+ credit_card_data->SetString(
+ "expirationYear",
+ credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)));
+ credit_card_list.Append(credit_card_data);
+
+ dom_ui_->CallJavascriptFunction(L"AutoFillOptions.editCreditCard",
+ credit_card_list);
}
void AutoFillOptionsHandler::SetAddress(const ListValue* args) {
@@ -273,79 +381,3 @@
personal_data_->UpdateCreditCard(credit_card);
}
}
-
-void AutoFillOptionsHandler::EditAddress(const std::string& guid) {
- DCHECK(personal_data_->IsDataLoaded());
-
- AutoFillProfile* profile = personal_data_->GetProfileByGUID(guid);
- if (!profile) {
- NOTREACHED();
- return;
- }
-
- // TODO(jhawkins): This is hacky because we can't send DictionaryValue
- // directly to CallJavascriptFunction().
- ListValue addressList;
- DictionaryValue* address = new DictionaryValue();
- address->SetString("guid", profile->guid());
- address->SetString("fullName",
- profile->GetFieldText(AutoFillType(NAME_FULL)));
- address->SetString("companyName",
- profile->GetFieldText(AutoFillType(COMPANY_NAME)));
- address->SetString("addrLine1",
- profile->GetFieldText(AutoFillType(ADDRESS_HOME_LINE1)));
- address->SetString("addrLine2",
- profile->GetFieldText(AutoFillType(ADDRESS_HOME_LINE2)));
- address->SetString("city",
- profile->GetFieldText(AutoFillType(ADDRESS_HOME_CITY)));
- address->SetString("state",
- profile->GetFieldText(AutoFillType(ADDRESS_HOME_STATE)));
- address->SetString("zipCode",
- profile->GetFieldText(AutoFillType(ADDRESS_HOME_ZIP)));
- address->SetString("country",
- profile->GetFieldText(AutoFillType(ADDRESS_HOME_COUNTRY)));
- address->SetString(
- "phone",
- profile->GetFieldText(AutoFillType(PHONE_HOME_WHOLE_NUMBER)));
- address->SetString(
- "fax",
- profile->GetFieldText(AutoFillType(PHONE_FAX_WHOLE_NUMBER)));
- address->SetString("email",
- profile->GetFieldText(AutoFillType(EMAIL_ADDRESS)));
- addressList.Append(address);
-
- dom_ui_->CallJavascriptFunction(L"AutoFillOptions.editAddress",
- addressList);
-}
-
-void AutoFillOptionsHandler::EditCreditCard(const std::string& guid) {
- DCHECK(personal_data_->IsDataLoaded());
-
- CreditCard* credit_card = personal_data_->GetCreditCardByGUID(guid);
- if (!credit_card) {
- NOTREACHED();
- return;
- }
-
- // TODO(jhawkins): This is hacky because we can't send DictionaryValue
- // directly to CallJavascriptFunction().
- ListValue credit_card_list;
- DictionaryValue* credit_card_data = new DictionaryValue();
- credit_card_data->SetString("guid", credit_card->guid());
- credit_card_data->SetString(
- "nameOnCard",
- credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NAME)));
- credit_card_data->SetString(
- "creditCardNumber",
- credit_card->GetFieldText(AutoFillType(CREDIT_CARD_NUMBER)));
- credit_card_data->SetString(
- "expirationMonth",
- credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_MONTH)));
- credit_card_data->SetString(
- "expirationYear",
- credit_card->GetFieldText(AutoFillType(CREDIT_CARD_EXP_4_DIGIT_YEAR)));
- credit_card_list.Append(credit_card_data);
-
- dom_ui_->CallJavascriptFunction(L"AutoFillOptions.editCreditCard",
- credit_card_list);
-}
diff --git a/chrome/browser/dom_ui/options/autofill_options_handler.h b/chrome/browser/dom_ui/options/autofill_options_handler.h
index eff357a..1eaed4f 100644
--- a/chrome/browser/dom_ui/options/autofill_options_handler.h
+++ b/chrome/browser/dom_ui/options/autofill_options_handler.h
@@ -36,16 +36,23 @@
// Loads AutoFill addresses and credit cards using the PersonalDataManager.
void LoadAutoFillData();
- // Removes either an address or a credit card, depending on the type of the
- // profile.
- // |args| - A string, the GUID of the profile to remove.
- void RemoveAutoFillProfile(const ListValue* args);
+ // Removes an address from the PersonalDataManager.
+ // |args| - A string, the GUID of the address to remove.
+ void RemoveAddress(const ListValue* args);
- // Requests profile data for a specific profile. Calls into DOMUI with the
- // loaded profile data to open the appropriate editor, depending on the type
- // of the profile.
- // |args| - A string, the GUID of the profile to load.
- void LoadProfileEditor(const ListValue* args);
+ // Removes a credit card from the PersonalDataManager.
+ // |args| - A string, the GUID of the credit card to remove.
+ void RemoveCreditCard(const ListValue* args);
+
+ // Requests profile data for a specific address. Calls into DOMUI with the
+ // loaded profile data to open the address editor.
+ // |args| - A string, the GUID of the address to load.
+ void LoadAddressEditor(const ListValue* args);
+
+ // Requests profile data for a specific credit card. Calls into DOMUI with the
+ // loaded profile data to open the credit card editor.
+ // |args| - A string, the GUID of the credit card to load.
+ void LoadCreditCardEditor(const ListValue* args);
// Adds or updates an address, depending on the GUID of the profile. If the
// GUID is empty, a new address is added to the WebDatabase; otherwise, the
@@ -61,14 +68,6 @@
// credit card data.
void SetCreditCard(const ListValue* args);
- // Loads the data from an address and sends this data back to the DOMUI to
- // show in the address editor. |guid| is the GUID of the profile to load.
- void EditAddress(const std::string& guid);
-
- // Loads the data from a credit card and sends this data back to the DOMUI to
- // show in the credit card editor. |guid| is the GUID of the profile to load.
- void EditCreditCard(const std::string& guid);
-
// The personal data manager, used to load AutoFill profiles and credit cards.
// Unowned pointer, may not be NULL.
PersonalDataManager* personal_data_;
diff --git a/chrome/browser/dom_ui/options/browser_options_handler.cc b/chrome/browser/dom_ui/options/browser_options_handler.cc
index 863b461..6d9a962 100644
--- a/chrome/browser/dom_ui/options/browser_options_handler.cc
+++ b/chrome/browser/dom_ui/options/browser_options_handler.cc
@@ -281,11 +281,10 @@
std::vector<GURL> urls = startup_custom_pages_table_model_->GetURLs();
for (int i = 0; i < page_count; ++i) {
DictionaryValue* entry = new DictionaryValue();
- entry->SetString("title", WideToUTF16Hack(
- startup_custom_pages_table_model_->GetText(i, 0)));
+ entry->SetString("title", startup_custom_pages_table_model_->GetText(i, 0));
entry->SetString("url", urls[i].spec());
- entry->SetString("tooltip", WideToUTF16Hack(
- startup_custom_pages_table_model_->GetTooltip(i)));
+ entry->SetString("tooltip",
+ startup_custom_pages_table_model_->GetTooltip(i));
startup_pages.Append(entry);
}
diff --git a/chrome/browser/dom_ui/options/import_data_handler.cc b/chrome/browser/dom_ui/options/import_data_handler.cc
index 85fd571..03d7716 100644
--- a/chrome/browser/dom_ui/options/import_data_handler.cc
+++ b/chrome/browser/dom_ui/options/import_data_handler.cc
@@ -11,7 +11,7 @@
#include "base/string16.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/prefs/pref_service.h"
diff --git a/chrome/browser/dom_ui/options/options_ui.cc b/chrome/browser/dom_ui/options/options_ui.cc
index 867b4fb..932de34 100644
--- a/chrome/browser/dom_ui/options/options_ui.cc
+++ b/chrome/browser/dom_ui/options/options_ui.cc
@@ -14,9 +14,10 @@
#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/values.h"
+#include "chrome/browser/browser_about_handler.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/dom_ui/dom_ui_theme_source.h"
#include "chrome/browser/dom_ui/options/about_page_handler.h"
@@ -46,13 +47,12 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/time_format.h"
#include "chrome/common/url_constants.h"
-#include "net/base/escape.h"
-
#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "grit/theme_resources.h"
+#include "net/base/escape.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/dom_ui/accounts_options_handler.h"
@@ -202,7 +202,7 @@
&ChromeURLDataManager::AddDataSource,
make_scoped_refptr(html_source)));
- // Set up chrome://theme/ source.
+ // Set up the chrome://theme/ source.
DOMUIThemeSource* theme = new DOMUIThemeSource(GetProfile());
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
@@ -210,6 +210,10 @@
ChromeURLDataManager::GetInstance(),
&ChromeURLDataManager::AddDataSource,
make_scoped_refptr(theme)));
+
+ // Initialize the chrome://about/ source in case the user clicks the credits
+ // link.
+ InitializeAboutDataSource();
}
OptionsUI::~OptionsUI() {
diff --git a/chrome/browser/dom_ui/options/options_ui_uitest.cc b/chrome/browser/dom_ui/options/options_ui_uitest.cc
index 6abad48..b6c8bd2 100644
--- a/chrome/browser/dom_ui/options/options_ui_uitest.cc
+++ b/chrome/browser/dom_ui/options/options_ui_uitest.cc
@@ -23,8 +23,6 @@
public:
OptionsUITest() {
dom_automation_enabled_ = true;
- // TODO(csilv): Remove when dom-ui options is enabled by default.
- launch_arguments_.AppendSwitch(switches::kEnableTabbedOptions);
}
void AssertIsOptionsPage(TabProxy* tab) {
diff --git a/chrome/browser/dom_ui/options/search_engine_manager_handler.cc b/chrome/browser/dom_ui/options/search_engine_manager_handler.cc
index 25ce098..78c8cd3 100644
--- a/chrome/browser/dom_ui/options/search_engine_manager_handler.cc
+++ b/chrome/browser/dom_ui/options/search_engine_manager_handler.cc
@@ -156,7 +156,7 @@
TableModel::Groups groups = list_controller_->table_model()->GetGroups();
DictionaryValue* dict = new DictionaryValue();
- dict->SetString("heading", WideToUTF16Hack(groups[group_index].title));
+ dict->SetString("heading", groups[group_index].title);
return dict;
}
@@ -165,10 +165,10 @@
TemplateURLTableModel* table_model = list_controller_->table_model();
DictionaryValue* dict = new DictionaryValue();
- dict->SetString("name", WideToUTF16Hack(table_model->GetText(
- index, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN)));
- dict->SetString("keyword", WideToUTF16Hack(table_model->GetText(
- index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN)));
+ dict->SetString("name", table_model->GetText(
+ index, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN));
+ dict->SetString("keyword", table_model->GetText(
+ index, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN));
const TemplateURL* template_url = list_controller_->GetTemplateURL(index);
GURL icon_url = template_url->GetFavIconURL();
if (icon_url.is_valid())
diff --git a/chrome/browser/dom_ui/shared_resources_data_source.cc b/chrome/browser/dom_ui/shared_resources_data_source.cc
index 6ff8343..709b33c 100644
--- a/chrome/browser/dom_ui/shared_resources_data_source.cc
+++ b/chrome/browser/dom_ui/shared_resources_data_source.cc
@@ -8,7 +8,7 @@
#include "app/resource_bundle.h"
#include "base/singleton.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
#include "chrome/browser/io_thread.h"
diff --git a/chrome/browser/dom_ui/slideshow_ui.cc b/chrome/browser/dom_ui/slideshow_ui.cc
index da8a807..a086372 100644
--- a/chrome/browser/dom_ui/slideshow_ui.cc
+++ b/chrome/browser/dom_ui/slideshow_ui.cc
@@ -11,7 +11,7 @@
#include "base/singleton.h"
#include "base/string_piece.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
diff --git a/chrome/browser/download/base_file.cc b/chrome/browser/download/base_file.cc
index 7d84670..9d77233 100644
--- a/chrome/browser/download/base_file.cc
+++ b/chrome/browser/download/base_file.cc
@@ -13,6 +13,7 @@
#include "chrome/browser/download/download_util.h"
#if defined(OS_WIN)
+#include "app/win/win_util.h"
#include "chrome/common/win_safe_util.h"
#elif defined(OS_MACOSX)
#include "chrome/browser/ui/cocoa/file_metadata.h"
diff --git a/chrome/browser/download/download_extensions.cc b/chrome/browser/download/download_extensions.cc
index 52aa565..b9cac1b 100644
--- a/chrome/browser/download/download_extensions.cc
+++ b/chrome/browser/download/download_extensions.cc
@@ -213,10 +213,6 @@
return NotDangerous;
}
-bool IsFileExtensionSafe(const FilePath::StringType& extension) {
- return GetFileExtensionDangerLevel(extension) == NotDangerous;
-}
-
bool IsFileSafe(const FilePath& path) {
return GetFileDangerLevel(path) == NotDangerous;
}
diff --git a/chrome/browser/download/download_extensions.h b/chrome/browser/download/download_extensions.h
index 3a7c557..022f2cd 100644
--- a/chrome/browser/download/download_extensions.h
+++ b/chrome/browser/download/download_extensions.h
@@ -28,9 +28,6 @@
// True if the download danger level of the file is NotDangerous.
bool IsFileSafe(const FilePath& path);
-// True if the download danger level of the extension is NotDangerous.
-bool IsFileExtensionSafe(const FilePath::StringType& extension);
-
// Tests if we think the server means for this mime_type to be executable.
bool IsExecutableMimeType(const std::string& mime_type);
diff --git a/chrome/browser/download/download_file_manager.cc b/chrome/browser/download/download_file_manager.cc
index 035714e..07eb72d 100644
--- a/chrome/browser/download/download_file_manager.cc
+++ b/chrome/browser/download/download_file_manager.cc
@@ -24,7 +24,6 @@
#include "net/base/io_buffer.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
#include "chrome/common/win_safe_util.h"
#elif defined(OS_MACOSX)
#include "chrome/browser/ui/cocoa/file_metadata.h"
diff --git a/chrome/browser/download/download_item.cc b/chrome/browser/download/download_item.cc
index f6bee14..db0c9ea 100644
--- a/chrome/browser/download/download_item.cc
+++ b/chrome/browser/download/download_item.cc
@@ -197,8 +197,7 @@
}
bool DownloadItem::CanOpenDownload() {
- return !Extension::IsExtension(target_name_) &&
- download_util::IsFileSafe(target_name_);
+ return !Extension::IsExtension(target_name_);
}
bool DownloadItem::ShouldOpenFileBasedOnExtension() {
diff --git a/chrome/browser/download/download_item_model.cc b/chrome/browser/download/download_item_model.cc
index 48c75ad..68c1861 100644
--- a/chrome/browser/download/download_item_model.cc
+++ b/chrome/browser/download/download_item_model.cc
@@ -27,7 +27,7 @@
download_->Cancel(true /* update history service */);
}
-std::wstring DownloadItemModel::GetStatusText() {
+string16 DownloadItemModel::GetStatusText() {
int64 size = download_->received_bytes();
int64 total = download_->total_bytes();
@@ -89,7 +89,7 @@
NOTREACHED();
}
- return UTF16ToWideHack(status_text);
+ return status_text;
}
// -----------------------------------------------------------------------------
@@ -104,23 +104,23 @@
save_->Cancel(true);
}
-std::wstring SavePageModel::GetStatusText() {
+string16 SavePageModel::GetStatusText() {
int64 size = download_->received_bytes();
int64 total_size = download_->total_bytes();
- std::wstring status_text;
+ string16 status_text;
switch (download_->state()) {
case DownloadItem::IN_PROGRESS:
- status_text = l10n_util::GetStringF(
+ status_text = l10n_util::GetStringFUTF16(
IDS_SAVE_PAGE_PROGRESS,
- UTF16ToWide(base::FormatNumber(size)),
- UTF16ToWide(base::FormatNumber(total_size)));
+ base::FormatNumber(size),
+ base::FormatNumber(total_size));
break;
case DownloadItem::COMPLETE:
- status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_COMPLETED);
+ status_text = l10n_util::GetStringUTF16(IDS_SAVE_PAGE_STATUS_COMPLETED);
break;
case DownloadItem::CANCELLED:
- status_text = l10n_util::GetString(IDS_SAVE_PAGE_STATUS_CANCELED);
+ status_text = l10n_util::GetStringUTF16(IDS_SAVE_PAGE_STATUS_CANCELED);
break;
case DownloadItem::REMOVING:
break;
diff --git a/chrome/browser/download/download_item_model.h b/chrome/browser/download/download_item_model.h
index f399489..d8327d3 100644
--- a/chrome/browser/download/download_item_model.h
+++ b/chrome/browser/download/download_item_model.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,6 +9,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/string16.h"
class DownloadItem;
class SavePackage;
@@ -25,7 +26,7 @@
virtual void CancelTask() = 0;
// Get the status text to display.
- virtual std::wstring GetStatusText() = 0;
+ virtual string16 GetStatusText() = 0;
DownloadItem* download() { return download_; }
@@ -45,7 +46,7 @@
virtual void CancelTask();
// Get downloading status text.
- virtual std::wstring GetStatusText();
+ virtual string16 GetStatusText();
private:
DISALLOW_COPY_AND_ASSIGN(DownloadItemModel);
@@ -63,7 +64,7 @@
virtual void CancelTask();
// Get page saving status text.
- virtual std::wstring GetStatusText();
+ virtual string16 GetStatusText();
private:
// Saving page management.
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index da878b0..268c417 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -48,10 +48,6 @@
#include "net/base/mime_util.h"
#include "net/base/net_util.h"
-#if defined(OS_WIN)
-#include "app/win_util.h"
-#endif
-
DownloadManager::DownloadManager(DownloadStatusUpdater* status_updater)
: shutdown_needed_(false),
profile_(NULL),
@@ -858,8 +854,6 @@
FilePath::StringType extension = path.Extension();
if (extension.empty())
return false;
- if (!download_util::IsFileExtensionSafe(extension))
- return false;
if (Extension::IsExtension(path))
return false;
DCHECK(extension[0] == FilePath::kExtensionSeparator);
diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc
index 210788d..2db13be 100644
--- a/chrome/browser/download/download_manager_unittest.cc
+++ b/chrome/browser/download/download_manager_unittest.cc
@@ -112,10 +112,15 @@
true,
false,
true, },
- { "http://www.foo.com/always_prompt.pdf",
+ { "http://www.foo.com/sometimes_prompt.pdf",
"application/pdf",
false,
true,
+ false, },
+ { "http://www.foo.com/always_prompt.jar",
+ "application/jar",
+ false,
+ true,
true, },
};
diff --git a/chrome/browser/download/download_prefs.cc b/chrome/browser/download/download_prefs.cc
index b4f9ddc..40be829 100644
--- a/chrome/browser/download/download_prefs.cc
+++ b/chrome/browser/download/download_prefs.cc
@@ -89,8 +89,6 @@
return false;
DCHECK(extension[0] == FilePath::kExtensionSeparator);
extension.erase(0, 1);
- if (!download_util::IsFileExtensionSafe(extension))
- return false;
auto_open_.insert(extension);
SaveAutoOpenState();
diff --git a/chrome/browser/download/download_uitest.cc b/chrome/browser/download/download_uitest.cc
index aed2f6c..b347a77 100644
--- a/chrome/browser/download/download_uitest.cc
+++ b/chrome/browser/download/download_uitest.cc
@@ -13,9 +13,9 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/string_util.h"
#include "base/test/test_file_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/download/download_util.h"
#include "chrome/browser/net/url_request_mock_http_job.h"
@@ -154,7 +154,7 @@
WaitUntilTabCount(1);
// Wait to see if the file will be downloaded.
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
EXPECT_FALSE(file_util::PathExists(file_path));
if (file_util::PathExists(file_path))
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index c7babd3..f00db36 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -22,7 +22,7 @@
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "base/sys_string_conversions.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "base/win/windows_version.h"
@@ -71,10 +71,9 @@
#if defined(OS_WIN)
#include "app/os_exchange_data_provider_win.h"
-#include "app/win_util.h"
#include "app/win/drag_source.h"
+#include "app/win/win_util.h"
#include "base/win/scoped_comptr.h"
-#include "base/win_util.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/views/frame/browser_view.h"
#endif
@@ -92,6 +91,39 @@
// Also used by code that cleans up said files.
static const int kMaxUniqueFiles = 100;
+namespace {
+
+#if defined(OS_WIN)
+// Returns whether the specified extension is automatically integrated into the
+// windows shell.
+bool IsShellIntegratedExtension(const string16& extension) {
+ string16 extension_lower = StringToLowerASCII(extension);
+
+ static const wchar_t* const integrated_extensions[] = {
+ // See <http://msdn.microsoft.com/en-us/library/ms811694.aspx>.
+ L"local",
+ // Right-clicking on shortcuts can be magical.
+ L"lnk",
+ };
+
+ for (int i = 0; i < arraysize(integrated_extensions); ++i) {
+ if (extension_lower == integrated_extensions[i])
+ return true;
+ }
+
+ // See <http://www.juniper.net/security/auto/vulnerabilities/vuln2612.html>.
+ // That vulnerability report is not exactly on point, but files become magical
+ // if their end in a CLSID. Here we block extensions that look like CLSIDs.
+ if (extension_lower.size() > 0 && extension_lower.at(0) == L'{' &&
+ extension_lower.at(extension_lower.length() - 1) == L'}')
+ return true;
+
+ return false;
+}
+#endif // OS_WIN
+
+} // namespace
+
// Download temporary file creation --------------------------------------------
class DefaultDownloadDirectory {
@@ -157,7 +189,7 @@
FILE_PATH_LITERAL("download");
// Rename shell-integrated extensions.
- if (win_util::IsShellIntegratedExtension(extension))
+ if (IsShellIntegratedExtension(extension))
extension.assign(default_extension);
#endif
@@ -186,12 +218,14 @@
const std::string& referrer_charset,
const std::string& mime_type,
FilePath* generated_name) {
- std::wstring default_name =
- l10n_util::GetString(IDS_DEFAULT_DOWNLOAD_FILENAME);
#if defined(OS_WIN)
- FilePath default_file_path(default_name);
+ FilePath default_file_path(
+ l10n_util::GetStringUTF16(IDS_DEFAULT_DOWNLOAD_FILENAME));
#elif defined(OS_POSIX)
- FilePath default_file_path(base::SysWideToNativeMB(default_name));
+ std::string default_file =
+ l10n_util::GetStringUTF8(IDS_DEFAULT_DOWNLOAD_FILENAME);
+ FilePath default_file_path(
+ base::SysWideToNativeMB(base::SysUTF8ToWide(default_file)));
#endif
*generated_name = net::GetSuggestedFilename(GURL(url),
@@ -214,7 +248,7 @@
// Prepend "_" to the file name if it's a reserved name
FilePath::StringType leaf_name = file_name->BaseName().value();
DCHECK(!leaf_name.empty());
- if (win_util::IsReservedName(leaf_name)) {
+ if (app::win::IsReservedName(leaf_name)) {
leaf_name = FilePath::StringType(FILE_PATH_LITERAL("_")) + leaf_name;
*file_name = file_name->DirName();
if (file_name->value() == FilePath::kCurrentDirectory) {
@@ -511,7 +545,7 @@
}
file_value->SetString("progress_status_text",
- WideToUTF16Hack(GetProgressStatusText(download)));
+ GetProgressStatusText(download));
file_value->SetInteger("percent",
static_cast<int>(download->PercentComplete()));
@@ -533,13 +567,12 @@
return file_value;
}
-std::wstring GetProgressStatusText(DownloadItem* download) {
+string16 GetProgressStatusText(DownloadItem* download) {
int64 total = download->total_bytes();
int64 size = download->received_bytes();
DataUnits amount_units = GetByteDisplayUnits(size);
- std::wstring received_size = UTF16ToWideHack(FormatBytes(size, amount_units,
- true));
- std::wstring amount = received_size;
+ string16 received_size = FormatBytes(size, amount_units, true);
+ string16 amount = received_size;
// Adjust both strings for the locale direction since we don't yet know which
// string we'll end up using for constructing the final progress string.
@@ -547,21 +580,19 @@
if (total) {
amount_units = GetByteDisplayUnits(total);
- std::wstring total_text =
- UTF16ToWideHack(FormatBytes(total, amount_units, true));
+ string16 total_text = FormatBytes(total, amount_units, true);
base::i18n::AdjustStringForLocaleDirection(&total_text);
base::i18n::AdjustStringForLocaleDirection(&received_size);
- amount = l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_SIZE,
- received_size,
- total_text);
+ amount = l10n_util::GetStringFUTF16(IDS_DOWNLOAD_TAB_PROGRESS_SIZE,
+ received_size,
+ total_text);
} else {
amount.assign(received_size);
}
int64 current_speed = download->CurrentSpeed();
amount_units = GetByteDisplayUnits(current_speed);
- std::wstring speed_text = UTF16ToWideHack(FormatSpeed(current_speed,
- amount_units, true));
+ string16 speed_text = FormatSpeed(current_speed, amount_units, true);
base::i18n::AdjustStringForLocaleDirection(&speed_text);
base::TimeDelta remaining;
@@ -573,11 +604,11 @@
if (time_remaining.empty()) {
base::i18n::AdjustStringForLocaleDirection(&amount);
- return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN,
- speed_text, amount);
+ return l10n_util::GetStringFUTF16(
+ IDS_DOWNLOAD_TAB_PROGRESS_STATUS_TIME_UNKNOWN, speed_text, amount);
}
- return l10n_util::GetStringF(IDS_DOWNLOAD_TAB_PROGRESS_STATUS, speed_text,
- amount, UTF16ToWideHack(time_remaining));
+ return l10n_util::GetStringFUTF16(IDS_DOWNLOAD_TAB_PROGRESS_STATUS,
+ speed_text, amount, time_remaining);
}
#if !defined(OS_MACOSX)
diff --git a/chrome/browser/download/download_util.h b/chrome/browser/download/download_util.h
index 0a0bd90..c1013a3 100644
--- a/chrome/browser/download/download_util.h
+++ b/chrome/browser/download/download_util.h
@@ -12,6 +12,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
+#include "base/string16.h"
#include "gfx/native_widget_types.h"
#if defined(TOOLKIT_VIEWS)
@@ -157,7 +158,7 @@
DictionaryValue* CreateDownloadItemValue(DownloadItem* download, int id);
// Get the localized status text for an in-progress download.
-std::wstring GetProgressStatusText(DownloadItem* download);
+string16 GetProgressStatusText(DownloadItem* download);
// Update the application icon to indicate overall download progress.
// |download_count| is the number of downloads currently in progress. If
diff --git a/chrome/browser/download/save_file_manager.cc b/chrome/browser/download/save_file_manager.cc
index 2c432a7..5b25ea6 100644
--- a/chrome/browser/download/save_file_manager.cc
+++ b/chrome/browser/download/save_file_manager.cc
@@ -11,7 +11,7 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/download/save_file.h"
#include "chrome/browser/download/save_package.h"
diff --git a/chrome/browser/download/save_package.cc b/chrome/browser/download/save_package.cc
index 7bda1bb..23c062c 100644
--- a/chrome/browser/download/save_package.cc
+++ b/chrome/browser/download/save_package.cc
@@ -17,7 +17,7 @@
#include "base/string_split.h"
#include "base/utf_string_conversions.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/download/download_item.h"
diff --git a/chrome/browser/download/save_page_uitest.cc b/chrome/browser/download/save_page_uitest.cc
index e6c6e08..d6078b3 100644
--- a/chrome/browser/download/save_page_uitest.cc
+++ b/chrome/browser/download/save_page_uitest.cc
@@ -1,10 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/string_util.h"
#include "base/test/test_file_util.h"
#include "chrome/app/chrome_command_ids.h"
diff --git a/chrome/browser/enumerate_modules_model_unittest_win.cc b/chrome/browser/enumerate_modules_model_unittest_win.cc
index 7aa6b63..1992e7a 100644
--- a/chrome/browser/enumerate_modules_model_unittest_win.cc
+++ b/chrome/browser/enumerate_modules_model_unittest_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -78,6 +78,12 @@
const ModuleEnumerator::Module kStandardModule =
{ kType, kStatus, L"c:\\foo\\bar.dll", L"", L"Prod", L"Desc", L"1.0", L"Sig",
ModuleEnumerator::NONE };
+const ModuleEnumerator::Module kStandardModuleNoDescription =
+ { kType, kStatus, L"c:\\foo\\bar.dll", L"", L"Prod", L"", L"1.0", L"Sig",
+ ModuleEnumerator::NONE };
+const ModuleEnumerator::Module kStandardModuleNoSignature =
+ { kType, kStatus, L"c:\\foo\\bar.dll", L"", L"Prod", L"Desc", L"1.0", L"",
+ ModuleEnumerator::NONE };
// Name, location, description and signature are compared by hashing.
static const char kMatchName[] = "88e8c9e0"; // "bar.dll".
@@ -120,6 +126,16 @@
kStandardModule,
{ kMatchName, kMatchLocation, kEmpty, kEmpty, kEmpty,
ModuleEnumerator::SEE_LINK }
+ }, { // Matches: Name, location, (description not given) => Confirmed match.
+ ModuleEnumerator::CONFIRMED_BAD,
+ kStandardModuleNoDescription, // Note: No description.
+ { kMatchName, kMatchLocation, kEmpty, kEmpty, kEmpty,
+ ModuleEnumerator::SEE_LINK }
+ }, { // Matches: Name, location, (signature not given) => Confirmed match.
+ ModuleEnumerator::CONFIRMED_BAD,
+ kStandardModuleNoSignature, // Note: No signature.
+ { kMatchName, kMatchLocation, kEmpty, kEmpty, kEmpty,
+ ModuleEnumerator::SEE_LINK }
}, { // Matches: Name, location (not version) => Not a match.
ModuleEnumerator::NOT_MATCHED,
kStandardModule,
diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc
index 83dc535..79e0604 100644
--- a/chrome/browser/enumerate_modules_model_win.cc
+++ b/chrome/browser/enumerate_modules_model_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,13 +8,12 @@
#include <wintrust.h>
#include "app/l10n_util.h"
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#include "base/command_line.h"
#include "base/environment.h"
#include "base/file_path.h"
#include "base/file_version_info_win.h"
#include "base/metrics/histogram.h"
-#include "base/scoped_handle.h"
#include "base/sha2.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
@@ -23,6 +22,7 @@
#include "base/values.h"
#include "base/version.h"
#include "base/win/registry.h"
+#include "base/win/scoped_handle.h"
#include "chrome/browser/net/service_providers_win.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
@@ -126,7 +126,8 @@
static_cast<RecommendedAction>(UPDATE | DISABLE) },
// is3lsp.dll, "%commonprogramfiles%\\is3\\anti-spyware\\".
- { "7ffbdce9", "bc5673f2", "", "", "", INVESTIGATING },
+ { "7ffbdce9", "bc5673f2", "", "", "",
+ static_cast<RecommendedAction>(UPDATE | DISABLE | SEE_LINK) },
// jsi.dll, "%programfiles%\\profilecraze\\".
{ "f9555eea", "e3548061", "", "", "", kUninstallLink },
@@ -219,7 +220,7 @@
// static
void ModuleEnumerator::NormalizeModule(Module* module) {
string16 path = module->location;
- if (!win_util::ConvertToLongPath(path, &module->location))
+ if (!app::win::ConvertToLongPath(path, &module->location))
module->location = path;
module->location = l10n_util::ToLower(module->location);
@@ -291,12 +292,13 @@
GenerateHash(WideToUTF8(module.digital_signer), &signer_hash);
GenerateHash(WideToUTF8(module.description), &description_hash);
- // If signatures match, we have a winner.
- if (!desc_or_signer.empty() && signer_hash == desc_or_signer)
+ // If signatures match (or both are empty), then we have a winner.
+ if (signer_hash == desc_or_signer)
return CONFIRMED_BAD;
- // If description matches and location, then we also have a match.
- if (!desc_or_signer.empty() && description_hash == desc_or_signer &&
+ // If descriptions match (or both are empty) and the locations match, then
+ // we also have a confirmed match.
+ if (description_hash == desc_or_signer &&
!location_hash.empty() && location_hash == blacklisted.location) {
return CONFIRMED_BAD;
}
@@ -311,22 +313,31 @@
ModuleEnumerator::ModuleEnumerator(EnumerateModulesModel* observer)
: observer_(observer),
+ limited_mode_(false),
callback_thread_id_(BrowserThread::ID_COUNT) {
}
ModuleEnumerator::~ModuleEnumerator() {
}
-void ModuleEnumerator::ScanNow(ModulesVector* list) {
- CHECK(BrowserThread::GetCurrentThreadIdentifier(&callback_thread_id_));
- DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE));
+void ModuleEnumerator::ScanNow(ModulesVector* list, bool limited_mode) {
enumerated_modules_ = list;
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE,
- NewRunnableMethod(this, &ModuleEnumerator::ScanOnFileThread));
+
+ limited_mode_ = limited_mode;
+
+ if (!limited_mode_) {
+ CHECK(BrowserThread::GetCurrentThreadIdentifier(&callback_thread_id_));
+ DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::FILE));
+ BrowserThread::PostTask(
+ BrowserThread::FILE, FROM_HERE,
+ NewRunnableMethod(this, &ModuleEnumerator::ScanImpl));
+ } else {
+ // Run it synchronously.
+ ScanImpl();
+ }
}
-void ModuleEnumerator::ScanOnFileThread() {
+void ModuleEnumerator::ScanImpl() {
base::TimeTicks start_time = base::TimeTicks::Now();
enumerated_modules_->clear();
@@ -334,42 +345,49 @@
// Make sure the path mapping vector is setup so we can collapse paths.
PreparePathMappings();
- base::TimeTicks checkpoint = base::TimeTicks::Now();
-
// Enumerating loaded modules must happen first since the other types of
// modules check for duplication against the loaded modules.
+ base::TimeTicks checkpoint = base::TimeTicks::Now();
EnumerateLoadedModules();
- HISTOGRAM_TIMES("Conflicts.EnumerateLoadedModules",
- base::TimeTicks::Now() - checkpoint);
+ base::TimeTicks checkpoint2 = base::TimeTicks::Now();
+ UMA_HISTOGRAM_TIMES("Conflicts.EnumerateLoadedModules",
+ checkpoint2 - checkpoint);
- checkpoint = base::TimeTicks::Now();
+ checkpoint = checkpoint2;
EnumerateShellExtensions();
- HISTOGRAM_TIMES("Conflicts.EnumerateShellExtensions",
- base::TimeTicks::Now() - checkpoint);
+ checkpoint2 = base::TimeTicks::Now();
+ UMA_HISTOGRAM_TIMES("Conflicts.EnumerateShellExtensions",
+ checkpoint2 - checkpoint);
- checkpoint = base::TimeTicks::Now();
+ checkpoint = checkpoint2;
EnumerateWinsockModules();
- HISTOGRAM_TIMES("Conflicts.EnumerateWinsockModules",
- base::TimeTicks::Now() - checkpoint);
+ checkpoint2 = base::TimeTicks::Now();
+ UMA_HISTOGRAM_TIMES("Conflicts.EnumerateWinsockModules",
+ checkpoint2 - checkpoint);
MatchAgainstBlacklist();
std::sort(enumerated_modules_->begin(),
enumerated_modules_->end(), ModuleSort);
- // Send a reply back on the UI thread.
- BrowserThread::PostTask(
- callback_thread_id_, FROM_HERE,
- NewRunnableMethod(this, &ModuleEnumerator::ReportBack));
+ if (!limited_mode_) {
+ // Send a reply back on the UI thread.
+ BrowserThread::PostTask(
+ callback_thread_id_, FROM_HERE,
+ NewRunnableMethod(this, &ModuleEnumerator::ReportBack));
+ } else {
+ // We are on the main thread already.
+ ReportBack();
+ }
- HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime",
- base::TimeTicks::Now() - start_time);
+ UMA_HISTOGRAM_TIMES("Conflicts.EnumerationTotalTime",
+ base::TimeTicks::Now() - start_time);
}
void ModuleEnumerator::EnumerateLoadedModules() {
// Get all modules in the current process.
- ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
- ::GetCurrentProcessId()));
+ base::win::ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,
+ ::GetCurrentProcessId()));
if (!snap.Get())
return;
@@ -584,7 +602,8 @@
}
void ModuleEnumerator::ReportBack() {
- DCHECK(BrowserThread::CurrentlyOn(callback_thread_id_));
+ if (!limited_mode_)
+ DCHECK(BrowserThread::CurrentlyOn(callback_thread_id_));
observer_->DoneScanning();
}
@@ -694,7 +713,7 @@
// ScanNow does not block.
if (!module_enumerator_)
module_enumerator_ = new ModuleEnumerator(this);
- module_enumerator_->ScanNow(&enumerated_modules_);
+ module_enumerator_->ScanNow(&enumerated_modules_, limited_mode_);
}
ListValue* EnumerateModulesModel::GetModuleList() {
@@ -727,8 +746,10 @@
}
// Must be one of the above type.
DCHECK(!type_string.empty());
- type_string += ASCIIToWide(" -- ");
- type_string += l10n_util::GetStringUTF16(IDS_CONFLICTS_NOT_LOADED_YET);
+ if (!limited_mode_) {
+ type_string += ASCIIToWide(" -- ");
+ type_string += l10n_util::GetStringUTF16(IDS_CONFLICTS_NOT_LOADED_YET);
+ }
}
data->SetString("type_description", type_string);
data->SetInteger("status", module->status);
@@ -739,40 +760,43 @@
data->SetString("version", module->version);
data->SetString("digital_signer", module->digital_signer);
- // Figure out the possible resolution help string.
- string16 actions;
- string16 separator = ASCIIToWide(" ") + l10n_util::GetStringUTF16(
- IDS_CONFLICTS_CHECK_POSSIBLE_ACTION_SEPERATOR) +
- ASCIIToWide(" ");
+ if (!limited_mode_) {
+ // Figure out the possible resolution help string.
+ string16 actions;
+ string16 separator = ASCIIToWide(" ") + l10n_util::GetStringUTF16(
+ IDS_CONFLICTS_CHECK_POSSIBLE_ACTION_SEPERATOR) +
+ ASCIIToWide(" ");
- if (module->recommended_action & ModuleEnumerator::NONE) {
- actions = l10n_util::GetStringUTF16(
- IDS_CONFLICTS_CHECK_INVESTIGATING);
+ if (module->recommended_action & ModuleEnumerator::NONE) {
+ actions = l10n_util::GetStringUTF16(
+ IDS_CONFLICTS_CHECK_INVESTIGATING);
+ }
+ if (module->recommended_action & ModuleEnumerator::UNINSTALL) {
+ if (!actions.empty())
+ actions += separator;
+ actions = l10n_util::GetStringUTF16(
+ IDS_CONFLICTS_CHECK_POSSIBLE_ACTION_UNINSTALL);
+ }
+ if (module->recommended_action & ModuleEnumerator::UPDATE) {
+ if (!actions.empty())
+ actions += separator;
+ actions += l10n_util::GetStringUTF16(
+ IDS_CONFLICTS_CHECK_POSSIBLE_ACTION_UPDATE);
+ }
+ if (module->recommended_action & ModuleEnumerator::DISABLE) {
+ if (!actions.empty())
+ actions += separator;
+ actions += l10n_util::GetStringUTF16(
+ IDS_CONFLICTS_CHECK_POSSIBLE_ACTION_DISABLE);
+ }
+ string16 possible_resolution = actions.empty() ? ASCIIToWide("") :
+ l10n_util::GetStringUTF16(IDS_CONFLICTS_CHECK_POSSIBLE_ACTIONS) +
+ ASCIIToWide(" ") +
+ actions;
+ data->SetString("possibleResolution", possible_resolution);
+ data->SetString("help_url",
+ ConstructHelpCenterUrl(*module).spec().c_str());
}
- if (module->recommended_action & ModuleEnumerator::UNINSTALL) {
- if (!actions.empty())
- actions += separator;
- actions = l10n_util::GetStringUTF16(
- IDS_CONFLICTS_CHECK_POSSIBLE_ACTION_UNINSTALL);
- }
- if (module->recommended_action & ModuleEnumerator::UPDATE) {
- if (!actions.empty())
- actions += separator;
- actions += l10n_util::GetStringUTF16(
- IDS_CONFLICTS_CHECK_POSSIBLE_ACTION_UPDATE);
- }
- if (module->recommended_action & ModuleEnumerator::DISABLE) {
- if (!actions.empty())
- actions += separator;
- actions += l10n_util::GetStringUTF16(
- IDS_CONFLICTS_CHECK_POSSIBLE_ACTION_DISABLE);
- }
- string16 possible_resolution = actions.empty() ? ASCIIToWide("") :
- l10n_util::GetStringUTF16(IDS_CONFLICTS_CHECK_POSSIBLE_ACTIONS) +
- ASCIIToWide(" ") +
- actions;
- data->SetString("possibleResolution", possible_resolution);
- data->SetString("help_url", ConstructHelpCenterUrl(*module).spec().c_str());
list->Append(data);
}
@@ -783,6 +807,7 @@
EnumerateModulesModel::EnumerateModulesModel()
: scanning_(false),
+ limited_mode_(false),
confirmed_bad_modules_detected_(0),
suspected_bad_modules_detected_(0) {
const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
@@ -814,16 +839,27 @@
scanning_ = false;
lock->Release();
- HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules",
- suspected_bad_modules_detected_);
- HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules",
- confirmed_bad_modules_detected_);
+ UMA_HISTOGRAM_COUNTS_100("Conflicts.SuspectedBadModules",
+ suspected_bad_modules_detected_);
+ UMA_HISTOGRAM_COUNTS_100("Conflicts.ConfirmedBadModules",
+ confirmed_bad_modules_detected_);
+
+ // Notifications are not available in limited mode.
+ if (limited_mode_)
+ return;
NotificationService::current()->Notify(
NotificationType::MODULE_LIST_ENUMERATED,
Source<EnumerateModulesModel>(this),
NotificationService::NoDetails());
+ // Command line flag must be enabled for the notification to get sent out.
+ // Otherwise we'd get the badge (while the feature is disabled) when we
+ // navigate to about:conflicts and find confirmed matches.
+ const CommandLine& cmd_line = *CommandLine::ForCurrentProcess();
+ if (!cmd_line.HasSwitch(switches::kConflictingModulesCheck))
+ return;
+
if (suspected_bad_modules_detected_ || confirmed_bad_modules_detected_) {
bool found_confirmed_bad_modules = confirmed_bad_modules_detected_ > 0;
NotificationService::current()->Notify(
@@ -845,8 +881,8 @@
GenerateHash(WideToUTF8(module.description), &description);
GenerateHash(WideToUTF8(module.digital_signer), &signer);
- string16 url = l10n_util::GetStringF(IDS_HELP_CENTER_VIEW_CONFLICTS,
- ASCIIToWide(filename), ASCIIToWide(location),
- ASCIIToWide(description), ASCIIToWide(signer));
- return GURL(WideToUTF8(url));
+ string16 url = l10n_util::GetStringFUTF16(IDS_HELP_CENTER_VIEW_CONFLICTS,
+ ASCIIToUTF16(filename), ASCIIToUTF16(location),
+ ASCIIToUTF16(description), ASCIIToUTF16(signer));
+ return GURL(UTF16ToUTF8(url));
}
diff --git a/chrome/browser/enumerate_modules_model_win.h b/chrome/browser/enumerate_modules_model_win.h
index 1f524c8..4364bb6 100644
--- a/chrome/browser/enumerate_modules_model_win.h
+++ b/chrome/browser/enumerate_modules_model_win.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -119,11 +119,15 @@
~ModuleEnumerator();
// Start scanning the loaded module list (if a scan is not already in
- // progress). This function does not block while reading the module list, but
- // will notify when done through the MODULE_LIST_ENUMERATED notification.
+ // progress). This function does not block while reading the module list
+ // (unless we are in limited_mode, see below), and will notify when done
+ // through the MODULE_LIST_ENUMERATED notification.
// The process will also send MODULE_INCOMPATIBILITY_DETECTED if an
// incompatible module was detected.
- void ScanNow(ModulesVector* list);
+ // When in |limited_mode|, this function will not leverage the File thread
+ // to run asynchronously and will therefore block until scanning is done
+ // (and will also not send out any notifications).
+ void ScanNow(ModulesVector* list, bool limited_mode);
private:
FRIEND_TEST_ALL_PREFIXES(EnumerateModulesTest, CollapsePath);
@@ -131,13 +135,14 @@
// The (currently) hard coded blacklist of known bad modules.
static const BlacklistEntry kModuleBlacklist[];
- // This function does the actual file scanning work on the FILE thread. It
- // enumerates all loaded modules in the process and other modules of
- // interest, such as the registered Winsock LSP modules and stores them in
- // |enumerated_modules_|. It then normalizes the module info and matches
- // them against a blacklist of known bad modules. Finally, it calls
- // ReportBack to let the observer know we are done.
- void ScanOnFileThread();
+ // This function does the actual file scanning work on the FILE thread (or
+ // block the main thread when in limited_mode). It enumerates all loaded
+ // modules in the process and other modules of interest, such as the
+ // registered Winsock LSP modules and stores them in |enumerated_modules_|.
+ // It then normalizes the module info and matches them against a blacklist
+ // of known bad modules. Finally, it calls ReportBack to let the observer
+ // know we are done.
+ void ScanImpl();
// Enumerate all modules loaded into the Chrome process.
void EnumerateLoadedModules();
@@ -200,6 +205,9 @@
// The observer, who needs to be notified when we are done.
EnumerateModulesModel* observer_;
+ // See limited_mode below.
+ bool limited_mode_;
+
// The thread that we need to call back on to report that we are done.
BrowserThread::ID callback_thread_id_;
@@ -235,8 +243,14 @@
return confirmed_bad_modules_detected_;
}
- // Asynchronously start the scan for the loaded module list.
- // When the list is ready.
+ // Set to true when we the scanning process can not rely on certain Chrome
+ // services to exists.
+ void set_limited_mode(bool limited_mode) {
+ limited_mode_ = limited_mode;
+ }
+
+ // Asynchronously start the scan for the loaded module list, except when in
+ // limited_mode (in which case it blocks).
void ScanNow();
// Gets the whole module list as a ListValue.
@@ -268,6 +282,13 @@
// start scanning for modules after a certain amount of time has passed.
base::OneShotTimer<EnumerateModulesModel> check_modules_timer_;
+ // While normally |false|, this mode can be set to indicate that the scanning
+ // process should not rely on certain services normally available to Chrome,
+ // such as the resource bundle and the notification system, not to mention
+ // having multiple threads. This mode is useful during diagnostics, which
+ // runs without firing up all necessary Chrome services first.
+ bool limited_mode_;
+
// True if we are currently scanning for modules.
bool scanning_;
diff --git a/chrome/browser/errorpage_uitest.cc b/chrome/browser/errorpage_uitest.cc
index 427f067..51b9754 100644
--- a/chrome/browser/errorpage_uitest.cc
+++ b/chrome/browser/errorpage_uitest.cc
@@ -1,8 +1,9 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "chrome/browser/net/url_request_failed_dns_job.h"
@@ -15,7 +16,7 @@
for (int i = 0; i < 10; ++i) {
if (GetActiveTabTitle() == title)
return true;
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
}
EXPECT_EQ(title, GetActiveTabTitle());
return false;
diff --git a/chrome/browser/extensions/app_process_apitest.cc b/chrome/browser/extensions/app_process_apitest.cc
index dece83c..c812b1a 100644
--- a/chrome/browser/extensions/app_process_apitest.cc
+++ b/chrome/browser/extensions/app_process_apitest.cc
@@ -61,14 +61,7 @@
EXPECT_EQ(url, contents->controller().GetLastCommittedEntry()->url());
}
-#if defined(OS_WIN)
-// AppProcess sometimes hangs on Windows
-// http://crbug.com/58810
-#define MAYBE_AppProcess DISABLED_AppProcess
-#else
-#define MAYBE_AppProcess AppProcess
-#endif
-IN_PROC_BROWSER_TEST_F(AppApiTest, MAYBE_AppProcess) {
+IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcess) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kDisablePopupBlocking);
@@ -145,3 +138,47 @@
&windowOpenerValid));
ASSERT_TRUE(windowOpenerValid);
}
+
+// Tests that app process switching works properly in the following scenario:
+// 1. navigate to a page1 in the app
+// 2. page1 redirects to a page2 outside the app extent (ie, "/server-redirect")
+// 3. page2 redirects back to a page in the app
+// The final navigation should end up in the app process.
+// See http://crbug.com/61757
+IN_PROC_BROWSER_TEST_F(AppApiTest, AppProcessRedirectBack) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kDisablePopupBlocking);
+
+ host_resolver()->AddRule("*", "127.0.0.1");
+ ASSERT_TRUE(test_server()->Start());
+
+ ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process")));
+
+ // Open two tabs in the app.
+ GURL base_url = test_server()->GetURL(
+ "files/extensions/api_test/app_process/");
+
+ // The app under test acts on URLs whose host is "localhost",
+ // so the URLs we navigate to must have host "localhost".
+ GURL::Replacements replace_host;
+ std::string host_str("localhost"); // must stay in scope with replace_host
+ replace_host.SetHostStr(host_str);
+ base_url = base_url.ReplaceComponents(replace_host);
+
+ browser()->NewTab();
+ ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html"));
+ browser()->NewTab();
+ // Wait until the second tab finishes its redirect train (2 hops).
+ ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
+ browser(), base_url.Resolve("path1/redirect.html"), 2);
+
+ // 3 tabs, including the initial about:blank. The last 2 should be the same
+ // process.
+ ASSERT_EQ(3, browser()->tab_count());
+ EXPECT_EQ("/files/extensions/api_test/app_process/path1/empty.html",
+ browser()->GetTabContentsAt(2)->controller().
+ GetLastCommittedEntry()->url().path());
+ RenderViewHost* host = browser()->GetTabContentsAt(1)->render_view_host();
+ EXPECT_EQ(host->process(),
+ browser()->GetTabContentsAt(2)->render_view_host()->process());
+}
diff --git a/chrome/browser/extensions/autoupdate_interceptor.cc b/chrome/browser/extensions/autoupdate_interceptor.cc
index e919189..751658b 100644
--- a/chrome/browser/extensions/autoupdate_interceptor.cc
+++ b/chrome/browser/extensions/autoupdate_interceptor.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/extensions/autoupdate_interceptor.h"
#include "base/file_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_thread.h"
#include "net/url_request/url_request_test_job.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc
index f6708c5..1593aea 100644
--- a/chrome/browser/extensions/crx_installer.cc
+++ b/chrome/browser/extensions/crx_installer.cc
@@ -16,7 +16,7 @@
#include "base/stringprintf.h"
#include "base/time.h"
#include "base/task.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "base/version.h"
#include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/extensions/default_apps.cc b/chrome/browser/extensions/default_apps.cc
index a9e305f..4afe325 100644
--- a/chrome/browser/extensions/default_apps.cc
+++ b/chrome/browser/extensions/default_apps.cc
@@ -18,26 +18,97 @@
prefs->RegisterIntegerPref(prefs::kAppsPromoCounter, 0);
}
-DefaultApps::DefaultApps(PrefService* prefs)
- : prefs_(prefs) {
-#if !defined(OS_CHROMEOS)
+DefaultApps::DefaultApps(PrefService* prefs,
+ const std::string& application_locale)
+ : prefs_(prefs), application_locale_(application_locale) {
// Poppit, Entanglement
ids_.insert("mcbkbpnkkkipelfledbfocopglifcfmi");
ids_.insert("aciahcmjmecflokailenpkdchphgkefd");
-#endif // OS_CHROMEOS
}
DefaultApps::~DefaultApps() {}
-const ExtensionIdSet* DefaultApps::GetAppsToInstall() const {
- if (GetDefaultAppsInstalled())
- return NULL;
- else
- return &ids_;
+const ExtensionIdSet& DefaultApps::default_apps() const {
+ return ids_;
}
-const ExtensionIdSet* DefaultApps::GetDefaultApps() const {
- return &ids_;
+bool DefaultApps::DefaultAppSupported() {
+ // On Chrome OS the default apps are installed via a different mechanism.
+#if defined(OS_CHROMEOS)
+ return false;
+#else
+ return DefaultAppsSupportedForLanguage();
+#endif
+}
+
+bool DefaultApps::DefaultAppsSupportedForLanguage() {
+ return application_locale_ == "en-US";
+}
+
+bool DefaultApps::ShouldInstallDefaultApps(
+ const ExtensionIdSet& installed_ids) {
+ if (!DefaultAppSupported())
+ return false;
+
+ if (GetDefaultAppsInstalled())
+ return false;
+
+ // If there are any non-default apps installed, we should never try to install
+ // the default apps again, even if the non-default apps are later removed.
+ if (NonDefaultAppIsInstalled(installed_ids)) {
+ SetDefaultAppsInstalled(true);
+ return false;
+ }
+
+ return true;
+}
+
+bool DefaultApps::ShouldShowAppLauncher(const ExtensionIdSet& installed_ids) {
+ // On Chrome OS the default apps are installed via a separate mechanism that
+ // is always enabled. Therefore we always show the launcher.
+#if defined(OS_CHROME)
+ return true;
+#else
+ // The app store only supports en-us at the moment, so we don't show the apps
+ // section by default for users in other locales. But we do show it if a user
+ // from a non-supported locale somehow installs an app (eg by navigating
+ // directly to the store).
+ if (!DefaultAppsSupportedForLanguage())
+ return !installed_ids.empty();
+
+ // For supported locales, we need to wait for all the default apps to be
+ // installed before showing the apps section. We also show it if any
+ // non-default app is installed (eg because the user installed the app in a
+ // previous version of Chrome).
+ if (GetDefaultAppsInstalled() || NonDefaultAppIsInstalled(installed_ids))
+ return true;
+ else
+ return false;
+#endif
+}
+
+bool DefaultApps::ShouldShowPromo(const ExtensionIdSet& installed_ids) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kForceAppsPromoVisible)) {
+ return true;
+ }
+
+ if (!DefaultAppSupported())
+ return false;
+
+ if (GetDefaultAppsInstalled() && GetPromoCounter() < kAppsPromoCounterMax) {
+ // If we have the exact set of default apps, show the promo. If we don't
+ // have the exact set of default apps, this means that the user manually
+ // installed or uninstalled one. The promo doesn't make sense if it shows
+ // apps the user manually installed, so expire it immediately in that
+ // situation.
+ if (installed_ids == ids_)
+ return true;
+ else
+ SetPromoHidden();
+ }
+
+ return false;
}
void DefaultApps::DidInstallApp(const ExtensionIdSet& installed_ids) {
@@ -52,30 +123,6 @@
}
}
-bool DefaultApps::CheckShouldShowPromo(const ExtensionIdSet& installed_ids) {
-#if defined(OS_CHROMEOS)
- // Don't show the promo at all on Chrome OS.
- return false;
-#endif
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kForceAppsPromoVisible)) {
- return true;
- }
-
- if (GetDefaultAppsInstalled() && GetPromoCounter() < kAppsPromoCounterMax) {
- // If we have the exact set of default apps, show the promo. If we don't
- // have the exact set of default apps, this means that the user manually
- // installed one. The promo doesn't make sense if it shows apps the user
- // manually installed, so expire it immediately in that situation.
- if (installed_ids == ids_)
- return true;
- else
- SetPromoHidden();
- }
-
- return false;
-}
-
void DefaultApps::DidShowPromo() {
if (!GetDefaultAppsInstalled()) {
NOTREACHED() << "Should not show promo until default apps are installed.";
@@ -99,6 +146,17 @@
}
}
+bool DefaultApps::NonDefaultAppIsInstalled(
+ const ExtensionIdSet& installed_ids) const {
+ for (ExtensionIdSet::const_iterator iter = installed_ids.begin();
+ iter != installed_ids.end(); ++iter) {
+ if (ids_.find(*iter) == ids_.end())
+ return true;
+ }
+
+ return false;
+}
+
void DefaultApps::SetPromoHidden() {
SetPromoCounter(kAppsPromoCounterMax);
}
diff --git a/chrome/browser/extensions/default_apps.h b/chrome/browser/extensions/default_apps.h
index b03f6ec..a8b162c 100644
--- a/chrome/browser/extensions/default_apps.h
+++ b/chrome/browser/extensions/default_apps.h
@@ -13,21 +13,10 @@
class PrefService;
-// Manages the installation of the set of default apps into Chrome, and the
-// promotion of those apps in the launcher.
-//
-// It implements the following rules:
-//
-// - Only install default apps once per-profile.
-// - Don't install default apps if any apps are already installed.
-// - Do not start showing the promo until all default apps have been installed.
-// - Do not show the promo if it has been hidden by the user.
-// - Do not show promo after one app has been manually installed or uninstalled.
-// - Do not show promo if the set of installed apps is different than the set of
-// default apps.
-// - Only show promo a certain amount of times.
-//
-// The promo can also be forced on with --force-apps-promo-visible.
+// Encapsulates business logic for:
+// - Whether to install default apps on Chrome startup
+// - Whether to show the app launcher
+// - Whether to show the apps promo in the launcher
class DefaultApps {
public:
// The maximum number of times to show the apps promo.
@@ -36,28 +25,28 @@
// Register our preferences.
static void RegisterUserPrefs(PrefService* prefs);
- explicit DefaultApps(PrefService* prefs);
+ explicit DefaultApps(PrefService* prefs,
+ const std::string& application_locale);
~DefaultApps();
- // Gets the list of default apps that should be installed. Can return NULL if
- // no apps need to be installed.
- const ExtensionIdSet* GetAppsToInstall() const;
+ // Gets the set of default apps.
+ const ExtensionIdSet& default_apps() const;
- // Gets the list of default apps.
- const ExtensionIdSet* GetDefaultApps() const;
+ // Returns true if the default apps should be installed.
+ bool ShouldInstallDefaultApps(const ExtensionIdSet& installed_ids);
- // Returns true if the default apps have been installed. False otherwise.
- bool GetDefaultAppsInstalled() const;
-
- // Should be called after each app is installed. Once installed_ids contains
- // all the default apps, GetAppsToInstall() will start returning NULL.
- void DidInstallApp(const ExtensionIdSet& installed_ids);
+ // Returns true if the app launcher in the NTP should be shown.
+ bool ShouldShowAppLauncher(const ExtensionIdSet& installed_ids);
// Returns true if the apps promo should be displayed in the launcher.
//
// NOTE: If the default apps have been installed, but |installed_ids| is
// different than GetDefaultApps(), this will permanently expire the promo.
- bool CheckShouldShowPromo(const ExtensionIdSet& installed_ids);
+ bool ShouldShowPromo(const ExtensionIdSet& installed_ids);
+
+ // Should be called after each app is installed. Once installed_ids contains
+ // all the default apps, GetAppsToInstall() will start returning NULL.
+ void DidInstallApp(const ExtensionIdSet& installed_ids);
// Should be called after each time the promo is installed.
void DidShowPromo();
@@ -66,12 +55,19 @@
void SetPromoHidden();
private:
- FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, Basics);
+ FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, HappyPath);
+ FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, UnsupportedLocale);
FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, HidePromo);
FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps, InstallingAnAppHidesPromo);
FRIEND_TEST_ALL_PREFIXES(ExtensionDefaultApps,
ManualAppInstalledWhileInstallingDefaultApps);
+ bool DefaultAppSupported();
+ bool DefaultAppsSupportedForLanguage();
+
+ bool NonDefaultAppIsInstalled(const ExtensionIdSet& installed_ids) const;
+
+ bool GetDefaultAppsInstalled() const;
void SetDefaultAppsInstalled(bool val);
int GetPromoCounter() const;
@@ -80,6 +76,9 @@
// Our permanent state is stored in this PrefService instance.
PrefService* prefs_;
+ // The locale the browser is currently in.
+ std::string application_locale_;
+
// The set of default extensions. Initialized to a static list in the
// constructor.
ExtensionIdSet ids_;
diff --git a/chrome/browser/extensions/default_apps_unittest.cc b/chrome/browser/extensions/default_apps_unittest.cc
index 4fa9bc2..fd87d58 100644
--- a/chrome/browser/extensions/default_apps_unittest.cc
+++ b/chrome/browser/extensions/default_apps_unittest.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/logging.h"
#include "chrome/browser/extensions/default_apps.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/test/testing_pref_service.h"
@@ -10,93 +11,141 @@
// TODO(dpolukhin): On Chrome OS all apps are installed via external extensions,
// and the web store promo is never shown.
#if !defined(OS_CHROMEOS)
-TEST(ExtensionDefaultApps, Basics) {
+TEST(ExtensionDefaultApps, HappyPath) {
TestingPrefService pref_service;
DefaultApps::RegisterUserPrefs(&pref_service);
- DefaultApps default_apps(&pref_service);
+ DefaultApps default_apps(&pref_service, "en-US");
- ExtensionIdSet default_app_ids = *default_apps.GetAppsToInstall();
+ const ExtensionIdSet& default_app_ids = default_apps.default_apps();
ASSERT_GT(default_app_ids.size(), 0u);
EXPECT_FALSE(default_apps.GetDefaultAppsInstalled());
EXPECT_EQ(0, default_apps.GetPromoCounter());
- EXPECT_EQ(default_app_ids, *default_apps.GetDefaultApps());
+
+ // If no apps are installed, the default apps should be installed.
+ ExtensionIdSet installed_app_ids;
+ EXPECT_TRUE(default_apps.ShouldInstallDefaultApps(installed_app_ids));
+
+ // The launcher should not be shown until the default apps have been
+ // installed.
+ EXPECT_FALSE(default_apps.ShouldShowAppLauncher(installed_app_ids));
// The promo should not be shown until the default apps have been installed.
- ExtensionIdSet installed_app_ids;
- EXPECT_FALSE(default_apps.CheckShouldShowPromo(installed_app_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_app_ids));
// Simulate installing the apps one by one and notifying default_apps after
// each intallation. Nothing should change until we have installed all the
// default apps.
- ExtensionIdSet extension_id_sets[] = {
- default_app_ids,
- default_app_ids,
- default_app_ids
- };
- extension_id_sets[0].clear();
- extension_id_sets[1].erase(extension_id_sets[1].begin());
- extension_id_sets[2].erase(extension_id_sets[2].begin(),
- ++extension_id_sets[2].begin());
- for (size_t i = 0; i < arraysize(extension_id_sets); ++i) {
- default_apps.DidInstallApp(extension_id_sets[i]);
- EXPECT_TRUE(default_app_ids == *default_apps.GetAppsToInstall());
+ for (size_t i = 0; i < default_app_ids.size() - 1; ++i) {
+ ExtensionIdSet::const_iterator iter = default_app_ids.begin();
+ for (size_t j = 0; j <= i; ++j)
+ ++iter;
+ installed_app_ids.insert(*iter);
+ default_apps.DidInstallApp(installed_app_ids);
EXPECT_FALSE(default_apps.GetDefaultAppsInstalled());
- EXPECT_FALSE(default_apps.CheckShouldShowPromo(extension_id_sets[i]));
+ EXPECT_TRUE(default_apps.ShouldInstallDefaultApps(installed_app_ids));
+ EXPECT_FALSE(default_apps.ShouldShowAppLauncher(installed_app_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_app_ids));
}
// Simulate all the default apps being installed. Now we should stop getting
// default apps to install.
- default_apps.DidInstallApp(default_app_ids);
- EXPECT_EQ(NULL, default_apps.GetAppsToInstall());
+ installed_app_ids = default_app_ids;
+ default_apps.DidInstallApp(installed_app_ids);
EXPECT_TRUE(default_apps.GetDefaultAppsInstalled());
+ EXPECT_FALSE(default_apps.ShouldInstallDefaultApps(installed_app_ids));
- // And the promo should become available.
- EXPECT_TRUE(default_apps.CheckShouldShowPromo(default_app_ids));
+ // And the promo and launcher should become available.
+ EXPECT_TRUE(default_apps.ShouldShowAppLauncher(installed_app_ids));
+ EXPECT_TRUE(default_apps.ShouldShowPromo(installed_app_ids));
// The promo should be available up to the max allowed times, then stop.
for (int i = 0; i < DefaultApps::kAppsPromoCounterMax; ++i) {
- EXPECT_TRUE(default_apps.CheckShouldShowPromo(default_app_ids));
+ EXPECT_TRUE(default_apps.ShouldShowPromo(installed_app_ids));
default_apps.DidShowPromo();
EXPECT_EQ(i + 1, default_apps.GetPromoCounter());
}
- EXPECT_FALSE(default_apps.CheckShouldShowPromo(default_app_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_app_ids));
EXPECT_EQ(DefaultApps::kAppsPromoCounterMax, default_apps.GetPromoCounter());
+
+ // Even if all the apps are subsequently removed, the apps section should
+ // remain.
+ installed_app_ids.clear();
+ EXPECT_FALSE(default_apps.ShouldInstallDefaultApps(installed_app_ids));
+ EXPECT_TRUE(default_apps.ShouldShowAppLauncher(installed_app_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_app_ids));
+}
+
+TEST(ExtensionDefaultApps, UnsupportedLocale) {
+ TestingPrefService pref_service;
+ DefaultApps::RegisterUserPrefs(&pref_service);
+ DefaultApps default_apps(&pref_service, "fr");
+
+ const ExtensionIdSet& default_app_ids = default_apps.default_apps();
+ EXPECT_GT(default_app_ids.size(), 0u);
+
+ // Since the store only supports en-US at the moment, we don't install default
+ // apps or promote the store.
+ ExtensionIdSet installed_ids;
+ EXPECT_FALSE(default_apps.ShouldInstallDefaultApps(installed_ids));
+ EXPECT_FALSE(default_apps.ShouldShowAppLauncher(installed_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_ids));
+
+ // If the user installs an app manually, then we show the apps section, but
+ // no promotion or default apps.
+ installed_ids.insert(*(default_app_ids.begin()));
+ EXPECT_FALSE(default_apps.ShouldInstallDefaultApps(installed_ids));
+ EXPECT_TRUE(default_apps.ShouldShowAppLauncher(installed_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_ids));
+
+ // Even if the user installs the exact set of default apps, we don't show the
+ // promo.
+ installed_ids = default_app_ids;
+ EXPECT_FALSE(default_apps.ShouldInstallDefaultApps(installed_ids));
+ EXPECT_TRUE(default_apps.ShouldShowAppLauncher(installed_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_ids));
+
+ // If the user uninstalls the apps again, we go back to not showing the
+ // apps section.
+ installed_ids.clear();
+ EXPECT_FALSE(default_apps.ShouldInstallDefaultApps(installed_ids));
+ EXPECT_FALSE(default_apps.ShouldShowAppLauncher(installed_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_ids));
}
TEST(ExtensionDefaultApps, HidePromo) {
TestingPrefService pref_service;
DefaultApps::RegisterUserPrefs(&pref_service);
- DefaultApps default_apps(&pref_service);
+ DefaultApps default_apps(&pref_service, "en-US");
- ExtensionIdSet default_app_ids = *default_apps.GetAppsToInstall();
+ const ExtensionIdSet& default_app_ids = default_apps.default_apps();
default_apps.DidInstallApp(default_app_ids);
- EXPECT_TRUE(default_apps.CheckShouldShowPromo(default_app_ids));
+ EXPECT_TRUE(default_apps.ShouldShowPromo(default_app_ids));
default_apps.DidShowPromo();
EXPECT_EQ(1, default_apps.GetPromoCounter());
default_apps.SetPromoHidden();
- EXPECT_FALSE(default_apps.CheckShouldShowPromo(default_app_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(default_app_ids));
EXPECT_EQ(DefaultApps::kAppsPromoCounterMax, default_apps.GetPromoCounter());
}
TEST(ExtensionDefaultApps, InstallingAnAppHidesPromo) {
TestingPrefService pref_service;
DefaultApps::RegisterUserPrefs(&pref_service);
- DefaultApps default_apps(&pref_service);
+ DefaultApps default_apps(&pref_service, "en-US");
- ExtensionIdSet default_app_ids = *default_apps.GetAppsToInstall();
+ const ExtensionIdSet& default_app_ids = default_apps.default_apps();
ExtensionIdSet installed_app_ids = default_app_ids;
default_apps.DidInstallApp(installed_app_ids);
- EXPECT_TRUE(default_apps.CheckShouldShowPromo(installed_app_ids));
+ EXPECT_TRUE(default_apps.ShouldShowPromo(installed_app_ids));
default_apps.DidShowPromo();
EXPECT_EQ(1, default_apps.GetPromoCounter());
// Now simulate a new extension being installed. This should cause the promo
// to be hidden.
installed_app_ids.insert("foo");
- EXPECT_FALSE(default_apps.CheckShouldShowPromo(installed_app_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_app_ids));
EXPECT_EQ(DefaultApps::kAppsPromoCounterMax, default_apps.GetPromoCounter());
}
@@ -111,27 +160,31 @@
// the default ones.
TestingPrefService pref_service;
DefaultApps::RegisterUserPrefs(&pref_service);
- DefaultApps default_apps(&pref_service);
+ DefaultApps default_apps(&pref_service, "en-US");
// Simulate an app getting installed before the complete set of default apps.
- // This shouldn't affect us installing default apps. We should keep trying.
+ // This should stop the default apps from trying to be installed. The launcher
+ // should also immediately show up.
ExtensionIdSet installed_ids;
installed_ids.insert("foo");
- default_apps.DidInstallApp(installed_ids);
- EXPECT_FALSE(default_apps.GetDefaultAppsInstalled());
- EXPECT_TRUE(default_apps.GetAppsToInstall());
-
- // Now add all the default apps in addition to the extra app. We should stop
- // trying to install default apps.
- installed_ids = *default_apps.GetAppsToInstall();
- installed_ids.insert("foo");
- default_apps.DidInstallApp(installed_ids);
+ EXPECT_FALSE(default_apps.ShouldInstallDefaultApps(installed_ids));
EXPECT_TRUE(default_apps.GetDefaultAppsInstalled());
- EXPECT_FALSE(default_apps.GetAppsToInstall());
+ EXPECT_TRUE(default_apps.ShouldShowAppLauncher(installed_ids));
// The promo shouldn't turn on though, because it would look weird with the
// user's extra, manually installed extensions.
- EXPECT_FALSE(default_apps.CheckShouldShowPromo(installed_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_ids));
EXPECT_EQ(DefaultApps::kAppsPromoCounterMax, default_apps.GetPromoCounter());
+
+ // Going back to a subset of the default apps shouldn't allow the default app
+ // install to continue.
+ installed_ids.clear();
+ EXPECT_FALSE(default_apps.ShouldInstallDefaultApps(installed_ids));
+ EXPECT_TRUE(default_apps.GetDefaultAppsInstalled());
+ EXPECT_TRUE(default_apps.ShouldShowAppLauncher(installed_ids));
+ EXPECT_FALSE(default_apps.ShouldShowPromo(installed_ids));
+
+ // Going to the exact set of default apps shouldn't show the promo.
+ EXPECT_FALSE(default_apps.ShouldShowPromo(default_apps.default_apps()));
}
#endif // OS_CHROMEOS
diff --git a/chrome/browser/extensions/extension_geolocation_apitest.cc b/chrome/browser/extensions/extension_geolocation_apitest.cc
index 940824a..de67c89 100644
--- a/chrome/browser/extensions/extension_geolocation_apitest.cc
+++ b/chrome/browser/extensions/extension_geolocation_apitest.cc
@@ -17,7 +17,7 @@
}
};
-IN_PROC_BROWSER_TEST_F(GeolocationApiTest, ExtensionGeolocationAccessFail) {
+IN_PROC_BROWSER_TEST_F(GeolocationApiTest, FLAKY_ExtensionGeolocationAccessFail) {
// Test that geolocation cannot be accessed from extension without permission.
ASSERT_TRUE(RunExtensionTest("geolocation/no_permission")) << message_;
}
diff --git a/chrome/browser/extensions/extension_history_apitest.cc b/chrome/browser/extensions/extension_history_apitest.cc
index 1e882be..874f868 100644
--- a/chrome/browser/extensions/extension_history_apitest.cc
+++ b/chrome/browser/extensions/extension_history_apitest.cc
@@ -7,8 +7,8 @@
#include "chrome/common/chrome_switches.h"
#include "net/base/mock_host_resolver.h"
-// Flaky, http://crbug.com/26296.
-IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FLAKY_History) {
+// Disabled, http://crbug.com/26296.
+IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLED_History) {
host_resolver()->AddRule("www.a.com", "127.0.0.1");
host_resolver()->AddRule("www.b.com", "127.0.0.1");
ASSERT_TRUE(StartTestServer());
diff --git a/chrome/browser/extensions/extension_install_ui.cc b/chrome/browser/extensions/extension_install_ui.cc
index 391a54c..18013e0 100644
--- a/chrome/browser/extensions/extension_install_ui.cc
+++ b/chrome/browser/extensions/extension_install_ui.cc
@@ -77,7 +77,22 @@
extension_(NULL),
delegate_(NULL),
prompt_type_(NUM_PROMPT_TYPES),
- ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) {}
+ ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) {
+ // Remember the current theme in case the user presses undo.
+ if (profile_) {
+ const Extension* previous_theme = profile_->GetTheme();
+ if (previous_theme)
+ previous_theme_id_ = previous_theme->id();
+#if defined(TOOLKIT_GTK)
+ // On Linux, we also need to take the user's system settings into account
+ // to undo theme installation.
+ previous_use_system_theme_ =
+ GtkThemeProvider::GetFrom(profile_)->UseGtkTheme();
+#else
+ DCHECK(!previous_use_system_theme_);
+#endif
+ }
+}
ExtensionInstallUI::~ExtensionInstallUI() {
}
@@ -92,20 +107,6 @@
// immediately installed, and then we show an infobar (see OnInstallSuccess)
// to allow the user to revert if they don't like it.
if (extension->is_theme()) {
- // Remember the current theme in case the user pressed undo.
- const Extension* previous_theme = profile_->GetTheme();
- if (previous_theme)
- previous_theme_id_ = previous_theme->id();
-
-#if defined(TOOLKIT_GTK)
- // On Linux, we also need to take the user's system settings into account
- // to undo theme installation.
- previous_use_system_theme_ =
- GtkThemeProvider::GetFrom(profile_)->UseGtkTheme();
-#else
- DCHECK(!previous_use_system_theme_);
-#endif
-
delegate->InstallUIProceed();
return;
}
diff --git a/chrome/browser/extensions/extension_protocols.cc b/chrome/browser/extensions/extension_protocols.cc
index e95f18d..faa7ae9 100644
--- a/chrome/browser/extensions/extension_protocols.cc
+++ b/chrome/browser/extensions/extension_protocols.cc
@@ -12,7 +12,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "chrome/browser/net/chrome_url_request_context.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
@@ -23,7 +23,7 @@
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/url_constants.h"
#include "googleurl/src/url_util.h"
-#include "grit/bookmark_manager_resources_map.h"
+#include "grit/component_extension_resources_map.h"
#include "net/base/mime_util.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request_error_job.h"
@@ -175,15 +175,15 @@
// TODO(tc): Make a map of FilePath -> resource ids so we don't have to
// covert to FilePaths all the time. This will be more useful as we add
// more resources.
- for (size_t i = 0; i < kBookmarkManagerResourcesSize; ++i) {
+ for (size_t i = 0; i < kComponentExtensionResourcesSize; ++i) {
FilePath bm_resource_path =
- FilePath().AppendASCII(kBookmarkManagerResources[i].name);
+ FilePath().AppendASCII(kComponentExtensionResources[i].name);
#if defined(OS_WIN)
bm_resource_path = bm_resource_path.NormalizeWindowsPathSeparators();
#endif
if (relative_path == bm_resource_path) {
return new URLRequestResourceBundleJob(request, relative_path,
- kBookmarkManagerResources[i].value);
+ kComponentExtensionResources[i].value);
}
}
}
diff --git a/chrome/browser/extensions/extension_rlz_module.cc b/chrome/browser/extensions/extension_rlz_module.cc
index 4f76bcc..bd85cf1 100644
--- a/chrome/browser/extensions/extension_rlz_module.cc
+++ b/chrome/browser/extensions/extension_rlz_module.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/extensions/extension_rlz_module.h"
#include "base/scoped_ptr.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "chrome/common/extensions/extension.h"
#include "rlz/win/lib/lib_values.h"
diff --git a/chrome/browser/extensions/extension_service.cc b/chrome/browser/extensions/extension_service.cc
index bb24e1e..8140d2b 100644
--- a/chrome/browser/extensions/extension_service.cc
+++ b/chrome/browser/extensions/extension_service.cc
@@ -15,7 +15,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
@@ -553,7 +553,8 @@
show_extensions_prompts_(true),
ready_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(toolbar_model_(this)),
- default_apps_(profile->GetPrefs()),
+ default_apps_(profile->GetPrefs(),
+ g_browser_process->GetApplicationLocale()),
event_routers_initialized_(false) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc
index 63374ac..04fb637 100644
--- a/chrome/browser/extensions/extension_updater.cc
+++ b/chrome/browser/extensions/extension_updater.cc
@@ -17,7 +17,7 @@
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/time.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
diff --git a/chrome/browser/extensions/extension_updater.h b/chrome/browser/extensions/extension_updater.h
index d9e6a3e..3d7986c 100644
--- a/chrome/browser/extensions/extension_updater.h
+++ b/chrome/browser/extensions/extension_updater.h
@@ -204,18 +204,18 @@
// URLFetcher::Delegate interface.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
// These do the actual work when a URL fetch completes.
virtual void OnManifestFetchComplete(const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const std::string& data);
virtual void OnCRXFetchComplete(const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const std::string& data);
diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc
index d501de6..d806b6e 100644
--- a/chrome/browser/extensions/extension_updater_unittest.cc
+++ b/chrome/browser/extensions/extension_updater_unittest.cc
@@ -11,7 +11,7 @@
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/version.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/extensions/extension_error_reporter.h"
diff --git a/chrome/browser/extensions/extensions_startup.cc b/chrome/browser/extensions/extensions_startup.cc
index 8e0b855..b44aade 100644
--- a/chrome/browser/extensions/extensions_startup.cc
+++ b/chrome/browser/extensions/extensions_startup.cc
@@ -12,7 +12,7 @@
#include "chrome/common/chrome_switches.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#endif
ExtensionsStartupUtil::ExtensionsStartupUtil() : pack_job_succeeded_(false) {}
@@ -21,9 +21,10 @@
const FilePath& crx_path,
const FilePath& output_private_key_path) {
pack_job_succeeded_ = true;
- ShowPackExtensionMessage(L"Extension Packaging Success",
- PackExtensionJob::StandardSuccessMessage(
- crx_path, output_private_key_path));
+ ShowPackExtensionMessage(
+ L"Extension Packaging Success",
+ UTF16ToWideHack(PackExtensionJob::StandardSuccessMessage(
+ crx_path, output_private_key_path)));
}
void ExtensionsStartupUtil::OnPackFailure(const std::string& error_message) {
@@ -35,7 +36,7 @@
const std::wstring& caption,
const std::wstring& message) {
#if defined(OS_WIN)
- win_util::MessageBox(NULL, message, caption, MB_OK | MB_SETFOREGROUND);
+ app::win::MessageBox(NULL, message, caption, MB_OK | MB_SETFOREGROUND);
#else
// Just send caption & text to stdout on mac & linux.
std::string out_text = WideToASCII(caption);
diff --git a/chrome/browser/extensions/extensions_ui.cc b/chrome/browser/extensions/extensions_ui.cc
index 5d3a05d..ec1f9bd 100644
--- a/chrome/browser/extensions/extensions_ui.cc
+++ b/chrome/browser/extensions/extensions_ui.cc
@@ -15,7 +15,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/version.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/debugger/devtools_manager.h"
@@ -611,8 +611,8 @@
void ExtensionsDOMHandler::OnPackSuccess(const FilePath& crx_file,
const FilePath& pem_file) {
- ShowAlert(WideToUTF8(PackExtensionJob::StandardSuccessMessage(crx_file,
- pem_file)));
+ ShowAlert(UTF16ToUTF8(PackExtensionJob::StandardSuccessMessage(crx_file,
+ pem_file)));
ListValue results;
dom_ui_->CallJavascriptFunction(L"hidePackDialog", results);
diff --git a/chrome/browser/extensions/pack_extension_job.cc b/chrome/browser/extensions/pack_extension_job.cc
index 327d7c4..f4e2a03 100644
--- a/chrome/browser/extensions/pack_extension_job.cc
+++ b/chrome/browser/extensions/pack_extension_job.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/message_loop.h"
+#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/task.h"
#include "chrome/browser/extensions/extension_creator.h"
@@ -80,20 +81,18 @@
}
// static
-std::wstring PackExtensionJob::StandardSuccessMessage(const FilePath& crx_file,
- const FilePath& key_file)
-{
- // TODO(isherman): we should use string16 instead of wstring.
- // See crbug.com/23581 and crbug.com/24672
- std::wstring message;
- if (key_file.empty()) {
- return l10n_util::GetStringF(
+string16 PackExtensionJob::StandardSuccessMessage(const FilePath& crx_file,
+ const FilePath& key_file) {
+ string16 crx_file_string = WideToUTF16(crx_file.ToWStringHack());
+ string16 key_file_string = WideToUTF16(key_file.ToWStringHack());
+ if (key_file_string.empty()) {
+ return l10n_util::GetStringFUTF16(
IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_UPDATE,
- crx_file.ToWStringHack());
+ crx_file_string);
} else {
- return l10n_util::GetStringF(
+ return l10n_util::GetStringFUTF16(
IDS_EXTENSION_PACK_DIALOG_SUCCESS_BODY_NEW,
- crx_file.ToWStringHack(),
- key_file.ToWStringHack());
+ crx_file_string,
+ key_file_string);
}
}
diff --git a/chrome/browser/extensions/pack_extension_job.h b/chrome/browser/extensions/pack_extension_job.h
index e26687a..6d4206d 100644
--- a/chrome/browser/extensions/pack_extension_job.h
+++ b/chrome/browser/extensions/pack_extension_job.h
@@ -10,6 +10,7 @@
#include "base/file_path.h"
#include "base/ref_counted.h"
+#include "base/string16.h"
#include "chrome/browser/browser_thread.h"
@@ -41,8 +42,8 @@
void ClearClient();
// The standard packing success message.
- static std::wstring StandardSuccessMessage(const FilePath& crx_file,
- const FilePath& key_file);
+ static string16 StandardSuccessMessage(const FilePath& crx_file,
+ const FilePath& key_file);
void set_asynchronous(bool async) { asynchronous_ = async; }
diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
index 1842e00..19cd379 100644
--- a/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
+++ b/chrome/browser/extensions/sandboxed_extension_unpacker_unittest.cc
@@ -4,7 +4,6 @@
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index cd40fd5..fe735ae 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/message_loop.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/extensions/extension_service_unittest.h"
#include "chrome/browser/extensions/user_script_listener.h"
#include "chrome/browser/renderer_host/global_request_id.h"
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index 2af102e..820ab5a 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -13,7 +13,7 @@
#include "base/pickle.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/version.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/external_protocol_handler.cc b/chrome/browser/external_protocol_handler.cc
index 49c0061..e9b4326 100644
--- a/chrome/browser/external_protocol_handler.cc
+++ b/chrome/browser/external_protocol_handler.cc
@@ -11,7 +11,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
diff --git a/chrome/browser/external_tab_container_win.cc b/chrome/browser/external_tab_container_win.cc
index 976d27d..ac4cfba 100644
--- a/chrome/browser/external_tab_container_win.cc
+++ b/chrome/browser/external_tab_container_win.cc
@@ -12,7 +12,7 @@
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "base/utf_string_conversions.h"
-#include "base/win_util.h"
+#include "base/win/win_util.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/automation/automation_provider.h"
@@ -527,7 +527,7 @@
bool ExternalTabContainer::TakeFocus(bool reverse) {
if (automation_) {
automation_->Send(new AutomationMsg_TabbedOut(tab_handle_,
- win_util::IsShiftPressed()));
+ base::win::IsShiftPressed()));
}
return true;
@@ -844,7 +844,7 @@
if (!automation_) {
return false;
}
- if ((wparam == VK_TAB) && !win_util::IsCtrlPressed()) {
+ if ((wparam == VK_TAB) && !base::win::IsCtrlPressed()) {
// Tabs are handled separately (except if this is Ctrl-Tab or
// Ctrl-Shift-Tab)
return false;
diff --git a/chrome/browser/file_path_watcher/file_path_watcher_browsertest.cc b/chrome/browser/file_path_watcher/file_path_watcher_browsertest.cc
index 9a8f29e..b733a9a 100644
--- a/chrome/browser/file_path_watcher/file_path_watcher_browsertest.cc
+++ b/chrome/browser/file_path_watcher/file_path_watcher_browsertest.cc
@@ -12,11 +12,10 @@
#include "base/message_loop.h"
#include "base/message_loop_proxy.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
#include "base/stl_util-inl.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_MACOSX)
diff --git a/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc b/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc
index c65b22d..bc59a2e 100644
--- a/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc
+++ b/chrome/browser/file_path_watcher/file_path_watcher_inotify.cc
@@ -26,7 +26,7 @@
#include "base/message_loop.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
namespace {
diff --git a/chrome/browser/file_path_watcher/file_path_watcher_win.cc b/chrome/browser/file_path_watcher/file_path_watcher_win.cc
index 57294d4..c2f49b9 100644
--- a/chrome/browser/file_path_watcher/file_path_watcher_win.cc
+++ b/chrome/browser/file_path_watcher/file_path_watcher_win.cc
@@ -7,14 +7,14 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/object_watcher.h"
#include "base/ref_counted.h"
#include "base/time.h"
+#include "base/win/object_watcher.h"
namespace {
class FilePathWatcherImpl : public FilePathWatcher::PlatformDelegate,
- public base::ObjectWatcher::Delegate {
+ public base::win::ObjectWatcher::Delegate {
public:
FilePathWatcherImpl() : delegate_(NULL), handle_(INVALID_HANDLE_VALUE) {}
@@ -49,7 +49,7 @@
HANDLE handle_;
// ObjectWatcher to watch handle_ for events.
- base::ObjectWatcher watcher_;
+ base::win::ObjectWatcher watcher_;
// Keep track of the last modified time of the file. We use nulltime
// to represent the file not existing.
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.cc b/chrome/browser/file_system/file_system_dispatcher_host.cc
index 98b14a5..cf28585 100644
--- a/chrome/browser/file_system/file_system_dispatcher_host.cc
+++ b/chrome/browser/file_system/file_system_dispatcher_host.cc
@@ -8,7 +8,7 @@
#include <vector>
#include "base/file_path.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/net/chrome_url_request_context.h"
diff --git a/chrome/browser/file_system/file_system_dispatcher_host.h b/chrome/browser/file_system/file_system_dispatcher_host.h
index ab57d09..865ef70 100644
--- a/chrome/browser/file_system/file_system_dispatcher_host.h
+++ b/chrome/browser/file_system/file_system_dispatcher_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -23,9 +23,12 @@
class Profile;
class Receiver;
class RenderMessageFilter;
-class URLRequestContext;
class URLRequestContextGetter;
+namespace net {
+class URLRequestContext;
+} // namespace net
+
namespace fileapi {
class SandboxedFileSystemContext;
class SandboxedFileSystemOperation;
@@ -93,7 +96,7 @@
// This holds the URLRequestContextGetter until Init() can be called from the
// IO thread, which will extract the URLRequestContext from it.
scoped_refptr<URLRequestContextGetter> request_context_getter_;
- scoped_refptr<URLRequestContext> request_context_;
+ scoped_refptr<net::URLRequestContext> request_context_;
DISALLOW_COPY_AND_ASSIGN(FileSystemDispatcherHost);
};
diff --git a/chrome/browser/first_run/first_run_win.cc b/chrome/browser/first_run/first_run_win.cc
index 995dcb2..5f6a0b0 100644
--- a/chrome/browser/first_run/first_run_win.cc
+++ b/chrome/browser/first_run/first_run_win.cc
@@ -16,13 +16,13 @@
#include "app/resource_bundle.h"
#include "base/environment.h"
#include "base/file_util.h"
-#include "base/object_watcher.h"
#include "base/path_service.h"
#include "base/scoped_comptr_win.h"
#include "base/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/utf_string_conversions.h"
+#include "base/win/object_watcher.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
#include "chrome/browser/extensions/extension_service.h"
@@ -321,7 +321,7 @@
// process has ended and what was the result of the operation as reported by
// the process exit code. This class executes in the context of the main chrome
// process.
-class ImportProcessRunner : public base::ObjectWatcher::Delegate {
+class ImportProcessRunner : public base::win::ObjectWatcher::Delegate {
public:
// The constructor takes the importer process to watch and then it does a
// message loop blocking wait until the process ends. This object now owns
@@ -350,7 +350,7 @@
}
private:
- base::ObjectWatcher watcher_;
+ base::win::ObjectWatcher watcher_;
base::ProcessHandle import_process_;
DWORD exit_code_;
};
@@ -692,16 +692,17 @@
// The heading has two flavors of text, the alt one features extensions but
// we only use it in the US until some international issues are fixed.
const std::string app_locale = g_browser_process->GetApplicationLocale();
- std::wstring heading;
+ int heading_id;
switch (version_) {
- case 0: heading = l10n_util::GetString(IDS_TRY_TOAST_HEADING); break;
- case 1: heading = l10n_util::GetString(IDS_TRY_TOAST_HEADING2); break;
- case 2: heading = l10n_util::GetString(IDS_TRY_TOAST_HEADING3); break;
- case 3: heading = l10n_util::GetString(IDS_TRY_TOAST_HEADING4); break;
+ case 0: heading_id = IDS_TRY_TOAST_HEADING; break;
+ case 1: heading_id = IDS_TRY_TOAST_HEADING2; break;
+ case 2: heading_id = IDS_TRY_TOAST_HEADING3; break;
+ case 3: heading_id = IDS_TRY_TOAST_HEADING4; break;
default:
NOTREACHED() << "Cannot determine which headline to show.";
return Upgrade::TD_DIALOG_ERROR;
}
+ string16 heading = l10n_util::GetStringUTF16(heading_id);
views::Label* label = new views::Label(heading);
label->SetFont(rb.GetFont(ResourceBundle::MediumBoldFont));
label->SetMultiLine(true);
@@ -720,23 +721,22 @@
layout->AddView(close_button);
// Second row views.
- const std::wstring try_it(l10n_util::GetString(IDS_TRY_TOAST_TRY_OPT));
+ const string16 try_it(l10n_util::GetStringUTF16(IDS_TRY_TOAST_TRY_OPT));
layout->StartRowWithPadding(0, 1, 0, 10);
try_chrome_ = new views::RadioButton(try_it, 1);
layout->AddView(try_chrome_);
try_chrome_->SetChecked(true);
// Third row views.
- const std::wstring
- kill_it(l10n_util::GetString(IDS_UNINSTALL_CHROME));
+ const string16 kill_it(l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME));
layout->StartRow(0, 2);
kill_chrome_ = new views::RadioButton(kill_it, 1);
layout->AddView(kill_chrome_);
// Fourth row views.
- const std::wstring ok_it(l10n_util::GetString(IDS_OK));
- const std::wstring cancel_it(l10n_util::GetString(IDS_TRY_TOAST_CANCEL));
- const std::wstring why_this(l10n_util::GetString(IDS_TRY_TOAST_WHY));
+ const string16 ok_it(l10n_util::GetStringUTF16(IDS_OK));
+ const string16 cancel_it(l10n_util::GetStringUTF16(IDS_TRY_TOAST_CANCEL));
+ const string16 why_this(l10n_util::GetStringUTF16(IDS_TRY_TOAST_WHY));
layout->StartRowWithPadding(0, 3, 0, 10);
views::Button* accept_button = new views::NativeButton(this, ok_it);
accept_button->set_tag(BT_OK_BUTTON);
diff --git a/chrome/browser/geolocation/core_location_data_provider_mac.h b/chrome/browser/geolocation/core_location_data_provider_mac.h
index 21ebadc..124ff47 100644
--- a/chrome/browser/geolocation/core_location_data_provider_mac.h
+++ b/chrome/browser/geolocation/core_location_data_provider_mac.h
@@ -47,7 +47,6 @@
scoped_nsobject<CoreLocationWrapperMac> wrapper_;
// The LocationProviderBase class that should receive position data
CoreLocationProviderMac* provider_;
- BrowserThread::ID origin_thread_id_;
};
#endif
diff --git a/chrome/browser/geolocation/core_location_data_provider_mac.mm b/chrome/browser/geolocation/core_location_data_provider_mac.mm
index b20230e..a88c6c4 100644
--- a/chrome/browser/geolocation/core_location_data_provider_mac.mm
+++ b/chrome/browser/geolocation/core_location_data_provider_mac.mm
@@ -11,6 +11,7 @@
#include "chrome/browser/geolocation/core_location_data_provider_mac.h"
#include "chrome/browser/geolocation/core_location_provider_mac.h"
+#include "chrome/browser/geolocation/geolocation_provider.h"
#include "base/logging.h"
#include "base/time.h"
@@ -41,7 +42,7 @@
- (void)stopUpdatingLocation;
@end
-@interface CLLocation : NSObject <NSCopying, NSCoding>
+@interface CLLocation : NSObject<NSCopying, NSCoding>
@property(readonly) CLLocationCoordinate2D coordinate;
@property(readonly) CLLocationDistance altitude;
@property(readonly) CLLocationAccuracy horizontalAccuracy;
@@ -64,9 +65,9 @@
// CLLocationManager. The location manaager's start and stop updating
// methods must be called from a thread that has an active run loop (which
// seems to only be the UI thread)
-@interface CoreLocationWrapperMac : NSObject <CLLocationManagerDelegate>
+@interface CoreLocationWrapperMac : NSObject<CLLocationManagerDelegate>
{
-@private
+ @private
NSBundle* bundle_;
Class locationManagerClass_;
id locationManager_;
@@ -119,8 +120,8 @@
}
- (void)startLocation {
- if([self locationDataAvailable]) {
- if(!locationManager_) {
+ if ([self locationDataAvailable]) {
+ if (!locationManager_) {
locationManager_ = [[locationManagerClass_ alloc] init];
[locationManager_ setDelegate:self];
}
@@ -151,7 +152,7 @@
- (void)locationManager:(CLLocationManager*)manager
didFailWithError:(NSError*)error {
Geoposition position;
- switch([error code]) {
+ switch ([error code]) {
case kCLErrorLocationUnknown:
position.error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE;
break;
@@ -166,10 +167,10 @@
}
- (BOOL)loadCoreLocationBundle {
- if(!bundle_) {
+ if (!bundle_) {
bundle_ = [[NSBundle alloc]
initWithPath:@"/System/Library/Frameworks/CoreLocation.framework"];
- if(!bundle_) {
+ if (!bundle_) {
DLOG(WARNING) << "Couldn't load CoreLocation Framework";
return NO;
}
@@ -183,9 +184,11 @@
@end
CoreLocationDataProviderMac::CoreLocationDataProviderMac() {
- if(!BrowserThread::GetCurrentThreadIdentifier(&origin_thread_id_))
- NOTREACHED() <<
- "CoreLocation data provider must be created in a valid BrowserThread.";
+ if (MessageLoop::current() !=
+ GeolocationProvider::GetInstance()->message_loop()) {
+ NOTREACHED() << "CoreLocation data provider must be created on "
+ "the Geolocation thread.";
+ }
provider_ = NULL;
wrapper_.reset([[CoreLocationWrapperMac alloc] initWithDataProvider:this]);
}
@@ -200,7 +203,7 @@
StartUpdating(CoreLocationProviderMac* provider) {
DCHECK(provider);
DCHECK(!provider_) << "StartUpdating called twice";
- if(![wrapper_ locationDataAvailable]) return false;
+ if (![wrapper_ locationDataAvailable]) return false;
provider_ = provider;
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &CoreLocationDataProviderMac::StartUpdatingTask));
@@ -216,7 +219,7 @@
}
void CoreLocationDataProviderMac::UpdatePosition(Geoposition *position) {
- BrowserThread::PostTask(origin_thread_id_, FROM_HERE,
+ GeolocationProvider::GetInstance()->message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(this,
&CoreLocationDataProviderMac::PositionUpdated,
*position));
@@ -235,7 +238,8 @@
}
void CoreLocationDataProviderMac::PositionUpdated(Geoposition position) {
- DCHECK(BrowserThread::CurrentlyOn(origin_thread_id_));
- if(provider_)
+ DCHECK(MessageLoop::current() ==
+ GeolocationProvider::GetInstance()->message_loop());
+ if (provider_)
provider_->SetPosition(&position);
}
diff --git a/chrome/browser/geolocation/core_location_provider_mac.h b/chrome/browser/geolocation/core_location_provider_mac.h
index 0d7d747..b936bfe 100644
--- a/chrome/browser/geolocation/core_location_provider_mac.h
+++ b/chrome/browser/geolocation/core_location_provider_mac.h
@@ -29,6 +29,7 @@
void SetPosition(Geoposition* position);
private:
+ bool is_updating_;
CoreLocationDataProviderMac* data_provider_;
Geoposition position_;
};
diff --git a/chrome/browser/geolocation/core_location_provider_mac.mm b/chrome/browser/geolocation/core_location_provider_mac.mm
index deb92c9..dbcd7d0 100644
--- a/chrome/browser/geolocation/core_location_provider_mac.mm
+++ b/chrome/browser/geolocation/core_location_provider_mac.mm
@@ -9,7 +9,8 @@
#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
-CoreLocationProviderMac::CoreLocationProviderMac() {
+CoreLocationProviderMac::CoreLocationProviderMac()
+ : is_updating_(false) {
data_provider_ = new CoreLocationDataProviderMac();
data_provider_->AddRef();
}
@@ -20,12 +21,19 @@
}
bool CoreLocationProviderMac::StartProvider(bool high_accuracy) {
- data_provider_->StartUpdating(this);
+ // StartProvider maybe called multiple times. For example, to update the high
+ // accuracy hint.
+ // TODO(jknotten): Support high_accuracy hint in underlying data provider.
+ if (is_updating_)
+ return true;
+
+ is_updating_ = data_provider_->StartUpdating(this);
return true;
}
void CoreLocationProviderMac::StopProvider() {
data_provider_->StopUpdating();
+ is_updating_ = false;
}
void CoreLocationProviderMac::GetPosition(Geoposition* position) {
@@ -43,8 +51,8 @@
}
LocationProviderBase* NewSystemLocationProvider() {
- if(CommandLine::ForCurrentProcess()
- ->HasSwitch(switches::kExperimentalLocationFeatures)) {
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kExperimentalLocationFeatures)) {
return new CoreLocationProviderMac;
}
return NULL;
diff --git a/chrome/browser/geolocation/device_data_provider.h b/chrome/browser/geolocation/device_data_provider.h
index b6a3882..f795d10 100644
--- a/chrome/browser/geolocation/device_data_provider.h
+++ b/chrome/browser/geolocation/device_data_provider.h
@@ -29,11 +29,11 @@
#include "base/basictypes.h"
#include "base/message_loop.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/task.h"
+#include "base/threading/non_thread_safe.h"
// The following data structures are used to store cell radio data and wifi
// data. See the Geolocation API design document at
@@ -264,7 +264,7 @@
// location providers. These location providers access the instance through the
// Register and Unregister methods.
template<typename DataType>
-class DeviceDataProvider : public NonThreadSafe {
+class DeviceDataProvider : public base::NonThreadSafe {
public:
// Interface to be implemented by listeners to a device data provider.
class ListenerInterface {
diff --git a/chrome/browser/geolocation/device_data_provider_unittest.cc b/chrome/browser/geolocation/device_data_provider_unittest.cc
index f6e9d96..a361fc6 100644
--- a/chrome/browser/geolocation/device_data_provider_unittest.cc
+++ b/chrome/browser/geolocation/device_data_provider_unittest.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/geolocation/device_data_provider.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/geolocation/wifi_data_provider_common.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,12 +28,12 @@
for (int i = 0; i < 10; i++) {
DeviceDataProvider<WifiData>::Register(&listener);
for (int j = 0; j < 10; j++) {
- PlatformThread::Sleep(0);
+ base::PlatformThread::Sleep(0);
main_message_loop.RunAllPending(); // See comment above
}
DeviceDataProvider<WifiData>::Unregister(&listener);
for (int j = 0; j < 10; j++) {
- PlatformThread::Sleep(0);
+ base::PlatformThread::Sleep(0);
main_message_loop.RunAllPending(); // See comment above
}
}
diff --git a/chrome/browser/geolocation/gateway_data_provider_common.h b/chrome/browser/geolocation/gateway_data_provider_common.h
index 6bc6f90..cc1c85a 100644
--- a/chrome/browser/geolocation/gateway_data_provider_common.h
+++ b/chrome/browser/geolocation/gateway_data_provider_common.h
@@ -10,7 +10,7 @@
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/geolocation/device_data_provider.h"
namespace {
diff --git a/chrome/browser/geolocation/geolocation_dispatcher_host.cc b/chrome/browser/geolocation/geolocation_dispatcher_host.cc
index 4f4020b..dbe6108 100644
--- a/chrome/browser/geolocation/geolocation_dispatcher_host.cc
+++ b/chrome/browser/geolocation/geolocation_dispatcher_host.cc
@@ -35,21 +35,17 @@
private:
virtual ~GeolocationDispatcherHostImpl();
- void OnRegisterDispatcher(int render_view_id);
- void OnUnregisterDispatcher(int render_view_id);
void OnRequestPermission(
int render_view_id, int bridge_id, const GURL& requesting_frame);
void OnCancelPermissionRequest(
int render_view_id, int bridge_id, const GURL& requesting_frame);
void OnStartUpdating(
- int render_view_id, int bridge_id, const GURL& requesting_frame,
+ int render_view_id, const GURL& requesting_frame,
bool enable_high_accuracy);
- void OnStopUpdating(int render_view_id, int bridge_id);
- void OnSuspend(int render_view_id, int bridge_id);
- void OnResume(int render_view_id, int bridge_id);
+ void OnStopUpdating(int render_view_id);
// Updates the |location_arbitrator_| with the currently required update
- // options, based on |bridge_update_options_|.
+ // options, based on |renderer_update_options_|.
void RefreshGeolocationObserverOptions();
int render_process_id_;
@@ -60,10 +56,9 @@
// context switches.
// Only used on the IO thread.
std::set<int> geolocation_renderer_ids_;
- // Maps <renderer_id, bridge_id> to the location arbitrator update options
- // that correspond to this particular bridge.
- std::map<std::pair<int, int>, GeolocationObserverOptions>
- bridge_update_options_;
+ // Maps renderer_id to the location arbitrator update options that correspond
+ // to this particular bridge.
+ std::map<int, GeolocationObserverOptions> renderer_update_options_;
// Only set whilst we are registered with the arbitrator.
GeolocationProvider* location_provider_;
@@ -92,10 +87,6 @@
*msg_was_ok = true;
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(GeolocationDispatcherHostImpl, msg, *msg_was_ok)
- IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_RegisterDispatcher,
- OnRegisterDispatcher)
- IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_UnregisterDispatcher,
- OnUnregisterDispatcher)
IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_CancelPermissionRequest,
OnCancelPermissionRequest)
IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_RequestPermission,
@@ -104,10 +95,6 @@
OnStartUpdating)
IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_StopUpdating,
OnStopUpdating)
- IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_Suspend,
- OnSuspend)
- IPC_MESSAGE_HANDLER(ViewHostMsg_Geolocation_Resume,
- OnResume)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -125,20 +112,6 @@
}
}
-void GeolocationDispatcherHostImpl::OnRegisterDispatcher(
- int render_view_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK_EQ(0u, geolocation_renderer_ids_.count(render_view_id));
- geolocation_renderer_ids_.insert(render_view_id);
-}
-
-void GeolocationDispatcherHostImpl::OnUnregisterDispatcher(
- int render_view_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DCHECK_EQ(1u, geolocation_renderer_ids_.count(render_view_id));
- geolocation_renderer_ids_.erase(render_view_id);
-}
-
void GeolocationDispatcherHostImpl::OnRequestPermission(
int render_view_id,
int bridge_id,
@@ -165,62 +138,35 @@
void GeolocationDispatcherHostImpl::OnStartUpdating(
int render_view_id,
- int bridge_id,
const GURL& requesting_frame,
bool enable_high_accuracy) {
-#if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
// StartUpdating() can be invoked as a result of high-accuracy mode
- // being enabled / disabled. No need to register the dispatcher again.
- if (!geolocation_renderer_ids_.count(render_view_id))
- OnRegisterDispatcher(render_view_id);
-#endif
- // WebKit sends the startupdating request before checking permissions, to
- // optimize the no-location-available case and reduce latency in the success
- // case (location lookup happens in parallel with the permission request).
+ // being enabled / disabled. No need to record the dispatcher again.
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":"
- << render_view_id << ":" << bridge_id;
- bridge_update_options_[std::make_pair(render_view_id, bridge_id)] =
+ << render_view_id;
+ if (!geolocation_renderer_ids_.count(render_view_id))
+ geolocation_renderer_ids_.insert(render_view_id);
+
+ renderer_update_options_[render_view_id] =
GeolocationObserverOptions(enable_high_accuracy);
- geolocation_permission_context_->StartUpdatingRequested(
- render_process_id_, render_view_id, bridge_id,
- requesting_frame);
RefreshGeolocationObserverOptions();
}
-void GeolocationDispatcherHostImpl::OnStopUpdating(int render_view_id,
- int bridge_id) {
+void GeolocationDispatcherHostImpl::OnStopUpdating(int render_view_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":"
- << render_view_id << ":" << bridge_id;
- if (bridge_update_options_.erase(std::make_pair(render_view_id, bridge_id)))
+ << render_view_id;
+ if (renderer_update_options_.erase(render_view_id))
RefreshGeolocationObserverOptions();
- geolocation_permission_context_->StopUpdatingRequested(
- render_process_id_, render_view_id, bridge_id);
-#if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
- OnUnregisterDispatcher(render_view_id);
-#endif
-}
-void GeolocationDispatcherHostImpl::OnSuspend(int render_view_id,
- int bridge_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":"
- << render_view_id << ":" << bridge_id;
- // TODO(bulach): connect this with GeolocationArbitrator.
-}
-
-void GeolocationDispatcherHostImpl::OnResume(int render_view_id,
- int bridge_id) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- DVLOG(1) << __FUNCTION__ << " " << render_process_id_ << ":"
- << render_view_id << ":" << bridge_id;
- // TODO(bulach): connect this with GeolocationArbitrator.
+ DCHECK_EQ(1U, geolocation_renderer_ids_.count(render_view_id));
+ geolocation_renderer_ids_.erase(render_view_id);
}
void GeolocationDispatcherHostImpl::RefreshGeolocationObserverOptions() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- if (bridge_update_options_.empty()) {
+ if (renderer_update_options_.empty()) {
if (location_provider_) {
location_provider_->RemoveObserver(this);
location_provider_ = NULL;
@@ -231,7 +177,7 @@
// Re-add to re-establish our options, in case they changed.
location_provider_->AddObserver(
this,
- GeolocationObserverOptions::Collapse(bridge_update_options_));
+ GeolocationObserverOptions::Collapse(renderer_update_options_));
}
}
} // namespace
diff --git a/chrome/browser/geolocation/geolocation_exceptions_table_model.cc b/chrome/browser/geolocation/geolocation_exceptions_table_model.cc
index 7095e53..9bd57fe 100644
--- a/chrome/browser/geolocation/geolocation_exceptions_table_model.cc
+++ b/chrome/browser/geolocation/geolocation_exceptions_table_model.cc
@@ -138,45 +138,45 @@
return entries_.size();
}
-std::wstring GeolocationExceptionsTableModel::GetText(int row,
- int column_id) {
+string16 GeolocationExceptionsTableModel::GetText(int row,
+ int column_id) {
const Entry& entry = entries_[row];
if (column_id == IDS_EXCEPTIONS_HOSTNAME_HEADER) {
if (entry.origin == entry.embedding_origin) {
- return content_settings_helper::OriginToWString(entry.origin);
+ return content_settings_helper::OriginToString16(entry.origin);
}
- std::wstring indent(L" ");
+ string16 indent(ASCIIToUTF16(" "));
if (entry.embedding_origin.is_empty()) {
// NOTE: As long as the user cannot add/edit entries from the exceptions
// dialog, it's impossible to actually have a non-default setting for some
// origin "embedded on any other site", so this row will never appear. If
// we add the ability to add/edit exceptions, we'll need to decide when to
// display this and how "removing" it will function.
- return indent +
- l10n_util::GetString(IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ANY_OTHER);
+ return indent + l10n_util::GetStringUTF16(
+ IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ANY_OTHER);
}
- return indent + l10n_util::GetStringF(
+ return indent + l10n_util::GetStringFUTF16(
IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST,
- content_settings_helper::OriginToWString(entry.embedding_origin));
+ content_settings_helper::OriginToString16(entry.embedding_origin));
}
if (column_id == IDS_EXCEPTIONS_ACTION_HEADER) {
switch (entry.setting) {
case CONTENT_SETTING_ALLOW:
- return l10n_util::GetString(IDS_EXCEPTIONS_ALLOW_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON);
case CONTENT_SETTING_BLOCK:
- return l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON);
case CONTENT_SETTING_ASK:
- return l10n_util::GetString(IDS_EXCEPTIONS_ASK_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ASK_BUTTON);
case CONTENT_SETTING_DEFAULT:
- return l10n_util::GetString(IDS_EXCEPTIONS_NOT_SET_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_NOT_SET_BUTTON);
default:
break;
}
}
NOTREACHED();
- return std::wstring();
+ return string16();
}
void GeolocationExceptionsTableModel::SetObserver(
@@ -223,7 +223,7 @@
// The entries are at the same "scope". If we're sorting by action, then do
// that now.
if (column_id == IDS_EXCEPTIONS_ACTION_HEADER) {
- int compare_text = l10n_util::CompareStringWithCollator(
+ int compare_text = l10n_util::CompareString16WithCollator(
GetCollator(), GetText(row1, column_id), GetText(row2, column_id));
if (compare_text != 0)
return compare_text;
diff --git a/chrome/browser/geolocation/geolocation_exceptions_table_model.h b/chrome/browser/geolocation/geolocation_exceptions_table_model.h
index 09014b4..d1223e6 100644
--- a/chrome/browser/geolocation/geolocation_exceptions_table_model.h
+++ b/chrome/browser/geolocation/geolocation_exceptions_table_model.h
@@ -8,6 +8,7 @@
#include <vector>
+#include "base/compiler_specific.h"
#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/remove_rows_table_model.h"
#include "chrome/common/content_settings.h"
@@ -37,10 +38,10 @@
virtual void RemoveAll();
// TableModel overrides:
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
- virtual void SetObserver(TableModelObserver* observer);
- virtual int CompareValues(int row1, int row2, int column_id);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column_id) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
+ virtual int CompareValues(int row1, int row2, int column_id) OVERRIDE;
private:
void AddEntriesForOrigin(
diff --git a/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc b/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc
index 68bc752..301a7b2 100644
--- a/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc
@@ -127,17 +127,17 @@
CreateAllowedSamples();
// Ensure the parent doesn't have any indentation.
- std::wstring text(model_->GetText(0, IDS_EXCEPTIONS_HOSTNAME_HEADER));
- EXPECT_EQ(content_settings_helper::OriginToWString(kUrl0), text);
+ string16 text = model_->GetText(0, IDS_EXCEPTIONS_HOSTNAME_HEADER);
+ EXPECT_EQ(content_settings_helper::OriginToString16(kUrl0), text);
// Ensure there's some indentation on the children nodes.
text = model_->GetText(1, IDS_EXCEPTIONS_HOSTNAME_HEADER);
- EXPECT_NE(content_settings_helper::OriginToWString(kUrl1), text);
- EXPECT_NE(std::wstring::npos,
- text.find(content_settings_helper::OriginToWString(kUrl1)));
+ EXPECT_NE(content_settings_helper::OriginToString16(kUrl1), text);
+ EXPECT_NE(string16::npos,
+ text.find(content_settings_helper::OriginToString16(kUrl1)));
text = model_->GetText(2, IDS_EXCEPTIONS_HOSTNAME_HEADER);
- EXPECT_NE(content_settings_helper::OriginToWString(kUrl2), text);
- EXPECT_NE(std::wstring::npos,
- text.find(content_settings_helper::OriginToWString(kUrl2)));
+ EXPECT_NE(content_settings_helper::OriginToString16(kUrl2), text);
+ EXPECT_NE(string16::npos,
+ text.find(content_settings_helper::OriginToString16(kUrl2)));
}
diff --git a/chrome/browser/geolocation/geolocation_permission_context.cc b/chrome/browser/geolocation/geolocation_permission_context.cc
index 1f8160d..76bc3d7 100644
--- a/chrome/browser/geolocation/geolocation_permission_context.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context.cc
@@ -432,38 +432,6 @@
CancelPendingInfoBarRequest(render_process_id, render_view_id, bridge_id);
}
-void GeolocationPermissionContext::StartUpdatingRequested(
- int render_process_id, int render_view_id, int bridge_id,
- const GURL& requesting_frame) {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- // Note we cannot store the arbitrator as a member as it is not thread safe.
- GeolocationProvider* provider = GeolocationProvider::GetInstance();
-
-#if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
- // Client-based Geolocation uses a preemptive permission model, so permission
- // ought to have been requested and granted before the controller requests
- // the client to start updating.
- DCHECK(provider->HasPermissionBeenGranted());
-#else
- // WebKit will not request permission until it has received a valid
- // location, but the google network location provider will not give a
- // valid location until the user has granted permission. So we cut the Gordian
- // Knot by reusing the the 'start updating' request to also trigger
- // a 'permission request' should the provider still be awaiting permission.
- if (!provider->HasPermissionBeenGranted()) {
- RequestGeolocationPermission(render_process_id, render_view_id, bridge_id,
- requesting_frame);
- }
-#endif
-}
-
-void GeolocationPermissionContext::StopUpdatingRequested(
- int render_process_id, int render_view_id, int bridge_id) {
-#if !defined(ENABLE_CLIENT_BASED_GEOLOCATION)
- CancelPendingInfoBarRequest(render_process_id, render_view_id, bridge_id);
-#endif
-}
-
void GeolocationPermissionContext::NotifyPermissionSet(
int render_process_id, int render_view_id, int bridge_id,
const GURL& requesting_frame, bool allowed) {
diff --git a/chrome/browser/geolocation/geolocation_permission_context.h b/chrome/browser/geolocation/geolocation_permission_context.h
index c2a08e7..cce7090 100644
--- a/chrome/browser/geolocation/geolocation_permission_context.h
+++ b/chrome/browser/geolocation/geolocation_permission_context.h
@@ -44,22 +44,6 @@
int render_process_id, int render_view_id, int bridge_id,
const GURL& requesting_frame, bool allowed);
- // Called when a geolocation object wants to start receiving location updates.
- // This also applies global policy around which location providers may be
- // enabled at a given time (e.g. prior to the user agreeing to any geolocation
- // permission requests).
- void StartUpdatingRequested(
- int render_process_id, int render_view_id, int bridge_id,
- const GURL& requesting_frame);
-
- // Called when a geolocation object has stopped. Because we are
- // short-circuiting permission request (see StartUpdatingRequested above), we
- // cancel any pending permission in here, since WebKit doesn't know about the
- // pending permission request and will never call
- // CancelGeolocationPermissionRequest().
- void StopUpdatingRequested(
- int render_process_id, int render_view_id, int bridge_id);
-
private:
friend class base::RefCountedThreadSafe<GeolocationPermissionContext>;
virtual ~GeolocationPermissionContext();
diff --git a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
index 0fadbe7..cd1426e 100644
--- a/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
+++ b/chrome/browser/geolocation/geolocation_permission_context_unittest.cc
@@ -290,36 +290,6 @@
requesting_frame_1, requesting_frame_0));
}
-// TODO(jknotten): Remove this test once we have completely
-// switched over to client-based geolocation.
-#if defined(ENABLE_CLIENT_BASED_GEOLOCATION)
-#define MAYBE_StopUpdating DISABLED_StopUpdating
-#else
-#define MAYBE_StopUpdating StopUpdating
-#endif
-TEST_F(GeolocationPermissionContextTests, MAYBE_StopUpdating) {
- GURL requesting_frame("http://www.example.com/geolocation");
- NavigateAndCommit(requesting_frame);
- EXPECT_EQ(0, contents()->infobar_delegate_count());
- geolocation_permission_context_->RequestGeolocationPermission(
- process_id(), render_id(), bridge_id(), requesting_frame);
- EXPECT_EQ(1, contents()->infobar_delegate_count());
- ConfirmInfoBarDelegate* infobar_0 =
- contents()->GetInfoBarDelegateAt(0)->AsConfirmInfoBarDelegate();
- ASSERT_TRUE(infobar_0);
-
- geolocation_permission_context_->StopUpdatingRequested(
- process_id(), render_id(), bridge_id());
- EXPECT_EQ(infobar_0,
- tab_contents_with_pending_infobar_->removed_infobar_delegate_);
- infobar_0->InfoBarClosed();
- EXPECT_EQ(0, contents()->infobar_delegate_count());
- EXPECT_EQ(
- CONTENT_SETTING_ASK,
- profile()->GetGeolocationContentSettingsMap()->GetContentSetting(
- requesting_frame, requesting_frame));
-}
-
TEST_F(GeolocationPermissionContextTests, InvalidURL) {
GURL invalid_embedder;
GURL requesting_frame("about:blank");
diff --git a/chrome/browser/geolocation/geolocation_provider.cc b/chrome/browser/geolocation/geolocation_provider.cc
index 3756af7..59365b1 100644
--- a/chrome/browser/geolocation/geolocation_provider.cc
+++ b/chrome/browser/geolocation/geolocation_provider.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/geolocation/geolocation_provider.h"
#include "base/singleton.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/geolocation/location_arbitrator.h"
// This class is guaranteed to outlive its internal thread, so ref counting
diff --git a/chrome/browser/geolocation/geolocation_provider.h b/chrome/browser/geolocation/geolocation_provider.h
index 9420f57..f83c427 100644
--- a/chrome/browser/geolocation/geolocation_provider.h
+++ b/chrome/browser/geolocation/geolocation_provider.h
@@ -8,7 +8,7 @@
#include <map>
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/geolocation/geolocation_observer.h"
#include "chrome/common/geoposition.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/browser/geolocation/location_provider.h b/chrome/browser/geolocation/location_provider.h
index 6c4d8da..fe19b36 100644
--- a/chrome/browser/geolocation/location_provider.h
+++ b/chrome/browser/geolocation/location_provider.h
@@ -15,8 +15,8 @@
#pragma once
#include <map>
-#include "base/non_thread_safe.h"
#include "base/string16.h"
+#include "base/threading/non_thread_safe.h"
class AccessTokenStore;
struct Geoposition;
@@ -24,7 +24,7 @@
class URLRequestContextGetter;
// The base class used by all location providers.
-class LocationProviderBase : public NonThreadSafe {
+class LocationProviderBase : public base::NonThreadSafe {
public:
// Clients of the location provider must implement this interface. All call-
// backs to this interface will happen in the context of the thread on which
diff --git a/chrome/browser/geolocation/mock_location_provider.h b/chrome/browser/geolocation/mock_location_provider.h
index 17f11d8..5d77631 100644
--- a/chrome/browser/geolocation/mock_location_provider.h
+++ b/chrome/browser/geolocation/mock_location_provider.h
@@ -9,7 +9,7 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/geolocation/location_provider.h"
#include "chrome/common/geoposition.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/browser/geolocation/network_location_provider.h b/chrome/browser/geolocation/network_location_provider.h
index 1e2485b..0c846d4 100644
--- a/chrome/browser/geolocation/network_location_provider.h
+++ b/chrome/browser/geolocation/network_location_provider.h
@@ -13,7 +13,7 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/geolocation/device_data_provider.h"
#include "chrome/browser/geolocation/location_provider.h"
#include "chrome/browser/geolocation/network_location_request.h"
diff --git a/chrome/browser/geolocation/network_location_request.h b/chrome/browser/geolocation/network_location_request.h
index f7c8a0c..90bc026 100644
--- a/chrome/browser/geolocation/network_location_request.h
+++ b/chrome/browser/geolocation/network_location_request.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -64,7 +64,7 @@
// URLFetcher::Delegate
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/geolocation/wifi_data_provider_common.h b/chrome/browser/geolocation/wifi_data_provider_common.h
index 5f0ee0a..c647c06 100644
--- a/chrome/browser/geolocation/wifi_data_provider_common.h
+++ b/chrome/browser/geolocation/wifi_data_provider_common.h
@@ -12,7 +12,7 @@
#include "base/scoped_ptr.h"
#include "base/string16.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/geolocation/device_data_provider.h"
// Converts a MAC address stored as an array of uint8 to a string.
diff --git a/chrome/browser/geolocation/win7_location_api_unittest_win.cc b/chrome/browser/geolocation/win7_location_api_unittest_win.cc
index 16d867c..a22b99b 100644
--- a/chrome/browser/geolocation/win7_location_api_unittest_win.cc
+++ b/chrome/browser/geolocation/win7_location_api_unittest_win.cc
@@ -12,7 +12,6 @@
#include "base/message_loop.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
-#include "base/win_util.h"
#include "chrome/common/geoposition.h"
#include "chrome/browser/geolocation/win7_location_api_win.h"
#include "testing/gmock/include/gmock/gmock.h"
diff --git a/chrome/browser/geolocation/win7_location_api_win.h b/chrome/browser/geolocation/win7_location_api_win.h
index 96fcd21..78bbed4 100644
--- a/chrome/browser/geolocation/win7_location_api_win.h
+++ b/chrome/browser/geolocation/win7_location_api_win.h
@@ -12,7 +12,6 @@
#include <Windows.h>
#include "base/time.h"
-#include "base/win_util.h"
struct Geoposition;
diff --git a/chrome/browser/google/google_update.cc b/chrome/browser/google/google_update.cc
index fc7f324..f12192d 100644
--- a/chrome/browser/google/google_update.cc
+++ b/chrome/browser/google/google_update.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,7 +13,7 @@
#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/installer/util/browser_distribution.h"
@@ -231,7 +231,6 @@
bool GoogleUpdate::InitiateGoogleUpdateCheck(bool install_if_newer,
Window* window,
MessageLoop* main_loop) {
-
FilePath chrome_exe_path;
if (!PathService::Get(base::DIR_EXE, &chrome_exe_path)) {
NOTREACHED();
@@ -261,6 +260,8 @@
ScopedComPtr<IGoogleUpdate> on_demand;
+ bool system_level = false;
+
if (InstallUtil::IsPerUserInstall(chrome_exe.c_str())) {
hr = on_demand.CreateInstance(CLSID_OnDemandUserAppsClass);
} else {
@@ -279,16 +280,19 @@
IID_IGoogleUpdate, foreground_hwnd,
reinterpret_cast<void**>(on_demand.Receive()));
}
+ system_level = true;
}
if (hr != S_OK)
return ReportFailure(hr, GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, main_loop);
- BrowserDistribution* dist = BrowserDistribution::GetDistribution();
+ std::wstring app_guid = installer::GetAppGuidForUpdates(system_level);
+ DCHECK(!app_guid.empty());
+
if (!install_if_newer)
- hr = on_demand->CheckForUpdate(dist->GetAppGuid().c_str(), job_observer);
+ hr = on_demand->CheckForUpdate(app_guid.c_str(), job_observer);
else
- hr = on_demand->Update(dist->GetAppGuid().c_str(), job_observer);
+ hr = on_demand->Update(app_guid.c_str(), job_observer);
if (hr != S_OK)
return ReportFailure(hr, GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR,
diff --git a/chrome/browser/google/google_url_tracker.h b/chrome/browser/google/google_url_tracker.h
index 590c6df..7f58ab1 100644
--- a/chrome/browser/google/google_url_tracker.h
+++ b/chrome/browser/google/google_url_tracker.h
@@ -108,7 +108,7 @@
// URLFetcher::Delegate
virtual void OnURLFetchComplete(const URLFetcher *source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc
index 9e374c4..8e7ac68 100644
--- a/chrome/browser/gpu_process_host.cc
+++ b/chrome/browser/gpu_process_host.cc
@@ -9,7 +9,7 @@
#include "base/command_line.h"
#include "base/metrics/histogram.h"
#include "base/string_piece.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/gpu_blacklist.h"
#include "chrome/browser/gpu_process_host_ui_shim.h"
@@ -97,6 +97,9 @@
if (!initialized_) {
initialized_ = true;
initialized_successfully_ = Init();
+ if (initialized_successfully_) {
+ Send(new GpuMsg_Initialize());
+ }
}
return initialized_successfully_;
}
@@ -228,10 +231,13 @@
}
void GpuProcessHost::OnSynchronizeReply() {
- const SynchronizationRequest& request =
- queued_synchronization_replies_.front();
- SendSynchronizationReply(request.reply, request.filter);
- queued_synchronization_replies_.pop();
+ // Guard against race conditions in abrupt GPU process termination.
+ if (queued_synchronization_replies_.size() > 0) {
+ const SynchronizationRequest& request =
+ queued_synchronization_replies_.front();
+ SendSynchronizationReply(request.reply, request.filter);
+ queued_synchronization_replies_.pop();
+ }
}
#if defined(OS_LINUX)
@@ -480,11 +486,26 @@
filter->Send(reply);
}
+void GpuProcessHost::SendOutstandingReplies() {
+ // First send empty channel handles for all EstablishChannel requests.
+ while (!sent_requests_.empty()) {
+ const ChannelRequest& request = sent_requests_.front();
+ SendEstablishChannelReply(IPC::ChannelHandle(), GPUInfo(), request.filter);
+ sent_requests_.pop();
+ }
+
+ // Now unblock all renderers waiting for synchronization replies.
+ while (!queued_synchronization_replies_.empty()) {
+ OnSynchronizeReply();
+ }
+}
+
bool GpuProcessHost::CanShutdown() {
return true;
}
void GpuProcessHost::OnChildDied() {
+ SendOutstandingReplies();
// Located in OnChildDied because OnProcessCrashed suffers from a race
// condition on Linux. The GPU process will only die if it crashes.
UMA_HISTOGRAM_ENUMERATION("GPU.GPUProcessLifetimeEvents",
@@ -493,6 +514,7 @@
}
void GpuProcessHost::OnProcessCrashed(int exit_code) {
+ SendOutstandingReplies();
if (++g_gpu_crash_count >= kGpuMaxCrashCount) {
// The gpu process is too unstable to use. Disable it for current session.
RenderViewHostDelegateHelper::set_gpu_enabled(false);
diff --git a/chrome/browser/gpu_process_host.h b/chrome/browser/gpu_process_host.h
index 14edf88..9a7a90d 100644
--- a/chrome/browser/gpu_process_host.h
+++ b/chrome/browser/gpu_process_host.h
@@ -9,8 +9,8 @@
#include <queue>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/browser/browser_child_process_host.h"
#include "gfx/native_widget_types.h"
@@ -29,7 +29,8 @@
class Message;
}
-class GpuProcessHost : public BrowserChildProcessHost, public NonThreadSafe {
+class GpuProcessHost : public BrowserChildProcessHost,
+ public base::NonThreadSafe {
public:
// Getter for the singleton. This will return NULL on failure.
static GpuProcessHost* Get();
@@ -106,6 +107,11 @@
void SendSynchronizationReply(IPC::Message* reply,
RenderMessageFilter* filter);
+ // Sends outstanding replies to renderer processes. This is only called
+ // in error situations like the GPU process crashing -- but is necessary
+ // to prevent the renderer process from hanging.
+ void SendOutstandingReplies();
+
virtual bool CanShutdown();
virtual void OnChildDied();
virtual void OnProcessCrashed(int exit_code);
diff --git a/chrome/browser/gpu_process_host_ui_shim.h b/chrome/browser/gpu_process_host_ui_shim.h
index f261093..17bf970 100644
--- a/chrome/browser/gpu_process_host_ui_shim.h
+++ b/chrome/browser/gpu_process_host_ui_shim.h
@@ -12,9 +12,9 @@
// shuttling messages between the browser and GPU processes.
#include "base/callback.h"
-#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
#include "base/singleton.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/common/gpu_info.h"
#include "chrome/common/message_router.h"
#include "ipc/ipc_channel.h"
@@ -22,7 +22,7 @@
class GpuProcessHostUIShim : public IPC::Channel::Sender,
public IPC::Channel::Listener,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
// Getter for the singleton. This will return NULL on failure.
static GpuProcessHostUIShim* GetInstance();
diff --git a/chrome/browser/gtk/about_chrome_dialog.cc b/chrome/browser/gtk/about_chrome_dialog.cc
index 23fad57..3d1ffa9 100644
--- a/chrome/browser/gtk/about_chrome_dialog.cc
+++ b/chrome/browser/gtk/about_chrome_dialog.cc
@@ -13,6 +13,7 @@
#include "app/resource_bundle.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
+#include "chrome/browser/google/google_util.h"
#include "chrome/browser/gtk/cairo_cached_surface.h"
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/gtk/gtk_theme_provider.h"
@@ -78,8 +79,9 @@
}
const char* GetChromiumUrl() {
- static std::string url(l10n_util::GetStringUTF8(IDS_CHROMIUM_PROJECT_URL));
- return url.c_str();
+ static GURL url = google_util::AppendGoogleLocaleParam(
+ GURL(chrome::kChromiumProjectURL));
+ return url.spec().c_str();
}
gboolean OnEventBoxExpose(GtkWidget* event_box,
@@ -253,18 +255,18 @@
gtk_box_pack_start(GTK_BOX(vbox), gtk_label_new(""), FALSE, FALSE, 0);
std::vector<size_t> url_offsets;
- std::wstring text = l10n_util::GetStringF(IDS_ABOUT_TERMS_OF_SERVICE,
- std::wstring(),
- std::wstring(),
- &url_offsets);
+ string16 text = l10n_util::GetStringFUTF16(IDS_ABOUT_TERMS_OF_SERVICE,
+ string16(),
+ string16(),
+ &url_offsets);
GtkWidget* tos_chunk1 = gtk_label_new(
- WideToUTF8(text.substr(0, url_offsets[0])).c_str());
+ UTF16ToUTF8(text.substr(0, url_offsets[0])).c_str());
gtk_misc_set_alignment(GTK_MISC(tos_chunk1), 0.0, 0.5);
GtkWidget* tos_link = gtk_chrome_link_button_new(
l10n_util::GetStringUTF8(IDS_TERMS_OF_SERVICE).c_str());
GtkWidget* tos_chunk2 = gtk_label_new(
- WideToUTF8(text.substr(url_offsets[0])).c_str());
+ UTF16ToUTF8(text.substr(url_offsets[0])).c_str());
gtk_misc_set_alignment(GTK_MISC(tos_chunk2), 0.0, 0.5);
GtkWidget* tos_hbox = gtk_hbox_new(FALSE, 0);
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc
index ab6c5a5..cd1ea94 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.cc
+++ b/chrome/browser/gtk/bookmark_bar_gtk.cc
@@ -7,7 +7,6 @@
#include <vector>
#include "app/gtk_dnd_util.h"
-#include "app/slide_animation.h"
#include "app/resource_bundle.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
@@ -46,6 +45,7 @@
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -75,13 +75,6 @@
const int kOtherBookmarksPaddingHorizontal = 2;
const int kOtherBookmarksPaddingVertical = 1;
-// Middle color of the separator gradient.
-const double kSeparatorColor[] =
- { 194.0 / 255.0, 205.0 / 255.0, 212.0 / 212.0 };
-// Top color of the separator gradient.
-const double kTopBorderColor[] =
- { 222.0 / 255.0, 234.0 / 255.0, 248.0 / 255.0 };
-
// The targets accepted by the toolbar and folder buttons for DnD.
const int kDestTargetList[] = { gtk_dnd_util::CHROME_BOOKMARK_ITEM,
gtk_dnd_util::CHROME_NAMED_URL,
@@ -284,7 +277,7 @@
gtk_widget_set_size_request(event_box_.get(), -1, kBookmarkBarMinimumHeight);
- slide_animation_.reset(new SlideAnimation(this));
+ slide_animation_.reset(new ui::SlideAnimation(this));
ViewIDUtil::SetID(other_bookmarks_button_, VIEW_ID_OTHER_BOOKMARKS);
ViewIDUtil::SetID(widget(), VIEW_ID_BOOKMARK_BAR);
@@ -779,7 +772,7 @@
return profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar);
}
-void BookmarkBarGtk::AnimationProgressed(const Animation* animation) {
+void BookmarkBarGtk::AnimationProgressed(const ui::Animation* animation) {
DCHECK_EQ(animation, slide_animation_.get());
int max_height = ShouldBeFloating() ?
@@ -791,7 +784,7 @@
gtk_widget_set_size_request(event_box_.get(), -1, height);
}
-void BookmarkBarGtk::AnimationEnded(const Animation* animation) {
+void BookmarkBarGtk::AnimationEnded(const ui::Animation* animation) {
DCHECK_EQ(animation, slide_animation_.get());
if (!slide_animation_->IsShowing()) {
diff --git a/chrome/browser/gtk/bookmark_bar_gtk.h b/chrome/browser/gtk/bookmark_bar_gtk.h
index 0939c70..7d62572 100644
--- a/chrome/browser/gtk/bookmark_bar_gtk.h
+++ b/chrome/browser/gtk/bookmark_bar_gtk.h
@@ -10,7 +10,6 @@
#include <vector>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/gtest_prod_util.h"
#include "base/scoped_ptr.h"
@@ -25,6 +24,7 @@
#include "chrome/common/notification_registrar.h"
#include "gfx/point.h"
#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
class BookmarkMenuController;
class Browser;
@@ -34,24 +34,24 @@
class MenuGtk;
class PageNavigator;
class Profile;
-class SlideAnimation;
class TabstripOriginProvider;
-class BookmarkBarGtk : public AnimationDelegate,
+namespace ui {
+class SlideAnimation;
+}
+
+class BookmarkBarGtk : public ui::AnimationDelegate,
public ProfileSyncServiceObserver,
public BookmarkModelObserver,
public MenuBarHelper::Delegate,
public NotificationObserver,
public BookmarkBarInstructionsGtk::Delegate,
public BookmarkContextMenuControllerDelegate {
- FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty);
- FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest,
- HidesHelpMessageWithBookmark);
- FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons);
public:
- explicit BookmarkBarGtk(BrowserWindowGtk* window,
- Profile* profile, Browser* browser,
- TabstripOriginProvider* tabstrip_origin_provider);
+ BookmarkBarGtk(BrowserWindowGtk* window,
+ Profile* profile,
+ Browser* browser,
+ TabstripOriginProvider* tabstrip_origin_provider);
virtual ~BookmarkBarGtk();
// Resets the profile. This removes any buttons for the current profile and
@@ -99,9 +99,9 @@
// Returns true if the bookmarks bar preference is set to 'always show'.
bool IsAlwaysShown();
- // AnimationDelegate implementation ------------------------------------------
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // ui::AnimationDelegate implementation --------------------------------------
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// MenuBarHelper::Delegate implementation ------------------------------------
virtual void PopupForButton(GtkWidget* button);
@@ -115,6 +115,11 @@
virtual void CloseMenu();
private:
+ FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, DisplaysHelpMessageOnEmpty);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest,
+ HidesHelpMessageWithBookmark);
+ FRIEND_TEST_ALL_PREFIXES(BookmarkBarGtkUnittest, BuildsButtons);
+
// Helper function which generates GtkToolItems for |bookmark_toolbar_|.
void CreateAllBookmarkButtons();
@@ -365,7 +370,7 @@
// displayed yet.
scoped_ptr<BookmarkMenuController> current_menu_;
- scoped_ptr<SlideAnimation> slide_animation_;
+ scoped_ptr<ui::SlideAnimation> slide_animation_;
// Whether we are currently configured as floating (detached from the
// toolbar). This reflects our actual state, and can be out of sync with
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
index 9ed0106..93b126d 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.cc
@@ -635,7 +635,8 @@
SetContainerWidth();
}
-void BrowserActionsToolbarGtk::AnimationProgressed(const Animation* animation) {
+void BrowserActionsToolbarGtk::AnimationProgressed(
+ const ui::Animation* animation) {
int width = start_width_ + (desired_width_ - start_width_) *
animation->GetCurrentValue();
gtk_widget_set_size_request(button_hbox_.get(), width, -1);
@@ -644,7 +645,7 @@
resize_animation_.Reset();
}
-void BrowserActionsToolbarGtk::AnimationEnded(const Animation* animation) {
+void BrowserActionsToolbarGtk::AnimationEnded(const ui::Animation* animation) {
gtk_widget_set_size_request(button_hbox_.get(), desired_width_, -1);
UpdateChevronVisibility();
}
diff --git a/chrome/browser/gtk/browser_actions_toolbar_gtk.h b/chrome/browser/gtk/browser_actions_toolbar_gtk.h
index 452a642..4d49416 100644
--- a/chrome/browser/gtk/browser_actions_toolbar_gtk.h
+++ b/chrome/browser/gtk/browser_actions_toolbar_gtk.h
@@ -9,11 +9,9 @@
#include <map>
#include <string>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "app/gtk_signal_registrar.h"
#include "app/menus/simple_menu_model.h"
-#include "app/slide_animation.h"
#include "base/linked_ptr.h"
#include "base/task.h"
#include "chrome/browser/extensions/extension_toolbar_model.h"
@@ -23,6 +21,8 @@
#include "chrome/browser/gtk/owned_widget_gtk.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
class Browser;
class BrowserActionButton;
@@ -34,7 +34,7 @@
typedef struct _GtkWidget GtkWidget;
class BrowserActionsToolbarGtk : public ExtensionToolbarModel::Observer,
- public AnimationDelegate,
+ public ui::AnimationDelegate,
public MenuGtk::Delegate,
public menus::SimpleMenuModel::Delegate,
public NotificationObserver {
@@ -111,9 +111,9 @@
virtual void BrowserActionMoved(const Extension* extension, int index);
virtual void ModelLoaded();
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// SimpleMenuModel::Delegate implementation.
// In our case, |command_id| is be the index into the model's extension list.
@@ -205,7 +205,7 @@
ExtensionButtonMap extension_button_map_;
// We use this animation for the smart resizing of the toolbar.
- SlideAnimation resize_animation_;
+ ui::SlideAnimation resize_animation_;
// This is the final width we are animating towards.
int desired_width_;
// This is the width we were at when we started animating.
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 0728464..ec300a1 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -1560,6 +1560,13 @@
gtk_container_add(GTK_CONTAINER(render_area_floating_container_),
render_area_vbox_);
+ GtkWidget* location_icon = toolbar_->GetLocationBarView()->
+ location_icon_widget();
+ g_signal_connect(location_icon, "size-allocate",
+ G_CALLBACK(OnLocationIconSizeAllocateThunk), this);
+ g_signal_connect_after(location_icon, "expose-event",
+ G_CALLBACK(OnExposeDrawInfobarBitsThunk), this);
+
toolbar_border_ = gtk_event_box_new();
gtk_box_pack_start(GTK_BOX(render_area_vbox_),
toolbar_border_, FALSE, FALSE, 0);
@@ -1805,6 +1812,12 @@
return x;
}
+void BrowserWindowGtk::OnLocationIconSizeAllocate(GtkWidget* sender,
+ GtkAllocation* allocation) {
+ // The position of the arrow may have changed, so we'll have to redraw it.
+ InvalidateInfoBarBits();
+}
+
gboolean BrowserWindowGtk::OnExposeDrawInfobarBits(GtkWidget* sender,
GdkEventExpose* expose) {
if (!infobar_arrow_model_.NeedToDrawInfoBarArrow())
diff --git a/chrome/browser/gtk/browser_window_gtk.h b/chrome/browser/gtk/browser_window_gtk.h
index 069cfd5..ad2fa40 100644
--- a/chrome/browser/gtk/browser_window_gtk.h
+++ b/chrome/browser/gtk/browser_window_gtk.h
@@ -314,6 +314,10 @@
// has changed.
void InvalidateInfoBarBits();
+ // When the location icon moves, we have to redraw the arrow.
+ CHROMEGTK_CALLBACK_1(BrowserWindowGtk, void, OnLocationIconSizeAllocate,
+ GtkAllocation*);
+
// Used to draw the infobar arrow and drop shadow. This is connected to
// multiple widgets' expose events because it overlaps several widgets.
CHROMEGTK_CALLBACK_1(BrowserWindowGtk, gboolean, OnExposeDrawInfobarBits,
diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc
index 08cd54d..375452d 100644
--- a/chrome/browser/gtk/custom_button.cc
+++ b/chrome/browser/gtk/custom_button.cc
@@ -192,7 +192,7 @@
}
void CustomDrawHoverController::AnimationProgressed(
- const Animation* animation) {
+ const ui::Animation* animation) {
gtk_widget_queue_draw(widget_);
}
diff --git a/chrome/browser/gtk/custom_button.h b/chrome/browser/gtk/custom_button.h
index 785df6b..85f07b1 100644
--- a/chrome/browser/gtk/custom_button.h
+++ b/chrome/browser/gtk/custom_button.h
@@ -8,15 +8,15 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
-#include "app/slide_animation.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/gtk/owned_widget_gtk.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "gfx/rect.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
class CairoCachedSurface;
class GtkThemeProvider;
@@ -98,7 +98,7 @@
// of controlling the hover state of a button. The "hover state" refers to the
// percent opacity of a button's PRELIGHT. The PRELIGHT is animated such that
// when a user moves a mouse over a button the PRELIGHT fades in.
-class CustomDrawHoverController : public AnimationDelegate {
+class CustomDrawHoverController : public ui::AnimationDelegate {
public:
explicit CustomDrawHoverController(GtkWidget* widget);
CustomDrawHoverController();
@@ -112,14 +112,14 @@
}
private:
- virtual void AnimationProgressed(const Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnEnter,
GdkEventCrossing*);
CHROMEGTK_CALLBACK_1(CustomDrawHoverController, gboolean, OnLeave,
GdkEventCrossing*);
- SlideAnimation slide_animation_;
+ ui::SlideAnimation slide_animation_;
GtkWidget* widget_;
};
diff --git a/chrome/browser/gtk/dialogs_gtk.cc b/chrome/browser/gtk/dialogs_gtk.cc
index 1814e92..7188620 100644
--- a/chrome/browser/gtk/dialogs_gtk.cc
+++ b/chrome/browser/gtk/dialogs_gtk.cc
@@ -13,8 +13,8 @@
#include "base/message_loop.h"
#include "base/mime_util.h"
#include "base/sys_string_conversions.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/shell_dialogs.h"
diff --git a/chrome/browser/gtk/download_item_gtk.cc b/chrome/browser/gtk/download_item_gtk.cc
index 69f0484..b0acf44 100644
--- a/chrome/browser/gtk/download_item_gtk.cc
+++ b/chrome/browser/gtk/download_item_gtk.cc
@@ -6,7 +6,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "app/text_elider.h"
#include "base/basictypes.h"
#include "base/callback.h"
@@ -35,6 +34,7 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -245,7 +245,7 @@
get_download()->AddObserver(this);
- new_item_animation_.reset(new SlideAnimation(this));
+ new_item_animation_.reset(new ui::SlideAnimation(this));
new_item_animation_->SetSlideDuration(kNewItemAnimationDurationMs);
gtk_widget_show_all(hbox_.get());
@@ -382,9 +382,9 @@
// Set up the widget as a drag source.
DownloadItemDrag::SetSource(body_.get(), get_download(), icon_large_);
- complete_animation_.reset(new SlideAnimation(this));
+ complete_animation_.reset(new ui::SlideAnimation(this));
complete_animation_->SetSlideDuration(kCompleteAnimationDurationMs);
- complete_animation_->SetTweenType(Tween::LINEAR);
+ complete_animation_->SetTweenType(ui::Tween::LINEAR);
complete_animation_->Show();
break;
case DownloadItem::IN_PROGRESS:
@@ -401,10 +401,9 @@
return;
}
- std::wstring status_text = download_model_->GetStatusText();
- status_text_ = WideToUTF8(status_text);
+ status_text_ = UTF16ToUTF8(download_model_->GetStatusText());
// Remove the status text label.
- if (status_text.empty()) {
+ if (status_text_.empty()) {
gtk_widget_destroy(status_label_);
return;
}
@@ -412,7 +411,7 @@
UpdateStatusLabel(status_text_);
}
-void DownloadItemGtk::AnimationProgressed(const Animation* animation) {
+void DownloadItemGtk::AnimationProgressed(const ui::Animation* animation) {
if (animation == complete_animation_.get()) {
gtk_widget_queue_draw(progress_area_.get());
} else {
diff --git a/chrome/browser/gtk/download_item_gtk.h b/chrome/browser/gtk/download_item_gtk.h
index 8d79080..56a0890 100644
--- a/chrome/browser/gtk/download_item_gtk.h
+++ b/chrome/browser/gtk/download_item_gtk.h
@@ -10,7 +10,6 @@
#include <string>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
@@ -19,6 +18,7 @@
#include "chrome/browser/gtk/owned_widget_gtk.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
class BaseDownloadItemModel;
class DownloadShelfContextMenuGtk;
@@ -26,10 +26,13 @@
class GtkThemeProvider;
class NineBox;
class SkBitmap;
+
+namespace ui {
class SlideAnimation;
+}
class DownloadItemGtk : public DownloadItem::Observer,
- public AnimationDelegate,
+ public ui::AnimationDelegate,
public NotificationObserver {
public:
// DownloadItemGtk takes ownership of |download_item_model|.
@@ -44,8 +47,8 @@
virtual void OnDownloadFileCompleted(DownloadItem* download) { }
virtual void OnDownloadOpened(DownloadItem* download) { }
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
@@ -189,13 +192,13 @@
int dangerous_hbox_full_width_;
// The animation when this item is first added to the shelf.
- scoped_ptr<SlideAnimation> new_item_animation_;
+ scoped_ptr<ui::SlideAnimation> new_item_animation_;
// Progress animation.
base::RepeatingTimer<DownloadItemGtk> progress_timer_;
// Animation for download complete.
- scoped_ptr<SlideAnimation> complete_animation_;
+ scoped_ptr<ui::SlideAnimation> complete_animation_;
// The file icon for the download. May be null. The small version is used
// for display in the shelf; the large version is for use as a drag icon.
diff --git a/chrome/browser/gtk/download_started_animation_gtk.cc b/chrome/browser/gtk/download_started_animation_gtk.cc
index 5015b80..e54e1a7 100644
--- a/chrome/browser/gtk/download_started_animation_gtk.cc
+++ b/chrome/browser/gtk/download_started_animation_gtk.cc
@@ -6,7 +6,6 @@
#include <gtk/gtk.h>
-#include "app/linear_animation.h"
#include "app/resource_bundle.h"
#include "base/message_loop.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -14,6 +13,7 @@
#include "chrome/common/notification_source.h"
#include "gfx/rect.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/linear_animation.h"
namespace {
@@ -28,7 +28,7 @@
// the frame.
const double kMoveFraction = 1.0 / 3.0;
-class DownloadStartedAnimationGtk : public LinearAnimation,
+class DownloadStartedAnimationGtk : public ui::LinearAnimation,
public NotificationObserver {
public:
explicit DownloadStartedAnimationGtk(TabContents* tab_contents);
@@ -78,7 +78,7 @@
DownloadStartedAnimationGtk::DownloadStartedAnimationGtk(
TabContents* tab_contents)
- : LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL),
+ : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL),
tab_contents_(tab_contents) {
static GdkPixbuf* kDownloadImage = NULL;
if (!kDownloadImage) {
diff --git a/chrome/browser/gtk/first_run_dialog.cc b/chrome/browser/gtk/first_run_dialog.cc
index b0f83fc..0074d28 100644
--- a/chrome/browser/gtk/first_run_dialog.cc
+++ b/chrome/browser/gtk/first_run_dialog.cc
@@ -12,6 +12,7 @@
#include "base/i18n/rtl.h"
#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/google/google_util.h"
#include "chrome/browser/gtk/gtk_chrome_link_button.h"
#include "chrome/browser/gtk/gtk_floating_container.h"
#include "chrome/browser/gtk/gtk_util.h"
@@ -22,6 +23,7 @@
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/pref_names.h"
+#include "chrome/common/url_constants.h"
#include "chrome/installer/util/google_update_settings.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -410,8 +412,8 @@
}
void FirstRunDialog::OnLearnMoreLinkClicked(GtkButton* button) {
- platform_util::OpenExternal(GURL(
- l10n_util::GetStringUTF8(IDS_LEARN_MORE_REPORTING_URL)));
+ platform_util::OpenExternal(google_util::AppendGoogleLocaleParam(
+ GURL(chrome::kLearnMoreReportingURL)));
}
void FirstRunDialog::FirstRunDone() {
diff --git a/chrome/browser/gtk/gtk_tree.cc b/chrome/browser/gtk/gtk_tree.cc
index 744a4a6..46307da 100644
--- a/chrome/browser/gtk/gtk_tree.cc
+++ b/chrome/browser/gtk/gtk_tree.cc
@@ -220,7 +220,7 @@
COL_WEIGHT_SET,
TRUE,
COL_TITLE,
- WideToUTF8(it->title).c_str(),
+ UTF16ToUTF8(it->title).c_str(),
COL_IS_HEADER,
TRUE,
-1);
diff --git a/chrome/browser/gtk/hover_controller_gtk.cc b/chrome/browser/gtk/hover_controller_gtk.cc
index f33554a..f7fe91a 100644
--- a/chrome/browser/gtk/hover_controller_gtk.cc
+++ b/chrome/browser/gtk/hover_controller_gtk.cc
@@ -64,7 +64,7 @@
delete this;
}
-void HoverControllerGtk::AnimationProgressed(const Animation* animation) {
+void HoverControllerGtk::AnimationProgressed(const ui::Animation* animation) {
if (!button_)
return;
@@ -76,7 +76,7 @@
animation->GetCurrentValue());
}
-void HoverControllerGtk::AnimationEnded(const Animation* animation) {
+void HoverControllerGtk::AnimationEnded(const ui::Animation* animation) {
if (!button_)
return;
if (animation != &throb_animation_)
@@ -86,7 +86,7 @@
gtk_chrome_button_set_hover_state(GTK_CHROME_BUTTON(button_), 0);
}
-void HoverControllerGtk::AnimationCanceled(const Animation* animation) {
+void HoverControllerGtk::AnimationCanceled(const ui::Animation* animation) {
AnimationEnded(animation);
}
diff --git a/chrome/browser/gtk/hover_controller_gtk.h b/chrome/browser/gtk/hover_controller_gtk.h
index 5504720..9172167 100644
--- a/chrome/browser/gtk/hover_controller_gtk.h
+++ b/chrome/browser/gtk/hover_controller_gtk.h
@@ -8,17 +8,17 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "app/gtk_signal_registrar.h"
-#include "app/slide_animation.h"
-#include "app/throb_animation.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/throb_animation.h"
// This class handles the "throbbing" of a GtkChromeButton. The visual effect
// of throbbing is created by painting partially transparent hover effects. It
// only works in non-gtk theme mode. This class mainly exists to glue an
// AnimationDelegate (C++ class) to a GtkChromeButton* (GTK/c object).
-class HoverControllerGtk : public AnimationDelegate {
+class HoverControllerGtk : public ui::AnimationDelegate {
public:
virtual ~HoverControllerGtk();
@@ -42,10 +42,10 @@
private:
explicit HoverControllerGtk(GtkWidget* button);
- // Overridden from AnimationDelegate.
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
CHROMEGTK_CALLBACK_1(HoverControllerGtk, gboolean, OnEnter,
GdkEventCrossing*);
@@ -55,8 +55,8 @@
GtkWidget*);
CHROMEGTK_CALLBACK_0(HoverControllerGtk, void, OnDestroy);
- ThrobAnimation throb_animation_;
- SlideAnimation hover_animation_;
+ ui::ThrobAnimation throb_animation_;
+ ui::SlideAnimation hover_animation_;
GtkWidget* button_;
GtkSignalRegistrar signals_;
diff --git a/chrome/browser/gtk/infobar_arrow_model.cc b/chrome/browser/gtk/infobar_arrow_model.cc
index e66bb02..fc2f889 100644
--- a/chrome/browser/gtk/infobar_arrow_model.cc
+++ b/chrome/browser/gtk/infobar_arrow_model.cc
@@ -14,7 +14,7 @@
InfoBarArrowModel::InfoBarArrowModel(Observer* observer)
: observer_(observer),
animation_(this) {
- animation_.SetTweenType(Tween::LINEAR);
+ animation_.SetTweenType(ui::Tween::LINEAR);
animation_.Reset(1.0);
target_colors_.top = target_colors_.bottom = SkColorSetARGB(0, 0, 0, 0);
previous_colors_ = target_colors_;
@@ -111,14 +111,14 @@
canvas.drawPath(path, paint);
}
-void InfoBarArrowModel::AnimationEnded(const Animation* animation) {
+void InfoBarArrowModel::AnimationEnded(const ui::Animation* animation) {
observer_->PaintStateChanged();
}
-void InfoBarArrowModel::AnimationProgressed(const Animation* animation) {
+void InfoBarArrowModel::AnimationProgressed(const ui::Animation* animation) {
observer_->PaintStateChanged();
}
-void InfoBarArrowModel::AnimationCanceled(const Animation* animation) {
+void InfoBarArrowModel::AnimationCanceled(const ui::Animation* animation) {
observer_->PaintStateChanged();
}
diff --git a/chrome/browser/gtk/infobar_arrow_model.h b/chrome/browser/gtk/infobar_arrow_model.h
index 721f32b..331089b 100644
--- a/chrome/browser/gtk/infobar_arrow_model.h
+++ b/chrome/browser/gtk/infobar_arrow_model.h
@@ -7,9 +7,9 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "third_party/skia/include/core/SkPaint.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
namespace gfx {
class Point;
@@ -19,7 +19,7 @@
// A helper class that tracks the state of an infobar arrow and provides a
// utility to draw it.
-class InfoBarArrowModel : public AnimationDelegate {
+class InfoBarArrowModel : public ui::AnimationDelegate {
public:
class Observer {
public:
@@ -44,10 +44,10 @@
const gfx::Point& origin,
const GdkColor& border_color);
- // Overridden from AnimationDelegate.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
private:
// A pair of colors used to draw a gradient for an arrow.
@@ -65,7 +65,7 @@
// An animation that tracks the progress of the transition from the last color
// to the new color.
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
// The color we are animating towards.
InfoBarColors target_colors_;
diff --git a/chrome/browser/gtk/keyword_editor_view.cc b/chrome/browser/gtk/keyword_editor_view.cc
index c4b98da..63931b9 100644
--- a/chrome/browser/gtk/keyword_editor_view.cc
+++ b/chrome/browser/gtk/keyword_editor_view.cc
@@ -233,9 +233,9 @@
// has an effect. So we just set it to normal.
COL_WEIGHT, PANGO_WEIGHT_NORMAL,
COL_WEIGHT_SET, TRUE,
- COL_TITLE, WideToUTF8(table_model_->GetText(
+ COL_TITLE, UTF16ToUTF8(table_model_->GetText(
model_row, IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN)).c_str(),
- COL_KEYWORD, WideToUTF8(table_model_->GetText(
+ COL_KEYWORD, UTF16ToUTF8(table_model_->GetText(
model_row, IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN)).c_str(),
-1);
g_object_unref(pixbuf);
@@ -311,7 +311,7 @@
list_store_, &iter,
COL_WEIGHT, PANGO_WEIGHT_BOLD,
COL_WEIGHT_SET, TRUE,
- COL_TITLE, WideToUTF8(groups[0].title).c_str(),
+ COL_TITLE, UTF16ToUTF8(groups[0].title).c_str(),
COL_IS_HEADER, TRUE,
-1);
// First group separator.
@@ -334,7 +334,7 @@
list_store_, &iter,
COL_WEIGHT, PANGO_WEIGHT_BOLD,
COL_WEIGHT_SET, TRUE,
- COL_TITLE, WideToUTF8(groups[1].title).c_str(),
+ COL_TITLE, UTF16ToUTF8(groups[1].title).c_str(),
COL_IS_HEADER, TRUE,
-1);
// Second group separator.
diff --git a/chrome/browser/gtk/keyword_editor_view_unittest.cc b/chrome/browser/gtk/keyword_editor_view_unittest.cc
index 636d6bd..1f06fb8 100644
--- a/chrome/browser/gtk/keyword_editor_view_unittest.cc
+++ b/chrome/browser/gtk/keyword_editor_view_unittest.cc
@@ -68,9 +68,9 @@
KeywordEditorView::COL_TITLE, &name,
KeywordEditorView::COL_IS_HEADER, &is_header,
-1);
- if (name && WideToUTF8(groups[0].title) == name)
+ if (name && UTF16ToUTF8(groups[0].title) == name)
parts.push_back("!");
- else if (name && WideToUTF8(groups[1].title) == name)
+ else if (name && UTF16ToUTF8(groups[1].title) == name)
parts.push_back("@");
else if (is_header)
parts.push_back("_");
diff --git a/chrome/browser/gtk/location_bar_view_gtk.cc b/chrome/browser/gtk/location_bar_view_gtk.cc
index c48f631..6bc7513 100644
--- a/chrome/browser/gtk/location_bar_view_gtk.cc
+++ b/chrome/browser/gtk/location_bar_view_gtk.cc
@@ -316,11 +316,11 @@
gtk_widget_set_name(security_info_label_,
"chrome-location-bar-security-info-label");
- GtkWidget* site_type_hbox = gtk_hbox_new(FALSE, 2);
+ GtkWidget* site_type_hbox = gtk_hbox_new(FALSE, 1);
gtk_box_pack_start(GTK_BOX(site_type_hbox), icon_alignment,
FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(site_type_hbox), security_info_label_,
- FALSE, FALSE, 1);
+ FALSE, FALSE, 2);
site_type_event_box_ = gtk_event_box_new();
gtk_widget_modify_bg(site_type_event_box_, GTK_STATE_NORMAL,
@@ -509,7 +509,7 @@
}
}
- if (browser_->instant())
+ if (browser_->instant() && !location_entry_->model()->popup_model()->IsOpen())
browser_->instant()->DestroyPreviewContents();
update_instant_ = true;
@@ -976,13 +976,15 @@
GetKeywordShortName(keyword, &is_extension_keyword);
int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT;
- std::wstring full_name(l10n_util::GetStringF(message_id, short_name));
- std::wstring partial_name(l10n_util::GetStringF(
- message_id, location_bar_util::CalculateMinString(short_name)));
+ string16 full_name = l10n_util::GetStringFUTF16(message_id,
+ WideToUTF16Hack(short_name));
+ string16 partial_name = l10n_util::GetStringFUTF16(
+ message_id,
+ WideToUTF16Hack(location_bar_util::CalculateMinString(short_name)));
gtk_label_set_text(GTK_LABEL(tab_to_search_full_label_),
- WideToUTF8(full_name).c_str());
+ UTF16ToUTF8(full_name).c_str());
gtk_label_set_text(GTK_LABEL(tab_to_search_partial_label_),
- WideToUTF8(partial_name).c_str());
+ UTF16ToUTF8(partial_name).c_str());
if (last_keyword_ != keyword) {
last_keyword_ = keyword;
@@ -1017,17 +1019,20 @@
int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT;
std::vector<size_t> content_param_offsets;
- const std::wstring keyword_hint(l10n_util::GetStringF(
- message_id, std::wstring(), short_name, &content_param_offsets));
+ const string16 keyword_hint = l10n_util::GetStringFUTF16(
+ message_id,
+ string16(),
+ WideToUTF16Hack(short_name),
+ &content_param_offsets);
if (content_param_offsets.size() != 2) {
// See comments on an identical NOTREACHED() in search_provider.cc.
NOTREACHED();
return;
}
- std::string leading(WideToUTF8(
+ std::string leading(UTF16ToUTF8(
keyword_hint.substr(0, content_param_offsets.front())));
- std::string trailing(WideToUTF8(
+ std::string trailing(UTF16ToUTF8(
keyword_hint.substr(content_param_offsets.front())));
gtk_label_set_text(GTK_LABEL(tab_to_search_hint_leading_label_),
leading.c_str());
diff --git a/chrome/browser/gtk/menu_gtk.cc b/chrome/browser/gtk/menu_gtk.cc
index 04450ef..52b9c12 100644
--- a/chrome/browser/gtk/menu_gtk.cc
+++ b/chrome/browser/gtk/menu_gtk.cc
@@ -803,7 +803,6 @@
if (model->IsVisibleAt(id)) {
// Update the menu item label if it is dynamic.
- // TODO(atwilson): Update the icon as well (http://crbug.com/66508).
if (model->IsItemDynamicAt(id)) {
std::string label =
gfx::ConvertAcceleratorsFromWindowsStyle(
@@ -814,6 +813,17 @@
#else
gtk_label_set_label(GTK_LABEL(GTK_BIN(widget)->child), label.c_str());
#endif
+ if (GTK_IS_IMAGE_MENU_ITEM(widget)) {
+ SkBitmap icon;
+ if (model->GetIconAt(id, &icon)) {
+ GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&icon);
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget),
+ gtk_image_new_from_pixbuf(pixbuf));
+ g_object_unref(pixbuf);
+ } else {
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(widget), NULL);
+ }
+ }
}
gtk_widget_show(widget);
diff --git a/chrome/browser/gtk/notifications/balloon_view_gtk.cc b/chrome/browser/gtk/notifications/balloon_view_gtk.cc
index bbca070..edb475e 100644
--- a/chrome/browser/gtk/notifications/balloon_view_gtk.cc
+++ b/chrome/browser/gtk/notifications/balloon_view_gtk.cc
@@ -11,7 +11,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#include "chrome/browser/browser_list.h"
@@ -43,6 +42,7 @@
#include "gfx/native_widget_types.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -163,11 +163,11 @@
anim_frame_start_ = gfx::Rect(start_x, start_y, start_w, start_h);
anim_frame_end_ = gfx::Rect(end_x, end_y, end_w, end_h);
- animation_.reset(new SlideAnimation(this));
+ animation_.reset(new ui::SlideAnimation(this));
animation_->Show();
}
-void BalloonViewImpl::AnimationProgressed(const Animation* animation) {
+void BalloonViewImpl::AnimationProgressed(const ui::Animation* animation) {
DCHECK_EQ(animation, animation_.get());
// Linear interpolation from start to end position.
diff --git a/chrome/browser/gtk/notifications/balloon_view_gtk.h b/chrome/browser/gtk/notifications/balloon_view_gtk.h
index de95e71..0db221b 100644
--- a/chrome/browser/gtk/notifications/balloon_view_gtk.h
+++ b/chrome/browser/gtk/notifications/balloon_view_gtk.h
@@ -8,7 +8,6 @@
#define CHROME_BROWSER_GTK_NOTIFICATIONS_BALLOON_VIEW_GTK_H_
#pragma once
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
@@ -20,6 +19,7 @@
#include "gfx/point.h"
#include "gfx/rect.h"
#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
class BalloonCollection;
class CustomDrawButton;
@@ -28,14 +28,17 @@
class NotificationDetails;
class NotificationOptionsMenuModel;
class NotificationSource;
+
+namespace ui {
class SlideAnimation;
+}
// A balloon view is the UI component for desktop notification toasts.
// It draws a border, and within the border an HTML renderer.
class BalloonViewImpl : public BalloonView,
public MenuGtk::Delegate,
public NotificationObserver,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit BalloonViewImpl(BalloonCollection* collection);
~BalloonViewImpl();
@@ -54,8 +57,8 @@
const NotificationSource& source,
const NotificationDetails& details);
- // AnimationDelegate interface.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate interface.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Do the delayed close work.
void DelayedClose(bool by_user);
@@ -109,7 +112,7 @@
scoped_ptr<CustomDrawButton> close_button_;
// An animation to move the balloon on the screen as its position changes.
- scoped_ptr<SlideAnimation> animation_;
+ scoped_ptr<ui::SlideAnimation> animation_;
gfx::Rect anim_frame_start_;
gfx::Rect anim_frame_end_;
diff --git a/chrome/browser/gtk/options/advanced_contents_gtk.cc b/chrome/browser/gtk/options/advanced_contents_gtk.cc
index 21fe182..5ffdee5 100644
--- a/chrome/browser/gtk/options/advanced_contents_gtk.cc
+++ b/chrome/browser/gtk/options/advanced_contents_gtk.cc
@@ -19,7 +19,6 @@
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_tokenizer.h"
-#include "base/thread_restrictions.h"
#include "base/nix/xdg_util.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
@@ -365,6 +364,11 @@
// The callback functions for invoking the proxy config dialog.
static void OnChangeProxiesButtonClicked(GtkButton *button,
NetworkSection* section);
+ // Detect, and if possible, start the appropriate proxy config utility. On
+ // failure to do so, show the Linux proxy config URL in a new tab instead.
+ static void DetectAndStartProxyConfigUtil(Profile* profile);
+ // Show the proxy config URL in a new tab.
+ static void ShowLinuxProxyConfigUrl(Profile* profile);
// Search $PATH to find one of the commands. Store the full path to
// it in the |binary| field and the command array index in in |index|.
static bool SearchPATH(ProxyConfigCommand* commands, size_t ncommands,
@@ -422,15 +426,8 @@
}
// static
-void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button,
- NetworkSection* section) {
- // Changing proxy settings searches the disk for the proxy configuration
- // binary. Temporarily allow IO for now, see http://crbug.com/63690
- base::ThreadRestrictions::ScopedAllowIO allow_io;
-
- section->UserMetricsRecordAction(UserMetricsAction("Options_ChangeProxies"),
- NULL);
-
+void NetworkSection::DetectAndStartProxyConfigUtil(Profile* profile) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
scoped_ptr<base::Environment> env(base::Environment::Create());
ProxyConfigCommand command;
@@ -463,18 +460,37 @@
}
if (found_command) {
- StartProxyConfigUtil(section->profile(), command);
+ StartProxyConfigUtil(profile, command);
} else {
- const char* name = base::nix::GetDesktopEnvironmentName(env.get());
- if (name)
- LOG(ERROR) << "Could not find " << name << " network settings in $PATH";
- browser::ShowOptionsURL(section->profile(), GURL(kLinuxProxyConfigUrl));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(&NetworkSection::ShowLinuxProxyConfigUrl, profile));
}
}
// static
+void NetworkSection::ShowLinuxProxyConfigUrl(Profile* profile) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ scoped_ptr<base::Environment> env(base::Environment::Create());
+ const char* name = base::nix::GetDesktopEnvironmentName(env.get());
+ if (name)
+ LOG(ERROR) << "Could not find " << name << " network settings in $PATH";
+ browser::ShowOptionsURL(profile, GURL(kLinuxProxyConfigUrl));
+}
+
+// static
+void NetworkSection::OnChangeProxiesButtonClicked(GtkButton *button,
+ NetworkSection* section) {
+ section->UserMetricsRecordAction(UserMetricsAction("Options_ChangeProxies"),
+ NULL);
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
+ NewRunnableFunction(&NetworkSection::DetectAndStartProxyConfigUtil,
+ section->profile()));
+}
+
+// static
bool NetworkSection::SearchPATH(ProxyConfigCommand* commands, size_t ncommands,
size_t* index) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
const char* path = getenv("PATH");
if (!path)
return false;
@@ -499,6 +515,7 @@
// static
void NetworkSection::StartProxyConfigUtil(Profile* profile,
const ProxyConfigCommand& command) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
std::vector<std::string> argv;
argv.push_back(command.binary);
for (size_t i = 1; command.argv[i]; i++)
@@ -507,7 +524,8 @@
base::ProcessHandle handle;
if (!base::LaunchApp(argv, no_files, false, &handle)) {
LOG(ERROR) << "StartProxyConfigUtil failed to start " << command.binary;
- browser::ShowOptionsURL(profile, GURL(kLinuxProxyConfigUrl));
+ BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(&NetworkSection::ShowLinuxProxyConfigUrl, profile));
return;
}
ProcessWatcher::EnsureProcessGetsReaped(handle);
diff --git a/chrome/browser/gtk/options/content_exceptions_window_gtk.cc b/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
index 6a1fc88..1189096 100644
--- a/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
+++ b/chrome/browser/gtk/options/content_exceptions_window_gtk.cc
@@ -184,13 +184,13 @@
}
void ContentExceptionsWindowGtk::SetColumnValues(int row, GtkTreeIter* iter) {
- std::wstring pattern = model_->GetText(row, IDS_EXCEPTIONS_PATTERN_HEADER);
+ string16 pattern = model_->GetText(row, IDS_EXCEPTIONS_PATTERN_HEADER);
gtk_list_store_set(list_store_, iter, COL_PATTERN,
- WideToUTF8(pattern).c_str(), -1);
+ UTF16ToUTF8(pattern).c_str(), -1);
- std::wstring action = model_->GetText(row, IDS_EXCEPTIONS_ACTION_HEADER);
+ string16 action = model_->GetText(row, IDS_EXCEPTIONS_ACTION_HEADER);
gtk_list_store_set(list_store_, iter, COL_ACTION,
- WideToUTF8(action).c_str(), -1);
+ UTF16ToUTF8(action).c_str(), -1);
bool is_off_the_record = model_->entry_is_off_the_record(row);
PangoStyle style =
diff --git a/chrome/browser/gtk/options/general_page_gtk.cc b/chrome/browser/gtk/options/general_page_gtk.cc
index 61f806e..1df3769 100644
--- a/chrome/browser/gtk/options/general_page_gtk.cc
+++ b/chrome/browser/gtk/options/general_page_gtk.cc
@@ -599,14 +599,14 @@
void GeneralPageGtk::SetColumnValues(int row, GtkTreeIter* iter) {
SkBitmap bitmap = startup_custom_pages_table_model_->GetIcon(row);
GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap);
- std::wstring text = startup_custom_pages_table_model_->GetText(row, 0);
+ string16 text = startup_custom_pages_table_model_->GetText(row, 0);
std::string tooltip =
- WideToUTF8(startup_custom_pages_table_model_->GetTooltip(row));
+ UTF16ToUTF8(startup_custom_pages_table_model_->GetTooltip(row));
gchar* escaped_tooltip = g_markup_escape_text(tooltip.c_str(),
tooltip.size());
gtk_list_store_set(startup_custom_pages_store_, iter,
COL_FAVICON, pixbuf,
- COL_URL, WideToUTF8(text).c_str(),
+ COL_URL, UTF16ToUTF8(text).c_str(),
COL_TOOLTIP, escaped_tooltip,
-1);
g_object_unref(pixbuf);
diff --git a/chrome/browser/gtk/options/languages_page_gtk.cc b/chrome/browser/gtk/options/languages_page_gtk.cc
index 9bb8732..6a400db 100644
--- a/chrome/browser/gtk/options/languages_page_gtk.cc
+++ b/chrome/browser/gtk/options/languages_page_gtk.cc
@@ -275,9 +275,9 @@
}
void LanguagesPageGtk::SetColumnValues(int row, GtkTreeIter* iter) {
- std::wstring lang = language_order_table_model_->GetText(row, 0);
+ string16 lang = language_order_table_model_->GetText(row, 0);
gtk_list_store_set(language_order_store_, iter,
- COL_LANG, WideToUTF8(lang).c_str(),
+ COL_LANG, UTF16ToUTF8(lang).c_str(),
-1);
}
diff --git a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
index 065d8f3..4146d9f 100644
--- a/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
+++ b/chrome/browser/gtk/options/passwords_exceptions_page_gtk.cc
@@ -38,12 +38,12 @@
: populater(this), profile_(profile) {
remove_button_ = gtk_button_new_with_label(
- l10n_util::GetStringUTF8(IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_BUTTON).c_str());
+ l10n_util::GetStringUTF8(IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON).c_str());
gtk_widget_set_sensitive(remove_button_, FALSE);
g_signal_connect(remove_button_, "clicked",
G_CALLBACK(OnRemoveButtonClickedThunk), this);
remove_all_button_ = gtk_button_new_with_label(l10n_util::GetStringUTF8(
- IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_ALL_BUTTON).c_str());
+ IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON).c_str());
gtk_widget_set_sensitive(remove_all_button_, FALSE);
g_signal_connect(remove_all_button_, "clicked",
G_CALLBACK(OnRemoveAllButtonClickedThunk), this);
diff --git a/chrome/browser/gtk/options/simple_content_exceptions_window.cc b/chrome/browser/gtk/options/simple_content_exceptions_window.cc
index 682cca1..58676f3 100644
--- a/chrome/browser/gtk/options/simple_content_exceptions_window.cc
+++ b/chrome/browser/gtk/options/simple_content_exceptions_window.cc
@@ -157,13 +157,13 @@
void SimpleContentExceptionsWindow::SetColumnValues(int row,
GtkTreeIter* iter) {
- std::wstring hostname = model_->GetText(row, IDS_EXCEPTIONS_HOSTNAME_HEADER);
+ string16 hostname = model_->GetText(row, IDS_EXCEPTIONS_HOSTNAME_HEADER);
gtk_list_store_set(list_store_, iter, gtk_tree::TableAdapter::COL_TITLE,
- WideToUTF8(hostname).c_str(), -1);
+ UTF16ToUTF8(hostname).c_str(), -1);
- std::wstring action = model_->GetText(row, IDS_EXCEPTIONS_ACTION_HEADER);
+ string16 action = model_->GetText(row, IDS_EXCEPTIONS_ACTION_HEADER);
gtk_list_store_set(list_store_, iter, COL_ACTION,
- WideToUTF8(action).c_str(), -1);
+ UTF16ToUTF8(action).c_str(), -1);
}
void SimpleContentExceptionsWindow::OnAnyModelUpdateStart() {
diff --git a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
index 2d00873..9f7ed06 100644
--- a/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
+++ b/chrome/browser/gtk/options/url_picker_dialog_gtk.cc
@@ -208,12 +208,12 @@
void UrlPickerDialogGtk::SetColumnValues(int row, GtkTreeIter* iter) {
SkBitmap bitmap = url_table_model_->GetIcon(row);
GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap);
- std::wstring title = url_table_model_->GetText(row, IDS_ASI_PAGE_COLUMN);
- std::wstring url = url_table_model_->GetText(row, IDS_ASI_URL_COLUMN);
+ string16 title = url_table_model_->GetText(row, IDS_ASI_PAGE_COLUMN);
+ string16 url = url_table_model_->GetText(row, IDS_ASI_URL_COLUMN);
gtk_list_store_set(history_list_store_, iter,
COL_FAVICON, pixbuf,
- COL_TITLE, WideToUTF8(title).c_str(),
- COL_DISPLAY_URL, WideToUTF8(url).c_str(),
+ COL_TITLE, UTF16ToUTF8(title).c_str(),
+ COL_DISPLAY_URL, UTF16ToUTF8(url).c_str(),
-1);
g_object_unref(pixbuf);
}
diff --git a/chrome/browser/gtk/slide_animator_gtk.cc b/chrome/browser/gtk/slide_animator_gtk.cc
index 0534a7c..a3ae9cc 100644
--- a/chrome/browser/gtk/slide_animator_gtk.cc
+++ b/chrome/browser/gtk/slide_animator_gtk.cc
@@ -4,10 +4,9 @@
#include "chrome/browser/gtk/slide_animator_gtk.h"
-#include "app/animation.h"
-#include "app/slide_animation.h"
-
#include "chrome/browser/gtk/gtk_expanded_container.h"
+#include "ui/base/animation/animation.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -56,10 +55,10 @@
child_needs_move_ = (direction == DOWN);
- animation_.reset(new SlideAnimation(this));
+ animation_.reset(new ui::SlideAnimation(this));
// Default tween type is EASE_OUT.
if (linear)
- animation_->SetTweenType(Tween::LINEAR);
+ animation_->SetTweenType(ui::Tween::LINEAR);
if (duration != 0)
animation_->SetSlideDuration(duration);
}
@@ -113,7 +112,7 @@
return animation_->is_animating();
}
-void SlideAnimatorGtk::AnimationProgressed(const Animation* animation) {
+void SlideAnimatorGtk::AnimationProgressed(const ui::Animation* animation) {
GtkRequisition req;
gtk_widget_size_request(child_, &req);
@@ -127,7 +126,7 @@
gtk_widget_set_size_request(widget_.get(), -1, showing_height);
}
-void SlideAnimatorGtk::AnimationEnded(const Animation* animation) {
+void SlideAnimatorGtk::AnimationEnded(const ui::Animation* animation) {
if (!animation_->IsShowing()) {
gtk_widget_hide(widget_.get());
if (delegate_)
diff --git a/chrome/browser/gtk/slide_animator_gtk.h b/chrome/browser/gtk/slide_animator_gtk.h
index 8028367..b0f5c73 100644
--- a/chrome/browser/gtk/slide_animator_gtk.h
+++ b/chrome/browser/gtk/slide_animator_gtk.h
@@ -17,13 +17,15 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/gtk/owned_widget_gtk.h"
+#include "ui/base/animation/animation_delegate.h"
+namespace ui {
class SlideAnimation;
+}
-class SlideAnimatorGtk : public AnimationDelegate {
+class SlideAnimatorGtk : public ui::AnimationDelegate {
public:
class Delegate {
public:
@@ -82,9 +84,9 @@
// animation.
bool IsAnimating();
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// Used during testing; disable or enable animations (default is enabled).
static void SetAnimationsForTesting(bool enable);
@@ -94,7 +96,7 @@
GtkAllocation* allocation,
SlideAnimatorGtk* slider);
- scoped_ptr<SlideAnimation> animation_;
+ scoped_ptr<ui::SlideAnimation> animation_;
// The top level widget of the SlideAnimatorGtk. It is a GtkFixed.
OwnedWidgetGtk widget_;
diff --git a/chrome/browser/gtk/status_bubble_gtk.cc b/chrome/browser/gtk/status_bubble_gtk.cc
index 08eab1a..06c33d0 100644
--- a/chrome/browser/gtk/status_bubble_gtk.cc
+++ b/chrome/browser/gtk/status_bubble_gtk.cc
@@ -8,7 +8,6 @@
#include <algorithm>
-#include "app/slide_animation.h"
#include "app/text_elider.h"
#include "base/i18n/rtl.h"
#include "base/message_loop.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/gtk/rounded_window.h"
#include "chrome/browser/gtk/slide_animator_gtk.h"
#include "chrome/common/notification_service.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -45,7 +45,8 @@
y_offset_(0),
download_shelf_is_visible_(false),
last_mouse_location_(0, 0),
- last_mouse_left_content_(false) {
+ last_mouse_left_content_(false),
+ ignore_next_left_content_(false) {
InitWidgets();
theme_provider_->InitThemesFor(this);
@@ -63,13 +64,12 @@
return;
status_text_ = status_text;
- if (!status_text_.empty()) {
+ if (!status_text_.empty())
SetStatusTextTo(status_text_);
- } else if (!url_text_.empty()) {
+ else if (!url_text_.empty())
SetStatusTextTo(url_text_);
- } else {
+ else
SetStatusTextTo(std::string());
- }
}
void StatusBubbleGtk::SetURL(const GURL& url, const string16& languages) {
@@ -155,6 +155,11 @@
void StatusBubbleGtk::MouseMoved(
const gfx::Point& location, bool left_content) {
+ if (left_content && ignore_next_left_content_) {
+ ignore_next_left_content_ = false;
+ return;
+ }
+
last_mouse_location_ = location;
last_mouse_left_content_ = left_content;
@@ -189,9 +194,9 @@
gtk_util::GetWidgetRectRelativeToToplevel(parent);
gfx::Rect bubble_rect(
toplevel_x + parent_rect.x() +
- (ltr ? 0 : parent->allocation.width - requisition.width),
+ (ltr ? 0 : parent->allocation.width - requisition.width),
toplevel_y + parent_rect.y() +
- parent->allocation.height - requisition.height,
+ parent->allocation.height - requisition.height,
requisition.width,
requisition.height);
@@ -210,8 +215,8 @@
} else {
SetFlipHorizontally(false);
int distance = std::max(ltr ?
- location.x() - right_threshold :
- left_threshold - location.x(),
+ location.x() - right_threshold :
+ left_threshold - location.x(),
top_threshold - location.y());
y_offset_ = std::min(-1 * distance, requisition.height);
}
@@ -260,9 +265,12 @@
// We need to listen for mouse motion events, since a fast-moving pointer may
// enter our window without us getting any motion events on the browser near
// enough for us to run away.
- gtk_widget_add_events(container_.get(), GDK_POINTER_MOTION_MASK);
+ gtk_widget_add_events(container_.get(), GDK_POINTER_MOTION_MASK |
+ GDK_ENTER_NOTIFY_MASK);
g_signal_connect(container_.get(), "motion-notify-event",
G_CALLBACK(HandleMotionNotifyThunk), this);
+ g_signal_connect(container_.get(), "enter-notify-event",
+ G_CALLBACK(HandleEnterNotifyThunk), this);
UserChangedTheme();
}
@@ -306,17 +314,17 @@
container_.get(),
kCornerSize,
flip_horizontally ?
- gtk_util::ROUNDED_TOP_LEFT :
- gtk_util::ROUNDED_TOP_RIGHT,
+ gtk_util::ROUNDED_TOP_LEFT :
+ gtk_util::ROUNDED_TOP_RIGHT,
gtk_util::BORDER_TOP |
- (flip_horizontally ? gtk_util::BORDER_LEFT : gtk_util::BORDER_RIGHT));
+ (flip_horizontally ? gtk_util::BORDER_LEFT : gtk_util::BORDER_RIGHT));
gtk_widget_queue_draw(container_.get());
}
void StatusBubbleGtk::ExpandURL() {
start_width_ = label_->allocation.width;
- expand_animation_.reset(new SlideAnimation(this));
- expand_animation_->SetTweenType(Tween::LINEAR);
+ expand_animation_.reset(new ui::SlideAnimation(this));
+ expand_animation_->SetTweenType(ui::Tween::LINEAR);
expand_animation_->Show();
SetStatusTextToURL();
@@ -333,16 +341,24 @@
gtk_widget_set_size_request(label_, new_width, -1);
}
+// See http://crbug.com/68897 for why we have to handle this event.
+gboolean StatusBubbleGtk::HandleEnterNotify(GtkWidget* sender,
+ GdkEventCrossing* event) {
+ ignore_next_left_content_ = true;
+ MouseMoved(gfx::Point(event->x_root, event->y_root), false);
+ return FALSE;
+}
+
gboolean StatusBubbleGtk::HandleMotionNotify(GtkWidget* sender,
GdkEventMotion* event) {
MouseMoved(gfx::Point(event->x_root, event->y_root), false);
return FALSE;
}
-void StatusBubbleGtk::AnimationEnded(const Animation* animation) {
+void StatusBubbleGtk::AnimationEnded(const ui::Animation* animation) {
UpdateLabelSizeRequest();
}
-void StatusBubbleGtk::AnimationProgressed(const Animation* animation) {
+void StatusBubbleGtk::AnimationProgressed(const ui::Animation* animation) {
UpdateLabelSizeRequest();
}
diff --git a/chrome/browser/gtk/status_bubble_gtk.h b/chrome/browser/gtk/status_bubble_gtk.h
index 82253d4..fcbf7a0 100644
--- a/chrome/browser/gtk/status_bubble_gtk.h
+++ b/chrome/browser/gtk/status_bubble_gtk.h
@@ -10,7 +10,6 @@
#include <string>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/scoped_ptr.h"
#include "base/timer.h"
@@ -20,10 +19,14 @@
#include "chrome/common/notification_registrar.h"
#include "gfx/point.h"
#include "googleurl/src/gurl.h"
+#include "ui/base/animation/animation_delegate.h"
class GtkThemeProvider;
class Profile;
+
+namespace ui {
class SlideAnimation;
+}
// GTK implementation of StatusBubble. Unlike Windows, our status bubble
// doesn't have the nice leave-the-window effect since we can't rely on the
@@ -31,7 +34,7 @@
// We therefore position it absolutely in a GtkFixed, that we don't own.
class StatusBubbleGtk : public StatusBubble,
public NotificationObserver,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit StatusBubbleGtk(Profile* profile);
virtual ~StatusBubbleGtk();
@@ -45,9 +48,9 @@
virtual void Hide();
virtual void MouseMoved(const gfx::Point& location, bool left_content);
- // AnimationDelegate implementation.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Called when the download shelf becomes visible or invisible.
// This is used by to ensure that the status bubble does not obscure
@@ -105,6 +108,9 @@
CHROMEGTK_CALLBACK_1(StatusBubbleGtk, gboolean, HandleMotionNotify,
GdkEventMotion*);
+ CHROMEGTK_CALLBACK_1(StatusBubbleGtk, gboolean, HandleEnterNotify,
+ GdkEventCrossing*);
+
NotificationRegistrar registrar_;
// Provides colors.
@@ -139,7 +145,7 @@
base::OneShotTimer<StatusBubbleGtk> expand_timer_;
// The animation for resizing the status bubble on long hovers.
- scoped_ptr<SlideAnimation> expand_animation_;
+ scoped_ptr<ui::SlideAnimation> expand_animation_;
// The start and end width of the current resize animation.
int start_width_;
@@ -161,6 +167,10 @@
// when its text changes, triggering a size change.
gfx::Point last_mouse_location_;
bool last_mouse_left_content_;
+
+ // Shortly after the cursor enters the status bubble, we'll get a message
+ // that the cursor left the content area. This lets us ignore that.
+ bool ignore_next_left_content_;
};
#endif // CHROME_BROWSER_GTK_STATUS_BUBBLE_GTK_H_
diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc
index a1fda13..299f183 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_gtk.cc
+++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.cc
@@ -126,7 +126,7 @@
animation_end_bounds_ = bounds;
close_animation_.SetSlideDuration(kAnimateToBoundsDurationMs);
- close_animation_.SetTweenType(Tween::EASE_OUT);
+ close_animation_.SetTweenType(ui::Tween::EASE_OUT);
if (!close_animation_.IsShowing()) {
close_animation_.Reset();
close_animation_.Show();
@@ -134,9 +134,9 @@
}
////////////////////////////////////////////////////////////////////////////////
-// DraggedTabGtk, AnimationDelegate implementation:
+// DraggedTabGtk, ui::AnimationDelegate implementation:
-void DraggedTabGtk::AnimationProgressed(const Animation* animation) {
+void DraggedTabGtk::AnimationProgressed(const ui::Animation* animation) {
int delta_x = (animation_end_bounds_.x() - animation_start_bounds_.x());
int x = animation_start_bounds_.x() +
static_cast<int>(delta_x * animation->GetCurrentValue());
@@ -144,11 +144,11 @@
gdk_window_move(container_->window, x, y);
}
-void DraggedTabGtk::AnimationEnded(const Animation* animation) {
+void DraggedTabGtk::AnimationEnded(const ui::Animation* animation) {
animation_callback_->Run();
}
-void DraggedTabGtk::AnimationCanceled(const Animation* animation) {
+void DraggedTabGtk::AnimationCanceled(const ui::Animation* animation) {
AnimationEnded(animation);
}
diff --git a/chrome/browser/gtk/tabs/dragged_tab_gtk.h b/chrome/browser/gtk/tabs/dragged_tab_gtk.h
index 6d7fcc4..ae4c0f1 100644
--- a/chrome/browser/gtk/tabs/dragged_tab_gtk.h
+++ b/chrome/browser/gtk/tabs/dragged_tab_gtk.h
@@ -8,8 +8,6 @@
#include <gtk/gtk.h>
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "base/callback.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
@@ -17,11 +15,13 @@
#include "gfx/point.h"
#include "gfx/rect.h"
#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
class TabContents;
class TabRendererGtk;
-class DraggedTabGtk : public AnimationDelegate {
+class DraggedTabGtk : public ui::AnimationDelegate {
public:
DraggedTabGtk(TabContents* datasource,
const gfx::Point& mouse_tab_offset,
@@ -63,10 +63,10 @@
GtkWidget* widget() const { return container_; }
private:
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
// Arranges the contents of the dragged tab.
void Layout();
@@ -132,7 +132,7 @@
gfx::Size contents_size_;
// The animation used to slide the attached tab to its final location.
- SlideAnimation close_animation_;
+ ui::SlideAnimation close_animation_;
// A callback notified when the animation is complete.
scoped_ptr<Callback0::Type> animation_callback_;
diff --git a/chrome/browser/gtk/tabs/tab_gtk.cc b/chrome/browser/gtk/tabs/tab_gtk.cc
index 440084b..c0f8e82 100644
--- a/chrome/browser/gtk/tabs/tab_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_gtk.cc
@@ -21,7 +21,7 @@
namespace {
// Returns the width of the title for the current font, in pixels.
-int GetTitleWidth(gfx::Font* font, std::wstring title) {
+int GetTitleWidth(gfx::Font* font, string16 title) {
DCHECK(font);
if (title.empty())
return 0;
@@ -338,7 +338,7 @@
void TabGtk::UpdateTooltipState() {
// Only show the tooltip if the title is truncated.
if (title_width_ > title_bounds().width()) {
- gtk_widget_set_tooltip_text(widget(), WideToUTF8(GetTitle()).c_str());
+ gtk_widget_set_tooltip_text(widget(), UTF16ToUTF8(GetTitle()).c_str());
} else {
gtk_widget_set_has_tooltip(widget(), FALSE);
}
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
index fc1f7c2..b3f1c91 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
@@ -9,8 +9,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
-#include "app/throb_animation.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/gtk/bookmark_utils_gtk.h"
@@ -28,6 +26,8 @@
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/throb_animation.h"
namespace {
@@ -205,16 +205,16 @@
// FaviconCrashAnimation
//
// A custom animation subclass to manage the favicon crash animation.
-class TabRendererGtk::FavIconCrashAnimation : public LinearAnimation,
- public AnimationDelegate {
+class TabRendererGtk::FavIconCrashAnimation : public ui::LinearAnimation,
+ public ui::AnimationDelegate {
public:
explicit FavIconCrashAnimation(TabRendererGtk* target)
- : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(1000, 25, this)),
+ : ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(1000, 25, this)),
target_(target) {
}
virtual ~FavIconCrashAnimation() {}
- // Animation overrides:
+ // ui::Animation overrides:
virtual void AnimateToState(double state) {
const double kHidingOffset = 27;
@@ -229,8 +229,8 @@
}
}
- // AnimationDelegate overrides:
- virtual void AnimationCanceled(const Animation* animation) {
+ // ui::AnimationDelegate overrides:
+ virtual void AnimationCanceled(const ui::Animation* animation) {
target_->SetFavIconHidingOffset(0);
}
@@ -263,7 +263,7 @@
close_button_.reset(MakeCloseButton());
gtk_widget_show(tab_.get());
- hover_animation_.reset(new SlideAnimation(this));
+ hover_animation_.reset(new ui::SlideAnimation(this));
hover_animation_->SetSlideDuration(kHoverDurationMs);
registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
@@ -520,7 +520,7 @@
void TabRendererGtk::StartMiniTabTitleAnimation() {
if (!mini_title_animation_.get()) {
- mini_title_animation_.reset(new ThrobAnimation(this));
+ mini_title_animation_.reset(new ui::ThrobAnimation(this));
mini_title_animation_->SetThrobDuration(kMiniTitleChangeThrobDuration);
}
@@ -562,22 +562,22 @@
////////////////////////////////////////////////////////////////////////////////
// TabRendererGtk, protected:
-std::wstring TabRendererGtk::GetTitle() const {
- return UTF16ToWideHack(data_.title);
+string16 TabRendererGtk::GetTitle() const {
+ return data_.title;
}
///////////////////////////////////////////////////////////////////////////////
-// TabRendererGtk, AnimationDelegate implementation:
+// TabRendererGtk, ui::AnimationDelegate implementation:
-void TabRendererGtk::AnimationProgressed(const Animation* animation) {
+void TabRendererGtk::AnimationProgressed(const ui::Animation* animation) {
gtk_widget_queue_draw(tab_.get());
}
-void TabRendererGtk::AnimationCanceled(const Animation* animation) {
+void TabRendererGtk::AnimationCanceled(const ui::Animation* animation) {
AnimationEnded(animation);
}
-void TabRendererGtk::AnimationEnded(const Animation* animation) {
+void TabRendererGtk::AnimationEnded(const ui::Animation* animation) {
gtk_widget_queue_draw(tab_.get());
}
@@ -1052,14 +1052,14 @@
gboolean TabRendererGtk::OnEnterNotifyEvent(GtkWidget* widget,
GdkEventCrossing* event) {
- hover_animation_->SetTweenType(Tween::EASE_OUT);
+ hover_animation_->SetTweenType(ui::Tween::EASE_OUT);
hover_animation_->Show();
return FALSE;
}
gboolean TabRendererGtk::OnLeaveNotifyEvent(GtkWidget* widget,
GdkEventCrossing* event) {
- hover_animation_->SetTweenType(Tween::EASE_IN);
+ hover_animation_->SetTweenType(ui::Tween::EASE_IN);
hover_animation_->Hide();
return FALSE;
}
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
index 6849a2a..0593e68 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
@@ -9,7 +9,6 @@
#include <gtk/gtk.h>
#include <map>
-#include "app/animation_delegate.h"
#include "app/gtk_signal.h"
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
@@ -21,6 +20,7 @@
#include "gfx/font.h"
#include "gfx/rect.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/animation/animation_delegate.h"
namespace gfx {
class Size;
@@ -28,12 +28,15 @@
class CustomDrawButton;
class GtkThemeProvider;
-class SlideAnimation;
class TabContents;
class ThemeProvider;
-class ThrobAnimation;
-class TabRendererGtk : public AnimationDelegate,
+namespace ui {
+class SlideAnimation;
+class ThrobAnimation;
+}
+
+class TabRendererGtk : public ui::AnimationDelegate,
public NotificationObserver {
public:
// Possible animation states.
@@ -225,7 +228,7 @@
const gfx::Rect& close_button_bounds() const { return close_button_bounds_; }
// Returns the title of the Tab.
- std::wstring GetTitle() const;
+ string16 GetTitle() const;
// enter-notify-event handler that signals when the mouse enters the tab.
CHROMEGTK_CALLBACK_1(TabRendererGtk, gboolean, OnEnterNotifyEvent,
@@ -288,10 +291,10 @@
int y_offset;
};
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// Starts/Stops the crash animation.
void StartCrashAnimation();
@@ -420,10 +423,10 @@
gfx::Rect requisition_;
// Hover animation.
- scoped_ptr<SlideAnimation> hover_animation_;
+ scoped_ptr<ui::SlideAnimation> hover_animation_;
// Animation used when the title of an inactive mini-tab changes.
- scoped_ptr<ThrobAnimation> mini_title_animation_;
+ scoped_ptr<ui::ThrobAnimation> mini_title_animation_;
// Contains the loading animation state.
LoadingAnimation loading_animation_;
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index 4c307d8..8cadca9 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -6,10 +6,8 @@
#include <algorithm>
-#include "app/animation_delegate.h"
#include "app/gtk_dnd_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/i18n/rtl.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -34,6 +32,8 @@
#include "gfx/point.h"
#include "grit/app_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -107,7 +107,7 @@
//
// A base class for all TabStrip animations.
//
-class TabStripGtk::TabAnimation : public AnimationDelegate {
+class TabStripGtk::TabAnimation : public ui::AnimationDelegate {
public:
friend class TabStripGtk;
@@ -137,7 +137,7 @@
void Start() {
animation_.SetSlideDuration(GetDuration());
- animation_.SetTweenType(Tween::EASE_OUT);
+ animation_.SetTweenType(ui::Tween::EASE_OUT);
if (!animation_.IsShowing()) {
animation_.Reset();
animation_.Show();
@@ -176,17 +176,17 @@
return tab_width;
}
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation) {
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation) {
tabstrip_->AnimationLayout(end_unselected_width_);
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
tabstrip_->FinishAnimation(this, layout_on_completion_);
// This object is destroyed now, so we can't do anything else after this.
}
- virtual void AnimationCanceled(const Animation* animation) {
+ virtual void AnimationCanceled(const ui::Animation* animation) {
AnimationEnded(animation);
}
@@ -234,7 +234,7 @@
}
TabStripGtk* tabstrip_;
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
double start_selected_width_;
double start_unselected_width_;
@@ -388,7 +388,7 @@
return start_unselected_width_ + (delta * animation_.GetCurrentValue());
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
tabstrip_->RemoveTabAt(index_);
TabStripGtk::TabAnimation::AnimationEnded(animation);
}
@@ -418,8 +418,8 @@
}
virtual ~MoveTabAnimation() {}
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation) {
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation) {
// Position Tab A
double distance = start_tab_b_bounds_.x() - start_tab_a_bounds_.x();
double delta = distance * animation_.GetCurrentValue();
@@ -469,8 +469,8 @@
}
virtual ~ResizeLayoutAnimation() {}
- // Overridden from AnimationDelegate:
- virtual void AnimationEnded(const Animation* animation) {
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationEnded(const ui::Animation* animation) {
tabstrip_->needs_resize_layout_ = false;
TabStripGtk::TabAnimation::AnimationEnded(animation);
}
@@ -603,8 +603,8 @@
tab_->set_animating_mini_change(true);
}
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation) {
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation) {
// Do the normal layout.
TabAnimation::AnimationProgressed(animation);
@@ -618,7 +618,7 @@
tabstrip_->SetTabBounds(tab_, tab_bounds);
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
tabstrip_->needs_resize_layout_ = false;
TabStripGtk::TabAnimation::AnimationEnded(animation);
}
diff --git a/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc b/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc
index 5560662..3d78de4 100644
--- a/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc
+++ b/chrome/browser/gtk/translate/translate_infobar_base_gtk.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/gtk/translate/translate_infobar_base_gtk.h"
#include "app/l10n_util.h"
-#include "app/slide_animation.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/translate/options_menu_model.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
@@ -16,6 +15,7 @@
#include "chrome/browser/gtk/menu_gtk.h"
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
+#include "ui/base/animation/slide_animation.h"
namespace {
@@ -35,8 +35,8 @@
TranslateInfoBarDelegate::BackgroundAnimationType animation =
delegate->background_animation_type();
if (animation != TranslateInfoBarDelegate::NONE) {
- background_color_animation_.reset(new SlideAnimation(this));
- background_color_animation_->SetTweenType(Tween::LINEAR);
+ background_color_animation_.reset(new ui::SlideAnimation(this));
+ background_color_animation_->SetTweenType(ui::Tween::LINEAR);
background_color_animation_->SetSlideDuration(500);
if (animation == TranslateInfoBarDelegate::NORMAL_TO_ERROR) {
background_color_animation_->Show();
@@ -117,7 +117,7 @@
}
}
-void TranslateInfoBarBase::AnimationProgressed(const Animation* animation) {
+void TranslateInfoBarBase::AnimationProgressed(const ui::Animation* animation) {
DCHECK(animation == background_color_animation_.get());
background_error_percent_ = animation->GetCurrentValue();
// Queue the info bar widget for redisplay so it repaints its background.
diff --git a/chrome/browser/gtk/translate/translate_infobar_base_gtk.h b/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
index ae147ca..6adf98a 100644
--- a/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
+++ b/chrome/browser/gtk/translate/translate_infobar_base_gtk.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_GTK_TRANSLATE_TRANSLATE_INFOBAR_BASE_GTK_H_
#pragma once
-#include "app/animation_delegate.h"
#include "chrome/browser/translate/translate_infobar_view.h"
#include "chrome/browser/gtk/infobar_gtk.h"
+#include "ui/base/animation/animation_delegate.h"
class MenuGtk;
class OptionsMenuModel;
@@ -18,7 +18,7 @@
// use.
class TranslateInfoBarBase : public TranslateInfoBarView,
public InfoBar,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit TranslateInfoBarBase(TranslateInfoBarDelegate* delegate);
virtual ~TranslateInfoBarBase();
@@ -37,8 +37,8 @@
virtual void OriginalLanguageChanged() {}
virtual void TargetLanguageChanged() {}
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
protected:
// Sub-classes that want to have the options menu button showing sould
@@ -81,7 +81,7 @@
double background_error_percent_;
// Changes the color of the background from normal to error color and back.
- scoped_ptr<SlideAnimation> background_color_animation_;
+ scoped_ptr<ui::SlideAnimation> background_color_animation_;
DISALLOW_COPY_AND_ASSIGN(TranslateInfoBarBase);
};
diff --git a/chrome/browser/hang_monitor/hung_plugin_action.cc b/chrome/browser/hang_monitor/hung_plugin_action.cc
index 9b719ca..77062b2 100644
--- a/chrome/browser/hang_monitor/hung_plugin_action.cc
+++ b/chrome/browser/hang_monitor/hung_plugin_action.cc
@@ -7,8 +7,7 @@
#include "chrome/browser/hang_monitor/hung_plugin_action.h"
#include "app/l10n_util.h"
-#include "app/win_util.h"
-#include "base/win_util.h"
+#include "app/win/hwnd_util.h"
#include "chrome/browser/platform_util.h"
#include "chrome/common/logging_chrome.h"
#include "grit/generated_resources.h"
@@ -43,18 +42,18 @@
NOTREACHED() << "Terminated a hung plugin process.";
*action = HungWindowNotification::HUNG_WINDOW_TERMINATE_PROCESS;
} else {
- std::wstring plugin_name;
+ string16 plugin_name;
GetPluginName(hung_window,
top_level_window_process_id,
&plugin_name);
if (plugin_name.empty()) {
- plugin_name = l10n_util::GetString(IDS_UNKNOWN_PLUGIN_NAME);
+ plugin_name = l10n_util::GetStringUTF16(IDS_UNKNOWN_PLUGIN_NAME);
}
- std::wstring msg = l10n_util::GetStringF(IDS_BROWSER_HANGMONITOR,
- plugin_name);
- std::wstring title = l10n_util::GetString(IDS_BROWSER_HANGMONITOR_TITLE);
- // Before displaying the message box,invoke SendMessageCallback on the
- // hung window. If the callback ever hits,the window is not hung anymore
+ string16 msg = l10n_util::GetStringFUTF16(IDS_BROWSER_HANGMONITOR,
+ plugin_name);
+ string16 title = l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_TITLE);
+ // Before displaying the message box, invoke SendMessageCallback on the
+ // hung window. If the callback ever hits, the window is not hung anymore
// and we can dismiss the message box.
SendMessageCallback(hung_window,
WM_NULL,
@@ -133,7 +132,7 @@
// static
BOOL CALLBACK HungPluginAction::DismissMessageBox(HWND window, LPARAM ignore) {
- std::wstring class_name = win_util::GetClassNameW(window);
+ string16 class_name = app::win::GetClassName(window);
// #32770 is the dialog window class which is the window class of
// the message box being displayed.
if (class_name == L"#32770") {
diff --git a/chrome/browser/history/history_database.cc b/chrome/browser/history/history_database.cc
index f0c546c..c5478b8 100644
--- a/chrome/browser/history/history_database.cc
+++ b/chrome/browser/history/history_database.cc
@@ -17,7 +17,7 @@
#include "chrome/common/chrome_switches.h"
#if defined(OS_MACOSX)
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#endif
namespace history {
@@ -99,11 +99,11 @@
#if defined(OS_MACOSX)
// Exclude the history file and its journal from backups.
- mac_util::SetFileBackupExclusion(history_name, true);
+ base::mac::SetFileBackupExclusion(history_name, true);
FilePath::StringType history_name_string(history_name.value());
history_name_string += "-journal";
FilePath history_journal_name(history_name_string);
- mac_util::SetFileBackupExclusion(history_journal_name, true);
+ base::mac::SetFileBackupExclusion(history_journal_name, true);
#endif
// Prime the cache.
diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc
index 05d9a72..ecc8314 100644
--- a/chrome/browser/history/history_types.cc
+++ b/chrome/browser/history/history_types.cc
@@ -315,6 +315,12 @@
KeywordSearchTermVisit::~KeywordSearchTermVisit() {}
+// KeywordSearchTermRow --------------------------------------------------------
+
+KeywordSearchTermRow::KeywordSearchTermRow() : keyword_id(0), url_id(0) {}
+
+KeywordSearchTermRow::~KeywordSearchTermRow() {}
+
// MostVisitedURL --------------------------------------------------------------
MostVisitedURL::MostVisitedURL() {}
diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h
index bc28dd1..76359fc 100644
--- a/chrome/browser/history/history_types.h
+++ b/chrome/browser/history/history_types.h
@@ -18,6 +18,7 @@
#include "base/string16.h"
#include "base/time.h"
#include "chrome/browser/history/snippet.h"
+#include "chrome/browser/search_engines/template_url_id.h"
#include "chrome/common/page_transition_types.h"
#include "chrome/common/ref_counted_util.h"
#include "chrome/common/thumbnail_score.h"
@@ -523,6 +524,23 @@
string16 term;
};
+// KeywordSearchTermRow --------------------------------------------------------
+
+// Used for URLs that have a search term associated with them.
+struct KeywordSearchTermRow {
+ KeywordSearchTermRow();
+ ~KeywordSearchTermRow();
+
+ // ID of the keyword.
+ TemplateURLID keyword_id;
+
+ // ID of the url.
+ URLID url_id;
+
+ // The search term that was used.
+ string16 term;
+};
+
// MostVisitedURL --------------------------------------------------------------
// Holds the per-URL information of the most visited query.
diff --git a/chrome/browser/history/in_memory_history_backend.cc b/chrome/browser/history/in_memory_history_backend.cc
index 978c8c4..25219f6 100644
--- a/chrome/browser/history/in_memory_history_backend.cc
+++ b/chrome/browser/history/in_memory_history_backend.cc
@@ -90,7 +90,8 @@
PageTransition::Type primary_type =
PageTransition::StripQualifier(visited_details->transition);
if (visited_details->row.typed_count() > 0 ||
- primary_type == PageTransition::KEYWORD) {
+ primary_type == PageTransition::KEYWORD ||
+ HasKeyword(visited_details->row.url())) {
URLsModifiedDetails modified_details;
modified_details.changed_urls.push_back(visited_details->row);
OnTypedURLsModified(modified_details);
@@ -186,4 +187,12 @@
db_->SetKeywordSearchTermsForURL(url_id, details.keyword_id, details.term);
}
+bool InMemoryHistoryBackend::HasKeyword(const GURL& url) {
+ URLID id = db_->GetRowForURL(url, NULL);
+ if (!id)
+ return false;
+
+ return db_->GetKeywordSearchTermRow(id, NULL);
+}
+
} // namespace history
diff --git a/chrome/browser/history/in_memory_history_backend.h b/chrome/browser/history/in_memory_history_backend.h
index c775800..6e56636 100644
--- a/chrome/browser/history/in_memory_history_backend.h
+++ b/chrome/browser/history/in_memory_history_backend.h
@@ -23,6 +23,7 @@
#include "chrome/common/notification_registrar.h"
class FilePath;
+class GURL;
class HistoryDatabase;
class Profile;
@@ -77,6 +78,9 @@
// Handler for HISTORY_KEYWORD_SEARCH_TERM_UPDATED.
void OnKeywordSearchTermUpdated(const KeywordSearchTermDetails& details);
+ // Returns true if there is a keyword associated with the specified url.
+ bool HasKeyword(const GURL& url);
+
NotificationRegistrar registrar_;
scoped_ptr<InMemoryDatabase> db_;
diff --git a/chrome/browser/history/redirect_uitest.cc b/chrome/browser/history/redirect_uitest.cc
index 1dbadcc..9d2c35a 100644
--- a/chrome/browser/history/redirect_uitest.cc
+++ b/chrome/browser/history/redirect_uitest.cc
@@ -8,11 +8,11 @@
// the case of redirects. It may also mean problems with the history system.
#include "base/file_util.h"
-#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
#include "base/string16.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -210,7 +210,7 @@
NavigateToURL(first_url);
for (int i = 0; i < 10; ++i) {
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects));
@@ -316,7 +316,7 @@
std::wstring final_url_title = UTF8ToWide("Title Of Awesomeness");
// Wait till the final page has been loaded.
for (int i = 0; i < 10; ++i) {
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
scoped_refptr<TabProxy> tab_proxy(GetActiveTab());
ASSERT_TRUE(tab_proxy.get());
ASSERT_TRUE(tab_proxy->GetTabTitle(&tab_title));
diff --git a/chrome/browser/history/thumbnail_database.cc b/chrome/browser/history/thumbnail_database.cc
index e1054ac..7fa8bd1 100644
--- a/chrome/browser/history/thumbnail_database.cc
+++ b/chrome/browser/history/thumbnail_database.cc
@@ -22,7 +22,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#if defined(OS_MACOSX)
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#endif
namespace history {
@@ -53,11 +53,11 @@
#if defined(OS_MACOSX)
// Exclude the thumbnails file and its journal from backups.
- mac_util::SetFileBackupExclusion(db_name, true);
+ base::mac::SetFileBackupExclusion(db_name, true);
FilePath::StringType db_name_string(db_name.value());
db_name_string += "-journal";
FilePath db_journal_name(db_name_string);
- mac_util::SetFileBackupExclusion(db_journal_name, true);
+ base::mac::SetFileBackupExclusion(db_journal_name, true);
#endif
// Create the tables.
diff --git a/chrome/browser/history/top_sites.cc b/chrome/browser/history/top_sites.cc
index dd3eee9..1635523 100644
--- a/chrome/browser/history/top_sites.cc
+++ b/chrome/browser/history/top_sites.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -220,7 +220,7 @@
// WARNING: this may be invoked on any thread.
scoped_refptr<CancelableRequest<GetTopSitesCallback> > request(
new CancelableRequest<GetTopSitesCallback>(callback));
- // This ensures cancelation of requests when either the consumer or the
+ // This ensures cancellation of requests when either the consumer or the
// provider is deleted. Deletion of requests is also guaranteed.
AddRequest(request, consumer);
MostVisitedURLList filtered_urls;
diff --git a/chrome/browser/history/url_database.cc b/chrome/browser/history/url_database.cc
index 3f297bd..dd3346b 100644
--- a/chrome/browser/history/url_database.cc
+++ b/chrome/browser/history/url_database.cc
@@ -386,6 +386,26 @@
return statement.Run();
}
+bool URLDatabase::GetKeywordSearchTermRow(URLID url_id,
+ KeywordSearchTermRow* row) {
+ DCHECK(url_id);
+ sql::Statement statement(GetDB().GetCachedStatement(SQL_FROM_HERE,
+ "SELECT keyword_id, term FROM keyword_search_terms WHERE url_id=?"));
+ if (!statement)
+ return false;
+
+ statement.BindInt64(0, url_id);
+ if (!statement.Step())
+ return false;
+
+ if (row) {
+ row->url_id = url_id;
+ row->keyword_id = statement.ColumnInt64(0);
+ row->term = statement.ColumnString16(1);
+ }
+ return true;
+}
+
void URLDatabase::DeleteAllSearchTermsForKeyword(
TemplateURLID keyword_id) {
DCHECK(keyword_id);
diff --git a/chrome/browser/history/url_database.h b/chrome/browser/history/url_database.h
index 49bf5f0..ae1d7cd 100644
--- a/chrome/browser/history/url_database.h
+++ b/chrome/browser/history/url_database.h
@@ -165,6 +165,10 @@
TemplateURLID keyword_id,
const string16& term);
+ // Looks up a keyword search term given a url id. Fills row with the data.
+ // Returns true on success and false otherwise.
+ bool GetKeywordSearchTermRow(URLID url_id, KeywordSearchTermRow* row);
+
// Deletes all search terms for the specified keyword that have been added by
// way of SetKeywordSearchTermsForURL.
void DeleteAllSearchTermsForKeyword(TemplateURLID keyword_id);
diff --git a/chrome/browser/history/url_database_unittest.cc b/chrome/browser/history/url_database_unittest.cc
index c37323f..b164e48 100644
--- a/chrome/browser/history/url_database_unittest.cc
+++ b/chrome/browser/history/url_database_unittest.cc
@@ -136,21 +136,31 @@
ASSERT_TRUE(url_id != 0);
// Add a keyword visit.
- ASSERT_TRUE(SetKeywordSearchTermsForURL(url_id, 1, UTF8ToUTF16("visit")));
+ TemplateURLID keyword_id = 100;
+ string16 keyword = UTF8ToUTF16("visit");
+ ASSERT_TRUE(SetKeywordSearchTermsForURL(url_id, keyword_id, keyword));
// Make sure we get it back.
std::vector<KeywordSearchTermVisit> matches;
- GetMostRecentKeywordSearchTerms(1, UTF8ToUTF16("visit"), 10, &matches);
+ GetMostRecentKeywordSearchTerms(keyword_id, keyword, 10, &matches);
ASSERT_EQ(1U, matches.size());
- ASSERT_EQ(UTF8ToUTF16("visit"), matches[0].term);
+ ASSERT_EQ(keyword, matches[0].term);
+
+ KeywordSearchTermRow keyword_search_term_row;
+ ASSERT_TRUE(GetKeywordSearchTermRow(url_id, &keyword_search_term_row));
+ EXPECT_EQ(keyword_id, keyword_search_term_row.keyword_id);
+ EXPECT_EQ(url_id, keyword_search_term_row.url_id);
+ EXPECT_EQ(keyword, keyword_search_term_row.term);
// Delete the keyword visit.
- DeleteAllSearchTermsForKeyword(1);
+ DeleteAllSearchTermsForKeyword(keyword_id);
// Make sure we don't get it back when querying.
matches.clear();
- GetMostRecentKeywordSearchTerms(1, UTF8ToUTF16("visit"), 10, &matches);
+ GetMostRecentKeywordSearchTerms(keyword_id, keyword, 10, &matches);
ASSERT_EQ(0U, matches.size());
+
+ ASSERT_FALSE(GetKeywordSearchTermRow(url_id, &keyword_search_term_row));
}
// Make sure deleting a URL also deletes a keyword visit.
diff --git a/chrome/browser/icon_loader_linux.cc b/chrome/browser/icon_loader_linux.cc
index 2452b4a..52f5e2c 100644
--- a/chrome/browser/icon_loader_linux.cc
+++ b/chrome/browser/icon_loader_linux.cc
@@ -12,7 +12,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/mime_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/string_util.h"
#include "gfx/codec/png_codec.h"
#include "gfx/gtk_util.h"
diff --git a/chrome/browser/icon_loader_mac.mm b/chrome/browser/icon_loader_mac.mm
index 441d12a..e14bde7 100644
--- a/chrome/browser/icon_loader_mac.mm
+++ b/chrome/browser/icon_loader_mac.mm
@@ -7,7 +7,7 @@
#import <AppKit/AppKit.h>
#include "base/message_loop.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/sys_string_conversions.h"
#include "skia/ext/skia_utils_mac.h"
#include "third_party/skia/include/core/SkBitmap.h"
diff --git a/chrome/browser/icon_loader_win.cc b/chrome/browser/icon_loader_win.cc
index dfa115c..c708fb6 100644
--- a/chrome/browser/icon_loader_win.cc
+++ b/chrome/browser/icon_loader_win.cc
@@ -8,7 +8,7 @@
#include <shellapi.h>
#include "base/message_loop.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "gfx/icon_util.h"
#include "gfx/size.h"
diff --git a/chrome/browser/images_uitest.cc b/chrome/browser/images_uitest.cc
index 2c67437..400ac86 100644
--- a/chrome/browser/images_uitest.cc
+++ b/chrome/browser/images_uitest.cc
@@ -4,7 +4,7 @@
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "net/base/net_util.h"
#include "chrome/test/ui/ui_test.h"
@@ -16,7 +16,7 @@
NavigateToURL(net::FilePathToFileURL(test_file));
// Let the GIFs fully animate.
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
std::wstring page_title = L"animated gif test";
EXPECT_EQ(page_title, GetActiveTabTitle());
diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
index 15ac4a2..f27a53c 100644
--- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
+++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
@@ -6,7 +6,6 @@
#include "base/base_switches.h"
#include "base/command_line.h"
-#include "base/debug_on_start.h"
#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/test/test_timeouts.h"
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index efa2a0a..b26c306 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -16,7 +16,8 @@
#include <vector>
#include "app/l10n_util.h"
-#include "app/win_util.h"
+#include "app/win/scoped_co_mem.h"
+#include "app/win/scoped_com_initializer.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/scoped_comptr_win.h"
@@ -26,6 +27,7 @@
#include "base/values.h"
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
+#include "base/win/scoped_handle.h"
#include "base/win/windows_version.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/importer/importer_bridge.h"
@@ -48,7 +50,7 @@
// Gets the creation time of the given file or directory.
static Time GetFileCreationTime(const std::wstring& file) {
Time creation_time;
- ScopedHandle file_handle(
+ base::win::ScopedHandle file_handle(
CreateFile(file.c_str(), GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
NULL, OPEN_EXISTING,
@@ -78,7 +80,7 @@
bridge_->NotifyStarted();
// Some IE settings (such as Protected Storage) are obtained via COM APIs.
- win_util::ScopedCOMInitializer com_initializer;
+ app::win::ScopedCOMInitializer com_initializer;
if ((items & importer::HOME_PAGE) && !cancelled())
ImportHomepage(); // Doesn't have a UI item.
@@ -122,7 +124,7 @@
if (!bookmarks.empty() && !cancelled()) {
const std::wstring& first_folder_name =
- l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_IE);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_IE));
int options = 0;
if (import_to_bookmark_bar())
options = ProfileWriter::IMPORT_TO_BOOKMARK_BAR;
@@ -487,7 +489,8 @@
void IEImporter::ParseFavoritesFolder(const FavoritesInfo& info,
BookmarkVector* bookmarks) {
- std::wstring ie_folder = l10n_util::GetString(IDS_BOOKMARK_GROUP_FROM_IE);
+ std::wstring ie_folder =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_IE));
BookmarkVector toolbar_bookmarks;
FilePath file;
std::vector<FilePath::StringType> file_list;
@@ -552,7 +555,7 @@
}
std::wstring IEImporter::ResolveInternetShortcut(const std::wstring& file) {
- win_util::CoMemReleaser<wchar_t> url;
+ app::win::ScopedCoMem<wchar_t> url;
ScopedComPtr<IUniformResourceLocator> url_locator;
HRESULT result = url_locator.CreateInstance(CLSID_InternetShortcut, NULL,
CLSCTX_INPROC_SERVER);
diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc
index 6379e7b..d69aff4 100644
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -5,7 +5,8 @@
#include "chrome/browser/importer/importer.h"
#include "app/l10n_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser_list.h"
@@ -29,7 +30,7 @@
// TODO(port): Port these files.
#if defined(OS_WIN)
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#include "chrome/browser/views/importer_lock_view.h"
#include "views/window/window.h"
#elif defined(OS_MACOSX)
@@ -211,9 +212,10 @@
// credentials.
if (profile_info.browser_type == importer::GOOGLE_TOOLBAR5) {
if (!toolbar_importer_utils::IsGoogleGAIACookieInstalled()) {
- win_util::MessageBox(
+ app::win::MessageBox(
NULL,
- l10n_util::GetString(IDS_IMPORTER_GOOGLE_LOGIN_TEXT).c_str(),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_IMPORTER_GOOGLE_LOGIN_TEXT)).c_str(),
L"",
MB_OK | MB_TOPMOST);
diff --git a/chrome/browser/importer/importer_bridge.cc b/chrome/browser/importer/importer_bridge.cc
index f4fce91..588e365 100644
--- a/chrome/browser/importer/importer_bridge.cc
+++ b/chrome/browser/importer/importer_bridge.cc
@@ -117,7 +117,7 @@
}
std::wstring InProcessImporterBridge::GetLocalizedString(int message_id) {
- return l10n_util::GetString(message_id);
+ return UTF16ToWideHack(l10n_util::GetStringUTF16(message_id));
}
InProcessImporterBridge::~InProcessImporterBridge() {}
diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc
index 10e1101..9574f95 100644
--- a/chrome/browser/importer/importer_list.cc
+++ b/chrome/browser/importer/importer_list.cc
@@ -23,7 +23,7 @@
#include "chrome/browser/password_manager/ie7_password.h"
#endif
#if defined(OS_MACOSX)
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/browser/importer/safari_importer.h"
#endif
@@ -33,7 +33,7 @@
void DetectIEProfiles(std::vector<importer::ProfileInfo*>* profiles) {
// IE always exists and doesn't have multiple profiles.
ProfileInfo* ie = new ProfileInfo();
- ie->description = l10n_util::GetString(IDS_IMPORT_FROM_IE);
+ ie->description = UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_IE));
ie->browser_type = importer::MS_IE;
ie->source_path.clear();
ie->app_path.clear();
@@ -46,12 +46,13 @@
#if defined(OS_MACOSX)
void DetectSafariProfiles(std::vector<importer::ProfileInfo*>* profiles) {
uint16 items = importer::NONE;
- if (!SafariImporter::CanImport(mac_util::GetUserLibraryPath(), &items))
+ if (!SafariImporter::CanImport(base::mac::GetUserLibraryPath(), &items))
return;
importer::ProfileInfo* safari = new importer::ProfileInfo();
safari->browser_type = importer::SAFARI;
- safari->description = l10n_util::GetString(IDS_IMPORT_FROM_SAFARI);
+ safari->description =
+ UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_SAFARI));
safari->source_path.clear();
safari->app_path.clear();
safari->services_supported = items;
@@ -84,7 +85,8 @@
}
importer::ProfileInfo* firefox = new importer::ProfileInfo();
- firefox->description = l10n_util::GetString(IDS_IMPORT_FROM_FIREFOX);
+ firefox->description =
+ UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX));
firefox->browser_type = firefox_type;
firefox->source_path = profile_path;
#if defined(OS_WIN)
@@ -105,8 +107,8 @@
importer::ProfileInfo* google_toolbar = new importer::ProfileInfo();
google_toolbar->browser_type = importer::GOOGLE_TOOLBAR5;
- google_toolbar->description = l10n_util::GetString(
- IDS_IMPORT_FROM_GOOGLE_TOOLBAR);
+ google_toolbar->description = UTF16ToWideHack(l10n_util::GetStringUTF16(
+ IDS_IMPORT_FROM_GOOGLE_TOOLBAR));
google_toolbar->source_path.clear();
google_toolbar->app_path.clear();
google_toolbar->services_supported = importer::FAVORITES;
@@ -131,7 +133,7 @@
return new Toolbar5Importer();
#if defined(OS_MACOSX)
case importer::SAFARI:
- return new SafariImporter(mac_util::GetUserLibraryPath());
+ return new SafariImporter(base::mac::GetUserLibraryPath());
#endif // OS_MACOSX
case importer::NO_PROFILE_TYPE:
NOTREACHED();
diff --git a/chrome/browser/importer/importer_list.h b/chrome/browser/importer/importer_list.h
index f3db148..513a55f 100644
--- a/chrome/browser/importer/importer_list.h
+++ b/chrome/browser/importer/importer_list.h
@@ -10,7 +10,6 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/scoped_vector.h"
#include "build/build_config.h"
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index 56ac2cc..595a3d7 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -17,6 +17,7 @@
#include <vector>
+#include "app/win/scoped_com_initializer.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/path_service.h"
@@ -34,7 +35,6 @@
#include "webkit/glue/password_form.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
#include "base/scoped_comptr_win.h"
#include "chrome/browser/importer/ie_importer.h"
#include "chrome/browser/password_manager/ie7_password.h"
@@ -357,9 +357,8 @@
TEST_F(ImporterTest, IEImporter) {
// Sets up a favorites folder.
- win_util::ScopedCOMInitializer com_init;
- std::wstring path = test_path_.ToWStringHack();
- file_util::AppendToPath(&path, L"Favorites");
+ app::win::ScopedCOMInitializer com_init;
+ std::wstring path = test_path_.AppendASCII("Favorites").value();
CreateDirectory(path.c_str(), NULL);
CreateDirectory((path + L"\\SubFolder").c_str(), NULL);
CreateDirectory((path + L"\\Links").c_str(), NULL);
diff --git a/chrome/browser/importer/nss_decryptor_win.cc b/chrome/browser/importer/nss_decryptor_win.cc
index a662abb..a7b5592 100644
--- a/chrome/browser/importer/nss_decryptor_win.cc
+++ b/chrome/browser/importer/nss_decryptor_win.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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 "chrome/browser/importer/nss_decryptor_win.h"
-#include "base/file_util.h"
+
+#include "base/file_path.h"
#include "base/sys_string_conversions.h"
namespace {
@@ -59,9 +60,8 @@
// Fall back on LoadLibraryEx if SetDllDirectory isn't available. We
// actually prefer this method because it doesn't change the DLL search
// path, which is a process-wide property.
- std::wstring path = dll_path;
- file_util::AppendToPath(&path, kNSS3Library);
- nss3_dll_ = LoadLibraryEx(path.c_str(), NULL,
+ FilePath path = FilePath(dll_path).Append(kNSS3Library);
+ nss3_dll_ = LoadLibraryEx(path.value().c_str(), NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
if (nss3_dll_ == NULL)
return false;
@@ -76,9 +76,8 @@
// LOAD_WITH_ALTERED_SEARCH_PATH flag. This helps because LoadLibrary
// doesn't load a DLL again if it's already loaded. This workaround is
// harmless for NSS 3.11.
- path = dll_path;
- file_util::AppendToPath(&path, kSoftokn3Library);
- softokn3_dll_ = LoadLibraryEx(path.c_str(), NULL,
+ path = FilePath(dll_path).Append(kSoftokn3Library);
+ softokn3_dll_ = LoadLibraryEx(path.value().c_str(), NULL,
LOAD_WITH_ALTERED_SEARCH_PATH);
if (softokn3_dll_ == NULL) {
Free();
diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc
index 68e5c96..00e8dcf 100644
--- a/chrome/browser/importer/profile_writer.cc
+++ b/chrome/browser/importer/profile_writer.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/importer/profile_writer.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/importer/importer.h"
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index cc3411c..adcea0c 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -135,7 +135,7 @@
void Toolbar5Importer::OnURLFetchComplete(
const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data) {
diff --git a/chrome/browser/importer/toolbar_importer.h b/chrome/browser/importer/toolbar_importer.h
index f83135a..e0b87e5 100644
--- a/chrome/browser/importer/toolbar_importer.h
+++ b/chrome/browser/importer/toolbar_importer.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -54,7 +54,7 @@
// URLFetcher::Delegate method called back from the URLFetcher object.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/in_process_webkit/indexed_db_browsertest.cc b/chrome/browser/in_process_webkit/indexed_db_browsertest.cc
index 70a8d13..fea58e0 100644
--- a/chrome/browser/in_process_webkit/indexed_db_browsertest.cc
+++ b/chrome/browser/in_process_webkit/indexed_db_browsertest.cc
@@ -67,7 +67,8 @@
SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("transaction_get_test.html"))));
}
-IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, ObjectStoreTest) {
+// Crashy, http://crbug.com/68446.
+IN_PROC_BROWSER_TEST_F(IndexedDBBrowserTest, DISABLED_ObjectStoreTest) {
SimpleTest(testUrl(FilePath(FILE_PATH_LITERAL("object_store_test.html"))));
}
diff --git a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h
index 6b8aec1..3a79c28 100644
--- a/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h
+++ b/chrome/browser/in_process_webkit/indexed_db_key_utility_client.h
@@ -7,7 +7,7 @@
#pragma once
#include "base/ref_counted.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/utility_process_host.h"
class IndexedDBKey;
diff --git a/chrome/browser/in_process_webkit/webkit_thread.h b/chrome/browser/in_process_webkit/webkit_thread.h
index 76e9730..856007c 100644
--- a/chrome/browser/in_process_webkit/webkit_thread.h
+++ b/chrome/browser/in_process_webkit/webkit_thread.h
@@ -9,7 +9,7 @@
#include "base/basictypes.h"
#include "base/lock.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_thread.h"
class BrowserWebKitClientImpl;
diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc
index ef1ac64..6eaca52 100644
--- a/chrome/browser/instant/instant_browsertest.cc
+++ b/chrome/browser/instant/instant_browsertest.cc
@@ -100,7 +100,8 @@
// When the page loads, the initial searchBox values are set and only a
// resize will have been sent.
- ASSERT_EQ("true 0 0 0 1 a false", GetSearchStateAsString(preview_));
+ ASSERT_EQ("true 0 0 0 1 a false a false",
+ GetSearchStateAsString(preview_));
}
void SetLocationBarText(const std::wstring& text) {
@@ -147,8 +148,13 @@
// Returns the state of the search box as a string. This consists of the
// following:
- // window.chrome.sv window.onsubmitcalls window.oncancelcalls
- // window.onchangecalls window.onresizecalls
+ // window.chrome.sv
+ // window.onsubmitcalls
+ // window.oncancelcalls
+ // window.onchangecalls
+ // window.onresizecalls
+ // window.beforeLoadSearchBox.value
+ // window.beforeLoadSearchBox.verbatim
// window.chrome.searchBox.value
// window.chrome.searchBox.verbatim
// If determining any of the values fails, the value is 'fail'.
@@ -158,6 +164,8 @@
int oncancelcalls = 0;
int onchangecalls = 0;
int onresizecalls = 0;
+ std::string before_load_value;
+ bool before_load_verbatim = false;
std::string value;
bool verbatim = false;
@@ -170,6 +178,12 @@
&onchangecalls) ||
!GetIntFromJavascript(tab_contents, "window.onresizecalls",
&onresizecalls) ||
+ !GetStringFromJavascript(
+ tab_contents, "window.beforeLoadSearchBox.value",
+ &before_load_value) ||
+ !GetBoolFromJavascript(
+ tab_contents, "window.beforeLoadSearchBox.verbatim",
+ &before_load_verbatim) ||
!GetStringFromJavascript(tab_contents, "window.chrome.searchBox.value",
&value) ||
!GetBoolFromJavascript(tab_contents, "window.chrome.searchBox.verbatim",
@@ -177,9 +191,15 @@
return "fail";
}
- return StringPrintf("%s %d %d %d %d %s %s",
- sv ? "true" : "false", onsubmitcalls, oncancelcalls,
- onchangecalls, onresizecalls, value.c_str(),
+ return StringPrintf("%s %d %d %d %d %s %s %s %s",
+ sv ? "true" : "false",
+ onsubmitcalls,
+ oncancelcalls,
+ onchangecalls,
+ onresizecalls,
+ before_load_value.c_str(),
+ before_load_verbatim ? "true" : "false",
+ value.c_str(),
verbatim ? "true" : "false");
}
@@ -242,7 +262,8 @@
ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc"));
// Check that the value is reflected and onchange is called.
- EXPECT_EQ("true 0 0 1 1 abc false", GetSearchStateAsString(preview_));
+ EXPECT_EQ("true 0 0 1 1 a false abc false",
+ GetSearchStateAsString(preview_));
}
// Verify instant preview is shown correctly for a non-search query.
@@ -399,25 +420,26 @@
}
// Verifies the page was told a non-zero height.
-// TODO: when we nuke the old api and fix 66104, this test should load
-// search.html.
IN_PROC_BROWSER_TEST_F(InstantTest, ValidHeight) {
ASSERT_TRUE(test_server()->Start());
- ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("old_api.html"));
- ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"a"));
- // The preview should be active.
- ASSERT_TRUE(browser()->instant()->is_displayable());
- // And the height should be valid.
- TabContents* tab = browser()->instant()->GetPreviewContents()->tab_contents();
- ASSERT_NO_FATAL_FAILURE(
- CheckBoolValueFromJavascript(true, "window.validHeight", tab));
+ ASSERT_NO_FATAL_FAILURE(SetupInstantProvider("search.html"));
+ ASSERT_NO_FATAL_FAILURE(SetupLocationBar());
+ ASSERT_NO_FATAL_FAILURE(SetupPreview());
- // Check that searchbox height was also set.
- std::wstring script =
- L"window.domAutomationController.send(window.chrome.searchBox.height)";
+ ASSERT_NO_FATAL_FAILURE(SetLocationBarText(L"abc"));
+
int height;
- ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractInt(
- tab->render_view_host(), std::wstring(), script, &height));
+
+ // searchBox height is not yet set during initial load.
+ ASSERT_TRUE(GetIntFromJavascript(preview_,
+ "window.beforeLoadSearchBox.height",
+ &height));
+ EXPECT_EQ(0, height);
+
+ // searchBox height is available by the time the page loads.
+ ASSERT_TRUE(GetIntFromJavascript(preview_,
+ "window.chrome.searchBox.height",
+ &height));
EXPECT_GT(height, 0);
}
@@ -467,7 +489,8 @@
ASSERT_TRUE(contents);
// Check that the value is reflected and onsubmit is called.
- EXPECT_EQ("true 1 0 1 1 abc true", GetSearchStateAsString(preview_));
+ EXPECT_EQ("true 1 0 1 1 a false abc true",
+ GetSearchStateAsString(preview_));
}
// Verify that the oncancel event is dispatched upon losing focus.
@@ -490,7 +513,8 @@
ASSERT_TRUE(contents);
// Check that the value is reflected and oncancel is called.
- EXPECT_EQ("true 0 1 1 1 abc false", GetSearchStateAsString(preview_));
+ EXPECT_EQ("true 0 1 1 1 a false abc false",
+ GetSearchStateAsString(preview_));
}
#if !defined(OS_MACOSX)
@@ -514,7 +538,8 @@
ASSERT_EQ(L"abcdef", location_bar_->location_entry()->GetText());
- EXPECT_EQ("true 0 0 2 2 abcdef false", GetSearchStateAsString(preview_));
+ EXPECT_EQ("true 0 0 2 2 a false abcdef false",
+ GetSearchStateAsString(preview_));
// Pressing tab again to accept the current instant preview.
ASSERT_NO_FATAL_FAILURE(SendKey(app::VKEY_TAB));
@@ -526,5 +551,6 @@
ASSERT_TRUE(contents);
// Check that the value is reflected and onsubmit is called.
- EXPECT_EQ("true 1 0 2 2 abcdef true", GetSearchStateAsString(preview_));
+ EXPECT_EQ("true 1 0 2 2 a false abcdef true",
+ GetSearchStateAsString(preview_));
}
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index ed01fc5..fffe5db 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -224,7 +224,8 @@
}
// ReleasePreviewContents sets is_active_ to false, but we need to set it
- // beore notifying the delegate so.
+ // before notifying the delegate, otherwise if the delegate asks for the state
+ // we'll still be active.
is_active_ = false;
delegate_->HideInstant();
delete ReleasePreviewContents(INSTANT_COMMIT_DESTROY);
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index b6b47a6..3d8189d 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -203,8 +203,24 @@
void set_user_typed_before_load() { user_typed_before_load_ = true; }
+ // Sets the last URL that will be added to history when CommitHistory is
+ // invoked and removes all but the first navigation.
+ void SetLastHistoryURLAndPrune(const GURL& url) {
+ if (add_page_vector_.empty())
+ return;
+
+ history::HistoryAddPageArgs* args = add_page_vector_.front().get();
+ args->url = url;
+ args->redirects.clear();
+ args->redirects.push_back(url);
+
+ // Prune all but the first entry.
+ add_page_vector_.erase(add_page_vector_.begin() + 1,
+ add_page_vector_.end());
+ }
+
// Commits the currently buffered history.
- void CommitHistory() {
+ void CommitHistory(bool supports_instant) {
TabContents* tab = loader_->preview_contents()->tab_contents();
if (tab->profile()->IsOffTheRecord())
return;
@@ -234,6 +250,15 @@
favicon_service->SetFavicon(active_entry->url(),
active_entry->favicon().url(),
image_data);
+ if (supports_instant && !add_page_vector_.empty()) {
+ // If we're using the instant API, then we've tweaked the url that is
+ // going to be added to history. We need to also set the favicon for the
+ // url we're adding to history (see comment in ReleasePreviewContents
+ // for details).
+ favicon_service->SetFavicon(add_page_vector_.back()->url,
+ active_entry->favicon().url(),
+ image_data);
+ }
}
}
@@ -271,10 +296,6 @@
virtual void LoadingStateChanged(TabContents* source) {}
virtual void CloseContents(TabContents* source) {}
virtual void MoveContents(TabContents* source, const gfx::Rect& pos) {}
- virtual void DetachContents(TabContents* source) {}
- virtual bool IsPopup(const TabContents* source) const {
- return false;
- }
virtual bool ShouldFocusConstrainedWindow() {
// Return false so that constrained windows are not initially focused. If
// we did otherwise the preview would prematurely get committed when focus
@@ -292,15 +313,6 @@
virtual void ToolbarSizeChanged(TabContents* source, bool is_animating) {}
virtual void URLStarredChanged(TabContents* source, bool starred) {}
virtual void UpdateTargetURL(TabContents* source, const GURL& url) {}
- virtual void ContentsMouseEvent(
- TabContents* source, const gfx::Point& location, bool motion) {}
- virtual void ContentsZoomChange(bool zoom_in) {}
- virtual void OnContentSettingsChange(TabContents* source) {}
- virtual bool IsApplication() const { return false; }
- virtual void ConvertContentsToApplication(TabContents* source) {}
- virtual bool CanReloadContents(TabContents* source) const { return true; }
- virtual void ShowHtmlDialog(HtmlDialogUIDelegate* delegate,
- gfx::NativeWindow parent_window) {}
virtual bool ShouldSuppressDialogs() {
// Any message shown during instant cancels instant, so we suppress them.
return true;
@@ -308,48 +320,18 @@
virtual void BeforeUnloadFired(TabContents* tab,
bool proceed,
bool* proceed_to_fire_unload) {}
- virtual void ForwardMessageToExternalHost(const std::string& message,
- const std::string& origin,
- const std::string& target) {}
- virtual bool IsExternalTabContainer() const { return false; }
virtual void SetFocusToLocationBar(bool select_all) {}
virtual bool ShouldFocusPageAfterCrash() { return false; }
- virtual void RenderWidgetShowing() {}
- virtual bool TakeFocus(bool reverse) { return false; }
virtual void LostCapture() {
CommitFromMouseReleaseIfNecessary();
}
- virtual void SetTabContentBlocked(TabContents* contents, bool blocked) {}
- virtual void TabContentsFocused(TabContents* tab_content) {
- }
- virtual int GetExtraRenderViewHeight() const { return 0; }
virtual bool CanDownload(int request_id) { return false; }
- virtual void OnStartDownload(DownloadItem* download, TabContents* tab) {}
- virtual bool HandleContextMenu(const ContextMenuParams& params) {
- return false;
- }
- virtual bool ExecuteContextMenuCommand(int command) {
- return false;
- }
- virtual void ConfirmAddSearchProvider(const TemplateURL* template_url,
- Profile* profile) {}
- virtual void ShowPageInfo(Profile* profile,
- const GURL& url,
- const NavigationEntry::SSLStatus& ssl,
- bool show_history) {}
- virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
- bool* is_keyboard_shortcut) {
- return false;
- }
virtual void HandleMouseUp() {
CommitFromMouseReleaseIfNecessary();
}
virtual void HandleMouseActivate() {
is_mouse_down_from_activate_ = true;
}
- virtual void ShowRepostFormWarningDialog(TabContents* tab_contents) {}
- virtual void ShowContentSettingsWindow(ContentSettingsType content_type) {}
- virtual void ShowCollectedCookiesDialog(TabContents* tab_contents) {}
virtual bool OnGoToEntryOffset(int offset) { return false; }
virtual bool ShouldAddNavigationToHistory(
const history::HistoryAddPageArgs& add_page_args,
@@ -363,16 +345,6 @@
}
return false;
}
- virtual void OnDidGetApplicationInfo(TabContents* tab_contents,
- int32 page_id) {}
- virtual gfx::NativeWindow GetFrameNativeWindow() {
- return NULL;
- }
- virtual void TabContentsCreated(TabContents* new_contents) {}
- virtual bool infobars_enabled() { return false; }
- virtual bool ShouldEnablePreferredSizeNotifications() { return false; }
- virtual void UpdatePreferredSize(const gfx::Size& pref_size) {}
- virtual void ContentTypeChanged(TabContents* source) {}
virtual void OnSetSuggestions(int32 page_id,
const std::vector<std::string>& suggestions) {
@@ -523,8 +495,6 @@
if (created_preview_contents)
CreatePreviewContents(tab_contents);
- preview_tab_contents_delegate_->PrepareForNewLoad();
-
if (template_url) {
DCHECK(template_url_id_ == template_url->id());
if (!created_preview_contents) {
@@ -549,6 +519,8 @@
complete_suggested_text_.substr(user_text_.size());
}
} else {
+ preview_tab_contents_delegate_->PrepareForNewLoad();
+
// Load the instant URL. We don't reflect the url we load in url() as
// callers expect that we're loading the URL they tell us to.
//
@@ -565,6 +537,8 @@
instant_url = GURL(cl->GetSwitchValueASCII(switches::kInstantURL));
preview_contents_->controller().LoadURL(
instant_url, GURL(), transition_type);
+ preview_contents_->render_view_host()->SearchBoxChange(
+ user_text_, verbatim, 0, 0);
frame_load_observer_.reset(
new FrameLoadObserver(this,
preview_contents()->tab_contents(),
@@ -573,6 +547,7 @@
}
} else {
DCHECK(template_url_id_ == 0);
+ preview_tab_contents_delegate_->PrepareForNewLoad();
frame_load_observer_.reset(NULL);
preview_contents_->controller().LoadURL(url_, GURL(), transition_type);
}
@@ -622,12 +597,20 @@
}
omnibox_bounds_ = gfx::Rect();
last_omnibox_bounds_ = gfx::Rect();
- url_ = GURL();
+ GURL url;
+ url.Swap(&url_);
user_text_.clear();
complete_suggested_text_.clear();
if (preview_contents_.get()) {
- if (type != INSTANT_COMMIT_DESTROY)
- preview_tab_contents_delegate_->CommitHistory();
+ if (type != INSTANT_COMMIT_DESTROY) {
+ if (template_url_id_) {
+ // The URL used during instant is mostly gibberish, and not something
+ // we'll parse and match as a past search. Set it to something we can
+ // parse.
+ preview_tab_contents_delegate_->SetLastHistoryURLAndPrune(url);
+ }
+ preview_tab_contents_delegate_->CommitHistory(template_url_id_ != 0);
+ }
// Destroy the paint observer.
// RenderWidgetHostView may be null during shutdown.
if (preview_contents_->tab_contents()->GetRenderWidgetHostView()) {
diff --git a/chrome/browser/intranet_redirect_detector.h b/chrome/browser/intranet_redirect_detector.h
index 1861dce..5e920cf 100644
--- a/chrome/browser/intranet_redirect_detector.h
+++ b/chrome/browser/intranet_redirect_detector.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -71,7 +71,7 @@
// URLFetcher::Delegate
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index f20c8a6..7af736c 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -14,7 +14,7 @@
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/gpu_process_host.h"
#include "chrome/browser/net/chrome_net_log.h"
diff --git a/chrome/browser/io_thread.h b/chrome/browser/io_thread.h
index 2f47a42..3d34538 100644
--- a/chrome/browser/io_thread.h
+++ b/chrome/browser/io_thread.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -21,7 +21,6 @@
class ListValue;
class PrefService;
class PrerenderInterceptor;
-class URLRequestContext;
namespace chrome_browser_net {
class ConnectInterceptor;
@@ -38,6 +37,7 @@
class ProxyScriptFetcher;
class ProxyService;
class SSLConfigService;
+class URLRequestContext;
class URLSecurityManager;
} // namespace net
@@ -58,7 +58,7 @@
proxy_script_fetcher_http_transaction_factory;
scoped_ptr<net::URLSecurityManager> url_security_manager;
ChromeNetworkDelegate network_delegate;
- scoped_refptr<URLRequestContext> proxy_script_fetcher_context;
+ scoped_refptr<net::URLRequestContext> proxy_script_fetcher_context;
};
// |net_log| must either outlive the IOThread or be NULL.
diff --git a/chrome/browser/jankometer.cc b/chrome/browser/jankometer.cc
index ed4f9fd..ea1cf27 100644
--- a/chrome/browser/jankometer.cc
+++ b/chrome/browser/jankometer.cc
@@ -13,9 +13,9 @@
#include "base/metrics/stats_counters.h"
#include "base/ref_counted.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/watchdog.h"
+#include "base/threading/thread.h"
#include "base/time.h"
-#include "base/watchdog.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
@@ -55,7 +55,7 @@
//------------------------------------------------------------------------------
// Provide a special watchdog to make it easy to set the breakpoint on this
// class only.
-class JankWatchdog : public Watchdog {
+class JankWatchdog : public base::Watchdog {
public:
JankWatchdog(const TimeDelta& duration,
const std::string& thread_watched_name,
diff --git a/chrome/browser/jumplist_win.cc b/chrome/browser/jumplist_win.cc
index 5337df7..b953795 100644
--- a/chrome/browser/jumplist_win.cc
+++ b/chrome/browser/jumplist_win.cc
@@ -19,7 +19,7 @@
#include "base/path_service.h"
#include "base/scoped_comptr_win.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_thread.h"
@@ -293,7 +293,7 @@
if (data.empty() || !max_slots)
return S_OK;
- std::wstring category = l10n_util::GetString(category_id);
+ std::wstring category = UTF16ToWide(l10n_util::GetStringUTF16(category_id));
// Create an EnumerableObjectCollection object.
// We once add the given items to this collection object and add this
@@ -348,7 +348,8 @@
// We remove '&' characters from this string so we can share it with our
// system menu.
scoped_refptr<ShellLinkItem> chrome(new ShellLinkItem);
- std::wstring chrome_title(l10n_util::GetString(IDS_NEW_WINDOW));
+ std::wstring chrome_title =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_NEW_WINDOW));
ReplaceSubstringsAfterOffset(&chrome_title, 0, L"&", L"");
chrome->SetTitle(chrome_title);
chrome->SetIcon(chrome_path, 0, false);
@@ -360,7 +361,8 @@
scoped_refptr<ShellLinkItem> incognito(new ShellLinkItem);
incognito->SetArguments(
ASCIIToWide(std::string("--") + switches::kIncognito));
- std::wstring incognito_title(l10n_util::GetString(IDS_NEW_INCOGNITO_WINDOW));
+ std::wstring incognito_title =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_NEW_INCOGNITO_WINDOW));
ReplaceSubstringsAfterOffset(&incognito_title, 0, L"&", L"");
incognito->SetTitle(incognito_title);
incognito->SetIcon(chrome_path, 0, false);
diff --git a/chrome/browser/language_combobox_model.cc b/chrome/browser/language_combobox_model.cc
index 69a3e11..6366d59 100644
--- a/chrome/browser/language_combobox_model.cc
+++ b/chrome/browser/language_combobox_model.cc
@@ -50,14 +50,14 @@
string16 name_native =
l10n_util::GetDisplayNameForLocale(locale_code, locale_code, false);
- locale_names_.push_back(UTF16ToWideHack(name_in_current_ui));
- native_names_[UTF16ToWideHack(name_in_current_ui)] = LocaleData(
- UTF16ToWideHack(name_native), locale_codes[i]);
+ locale_names_.push_back(name_in_current_ui);
+ native_names_[name_in_current_ui] =
+ LocaleData(name_native, locale_codes[i]);
}
// Sort using locale specific sorter.
- l10n_util::SortStrings(g_browser_process->GetApplicationLocale(),
- &locale_names_);
+ l10n_util::SortStrings16(g_browser_process->GetApplicationLocale(),
+ &locale_names_);
}
void LanguageList::CopySpecifiedLanguagesUp(const std::string& locale_codes) {
@@ -76,7 +76,7 @@
return static_cast<int>(locale_names_.size());
}
-std::wstring LanguageList::GetLanguageNameAt(int index) const {
+string16 LanguageList::GetLanguageNameAt(int index) const {
DCHECK(static_cast<int>(locale_names_.size()) > index);
LocaleDataMap::const_iterator it =
native_names_.find(locale_names_[index]);
@@ -90,24 +90,25 @@
// We must add directionality formatting to both the native name and the
// locale name in order to avoid text rendering problems such as misplaced
// parentheses or languages appearing in the wrong order.
- std::wstring locale_name = locale_names_[index];
+ string16 locale_name = locale_names_[index];
base::i18n::AdjustStringForLocaleDirection(&locale_name);
- std::wstring native_name = it->second.native_name;
+ string16 native_name = it->second.native_name;
base::i18n::AdjustStringForLocaleDirection(&native_name);
// We used to have a localizable template here, but none of translators
// changed the format. We also want to switch the order of locale_name
// and native_name without going back to translators.
- std::wstring formatted_item;
- base::SStringPrintf(&formatted_item, L"%ls - %ls", locale_name.c_str(),
- native_name.c_str());
+ std::string formatted_item;
+ base::SStringPrintf(&formatted_item, "%s - %s",
+ UTF16ToUTF8(locale_name).c_str(),
+ UTF16ToUTF8(native_name).c_str());
if (base::i18n::IsRTL())
// Somehow combo box (even with LAYOUTRTL flag) doesn't get this
// right so we add RTL BDO (U+202E) to set the direction
// explicitly.
- formatted_item.insert(0, L"\x202E");
- return formatted_item;
+ formatted_item.insert(0, "\xE2\x80\xAE"); // U+202E = UTF-8 0xE280AE
+ return UTF8ToUTF16(formatted_item);
}
// Return the locale for the given index. E.g., may return pt-BR.
@@ -152,7 +153,7 @@
}
string16 LanguageComboboxModel::GetItemAt(int index) {
- return WideToUTF16Hack(GetLanguageNameAt(index));
+ return GetLanguageNameAt(index);
}
// Returns the index of the language currently specified in the user's
diff --git a/chrome/browser/language_combobox_model.h b/chrome/browser/language_combobox_model.h
index a3fdf77..7844311 100644
--- a/chrome/browser/language_combobox_model.h
+++ b/chrome/browser/language_combobox_model.h
@@ -24,13 +24,13 @@
public:
struct LocaleData {
LocaleData() { }
- LocaleData(const std::wstring& name, const std::string& code)
+ LocaleData(const string16& name, const std::string& code)
: native_name(name), locale_code(code) { }
- std::wstring native_name;
+ string16 native_name;
std::string locale_code; // E.g., en-us.
};
- typedef std::map<std::wstring, LocaleData> LocaleDataMap;
+ typedef std::map<string16, LocaleData> LocaleDataMap;
LanguageList();
@@ -44,7 +44,7 @@
int get_languages_count() const;
- std::wstring GetLanguageNameAt(int index) const;
+ string16 GetLanguageNameAt(int index) const;
// Return the locale for the given index. E.g., may return pt-BR.
std::string GetLocaleFromIndex(int index) const;
@@ -55,7 +55,7 @@
private:
// The names of all the locales in the current application locale.
- std::vector<std::wstring> locale_names_;
+ std::vector<string16> locale_names_;
// A map of some extra data (LocaleData) keyed off the name of the locale.
LocaleDataMap native_names_;
diff --git a/chrome/browser/language_order_table_model.cc b/chrome/browser/language_order_table_model.cc
index c1a4103..90501d8 100644
--- a/chrome/browser/language_order_table_model.cc
+++ b/chrome/browser/language_order_table_model.cc
@@ -39,12 +39,12 @@
observer_ = observer;
}
-std::wstring LanguageOrderTableModel::GetText(int row, int column_id) {
+string16 LanguageOrderTableModel::GetText(int row, int column_id) {
DCHECK(row >= 0 && row < RowCount());
const std::string app_locale = g_browser_process->GetApplicationLocale();
- return UTF16ToWide(l10n_util::GetDisplayNameForLocale(languages_.at(row),
- app_locale,
- true));
+ return l10n_util::GetDisplayNameForLocale(languages_.at(row),
+ app_locale,
+ true);
}
bool LanguageOrderTableModel::Add(const std::string& language) {
diff --git a/chrome/browser/language_order_table_model.h b/chrome/browser/language_order_table_model.h
index 9cfdf4c..d23f638 100644
--- a/chrome/browser/language_order_table_model.h
+++ b/chrome/browser/language_order_table_model.h
@@ -11,6 +11,7 @@
#include "app/table_model.h"
#include "base/basictypes.h"
+#include "base/compiler_specific.h"
class TableModelObserver;
@@ -43,9 +44,9 @@
std::string GetLanguageList();
// TableModel overrides:
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
- virtual void SetObserver(TableModelObserver* observer);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column_id) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
private:
// Set of entries we're showing.
diff --git a/chrome/browser/mach_broker_mac.cc b/chrome/browser/mach_broker_mac.cc
index b3afe94..4ea2069 100644
--- a/chrome/browser/mach_broker_mac.cc
+++ b/chrome/browser/mach_broker_mac.cc
@@ -7,9 +7,9 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/mach_ipc_mac.h"
-#include "base/platform_thread.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/extensions/extension_host.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -54,7 +54,7 @@
DISALLOW_COPY_AND_ASSIGN(RegisterNotificationTask);
};
-class MachListenerThreadDelegate : public PlatformThread::Delegate {
+class MachListenerThreadDelegate : public base::PlatformThread::Delegate {
public:
MachListenerThreadDelegate(MachBroker* broker) : broker_(broker) {
DCHECK(broker_);
@@ -136,7 +136,8 @@
BrowserThread::UI, FROM_HERE, new RegisterNotificationTask(this));
// Intentional leak. This thread is never joined or reaped.
- PlatformThread::CreateNonJoinable(0, new MachListenerThreadDelegate(this));
+ base::PlatformThread::CreateNonJoinable(
+ 0, new MachListenerThreadDelegate(this));
}
}
diff --git a/chrome/browser/media_uitest.cc b/chrome/browser/media_uitest.cc
index 61861e0..0d1bc26 100644
--- a/chrome/browser/media_uitest.cc
+++ b/chrome/browser/media_uitest.cc
@@ -5,8 +5,8 @@
#include "app/gfx/gl/gl_implementation.h"
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "base/platform_thread.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/test_launcher_utils.h"
#include "chrome/test/ui/ui_layout_test.h"
@@ -46,7 +46,7 @@
const std::wstring kFailed = L"FAILED";
const std::wstring kError = L"ERROR";
for (int i = 0; i < 10; ++i) {
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
const std::wstring& title = GetActiveTabTitle();
if (title == kPlaying || title == kFailed ||
StartsWith(title, kError, true))
@@ -65,7 +65,7 @@
}
};
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) || defined(OS_WIN)
// Test appears to be fine on linux, but let's first change to flaky and
// see how that goes.
// http://crbug.com/56364
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 6f83083..233f444 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -12,11 +12,15 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_child_process_host.h"
#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/renderer_host/backing_store_manager.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/bindings_policy.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -30,7 +34,8 @@
: pid(0),
num_processes(0),
is_diagnostics(false),
- type(ChildProcessInfo::UNKNOWN_PROCESS) {
+ type(ChildProcessInfo::UNKNOWN_PROCESS),
+ renderer_type(ChildProcessInfo::RENDERER_UNKNOWN) {
}
ProcessMemoryInformation::~ProcessMemoryInformation() {}
@@ -90,6 +95,7 @@
continue;
info.type = iter->type();
+ info.renderer_type = iter->renderer_type();
info.titles.push_back(WideToUTF16Hack(iter->name()));
child_info.push_back(info);
}
@@ -113,22 +119,25 @@
for (size_t index = 0; index < chrome_browser->processes.size();
index++) {
// Check if it's a renderer, if so get the list of page titles in it and
- // check if it's a diagnostics-related process. We skip all diagnostics
- // pages (e.g. "about:xxx" URLs). Iterate the RenderProcessHosts to find
- // the tab contents.
+ // check if it's a diagnostics-related process. We skip about:memory pages.
+ // Iterate the RenderProcessHosts to find the tab contents.
ProcessMemoryInformation& process =
chrome_browser->processes[index];
for (RenderProcessHost::iterator renderer_iter(
RenderProcessHost::AllHostsIterator()); !renderer_iter.IsAtEnd();
renderer_iter.Advance()) {
- DCHECK(renderer_iter.GetCurrentValue());
+ RenderProcessHost* render_process_host = renderer_iter.GetCurrentValue();
+ DCHECK(render_process_host);
// Ignore processes that don't have a connection, such as crashed tabs.
- if (!renderer_iter.GetCurrentValue()->HasConnection() || process.pid !=
- base::GetProcId(renderer_iter.GetCurrentValue()->GetHandle())) {
+ if (!render_process_host->HasConnection() ||
+ process.pid != base::GetProcId(render_process_host->GetHandle())) {
continue;
}
process.type = ChildProcessInfo::RENDER_PROCESS;
+ Profile* profile = render_process_host->profile();
+ ExtensionService* extension_service = profile->GetExtensionService();
+
// The RenderProcessHost may host multiple TabContents. Any
// of them which contain diagnostics information make the whole
// process be considered a diagnostics process.
@@ -137,7 +146,7 @@
// are always RenderWidgetHosts. But in theory, they don't
// have to be.
RenderProcessHost::listeners_iterator iter(
- renderer_iter.GetCurrentValue()->ListenersIterator());
+ render_process_host->ListenersIterator());
for (; !iter.IsAtEnd(); iter.Advance()) {
const RenderWidgetHost* widget =
static_cast<const RenderWidgetHost*>(iter.GetCurrentValue());
@@ -146,11 +155,57 @@
continue;
const RenderViewHost* host = static_cast<const RenderViewHost*>(widget);
+ RenderViewHostDelegate* host_delegate = host->delegate();
+ GURL url = host_delegate->GetURL();
+ ViewType::Type type = host_delegate->GetRenderViewType();
+ if (host->enabled_bindings() & BindingsPolicy::DOM_UI) {
+ // TODO(erikkay) the type for devtools doesn't actually appear to
+ // be set.
+ if (type == ViewType::DEV_TOOLS_UI)
+ process.renderer_type = ChildProcessInfo::RENDERER_DEVTOOLS;
+ else
+ process.renderer_type = ChildProcessInfo::RENDERER_CHROME;
+ } else if (host->enabled_bindings() & BindingsPolicy::EXTENSION) {
+ process.renderer_type = ChildProcessInfo::RENDERER_EXTENSION;
+ }
TabContents* contents = NULL;
- if (host->delegate())
- contents = host->delegate()->GetAsTabContents();
- if (!contents)
+ if (host_delegate)
+ contents = host_delegate->GetAsTabContents();
+ if (!contents) {
+ if (host->is_extension_process()) {
+ const Extension* extension =
+ extension_service->GetExtensionByURL(url);
+ if (extension) {
+ string16 title = UTF8ToUTF16(extension->name());
+ process.titles.push_back(title);
+ }
+ } else if (process.renderer_type ==
+ ChildProcessInfo::RENDERER_UNKNOWN) {
+ process.titles.push_back(UTF8ToUTF16(url.spec()));
+ switch (type) {
+ case ViewType::BACKGROUND_CONTENTS:
+ process.renderer_type =
+ ChildProcessInfo::RENDERER_BACKGROUND_APP;
+ break;
+ case ViewType::INTERSTITIAL_PAGE:
+ process.renderer_type = ChildProcessInfo::RENDERER_INTERSTITIAL;
+ break;
+ case ViewType::NOTIFICATION:
+ process.renderer_type = ChildProcessInfo::RENDERER_NOTIFICATION;
+ break;
+ default:
+ process.renderer_type = ChildProcessInfo::RENDERER_UNKNOWN;
+ break;
+ }
+ }
continue;
+ }
+
+ // Since We have a TabContents and and the renderer type hasn't been
+ // set yet, it must be a normal tabbed renderer.
+ if (process.renderer_type == ChildProcessInfo::RENDERER_UNKNOWN)
+ process.renderer_type = ChildProcessInfo::RENDERER_NORMAL;
+
string16 title = contents->GetTitle();
if (!title.length())
title = l10n_util::GetStringUTF16(IDS_DEFAULT_TAB_TITLE);
@@ -212,7 +267,11 @@
const ProcessData& browser = *ChromeBrowser();
size_t aggregate_memory = 0;
+ int chrome_count = 0;
+ int extension_count = 0;
int plugin_count = 0;
+ int renderer_count = 0;
+ int other_count = 0;
int worker_count = 0;
for (size_t index = 0; index < browser.processes.size(); index++) {
int sample = static_cast<int>(browser.processes[index].working_set.priv);
@@ -221,9 +280,30 @@
case ChildProcessInfo::BROWSER_PROCESS:
UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample);
break;
- case ChildProcessInfo::RENDER_PROCESS:
- UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample);
+ case ChildProcessInfo::RENDER_PROCESS: {
+ ChildProcessInfo::RendererProcessType renderer_type =
+ browser.processes[index].renderer_type;
+ switch (renderer_type) {
+ case ChildProcessInfo::RENDERER_EXTENSION:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Extension", sample);
+ extension_count++;
+ break;
+ case ChildProcessInfo::RENDERER_CHROME:
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Chrome", sample);
+ chrome_count++;
+ break;
+ case ChildProcessInfo::RENDERER_UNKNOWN:
+ NOTREACHED() << "Unknown renderer process type.";
+ break;
+ case ChildProcessInfo::RENDERER_NORMAL:
+ default:
+ // TODO(erikkay): Should we bother splitting out the other subtypes?
+ UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample);
+ renderer_count++;
+ break;
+ }
break;
+ }
case ChildProcessInfo::PLUGIN_PROCESS:
UMA_HISTOGRAM_MEMORY_KB("Memory.Plugin", sample);
plugin_count++;
@@ -234,21 +314,27 @@
break;
case ChildProcessInfo::UTILITY_PROCESS:
UMA_HISTOGRAM_MEMORY_KB("Memory.Utility", sample);
+ other_count++;
break;
case ChildProcessInfo::ZYGOTE_PROCESS:
UMA_HISTOGRAM_MEMORY_KB("Memory.Zygote", sample);
+ other_count++;
break;
case ChildProcessInfo::SANDBOX_HELPER_PROCESS:
UMA_HISTOGRAM_MEMORY_KB("Memory.SandboxHelper", sample);
+ other_count++;
break;
case ChildProcessInfo::NACL_LOADER_PROCESS:
UMA_HISTOGRAM_MEMORY_KB("Memory.NativeClient", sample);
+ other_count++;
break;
case ChildProcessInfo::NACL_BROKER_PROCESS:
UMA_HISTOGRAM_MEMORY_KB("Memory.NativeClientBroker", sample);
+ other_count++;
break;
case ChildProcessInfo::GPU_PROCESS:
UMA_HISTOGRAM_MEMORY_KB("Memory.Gpu", sample);
+ other_count++;
break;
default:
NOTREACHED();
@@ -259,7 +345,11 @@
UMA_HISTOGRAM_COUNTS_100("Memory.ProcessCount",
static_cast<int>(browser.processes.size()));
+ UMA_HISTOGRAM_COUNTS_100("Memory.ChromeProcessCount", chrome_count);
+ UMA_HISTOGRAM_COUNTS_100("Memory.ExtensionProcessCount", extension_count);
+ UMA_HISTOGRAM_COUNTS_100("Memory.OtherProcessCount", other_count);
UMA_HISTOGRAM_COUNTS_100("Memory.PluginProcessCount", plugin_count);
+ UMA_HISTOGRAM_COUNTS_100("Memory.RendererProcessCount", renderer_count);
UMA_HISTOGRAM_COUNTS_100("Memory.WorkerProcessCount", worker_count);
// TODO(viettrungluu): Do we want separate counts for the other
// (platform-specific) process types?
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index b39a1a6..9333b56 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -32,11 +32,14 @@
string16 product_name;
// The number of processes which this memory represents.
int num_processes;
- // A process is a diagnostics process if it is rendering
- // about:xxx information.
+ // A process is a diagnostics process if it is rendering about:memory.
+ // Mark this specially so that it can avoid counting it in its own
+ // results.
bool is_diagnostics;
// If this is a child process of Chrome, what type (i.e. plugin) it is.
ChildProcessInfo::ProcessType type;
+ // If this is a renderer process, what type it is.
+ ChildProcessInfo::RendererProcessType renderer_type;
// A collection of titles used, i.e. for a tab it'll show all the page titles.
std::vector<string16> titles;
};
diff --git a/chrome/browser/memory_details_mac.cc b/chrome/browser/memory_details_mac.cc
index 09a298f..fbc4d98 100644
--- a/chrome/browser/memory_details_mac.cc
+++ b/chrome/browser/memory_details_mac.cc
@@ -11,10 +11,10 @@
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/file_version_info.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/string_util.h"
#include "base/process_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_child_process_host.h"
#include "chrome/browser/browser_thread.h"
@@ -146,7 +146,7 @@
if (process_info.GetProcInfo(info.pid, &proc_info)) {
if (proc_info.command.length() > 1 && proc_info.command[0] == '/') {
FilePath bundle_name =
- mac_util::GetAppBundlePath(FilePath(proc_info.command));
+ base::mac::GetAppBundlePath(FilePath(proc_info.command));
if (!bundle_name.empty()) {
version_info.reset(FileVersionInfo::CreateFileVersionInfo(
bundle_name));
diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc
index 91f0b6d..4684fd0 100644
--- a/chrome/browser/memory_details_win.cc
+++ b/chrome/browser/memory_details_win.cc
@@ -1,8 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "chrome/browser/memory_details.h"
+
#include <psapi.h>
#include "app/l10n_util.h"
@@ -10,6 +11,7 @@
#include "base/file_version_info.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "base/win/scoped_handle.h"
#include "chrome/browser/browser_child_process_host.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/renderer_host/backing_store_manager.h"
@@ -34,7 +36,7 @@
MemoryDetails::MemoryDetails() {
static const std::wstring google_browser_name =
- l10n_util::GetString(IDS_PRODUCT_NAME);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
struct {
const wchar_t* name;
const wchar_t* process_name;
@@ -74,7 +76,8 @@
bool is_64bit_os =
system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64;
- ScopedHandle snapshot(::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
+ base::win::ScopedHandle snapshot(
+ ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)};
if (!snapshot.Get()) {
LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError();
@@ -86,7 +89,7 @@
}
do {
base::ProcessId pid = process_entry.th32ProcessID;
- ScopedHandle handle(::OpenProcess(
+ base::win::ScopedHandle handle(::OpenProcess(
PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid));
if (!handle.Get())
continue;
diff --git a/chrome/browser/memory_purger.cc b/chrome/browser/memory_purger.cc
index 2bfbebd..06c619e 100644
--- a/chrome/browser/memory_purger.cc
+++ b/chrome/browser/memory_purger.cc
@@ -6,7 +6,7 @@
#include <set>
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history.h"
diff --git a/chrome/browser/metrics/histogram_synchronizer.cc b/chrome/browser/metrics/histogram_synchronizer.cc
index 3a5ae08..c383594 100644
--- a/chrome/browser/metrics/histogram_synchronizer.cc
+++ b/chrome/browser/metrics/histogram_synchronizer.cc
@@ -6,7 +6,7 @@
#include "base/metrics/histogram.h"
#include "base/logging.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/common/chrome_constants.h"
@@ -57,7 +57,7 @@
TimeTicks end_time = start + wait_time;
int unresponsive_renderer_count;
{
- AutoLock auto_lock(lock_);
+ base::AutoLock auto_lock(lock_);
while (synchronous_renderers_pending_ > 0 && TimeTicks::Now() < end_time) {
wait_time = end_time - TimeTicks::Now();
received_all_renderer_histograms_.TimedWait(wait_time);
@@ -154,7 +154,7 @@
bool asynchronous_completed = false;
{
- AutoLock auto_lock(lock_);
+ base::AutoLock auto_lock(lock_);
if (sequence_number == async_sequence_number_) {
if (--async_renderers_pending_ <= 0)
asynchronous_completed = true;
@@ -179,7 +179,7 @@
int unresponsive_renderers;
const TimeTicks now = TimeTicks::Now();
{
- AutoLock auto_lock(lock_);
+ base::AutoLock auto_lock(lock_);
old_task = callback_task_;
callback_task_ = callback_task;
old_thread = callback_thread_;
@@ -202,7 +202,7 @@
TimeTicks started;
int unresponsive_renderers;
{
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (sequence_number != async_sequence_number_)
return;
task = callback_task_;
@@ -233,7 +233,7 @@
int HistogramSynchronizer::GetNextAvailableSequenceNumber(
RendererHistogramRequester requester,
int renderer_count) {
- AutoLock auto_lock(lock_);
+ base::AutoLock auto_lock(lock_);
++last_used_sequence_number_;
// Watch out for wrapping to a negative number.
if (last_used_sequence_number_ < 0) {
diff --git a/chrome/browser/metrics/histogram_synchronizer.h b/chrome/browser/metrics/histogram_synchronizer.h
index 2f75a63..222a403 100644
--- a/chrome/browser/metrics/histogram_synchronizer.h
+++ b/chrome/browser/metrics/histogram_synchronizer.h
@@ -10,9 +10,9 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/condition_variable.h"
-#include "base/lock.h"
#include "base/ref_counted.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/synchronization/lock.h"
#include "base/time.h"
class MessageLoop;
@@ -120,11 +120,11 @@
int unresponsive_renderers, const base::TimeTicks& started);
// This lock_ protects access to all members.
- Lock lock_;
+ base::Lock lock_;
// This condition variable is used to block caller of the synchronous request
// to update histograms, and to signal that thread when updates are completed.
- ConditionVariable received_all_renderer_histograms_;
+ base::ConditionVariable received_all_renderer_histograms_;
// When a request is made to asynchronously update the histograms, we store
// the task and thread we use to post a completion notification in
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 5e1af15..a5394c0 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-
-
//------------------------------------------------------------------------------
// Description of the life cycle of a instance of MetricsService.
//
@@ -163,7 +161,8 @@
#include "base/md5.h"
#include "base/metrics/histogram.h"
#include "base/string_number_conversions.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -1904,10 +1903,10 @@
}
static bool IsSingleThreaded() {
- static PlatformThreadId thread_id = 0;
+ static base::PlatformThreadId thread_id = 0;
if (!thread_id)
- thread_id = PlatformThread::CurrentId();
- return PlatformThread::CurrentId() == thread_id;
+ thread_id = base::PlatformThread::CurrentId();
+ return base::PlatformThread::CurrentId() == thread_id;
}
#if defined(OS_CHROMEOS)
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index fa15a12..a4bee94 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -274,7 +274,7 @@
// completes (either successfully or with failure).
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/metrics/metrics_service_uitest.cc b/chrome/browser/metrics/metrics_service_uitest.cc
index 16eb641..24ea726 100644
--- a/chrome/browser/metrics/metrics_service_uitest.cc
+++ b/chrome/browser/metrics/metrics_service_uitest.cc
@@ -10,7 +10,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/pref_service_mock_builder.h"
#include "chrome/browser/prefs/pref_value_store.h"
@@ -73,7 +73,7 @@
TEST_F(MetricsServiceTest, CrashRenderers) {
// This doesn't make sense to test in single process mode.
- if (in_process_renderer_)
+ if (ProxyLauncher::in_process_renderer())
return;
OpenTabs();
@@ -99,7 +99,7 @@
}
// Give the browser a chance to notice the crashed tab.
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
QuitBrowser();
diff --git a/chrome/browser/net/chrome_net_log_unittest.cc b/chrome/browser/net/chrome_net_log_unittest.cc
index 7bd9301..dead901 100644
--- a/chrome/browser/net/chrome_net_log_unittest.cc
+++ b/chrome/browser/net/chrome_net_log_unittest.cc
@@ -4,8 +4,8 @@
#include "chrome/browser/net/chrome_net_log.h"
-#include "base/waitable_event.h"
-#include "base/simple_thread.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/threading/simple_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
diff --git a/chrome/browser/net/chrome_url_request_context.h b/chrome/browser/net/chrome_url_request_context.h
index 8d1377b..93f0e37 100644
--- a/chrome/browser/net/chrome_url_request_context.h
+++ b/chrome/browser/net/chrome_url_request_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -45,7 +45,7 @@
//
// All methods of this class must be called from the IO thread,
// including the constructor and destructor.
-class ChromeURLRequestContext : public URLRequestContext {
+class ChromeURLRequestContext : public net::URLRequestContext {
public:
ChromeURLRequestContext();
@@ -214,7 +214,7 @@
// GetIOMessageLoopProxy however can be called from any thread.
//
// URLRequestContextGetter implementation.
- virtual URLRequestContext* GetURLRequestContext();
+ virtual net::URLRequestContext* GetURLRequestContext();
virtual net::CookieStore* GetCookieStore();
virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const;
@@ -301,7 +301,7 @@
// NULL if not yet initialized. Otherwise, it is the URLRequestContext
// instance that was lazilly created by GetURLRequestContext.
// Access only from the IO thread.
- scoped_refptr<URLRequestContext> url_request_context_;
+ scoped_refptr<net::URLRequestContext> url_request_context_;
DISALLOW_COPY_AND_ASSIGN(ChromeURLRequestContextGetter);
};
diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc
index 588cf57..f23d619 100644
--- a/chrome/browser/net/connection_tester.cc
+++ b/chrome/browser/net/connection_tester.cc
@@ -8,7 +8,7 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/importer/firefox_proxy_settings.h"
#include "chrome/common/chrome_switches.h"
@@ -71,6 +71,7 @@
dnsrr_resolver_, NULL /* dns_cert_checker */,
NULL /* ssl_host_info_factory */, proxy_service_,
ssl_config_service_, http_auth_handler_factory_, NULL, NULL),
+ NULL /* net_log */,
net::HttpCache::DefaultBackend::InMemory(0));
// In-memory cookie store.
cookie_store_ = new net::CookieMonster(NULL, NULL);
diff --git a/chrome/browser/net/connection_tester.h b/chrome/browser/net/connection_tester.h
index 1d206ac..dd6715d 100644
--- a/chrome/browser/net/connection_tester.h
+++ b/chrome/browser/net/connection_tester.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,7 +13,9 @@
#include "googleurl/src/gurl.h"
#include "net/base/completion_callback.h"
+namespace net {
class URLRequestContext;
+} // namespace net
// ConnectionTester runs a suite of tests (also called "experiments"),
// to try and discover why loading a particular URL is failing with an error
@@ -126,7 +128,7 @@
// |delegate| is owned by the caller, and must remain valid for the lifetime
// of ConnectionTester.
ConnectionTester(Delegate* delegate,
- URLRequestContext* proxy_request_context);
+ net::URLRequestContext* proxy_request_context);
// Note that destruction cancels any in-progress tests.
~ConnectionTester();
@@ -172,7 +174,7 @@
// of the list is the one currently in progress.
ExperimentList remaining_experiments_;
- const scoped_refptr<URLRequestContext> proxy_request_context_;
+ const scoped_refptr<net::URLRequestContext> proxy_request_context_;
DISALLOW_COPY_AND_ASSIGN(ConnectionTester);
};
diff --git a/chrome/browser/net/cookie_policy_browsertest.cc b/chrome/browser/net/cookie_policy_browsertest.cc
index fef104d..58a443d 100644
--- a/chrome/browser/net/cookie_policy_browsertest.cc
+++ b/chrome/browser/net/cookie_policy_browsertest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/task.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
diff --git a/chrome/browser/net/passive_log_collector.cc b/chrome/browser/net/passive_log_collector.cc
index 0d41479..21e2935 100644
--- a/chrome/browser/net/passive_log_collector.cc
+++ b/chrome/browser/net/passive_log_collector.cc
@@ -70,6 +70,7 @@
trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_REQUEST] =
&dns_request_tracker_;
trackers_[net::NetLog::SOURCE_HOST_RESOLVER_IMPL_JOB] = &dns_job_tracker_;
+ trackers_[net::NetLog::SOURCE_DISK_CACHE_ENTRY] = &disk_cache_entry_tracker_;
// Make sure our mapping is up-to-date.
for (size_t i = 0; i < arraysize(trackers_); ++i)
DCHECK(trackers_[i]) << "Unhandled SourceType: " << i;
@@ -560,3 +561,28 @@
return ACTION_NONE;
}
}
+
+//----------------------------------------------------------------------------
+// DiskCacheEntryTracker
+//----------------------------------------------------------------------------
+
+const size_t PassiveLogCollector::DiskCacheEntryTracker::kMaxNumSources = 100;
+const size_t PassiveLogCollector::DiskCacheEntryTracker::kMaxGraveyardSize = 25;
+
+PassiveLogCollector::DiskCacheEntryTracker::DiskCacheEntryTracker()
+ : SourceTracker(kMaxNumSources, kMaxGraveyardSize, NULL) {
+}
+
+PassiveLogCollector::SourceTracker::Action
+PassiveLogCollector::DiskCacheEntryTracker::DoAddEntry(
+ const ChromeNetLog::Entry& entry, SourceInfo* out_info) {
+ AddEntryToSourceInfo(entry, out_info);
+
+ // If the request has ended, move it to the graveyard.
+ if (entry.type == net::NetLog::TYPE_DISK_CACHE_ENTRY &&
+ entry.phase == net::NetLog::PHASE_END) {
+ return ACTION_MOVE_TO_GRAVEYARD;
+ }
+
+ return ACTION_NONE;
+}
diff --git a/chrome/browser/net/passive_log_collector.h b/chrome/browser/net/passive_log_collector.h
index 114e439..a415d59 100644
--- a/chrome/browser/net/passive_log_collector.h
+++ b/chrome/browser/net/passive_log_collector.h
@@ -304,6 +304,22 @@
DISALLOW_COPY_AND_ASSIGN(DNSJobTracker);
};
+ // Tracks the log entries for the last seen SOURCE_DISK_CACHE_ENTRY.
+ class DiskCacheEntryTracker : public SourceTracker {
+ public:
+ static const size_t kMaxNumSources;
+ static const size_t kMaxGraveyardSize;
+
+ DiskCacheEntryTracker();
+
+ protected:
+ virtual Action DoAddEntry(const ChromeNetLog::Entry& entry,
+ SourceInfo* out_info);
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DiskCacheEntryTracker);
+ };
+
PassiveLogCollector();
~PassiveLogCollector();
@@ -340,6 +356,7 @@
SpdySessionTracker spdy_session_tracker_;
DNSRequestTracker dns_request_tracker_;
DNSJobTracker dns_job_tracker_;
+ DiskCacheEntryTracker disk_cache_entry_tracker_;
// This array maps each NetLog::SourceType to one of the tracker instances
// defined above. Use of this array avoid duplicating the list of trackers
diff --git a/chrome/browser/net/predictor_api.cc b/chrome/browser/net/predictor_api.cc
index 40a583e..9296cfa 100644
--- a/chrome/browser/net/predictor_api.cc
+++ b/chrome/browser/net/predictor_api.cc
@@ -11,9 +11,9 @@
#include "base/lazy_instance.h"
#include "base/stl_util-inl.h"
#include "base/string_number_conversions.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/values.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/io_thread.h"
diff --git a/chrome/browser/net/sdch_dictionary_fetcher.h b/chrome/browser/net/sdch_dictionary_fetcher.h
index 32bf0d7..0240245 100644
--- a/chrome/browser/net/sdch_dictionary_fetcher.h
+++ b/chrome/browser/net/sdch_dictionary_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -52,7 +52,7 @@
// completes (either successfully or with failure).
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/net/sqlite_persistent_cookie_store.cc b/chrome/browser/net/sqlite_persistent_cookie_store.cc
index 23f694f..404170a 100644
--- a/chrome/browser/net/sqlite_persistent_cookie_store.cc
+++ b/chrome/browser/net/sqlite_persistent_cookie_store.cc
@@ -17,8 +17,12 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
+<<<<<<< HEAD
#include "base/thread.h"
#ifndef ANDROID
+=======
+#include "base/threading/thread.h"
+>>>>>>> chromium.org at r10.0.634.0
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/diagnostics/sqlite_diagnostics.h"
#endif
diff --git a/chrome/browser/net/ssl_config_service_manager_pref.cc b/chrome/browser/net/ssl_config_service_manager_pref.cc
index d024f72..d3eb2a1 100644
--- a/chrome/browser/net/ssl_config_service_manager_pref.cc
+++ b/chrome/browser/net/ssl_config_service_manager_pref.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/message_loop.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/io_thread.h"
#include "chrome/browser/net/ssl_config_service_manager.h"
diff --git a/chrome/browser/net/url_info_unittest.cc b/chrome/browser/net/url_info_unittest.cc
index ea7d619..870ad7e 100644
--- a/chrome/browser/net/url_info_unittest.cc
+++ b/chrome/browser/net/url_info_unittest.cc
@@ -7,7 +7,7 @@
#include <time.h>
#include <string>
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "chrome/browser/net/url_info.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -67,7 +67,7 @@
info.SetAssignedState();
EXPECT_FALSE(info.NeedsDnsUpdate());
// Greater than minimal expected network latency on DNS lookup.
- PlatformThread::Sleep(25);
+ base::PlatformThread::Sleep(25);
before_resolution_complete = TimeTicks::Now();
info.SetNoSuchNameState();
// "Immediately" check to see if we need an update yet (we shouldn't).
@@ -78,7 +78,7 @@
return;
}
// Wait over 300ms, so it should definately be considered out of cache.
- PlatformThread::Sleep(kMockExpirationTime + 20);
+ base::PlatformThread::Sleep(kMockExpirationTime + 20);
EXPECT_TRUE(info.NeedsDnsUpdate()) << "expiration time not honored";
}
diff --git a/chrome/browser/net/url_request_failed_dns_job.cc b/chrome/browser/net/url_request_failed_dns_job.cc
index 7137468..3481ee7 100644
--- a/chrome/browser/net/url_request_failed_dns_job.cc
+++ b/chrome/browser/net/url_request_failed_dns_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -27,9 +27,9 @@
&URLRequestFailedDnsJob::StartAsync));
}
-/* static */
+// static
void URLRequestFailedDnsJob::AddUrlHandler() {
- URLRequestFilter* filter = URLRequestFilter::GetInstance();
+ net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
filter->AddUrlHandler(GURL(kTestUrl),
&URLRequestFailedDnsJob::Factory);
}
diff --git a/chrome/browser/net/url_request_failed_dns_job.h b/chrome/browser/net/url_request_failed_dns_job.h
index 197fb2a..693f382 100644
--- a/chrome/browser/net/url_request_failed_dns_job.h
+++ b/chrome/browser/net/url_request_failed_dns_job.h
@@ -22,7 +22,7 @@
// A test URL that can be used in UI tests.
static const char kTestUrl[];
- // Adds the testing URLs to the URLRequestFilter.
+ // Adds the testing URLs to the net::URLRequestFilter.
static void AddUrlHandler();
private:
diff --git a/chrome/browser/net/url_request_mock_http_job.cc b/chrome/browser/net/url_request_mock_http_job.cc
index cad1a1e..3611308 100644
--- a/chrome/browser/net/url_request_mock_http_job.cc
+++ b/chrome/browser/net/url_request_mock_http_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,7 +7,7 @@
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/url_constants.h"
#include "net/base/net_util.h"
@@ -20,19 +20,19 @@
FilePath URLRequestMockHTTPJob::base_path_;
-/* static */
+// static
net::URLRequestJob* URLRequestMockHTTPJob::Factory(net::URLRequest* request,
const std::string& scheme) {
return new URLRequestMockHTTPJob(request,
GetOnDiskPath(base_path_, request, scheme));
}
-/* static */
+// static
void URLRequestMockHTTPJob::AddUrlHandler(const FilePath& base_path) {
base_path_ = base_path;
- // Add kMockHostname to URLRequestFilter.
- URLRequestFilter* filter = URLRequestFilter::GetInstance();
+ // Add kMockHostname to net::URLRequestFilter.
+ net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
filter->AddHostnameHandler("http", kMockHostname,
URLRequestMockHTTPJob::Factory);
}
diff --git a/chrome/browser/net/url_request_mock_http_job.h b/chrome/browser/net/url_request_mock_http_job.h
index bba882e..57ed24c 100644
--- a/chrome/browser/net/url_request_mock_http_job.h
+++ b/chrome/browser/net/url_request_mock_http_job.h
@@ -25,7 +25,7 @@
static net::URLRequest::ProtocolFactory Factory;
- // Adds the testing URLs to the URLRequestFilter.
+ // Adds the testing URLs to the net::URLRequestFilter.
static void AddUrlHandler(const FilePath& base_path);
// Given the path to a file relative to base_path_, construct a mock URL.
diff --git a/chrome/browser/net/url_request_mock_link_doctor_job.cc b/chrome/browser/net/url_request_mock_link_doctor_job.cc
index e11978e..1bfcb40 100644
--- a/chrome/browser/net/url_request_mock_link_doctor_job.cc
+++ b/chrome/browser/net/url_request_mock_link_doctor_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -21,16 +21,16 @@
} // namespace
-/* static */
+// static
net::URLRequestJob* URLRequestMockLinkDoctorJob::Factory(
net::URLRequest* request,
const std::string& scheme) {
return new URLRequestMockLinkDoctorJob(request);
}
-/* static */
+// static
void URLRequestMockLinkDoctorJob::AddUrlHandler() {
- URLRequestFilter* filter = URLRequestFilter::GetInstance();
+ net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
filter->AddHostnameHandler("http",
GURL(google_util::kLinkDoctorBaseURL).host(),
URLRequestMockLinkDoctorJob::Factory);
diff --git a/chrome/browser/net/url_request_mock_link_doctor_job.h b/chrome/browser/net/url_request_mock_link_doctor_job.h
index 3c3af31..1e8a5a6 100644
--- a/chrome/browser/net/url_request_mock_link_doctor_job.h
+++ b/chrome/browser/net/url_request_mock_link_doctor_job.h
@@ -16,7 +16,7 @@
static net::URLRequest::ProtocolFactory Factory;
- // Adds the testing URLs to the URLRequestFilter.
+ // Adds the testing URLs to the net::URLRequestFilter.
static void AddUrlHandler();
private:
diff --git a/chrome/browser/net/url_request_mock_net_error_job.cc b/chrome/browser/net/url_request_mock_net_error_job.cc
index 5f66bc4..b88b160 100644
--- a/chrome/browser/net/url_request_mock_net_error_job.cc
+++ b/chrome/browser/net/url_request_mock_net_error_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -44,7 +44,7 @@
#endif
url_mock_info_map_[url] = MockInfo(base, errors, ssl_cert);
- URLRequestFilter::GetInstance()
+ net::URLRequestFilter::GetInstance()
->AddUrlHandler(url, &URLRequestMockNetErrorJob::Factory);
}
@@ -53,7 +53,7 @@
URLMockInfoMap::iterator iter = url_mock_info_map_.find(url);
DCHECK(iter != url_mock_info_map_.end());
url_mock_info_map_.erase(iter);
- URLRequestFilter::GetInstance()->RemoveUrlHandler(url);
+ net::URLRequestFilter::GetInstance()->RemoveUrlHandler(url);
}
// static
diff --git a/chrome/browser/net/url_request_mock_util.cc b/chrome/browser/net/url_request_mock_util.cc
index ce32af3..b69ec5e 100644
--- a/chrome/browser/net/url_request_mock_util.cc
+++ b/chrome/browser/net/url_request_mock_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,7 +7,7 @@
#include <string>
#include "base/path_service.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/net/url_request_failed_dns_job.h"
#include "chrome/browser/net/url_request_mock_http_job.h"
@@ -30,7 +30,7 @@
// anywhere.
base::ThreadRestrictions::ScopedAllowIO allow_io;
- URLRequestFilter::GetInstance()->ClearHandlers();
+ net::URLRequestFilter::GetInstance()->ClearHandlers();
URLRequestFailedDnsJob::AddUrlHandler();
URLRequestMockLinkDoctorJob::AddUrlHandler();
@@ -42,7 +42,7 @@
URLRequestSlowHTTPJob::AddUrlHandler(root_http);
} else {
// Revert to the default handlers.
- URLRequestFilter::GetInstance()->ClearHandlers();
+ net::URLRequestFilter::GetInstance()->ClearHandlers();
}
}
diff --git a/chrome/browser/net/url_request_slow_download_job.cc b/chrome/browser/net/url_request_slow_download_job.cc
index d10591d..d4b2007 100644
--- a/chrome/browser/net/url_request_slow_download_job.cc
+++ b/chrome/browser/net/url_request_slow_download_job.cc
@@ -33,9 +33,9 @@
&URLRequestSlowDownloadJob::StartAsync));
}
-/* static */
+// static
void URLRequestSlowDownloadJob::AddUrlHandler() {
- URLRequestFilter* filter = URLRequestFilter::GetInstance();
+ net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
filter->AddUrlHandler(GURL(kUnknownSizeUrl),
&URLRequestSlowDownloadJob::Factory);
filter->AddUrlHandler(GURL(kKnownSizeUrl),
diff --git a/chrome/browser/net/url_request_slow_download_job.h b/chrome/browser/net/url_request_slow_download_job.h
index d6927b8..f84dd2c 100644
--- a/chrome/browser/net/url_request_slow_download_job.h
+++ b/chrome/browser/net/url_request_slow_download_job.h
@@ -37,7 +37,7 @@
static const char kKnownSizeUrl[];
static const char kFinishDownloadUrl[];
- // Adds the testing URLs to the URLRequestFilter.
+ // Adds the testing URLs to the net::URLRequestFilter.
static void AddUrlHandler();
private:
diff --git a/chrome/browser/net/url_request_slow_http_job.cc b/chrome/browser/net/url_request_slow_http_job.cc
index 967ea1e..04a24f9 100644
--- a/chrome/browser/net/url_request_slow_http_job.cc
+++ b/chrome/browser/net/url_request_slow_http_job.cc
@@ -1,10 +1,9 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
#include "chrome/browser/net/url_request_slow_http_job.h"
-#include "base/platform_thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "net/url_request/url_request_filter.h"
@@ -29,8 +28,8 @@
void URLRequestSlowHTTPJob::AddUrlHandler(const FilePath& base_path) {
base_path_ = base_path;
- // Add kMockHostname to URLRequestFilter.
- URLRequestFilter* filter = URLRequestFilter::GetInstance();
+ // Add kMockHostname to net::URLRequestFilter.
+ net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
filter->AddHostnameHandler("http", kMockHostname,
URLRequestSlowHTTPJob::Factory);
}
diff --git a/chrome/browser/net/url_request_slow_http_job.h b/chrome/browser/net/url_request_slow_http_job.h
index e58f8df..d46719f 100644
--- a/chrome/browser/net/url_request_slow_http_job.h
+++ b/chrome/browser/net/url_request_slow_http_job.h
@@ -19,7 +19,7 @@
static net::URLRequest::ProtocolFactory Factory;
- // Adds the testing URLs to the URLRequestFilter.
+ // Adds the testing URLs to the net::URLRequestFilter.
static void AddUrlHandler(const FilePath& base_path);
// Given the path to a file relative to base_path_, construct a mock URL.
diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc b/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
index f116119..09cccc7 100644
--- a/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
+++ b/chrome/browser/net/websocket_experiment/websocket_experiment_task.cc
@@ -295,7 +295,7 @@
void WebSocketExperimentTask::OnURLFetchComplete(
const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data) {
diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_task.h b/chrome/browser/net/websocket_experiment/websocket_experiment_task.h
index c1fe41c..b23c0a0 100644
--- a/chrome/browser/net/websocket_experiment/websocket_experiment_task.h
+++ b/chrome/browser/net/websocket_experiment/websocket_experiment_task.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -147,7 +147,7 @@
// URLFetcher::Delegate method.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/notifications/balloon.h b/chrome/browser/notifications/balloon.h
index 3f4ba0b..5b86508 100644
--- a/chrome/browser/notifications/balloon.h
+++ b/chrome/browser/notifications/balloon.h
@@ -68,6 +68,8 @@
const gfx::Size& content_size() const { return content_size_; }
void set_content_size(const gfx::Size& size) { content_size_ = size; }
+ const BalloonCollection* collection() const { return collection_; }
+
const gfx::Size& min_scrollbar_size() const { return min_scrollbar_size_; }
void set_min_scrollbar_size(const gfx::Size& size) {
min_scrollbar_size_ = size;
diff --git a/chrome/browser/notifications/balloon_collection.cc b/chrome/browser/notifications/balloon_collection.cc
index 218126b..60c9f2d 100644
--- a/chrome/browser/notifications/balloon_collection.cc
+++ b/chrome/browser/notifications/balloon_collection.cc
@@ -28,20 +28,14 @@
} // namespace
-// static
-// Note that on MacOS, since the coordinate system is inverted vertically from
-// the others, this actually produces notifications coming from the TOP right,
-// which is what is desired.
-BalloonCollectionImpl::Layout::Placement
- BalloonCollectionImpl::Layout::placement_ =
- Layout::VERTICALLY_FROM_BOTTOM_RIGHT;
-
BalloonCollectionImpl::BalloonCollectionImpl()
#if USE_OFFSETS
: ALLOW_THIS_IN_INITIALIZER_LIST(reposition_factory_(this)),
added_as_message_loop_observer_(false)
#endif
{
+
+ SetPositionPreference(BalloonCollection::DEFAULT_POSITION);
}
BalloonCollectionImpl::~BalloonCollectionImpl() {
@@ -221,26 +215,27 @@
int* total_size) const {
DCHECK(max_balloon_size && total_size);
- switch (placement_) {
- case VERTICALLY_FROM_TOP_RIGHT:
- case VERTICALLY_FROM_BOTTOM_RIGHT:
- *total_size = work_area_.height();
- *max_balloon_size = max_balloon_height();
- break;
- default:
- NOTREACHED();
- break;
- }
+ // All placement schemes are vertical, so we only care about height.
+ *total_size = work_area_.height();
+ *max_balloon_size = max_balloon_height();
}
gfx::Point BalloonCollectionImpl::Layout::GetLayoutOrigin() const {
int x = 0;
int y = 0;
switch (placement_) {
+ case VERTICALLY_FROM_TOP_LEFT:
+ x = work_area_.x() + HorizontalEdgeMargin();
+ y = work_area_.y() + VerticalEdgeMargin();
+ break;
case VERTICALLY_FROM_TOP_RIGHT:
x = work_area_.right() - HorizontalEdgeMargin();
y = work_area_.y() + VerticalEdgeMargin();
break;
+ case VERTICALLY_FROM_BOTTOM_LEFT:
+ x = work_area_.x() + HorizontalEdgeMargin();
+ y = work_area_.bottom() - VerticalEdgeMargin();
+ break;
case VERTICALLY_FROM_BOTTOM_RIGHT:
x = work_area_.right() - HorizontalEdgeMargin();
y = work_area_.bottom() - VerticalEdgeMargin();
@@ -260,12 +255,24 @@
int x = 0;
int y = 0;
switch (placement_) {
+ case VERTICALLY_FROM_TOP_LEFT:
+ x = position_iterator->x();
+ y = position_iterator->y();
+ position_iterator->set_y(position_iterator->y() + balloon_size.height() +
+ InterBalloonMargin());
+ break;
case VERTICALLY_FROM_TOP_RIGHT:
x = position_iterator->x() - balloon_size.width();
y = position_iterator->y();
position_iterator->set_y(position_iterator->y() + balloon_size.height() +
InterBalloonMargin());
break;
+ case VERTICALLY_FROM_BOTTOM_LEFT:
+ position_iterator->set_y(position_iterator->y() - balloon_size.height() -
+ InterBalloonMargin());
+ x = position_iterator->x();
+ y = position_iterator->y();
+ break;
case VERTICALLY_FROM_BOTTOM_RIGHT:
position_iterator->set_y(position_iterator->y() - balloon_size.height() -
InterBalloonMargin());
@@ -283,10 +290,18 @@
int x = 0;
int y = 0;
switch (placement_) {
+ case VERTICALLY_FROM_TOP_LEFT:
+ x = work_area_.x() + HorizontalEdgeMargin();
+ y = work_area_.y() + kBalloonMaxHeight + VerticalEdgeMargin();
+ break;
case VERTICALLY_FROM_TOP_RIGHT:
x = work_area_.right() - kBalloonMaxWidth - HorizontalEdgeMargin();
y = work_area_.y() + kBalloonMaxHeight + VerticalEdgeMargin();
break;
+ case VERTICALLY_FROM_BOTTOM_LEFT:
+ x = work_area_.x() + HorizontalEdgeMargin();
+ y = work_area_.bottom() + kBalloonMaxHeight + VerticalEdgeMargin();
+ break;
case VERTICALLY_FROM_BOTTOM_RIGHT:
x = work_area_.right() - kBalloonMaxWidth - HorizontalEdgeMargin();
y = work_area_.bottom() + kBalloonMaxHeight + VerticalEdgeMargin();
diff --git a/chrome/browser/notifications/balloon_collection.h b/chrome/browser/notifications/balloon_collection.h
index 13875dc..6909759 100644
--- a/chrome/browser/notifications/balloon_collection.h
+++ b/chrome/browser/notifications/balloon_collection.h
@@ -34,6 +34,18 @@
virtual void OnBalloonSpaceChanged() = 0;
};
+ // Do not change existing values without migration path; these
+ // are stored as integers in user preferences.
+ enum PositionPreference {
+ UPPER_RIGHT = 0,
+ LOWER_RIGHT = 1,
+ UPPER_LEFT = 2,
+ LOWER_LEFT = 3,
+
+ // The default position is different on different platforms.
+ DEFAULT_POSITION = -1
+ };
+
static BalloonCollection* Create();
BalloonCollection()
@@ -63,6 +75,9 @@
// Request the resizing of a balloon.
virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size) = 0;
+ // Set the position preference for the collection.
+ virtual void SetPositionPreference(PositionPreference position) = 0;
+
// Update for new screen dimensions.
virtual void DisplayChanged() = 0;
diff --git a/chrome/browser/notifications/balloon_collection_impl.h b/chrome/browser/notifications/balloon_collection_impl.h
index 7fb1ea9..d123717 100644
--- a/chrome/browser/notifications/balloon_collection_impl.h
+++ b/chrome/browser/notifications/balloon_collection_impl.h
@@ -47,6 +47,7 @@
virtual void RemoveAll();
virtual bool HasSpace() const;
virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size);
+ virtual void SetPositionPreference(PositionPreference position);
virtual void DisplayChanged();
virtual void OnBalloonClosed(Balloon* source);
virtual const Balloons& GetActiveBalloons() { return base_.balloons(); }
@@ -68,6 +69,15 @@
public:
Layout();
+ // These enumerations all are based on a screen orientation where
+ // the origin is the top-left.
+ enum Placement {
+ VERTICALLY_FROM_TOP_LEFT,
+ VERTICALLY_FROM_TOP_RIGHT,
+ VERTICALLY_FROM_BOTTOM_LEFT,
+ VERTICALLY_FROM_BOTTOM_RIGHT
+ };
+
// Refresh the work area and balloon placement.
void OnDisplaySettingsChanged();
@@ -80,6 +90,8 @@
// Utility function constrains the input rectangle to the min and max sizes.
static gfx::Size ConstrainToSizeLimits(const gfx::Size& rect);
+ void set_placement(Placement placement) { placement_ = placement; }
+
// Returns both the total space available and the maximum
// allowed per balloon.
//
@@ -109,11 +121,6 @@
gfx::Point OffScreenLocation() const;
private:
- enum Placement {
- VERTICALLY_FROM_TOP_RIGHT,
- VERTICALLY_FROM_BOTTOM_RIGHT
- };
-
// Layout parameters
int VerticalEdgeMargin() const;
int HorizontalEdgeMargin() const;
@@ -125,7 +132,7 @@
static const int kBalloonMinHeight = 24;
static const int kBalloonMaxHeight = 160;
- static Placement placement_;
+ Placement placement_;
gfx::Rect work_area_;
DISALLOW_COPY_AND_ASSIGN(Layout);
};
diff --git a/chrome/browser/notifications/balloon_collection_linux.cc b/chrome/browser/notifications/balloon_collection_linux.cc
index 08354a0..099193c 100644
--- a/chrome/browser/notifications/balloon_collection_linux.cc
+++ b/chrome/browser/notifications/balloon_collection_linux.cc
@@ -67,6 +67,27 @@
return bounds.Contains(cursor);
}
+void BalloonCollectionImpl::SetPositionPreference(
+ PositionPreference position) {
+ if (position == DEFAULT_POSITION)
+ position = LOWER_RIGHT;
+
+ // All positioning schemes are vertical, and linux
+ // uses the normal screen orientation.
+ if (position == UPPER_RIGHT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_TOP_RIGHT);
+ else if (position == UPPER_LEFT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_TOP_LEFT);
+ else if (position == LOWER_LEFT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_LEFT);
+ else if (position == LOWER_RIGHT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_RIGHT);
+ else
+ NOTREACHED();
+
+ PositionBalloons(true);
+}
+
// static
BalloonCollection* BalloonCollection::Create() {
return new BalloonCollectionImpl();
diff --git a/chrome/browser/notifications/balloon_collection_mac.mm b/chrome/browser/notifications/balloon_collection_mac.mm
index 7615415..d31bc39 100644
--- a/chrome/browser/notifications/balloon_collection_mac.mm
+++ b/chrome/browser/notifications/balloon_collection_mac.mm
@@ -43,6 +43,27 @@
[NSAnimationContext endGrouping];
}
+void BalloonCollectionImpl::SetPositionPreference(
+ PositionPreference position) {
+ if (position == DEFAULT_POSITION)
+ position = UPPER_RIGHT;
+
+ // All positioning schemes are vertical, but mac
+ // uses a vertically reversed screen orientation.
+ if (position == UPPER_RIGHT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_RIGHT);
+ else if (position == UPPER_LEFT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_LEFT);
+ else if (position == LOWER_LEFT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_TOP_LEFT);
+ else if (position == LOWER_RIGHT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_TOP_RIGHT);
+ else
+ NOTREACHED();
+
+ PositionBalloons(true);
+}
+
// static
BalloonCollection* BalloonCollection::Create() {
return new BalloonCollectionImpl();
diff --git a/chrome/browser/notifications/balloon_collection_win.cc b/chrome/browser/notifications/balloon_collection_win.cc
index 07bcd18..742872b 100644
--- a/chrome/browser/notifications/balloon_collection_win.cc
+++ b/chrome/browser/notifications/balloon_collection_win.cc
@@ -62,6 +62,27 @@
return bounds.Contains(cursor);
}
+void BalloonCollectionImpl::SetPositionPreference(
+ PositionPreference position) {
+ if (position == DEFAULT_POSITION)
+ position = LOWER_RIGHT;
+
+ // All positioning schemes are vertical, and windows
+ // uses the normal screen orientation.
+ if (position == UPPER_RIGHT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_TOP_RIGHT);
+ else if (position == UPPER_LEFT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_TOP_LEFT);
+ else if (position == LOWER_LEFT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_LEFT);
+ else if (position == LOWER_RIGHT)
+ layout_.set_placement(Layout::VERTICALLY_FROM_BOTTOM_RIGHT);
+ else
+ NOTREACHED();
+
+ PositionBalloons(true);
+}
+
// static
BalloonCollection* BalloonCollection::Create() {
return new BalloonCollectionImpl();
diff --git a/chrome/browser/notifications/desktop_notification_service.cc b/chrome/browser/notifications/desktop_notification_service.cc
index afc01c7..a1eaeb3 100644
--- a/chrome/browser/notifications/desktop_notification_service.cc
+++ b/chrome/browser/notifications/desktop_notification_service.cc
@@ -7,7 +7,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/metrics/histogram.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_child_process_host.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/notifications/desktop_notification_service_unittest.cc b/chrome/browser/notifications/desktop_notification_service_unittest.cc
index 4532dd2..64ad3fc 100644
--- a/chrome/browser/notifications/desktop_notification_service_unittest.cc
+++ b/chrome/browser/notifications/desktop_notification_service_unittest.cc
@@ -6,7 +6,7 @@
#include "base/message_loop.h"
#include "base/ref_counted.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/notifications/notifications_prefs_cache.h"
#include "chrome/browser/prefs/pref_service.h"
diff --git a/chrome/browser/notifications/desktop_notifications_unittest.cc b/chrome/browser/notifications/desktop_notifications_unittest.cc
index ebb6ab8..762990f 100644
--- a/chrome/browser/notifications/desktop_notifications_unittest.cc
+++ b/chrome/browser/notifications/desktop_notifications_unittest.cc
@@ -6,7 +6,9 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages_params.h"
+#include "chrome/test/testing_pref_service.h"
// static
const int MockBalloonCollection::kMockBalloonSpace = 5;
@@ -69,7 +71,8 @@
void DesktopNotificationsTest::SetUp() {
profile_.reset(new TestingProfile());
balloon_collection_ = new MockBalloonCollection();
- ui_manager_.reset(new NotificationUIManager());
+ ui_manager_.reset(
+ new NotificationUIManager(profile_->GetTestingPrefService()));
ui_manager_->Initialize(balloon_collection_);
balloon_collection_->set_space_change_listener(ui_manager_.get());
service_.reset(new DesktopNotificationService(profile(), ui_manager_.get()));
@@ -78,8 +81,8 @@
void DesktopNotificationsTest::TearDown() {
service_.reset(NULL);
- profile_.reset(NULL);
ui_manager_.reset(NULL);
+ profile_.reset(NULL);
}
ViewHostMsg_ShowNotification_Params
@@ -320,3 +323,77 @@
EXPECT_EQ(std::string::npos, data_url.spec().find("%3cscript%3e"));
EXPECT_EQ(std::string::npos, data_url.spec().find("%3ci%3e"));
}
+
+TEST_F(DesktopNotificationsTest, TestPositionPreference) {
+ // Set position preference to lower right.
+ profile_->GetPrefs()->SetInteger(prefs::kDesktopNotificationPosition,
+ BalloonCollection::LOWER_RIGHT);
+
+ // Create some notifications.
+ ViewHostMsg_ShowNotification_Params params = StandardTestNotification();
+ for (int id = 0; id <= 3; ++id) {
+ params.notification_id = id;
+ EXPECT_TRUE(service_->ShowDesktopNotification(
+ params, 0, 0, DesktopNotificationService::PageNotification));
+ }
+
+ std::deque<Balloon*>& balloons = balloon_collection_->balloons();
+ std::deque<Balloon*>::iterator iter;
+
+ // Check that they decrease in y-position (for MAC, with reversed
+ // coordinates, they should increase).
+ int last_y = -1;
+ int last_x = -1;
+
+ for (iter = balloons.begin(); iter != balloons.end(); ++iter) {
+ int current_x = (*iter)->GetPosition().x();
+ int current_y = (*iter)->GetPosition().y();
+ if (last_x > 0)
+ EXPECT_EQ(last_x, current_x);
+
+ if (last_y > 0) {
+#if defined(OS_MACOSX)
+ EXPECT_GT(current_y, last_y);
+#else
+ EXPECT_LT(current_y, last_y);
+#endif
+ }
+
+ last_x = current_x;
+ last_y = current_y;
+ }
+
+ // Now change the position to upper right. This should cause an immediate
+ // repositioning, and we check for the reverse ordering.
+ profile_->GetPrefs()->SetInteger(prefs::kDesktopNotificationPosition,
+ BalloonCollection::UPPER_RIGHT);
+ last_x = -1;
+ last_y = -1;
+
+ for (iter = balloons.begin(); iter != balloons.end(); ++iter) {
+ int current_x = (*iter)->GetPosition().x();
+ int current_y = (*iter)->GetPosition().y();
+
+ if (last_x > 0)
+ EXPECT_EQ(last_x, current_x);
+
+ if (last_y > 0) {
+#if defined(OS_MACOSX)
+ EXPECT_LT(current_y, last_y);
+#else
+ EXPECT_GT(current_y, last_y);
+#endif
+ }
+
+ last_x = current_x;
+ last_y = current_y;
+ }
+
+ // Now change the position to upper left. Confirm that the X value for the
+ // balloons gets smaller.
+ profile_->GetPrefs()->SetInteger(prefs::kDesktopNotificationPosition,
+ BalloonCollection::UPPER_LEFT);
+
+ int current_x = (*balloons.begin())->GetPosition().x();
+ EXPECT_LT(current_x, last_x);
+}
diff --git a/chrome/browser/notifications/notification_exceptions_table_model.cc b/chrome/browser/notifications/notification_exceptions_table_model.cc
index a3326f9..e70536c 100644
--- a/chrome/browser/notifications/notification_exceptions_table_model.cc
+++ b/chrome/browser/notifications/notification_exceptions_table_model.cc
@@ -7,7 +7,6 @@
#include "app/l10n_util.h"
#include "app/table_model_observer.h"
#include "base/auto_reset.h"
-#include "base/utf_string_conversions.h"
#include "chrome/common/content_settings.h"
#include "chrome/common/content_settings_helper.h"
#include "chrome/common/content_settings_types.h"
@@ -71,26 +70,26 @@
return static_cast<int>(entries_.size());
}
-std::wstring NotificationExceptionsTableModel::GetText(int row,
- int column_id) {
+string16 NotificationExceptionsTableModel::GetText(int row,
+ int column_id) {
const Entry& entry = entries_[row];
if (column_id == IDS_EXCEPTIONS_HOSTNAME_HEADER) {
- return content_settings_helper::OriginToWString(entry.origin);
+ return content_settings_helper::OriginToString16(entry.origin);
}
if (column_id == IDS_EXCEPTIONS_ACTION_HEADER) {
switch (entry.setting) {
case CONTENT_SETTING_ALLOW:
- return l10n_util::GetString(IDS_EXCEPTIONS_ALLOW_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON);
case CONTENT_SETTING_BLOCK:
- return l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON);
default:
break;
}
}
NOTREACHED();
- return std::wstring();
+ return string16();
}
void NotificationExceptionsTableModel::SetObserver(
diff --git a/chrome/browser/notifications/notification_exceptions_table_model.h b/chrome/browser/notifications/notification_exceptions_table_model.h
index 107b2ec..de19963 100644
--- a/chrome/browser/notifications/notification_exceptions_table_model.h
+++ b/chrome/browser/notifications/notification_exceptions_table_model.h
@@ -6,9 +6,9 @@
#define CHROME_BROWSER_NOTIFICATIONS_NOTIFICATION_EXCEPTIONS_TABLE_MODEL_H_
#pragma once
-#include <string>
#include <vector>
+#include "base/compiler_specific.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/remove_rows_table_model.h"
#include "chrome/common/notification_observer.h"
@@ -26,9 +26,9 @@
virtual void RemoveAll();
// Overridden from TableModel:
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
- virtual void SetObserver(TableModelObserver* observer);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column_id) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
// Overridden from NotificationObserver:
virtual void Observe(NotificationType type,
diff --git a/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc b/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc
index 18a998b..4fdcb24 100644
--- a/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc
+++ b/chrome/browser/notifications/notification_exceptions_table_model_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/notifications/notification_exceptions_table_model.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/renderer_host/test/test_render_view_host.h"
#include "chrome/test/testing_profile.h"
@@ -73,29 +74,29 @@
FillData();
EXPECT_EQ(5, model_->RowCount());
- EXPECT_EQ(L"allowed.com",
+ EXPECT_EQ(ASCIIToUTF16("allowed.com"),
model_->GetText(0, IDS_EXCEPTIONS_HOSTNAME_HEADER));
- EXPECT_EQ(l10n_util::GetString(IDS_EXCEPTIONS_ALLOW_BUTTON),
+ EXPECT_EQ(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON),
model_->GetText(0, IDS_EXCEPTIONS_ACTION_HEADER));
- EXPECT_EQ(L"denied.com",
+ EXPECT_EQ(ASCIIToUTF16("denied.com"),
model_->GetText(1, IDS_EXCEPTIONS_HOSTNAME_HEADER));
- EXPECT_EQ(l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON),
+ EXPECT_EQ(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON),
model_->GetText(1, IDS_EXCEPTIONS_ACTION_HEADER));
- EXPECT_EQ(L"denied2.com",
+ EXPECT_EQ(ASCIIToUTF16("denied2.com"),
model_->GetText(2, IDS_EXCEPTIONS_HOSTNAME_HEADER));
- EXPECT_EQ(l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON),
+ EXPECT_EQ(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON),
model_->GetText(2, IDS_EXCEPTIONS_ACTION_HEADER));
- EXPECT_EQ(L"e-allowed2.com",
+ EXPECT_EQ(ASCIIToUTF16("e-allowed2.com"),
model_->GetText(3, IDS_EXCEPTIONS_HOSTNAME_HEADER));
- EXPECT_EQ(l10n_util::GetString(IDS_EXCEPTIONS_ALLOW_BUTTON),
+ EXPECT_EQ(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON),
model_->GetText(3, IDS_EXCEPTIONS_ACTION_HEADER));
- EXPECT_EQ(L"f-denied3.com",
+ EXPECT_EQ(ASCIIToUTF16("f-denied3.com"),
model_->GetText(4, IDS_EXCEPTIONS_HOSTNAME_HEADER));
- EXPECT_EQ(l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON),
+ EXPECT_EQ(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON),
model_->GetText(4, IDS_EXCEPTIONS_ACTION_HEADER));
}
diff --git a/chrome/browser/notifications/notification_options_menu_model.cc b/chrome/browser/notifications/notification_options_menu_model.cc
index 45620c9..fb05bda 100644
--- a/chrome/browser/notifications/notification_options_menu_model.cc
+++ b/chrome/browser/notifications/notification_options_menu_model.cc
@@ -7,10 +7,14 @@
#include "app/l10n_util.h"
#include "base/compiler_specific.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extension_service.h"
+#include "chrome/browser/notifications/balloon_collection.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/notifications/notification.h"
+#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/notifications/notifications_prefs_cache.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/chrome_switches.h"
@@ -27,6 +31,89 @@
const int kTogglePermissionCommand = 0;
const int kToggleExtensionCommand = 1;
const int kOpenContentSettingsCommand = 2;
+const int kCornerSelectionSubMenu = 3;
+
+const int kCornerGroupId = 10;
+const int kCornerUpperLeft = 11;
+const int kCornerUpperRight = 12;
+const int kCornerLowerLeft = 13;
+const int kCornerLowerRight = 14;
+const int kCornerDefault = 20;
+
+CornerSelectionMenuModel::CornerSelectionMenuModel(Balloon* balloon)
+ : ALLOW_THIS_IN_INITIALIZER_LIST(menus::SimpleMenuModel(this)),
+ balloon_(balloon) {
+ AddRadioItem(kCornerDefault,
+ l10n_util::GetStringUTF16(IDS_NOTIFICATION_POSITION_DEFAULT),
+ kCornerGroupId);
+ AddSeparator();
+ AddRadioItem(kCornerUpperLeft,
+ l10n_util::GetStringUTF16(IDS_NOTIFICATION_POSITION_UPPER_LEFT),
+ kCornerGroupId);
+ AddRadioItem(kCornerUpperRight,
+ l10n_util::GetStringUTF16(IDS_NOTIFICATION_POSITION_UPPER_RIGHT),
+ kCornerGroupId);
+ AddRadioItem(kCornerLowerLeft,
+ l10n_util::GetStringUTF16(IDS_NOTIFICATION_POSITION_LOWER_LEFT),
+ kCornerGroupId);
+ AddRadioItem(kCornerLowerRight,
+ l10n_util::GetStringUTF16(IDS_NOTIFICATION_POSITION_LOWER_RIGHT),
+ kCornerGroupId);
+}
+
+CornerSelectionMenuModel::~CornerSelectionMenuModel() {
+}
+
+bool CornerSelectionMenuModel::IsCommandIdChecked(int command_id) const {
+ NotificationUIManager* ui = g_browser_process->notification_ui_manager();
+ BalloonCollection::PositionPreference current = ui->GetPositionPreference();
+
+ LOG(INFO) << "Current position preference: " << current;
+
+ if (command_id == kCornerUpperLeft)
+ return (current == BalloonCollection::UPPER_LEFT);
+ else if (command_id == kCornerUpperRight)
+ return (current == BalloonCollection::UPPER_RIGHT);
+ else if (command_id == kCornerLowerLeft)
+ return (current == BalloonCollection::LOWER_LEFT);
+ else if (command_id == kCornerLowerRight)
+ return (current == BalloonCollection::LOWER_RIGHT);
+ else if (command_id == kCornerDefault)
+ return (current == BalloonCollection::DEFAULT_POSITION);
+
+ NOTREACHED();
+ return false;
+}
+
+bool CornerSelectionMenuModel::IsCommandIdEnabled(int command_id) const {
+ // All the menu options are always enabled.
+ return true;
+}
+
+bool CornerSelectionMenuModel::GetAcceleratorForCommandId(
+ int command_id, menus::Accelerator* accelerator) {
+ // Currently no accelerators.
+ return false;
+}
+
+void CornerSelectionMenuModel::ExecuteCommand(int command_id) {
+ NotificationUIManager* ui = g_browser_process->notification_ui_manager();
+
+ LOG(INFO) << "Executing command: " << command_id;
+
+ if (command_id == kCornerUpperLeft)
+ ui->SetPositionPreference(BalloonCollection::UPPER_LEFT);
+ else if (command_id == kCornerUpperRight)
+ ui->SetPositionPreference(BalloonCollection::UPPER_RIGHT);
+ else if (command_id == kCornerLowerLeft)
+ ui->SetPositionPreference(BalloonCollection::LOWER_LEFT);
+ else if (command_id == kCornerLowerRight)
+ ui->SetPositionPreference(BalloonCollection::LOWER_RIGHT);
+ else if (command_id == kCornerDefault)
+ ui->SetPositionPreference(BalloonCollection::DEFAULT_POSITION);
+ else
+ NOTREACHED();
+}
NotificationOptionsMenuModel::NotificationOptionsMenuModel(Balloon* balloon)
: ALLOW_THIS_IN_INITIALIZER_LIST(menus::SimpleMenuModel(this)),
@@ -49,6 +136,11 @@
const string16 settings_label = l10n_util::GetStringUTF16(
IDS_NOTIFICATIONS_SETTINGS_BUTTON);
AddItem(kOpenContentSettingsCommand, settings_label);
+
+ corner_menu_model_.reset(new CornerSelectionMenuModel(balloon));
+ AddSubMenu(kCornerSelectionSubMenu,
+ l10n_util::GetStringUTF16(IDS_NOTIFICATION_CHOOSE_POSITION),
+ corner_menu_model_.get());
}
NotificationOptionsMenuModel::~NotificationOptionsMenuModel() {
diff --git a/chrome/browser/notifications/notification_options_menu_model.h b/chrome/browser/notifications/notification_options_menu_model.h
index f7f4c77..022b7e0 100644
--- a/chrome/browser/notifications/notification_options_menu_model.h
+++ b/chrome/browser/notifications/notification_options_menu_model.h
@@ -9,6 +9,28 @@
#include "app/menus/simple_menu_model.h"
#include "chrome/browser/notifications/balloon.h"
+// Model for the corner-selection submenu.
+class CornerSelectionMenuModel : public menus::SimpleMenuModel,
+ public menus::SimpleMenuModel::Delegate {
+ public:
+ explicit CornerSelectionMenuModel(Balloon* balloon);
+ virtual ~CornerSelectionMenuModel();
+
+ // Overridden from menus::SimpleMenuModel::Delegate:
+ virtual bool IsCommandIdChecked(int command_id) const;
+ virtual bool IsCommandIdEnabled(int command_id) const;
+ virtual bool GetAcceleratorForCommandId(int command_id,
+ menus::Accelerator* accelerator);
+ virtual void ExecuteCommand(int command_id);
+
+ private:
+ // Not owned.
+ Balloon* balloon_;
+
+ DISALLOW_COPY_AND_ASSIGN(CornerSelectionMenuModel);
+};
+
+// Model for the notification options menu itself.
class NotificationOptionsMenuModel : public menus::SimpleMenuModel,
public menus::SimpleMenuModel::Delegate {
public:
@@ -29,6 +51,8 @@
private:
Balloon* balloon_; // Not owned.
+ scoped_ptr<CornerSelectionMenuModel> corner_menu_model_;
+
DISALLOW_COPY_AND_ASSIGN(NotificationOptionsMenuModel);
};
diff --git a/chrome/browser/notifications/notification_ui_manager.cc b/chrome/browser/notifications/notification_ui_manager.cc
index 6e2ff02..950bd6c 100644
--- a/chrome/browser/notifications/notification_ui_manager.cc
+++ b/chrome/browser/notifications/notification_ui_manager.cc
@@ -7,11 +7,14 @@
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/notifications/balloon_collection.h"
#include "chrome/browser/notifications/notification.h"
+#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_type.h"
+#include "chrome/common/pref_names.h"
// A class which represents a notification waiting to be shown.
class QueuedNotification {
@@ -38,10 +41,11 @@
DISALLOW_COPY_AND_ASSIGN(QueuedNotification);
};
-NotificationUIManager::NotificationUIManager()
+NotificationUIManager::NotificationUIManager(PrefService* local_state)
: balloon_collection_(NULL) {
registrar_.Add(this, NotificationType::APP_TERMINATING,
NotificationService::AllSources());
+ position_pref_.Init(prefs::kDesktopNotificationPosition, local_state, this);
}
NotificationUIManager::~NotificationUIManager() {
@@ -49,14 +53,30 @@
}
// static
-NotificationUIManager* NotificationUIManager::Create() {
+NotificationUIManager* NotificationUIManager::Create(PrefService* local_state) {
BalloonCollection* balloons = BalloonCollection::Create();
- NotificationUIManager* instance = new NotificationUIManager();
+ NotificationUIManager* instance = new NotificationUIManager(local_state);
instance->Initialize(balloons);
balloons->set_space_change_listener(instance);
return instance;
}
+// static
+void NotificationUIManager::RegisterPrefs(PrefService* prefs) {
+ prefs->RegisterIntegerPref(prefs::kDesktopNotificationPosition,
+ BalloonCollection::DEFAULT_POSITION);
+}
+
+void NotificationUIManager::Initialize(
+ BalloonCollection* balloon_collection) {
+ DCHECK(!balloon_collection_.get());
+ DCHECK(balloon_collection);
+ balloon_collection_.reset(balloon_collection);
+ balloon_collection_->SetPositionPreference(
+ static_cast<BalloonCollection::PositionPreference>(
+ position_pref_.GetValue()));
+}
+
void NotificationUIManager::Add(const Notification& notification,
Profile* profile) {
if (TryReplacement(notification)) {
@@ -157,11 +177,33 @@
return false;
}
+BalloonCollection::PositionPreference
+NotificationUIManager::GetPositionPreference() {
+ LOG(INFO) << "Current position preference: " << position_pref_.GetValue();
+
+ return static_cast<BalloonCollection::PositionPreference>(
+ position_pref_.GetValue());
+}
+
+void NotificationUIManager::SetPositionPreference(
+ BalloonCollection::PositionPreference preference) {
+ LOG(INFO) << "Setting position preference: " << preference;
+ position_pref_.SetValue(static_cast<int>(preference));
+ balloon_collection_->SetPositionPreference(preference);
+}
+
void NotificationUIManager::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
- if (type == NotificationType::APP_TERMINATING)
+ if (type == NotificationType::APP_TERMINATING) {
CancelAll();
- else
+ } else if (type == NotificationType::PREF_CHANGED) {
+ std::string* name = Details<std::string>(details).ptr();
+ if (*name == prefs::kDesktopNotificationPosition)
+ balloon_collection_->SetPositionPreference(
+ static_cast<BalloonCollection::PositionPreference>(
+ position_pref_.GetValue()));
+ } else {
NOTREACHED();
+ }
}
diff --git a/chrome/browser/notifications/notification_ui_manager.h b/chrome/browser/notifications/notification_ui_manager.h
index de429db..3a0125c 100644
--- a/chrome/browser/notifications/notification_ui_manager.h
+++ b/chrome/browser/notifications/notification_ui_manager.h
@@ -13,10 +13,12 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/notifications/balloon.h"
#include "chrome/browser/notifications/balloon_collection.h"
+#include "chrome/browser/prefs/pref_member.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
class Notification;
+class PrefService;
class Profile;
class QueuedNotification;
class SiteInstance;
@@ -27,21 +29,20 @@
: public BalloonCollection::BalloonSpaceChangeListener,
public NotificationObserver {
public:
- NotificationUIManager();
+ explicit NotificationUIManager(PrefService* local_state);
virtual ~NotificationUIManager();
// Creates an initialized UI manager with a new balloon collection
// and the listener relationship setup.
// Except for unit tests, this is the way to construct the object.
- static NotificationUIManager* Create();
+ static NotificationUIManager* Create(PrefService* local_state);
+
+ // Registers preferences.
+ static void RegisterPrefs(PrefService* prefs);
// Initializes the UI manager with a balloon collection; this object
// takes ownership of the balloon collection.
- void Initialize(BalloonCollection* balloon_collection) {
- DCHECK(!balloon_collection_.get());
- DCHECK(balloon_collection);
- balloon_collection_.reset(balloon_collection);
- }
+ void Initialize(BalloonCollection* balloon_collection);
// Adds a notification to be displayed. Virtual for unit test override.
virtual void Add(const Notification& notification,
@@ -65,6 +66,13 @@
return balloon_collection_.get();
}
+ // Gets the preference indicating where notifications should be placed.
+ BalloonCollection::PositionPreference GetPositionPreference();
+
+ // Sets the preference that indicates where notifications should
+ // be placed on the screen.
+ void SetPositionPreference(BalloonCollection::PositionPreference preference);
+
// NotificationObserver interface (the event signaling kind of notifications)
virtual void Observe(NotificationType type,
const NotificationSource& source,
@@ -95,6 +103,9 @@
// Registrar for the other kind of notifications (event signaling).
NotificationRegistrar registrar_;
+ // Prefs listener for the position preference.
+ IntegerPrefMember position_pref_;
+
DISALLOW_COPY_AND_ASSIGN(NotificationUIManager);
};
diff --git a/chrome/browser/omnibox_search_hint.cc b/chrome/browser/omnibox_search_hint.cc
index e06931a..4822cc8 100644
--- a/chrome/browser/omnibox_search_hint.cc
+++ b/chrome/browser/omnibox_search_hint.cc
@@ -9,6 +9,8 @@
#include "base/command_line.h"
#include "base/metrics/histogram.h"
#include "base/task.h"
+// TODO(avi): remove when conversions not needed any more
+#include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_edit.h"
#include "chrome/browser/autocomplete/autocomplete_edit_view.h"
@@ -183,8 +185,8 @@
GetLocationBar();
AutocompleteEditView* edit_view = location_bar->location_entry();
location_bar->FocusLocation(true);
- edit_view->SetUserText(
- l10n_util::GetString(IDS_OMNIBOX_SEARCH_HINT_OMNIBOX_TEXT));
+ edit_view->SetUserText(UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_OMNIBOX_SEARCH_HINT_OMNIBOX_TEXT)));
edit_view->SelectAll(false);
// Entering text in the autocomplete edit view triggers the suggestion popup
// that we don't want to show in this case.
diff --git a/chrome/browser/oom_priority_manager.cc b/chrome/browser/oom_priority_manager.cc
index bb8ba7e..d699053 100644
--- a/chrome/browser/oom_priority_manager.cc
+++ b/chrome/browser/oom_priority_manager.cc
@@ -8,7 +8,7 @@
#include "base/process.h"
#include "base/process_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "build/build_config.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/page_info_model.cc b/chrome/browser/page_info_model.cc
index 750c45b..471962e 100644
--- a/chrome/browser/page_info_model.cc
+++ b/chrome/browser/page_info_model.cc
@@ -26,7 +26,7 @@
#include "net/base/x509_certificate.h"
#if defined(OS_MACOSX)
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#endif
PageInfoModel::PageInfoModel(Profile* profile,
@@ -277,7 +277,7 @@
// Release the NSImages.
for (std::vector<gfx::NativeImage>::iterator it = icons_.begin();
it != icons_.end(); ++it) {
- mac_util::NSObjectRelease(*it);
+ base::mac::NSObjectRelease(*it);
}
#endif
}
@@ -355,7 +355,7 @@
#if defined(OS_MACOSX)
// Unlike other platforms, the Mac ResourceBundle does not keep a shared image
// cache. These are released in the dtor.
- mac_util::NSObjectRetain(image);
+ base::mac::NSObjectRetain(image);
#endif
return image;
}
diff --git a/chrome/browser/password_manager/native_backend_gnome_x.cc b/chrome/browser/password_manager/native_backend_gnome_x.cc
index 116da64..576cd89 100644
--- a/chrome/browser/password_manager/native_backend_gnome_x.cc
+++ b/chrome/browser/password_manager/native_backend_gnome_x.cc
@@ -17,7 +17,7 @@
#include "base/string_util.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
using webkit_glue::PasswordForm;
diff --git a/chrome/browser/password_manager/password_manager.cc b/chrome/browser/password_manager/password_manager.cc
index 90de8be..a96492a 100644
--- a/chrome/browser/password_manager/password_manager.cc
+++ b/chrome/browser/password_manager/password_manager.cc
@@ -6,8 +6,8 @@
#include <vector>
-#include "base/platform_thread.h"
#include "base/stl_util-inl.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/password_manager/password_form_manager.h"
@@ -35,8 +35,9 @@
// avoid needing to lock (a static boolean flag is then sufficient to
// guarantee running only once).
static void ReportMetrics(bool password_manager_enabled) {
- static PlatformThreadId initial_thread_id = PlatformThread::CurrentId();
- DCHECK(initial_thread_id == PlatformThread::CurrentId());
+ static base::PlatformThreadId initial_thread_id =
+ base::PlatformThread::CurrentId();
+ DCHECK(initial_thread_id == base::PlatformThread::CurrentId());
static bool ran_once = false;
if (ran_once)
diff --git a/chrome/browser/password_manager/password_store.h b/chrome/browser/password_manager/password_store.h
index 4ab5575..1ac6f8b 100644
--- a/chrome/browser/password_manager/password_store.h
+++ b/chrome/browser/password_manager/password_store.h
@@ -10,7 +10,7 @@
#include <vector>
#include "base/ref_counted.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "webkit/glue/password_form.h"
diff --git a/chrome/browser/password_manager/password_store_default_unittest.cc b/chrome/browser/password_manager/password_store_default_unittest.cc
index 537b134..255a092 100644
--- a/chrome/browser/password_manager/password_store_default_unittest.cc
+++ b/chrome/browser/password_manager/password_store_default_unittest.cc
@@ -8,7 +8,7 @@
#include "base/scoped_temp_dir.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/password_manager/password_store_change.h"
#include "chrome/browser/password_manager/password_store_default.h"
#include "chrome/browser/password_manager/password_form_data.h"
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index f45200a..abdb9c7 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -11,7 +11,7 @@
#include <vector>
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/message_loop.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
@@ -565,7 +565,8 @@
password.size(), password.c_str(), &new_item);
if (result == noErr) {
- SetKeychainItemCreatorCode(new_item, mac_util::CreatorCodeForApplication());
+ SetKeychainItemCreatorCode(new_item,
+ base::mac::CreatorCodeForApplication());
keychain_->Free(new_item);
} else if (result == errSecDuplicateItem) {
// If we collide with an existing item, find and update it instead.
@@ -722,7 +723,7 @@
}
OSType MacKeychainPasswordFormAdapter::CreatorCodeForSearch() {
- return finds_only_owned_ ? mac_util::CreatorCodeForApplication() : 0;
+ return finds_only_owned_ ? base::mac::CreatorCodeForApplication() : 0;
}
#pragma mark -
diff --git a/chrome/browser/password_manager/password_store_mac.h b/chrome/browser/password_manager/password_store_mac.h
index 8a70338..371fd21 100644
--- a/chrome/browser/password_manager/password_store_mac.h
+++ b/chrome/browser/password_manager/password_store_mac.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/password_manager/login_database.h"
#include "chrome/browser/password_manager/password_store.h"
diff --git a/chrome/browser/password_manager/password_store_win_unittest.cc b/chrome/browser/password_manager/password_store_win_unittest.cc
index 824f37a..9c692b6 100644
--- a/chrome/browser/password_manager/password_store_win_unittest.cc
+++ b/chrome/browser/password_manager/password_store_win_unittest.cc
@@ -12,7 +12,7 @@
#include "base/scoped_temp_dir.h"
#include "base/stl_util-inl.h"
#include "base/time.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/password_manager/password_form_data.h"
#include "chrome/browser/password_manager/password_store_win.h"
diff --git a/chrome/browser/password_manager/password_store_x_unittest.cc b/chrome/browser/password_manager/password_store_x_unittest.cc
index eb9f5b3..94aadfc 100644
--- a/chrome/browser/password_manager/password_store_x_unittest.cc
+++ b/chrome/browser/password_manager/password_store_x_unittest.cc
@@ -7,7 +7,7 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/time.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/password_manager/password_form_data.h"
#include "chrome/browser/password_manager/password_store_change.h"
#include "chrome/browser/password_manager/password_store_x.h"
diff --git a/chrome/browser/platform_util_mac.mm b/chrome/browser/platform_util_mac.mm
index 719183d..5306598 100644
--- a/chrome/browser/platform_util_mac.mm
+++ b/chrome/browser/platform_util_mac.mm
@@ -4,6 +4,7 @@
#include "chrome/browser/platform_util.h"
+#include <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>
#import <CoreServices/CoreServices.h>
@@ -11,7 +12,6 @@
#include "app/l10n_util_mac.h"
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/mac_util.h"
#include "base/mac/scoped_aedesc.h"
#include "base/sys_string_conversions.h"
#include "googleurl/src/gurl.h"
diff --git a/chrome/browser/platform_util_win.cc b/chrome/browser/platform_util_win.cc
index f27e936..f03f653 100644
--- a/chrome/browser/platform_util_win.cc
+++ b/chrome/browser/platform_util_win.cc
@@ -9,7 +9,9 @@
#include <shellapi.h>
#include <shlobj.h>
-#include "app/win_util.h"
+#include "app/win/scoped_co_mem.h"
+#include "app/win/shell.h"
+#include "app/win/win_util.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
@@ -67,14 +69,14 @@
if (FAILED(hr))
return;
- win_util::CoMemReleaser<ITEMIDLIST> dir_item;
+ app::win::ScopedCoMem<ITEMIDLIST> dir_item;
hr = desktop->ParseDisplayName(NULL, NULL,
const_cast<wchar_t *>(dir.value().c_str()),
NULL, &dir_item, NULL);
if (FAILED(hr))
return;
- win_util::CoMemReleaser<ITEMIDLIST> file_item;
+ app::win::ScopedCoMem<ITEMIDLIST> file_item;
hr = desktop->ParseDisplayName(NULL, NULL,
const_cast<wchar_t *>(full_path.value().c_str()),
NULL, &file_item, NULL);
@@ -89,7 +91,7 @@
}
void OpenItem(const FilePath& full_path) {
- win_util::OpenItemViaShell(full_path);
+ app::win::OpenItemViaShell(full_path);
}
void OpenExternal(const GURL& url) {
@@ -160,13 +162,13 @@
void SimpleErrorBox(gfx::NativeWindow parent,
const string16& title,
const string16& message) {
- win_util::MessageBox(parent, message, title, MB_OK | MB_SETFOREGROUND);
+ app::win::MessageBox(parent, message, title, MB_OK | MB_SETFOREGROUND);
}
bool SimpleYesNoBox(gfx::NativeWindow parent,
const string16& title,
const string16& message) {
- return win_util::MessageBox(parent, message.c_str(), title.c_str(),
+ return app::win::MessageBox(parent, message.c_str(), title.c_str(),
MB_YESNO | MB_ICONWARNING | MB_SETFOREGROUND) == IDYES;
}
diff --git a/chrome/browser/plugin_download_helper.cc b/chrome/browser/plugin_download_helper.cc
index 0d85e27..e9d306c 100644
--- a/chrome/browser/plugin_download_helper.cc
+++ b/chrome/browser/plugin_download_helper.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -34,7 +34,7 @@
}
void PluginDownloadUrlHelper::InitiateDownload(
- URLRequestContext* request_context) {
+ net::URLRequestContext* request_context) {
download_file_request_ = new net::URLRequest(GURL(download_url_), this);
chrome_browser_net::SetOriginProcessUniqueIDForRequest(
download_source_child_unique_id_, download_file_request_);
diff --git a/chrome/browser/plugin_download_helper.h b/chrome/browser/plugin_download_helper.h
index cccf3f0..63b24be 100644
--- a/chrome/browser/plugin_download_helper.h
+++ b/chrome/browser/plugin_download_helper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -36,7 +36,7 @@
PluginDownloadUrlHelper::DownloadDelegate* delegate);
~PluginDownloadUrlHelper();
- void InitiateDownload(URLRequestContext* request_context);
+ void InitiateDownload(net::URLRequestContext* request_context);
// net::URLRequest::Delegate
virtual void OnAuthRequired(net::URLRequest* request,
diff --git a/chrome/browser/plugin_exceptions_table_model.cc b/chrome/browser/plugin_exceptions_table_model.cc
index 5b2a2c1..a8cc464 100644
--- a/chrome/browser/plugin_exceptions_table_model.cc
+++ b/chrome/browser/plugin_exceptions_table_model.cc
@@ -75,21 +75,21 @@
return settings_.size();
}
-std::wstring PluginExceptionsTableModel::GetText(int row, int column_id) {
+string16 PluginExceptionsTableModel::GetText(int row, int column_id) {
DCHECK_GE(row, 0);
DCHECK_LT(row, static_cast<int>(settings_.size()));
SettingsEntry& entry = settings_[row];
switch (column_id) {
case IDS_EXCEPTIONS_PATTERN_HEADER:
case IDS_EXCEPTIONS_HOSTNAME_HEADER:
- return UTF8ToWide(entry.pattern.AsString());
+ return UTF8ToUTF16(entry.pattern.AsString());
case IDS_EXCEPTIONS_ACTION_HEADER:
switch (entry.setting) {
case CONTENT_SETTING_ALLOW:
- return l10n_util::GetString(IDS_EXCEPTIONS_ALLOW_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ALLOW_BUTTON);
case CONTENT_SETTING_BLOCK:
- return l10n_util::GetString(IDS_EXCEPTIONS_BLOCK_BUTTON);
+ return l10n_util::GetStringUTF16(IDS_EXCEPTIONS_BLOCK_BUTTON);
default:
NOTREACHED();
}
@@ -99,7 +99,7 @@
NOTREACHED();
}
- return std::wstring();
+ return string16();
}
bool PluginExceptionsTableModel::HasGroups() {
@@ -154,7 +154,7 @@
plugin,
&otr_settings);
}
- std::wstring title = UTF16ToWide(plugins[i].GetGroupName());
+ string16 title = plugins[i].GetGroupName();
for (HostContentSettingsMap::SettingsForOneType::iterator setting_it =
settings.begin(); setting_it != settings.end(); ++setting_it) {
SettingsEntry entry = {
diff --git a/chrome/browser/plugin_exceptions_table_model.h b/chrome/browser/plugin_exceptions_table_model.h
index 045c218..009ab35 100644
--- a/chrome/browser/plugin_exceptions_table_model.h
+++ b/chrome/browser/plugin_exceptions_table_model.h
@@ -10,6 +10,7 @@
#include <string>
#include <vector>
+#include "base/compiler_specific.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/remove_rows_table_model.h"
#include "chrome/common/notification_observer.h"
@@ -34,12 +35,12 @@
virtual void RemoveAll();
// TableModel methods:
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
- virtual void SetObserver(TableModelObserver* observer);
- virtual bool HasGroups();
- virtual Groups GetGroups();
- virtual int GetGroupID(int row);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column_id) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
+ virtual bool HasGroups() OVERRIDE;
+ virtual Groups GetGroups() OVERRIDE;
+ virtual int GetGroupID(int row) OVERRIDE;
// NotificationObserver methods:
virtual void Observe(NotificationType type,
diff --git a/chrome/browser/plugin_process_host.cc b/chrome/browser/plugin_process_host.cc
index cb99a80..7bbb5a7 100644
--- a/chrome/browser/plugin_process_host.cc
+++ b/chrome/browser/plugin_process_host.cc
@@ -48,7 +48,7 @@
#endif
#if defined(OS_MACOSX)
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/common/plugin_carbon_interpose_constants_mac.h"
#include "gfx/rect.h"
#endif
@@ -148,22 +148,22 @@
window_index != plugin_fullscreen_windows_set_.end();
window_index++) {
if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- mac_util::ReleaseFullScreen(mac_util::kFullScreenModeHideAll);
+ base::mac::ReleaseFullScreen(base::mac::kFullScreenModeHideAll);
} else {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(mac_util::ReleaseFullScreen,
- mac_util::kFullScreenModeHideAll));
+ NewRunnableFunction(base::mac::ReleaseFullScreen,
+ base::mac::kFullScreenModeHideAll));
}
}
// If the plugin hid the cursor, reset that.
if (!plugin_cursor_visible_) {
if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
- mac_util::SetCursorVisibility(true);
+ base::mac::SetCursorVisibility(true);
} else {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(mac_util::SetCursorVisibility,
+ NewRunnableFunction(base::mac::SetCursorVisibility,
true));
}
}
diff --git a/chrome/browser/plugin_process_host_mac.cc b/chrome/browser/plugin_process_host_mac.cc
index cf05894..d976369 100644
--- a/chrome/browser/plugin_process_host_mac.cc
+++ b/chrome/browser/plugin_process_host_mac.cc
@@ -9,7 +9,7 @@
#include <vector>
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/plugin_process_host.h"
#include "chrome/common/plugin_messages.h"
@@ -44,8 +44,8 @@
// otherwise our refcounting can get skewed).
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(mac_util::RequestFullScreen,
- mac_util::kFullScreenModeHideAll));
+ NewRunnableFunction(base::mac::RequestFullScreen,
+ base::mac::kFullScreenModeHideAll));
}
}
@@ -55,10 +55,10 @@
static void ReleasePluginFullScreen(pid_t plugin_pid) {
// Releasing full screen only works if we are the frontmost process; grab
// focus, but give it back to the plugin process if requested.
- mac_util::ActivateProcess(base::GetCurrentProcId());
- mac_util::ReleaseFullScreen(mac_util::kFullScreenModeHideAll);
+ base::mac::ActivateProcess(base::GetCurrentProcId());
+ base::mac::ReleaseFullScreen(base::mac::kFullScreenModeHideAll);
if (plugin_pid != -1) {
- mac_util::ActivateProcess(plugin_pid);
+ base::mac::ActivateProcess(plugin_pid);
}
}
@@ -83,7 +83,7 @@
if (browser_needs_activation) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(mac_util::ActivateProcess,
+ NewRunnableFunction(base::mac::ActivateProcess,
base::GetCurrentProcId()));
}
}
@@ -96,7 +96,7 @@
if (!plugin_modal_windows_set_.empty()) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(mac_util::ActivateProcess, handle()));
+ NewRunnableFunction(base::mac::ActivateProcess, handle()));
}
}
@@ -105,7 +105,7 @@
plugin_cursor_visible_ = visible;
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(mac_util::SetCursorVisibility,
+ NewRunnableFunction(base::mac::SetCursorVisibility,
visible));
}
}
diff --git a/chrome/browser/plugin_service.cc b/chrome/browser/plugin_service.cc
index ee7cd81..0c8ee4c 100644
--- a/chrome/browser/plugin_service.cc
+++ b/chrome/browser/plugin_service.cc
@@ -9,10 +9,10 @@
#include "base/command_line.h"
#include "base/path_service.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/chrome_plugin_host.h"
diff --git a/chrome/browser/plugin_service.h b/chrome/browser/plugin_service.h
index a66d76a..d24c4e2 100644
--- a/chrome/browser/plugin_service.h
+++ b/chrome/browser/plugin_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -15,7 +15,7 @@
#include "base/file_path.h"
#include "base/hash_tables.h"
#include "base/singleton.h"
-#include "base/waitable_event_watcher.h"
+#include "base/synchronization/waitable_event_watcher.h"
#include "chrome/browser/plugin_process_host.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -40,8 +40,10 @@
class MessageLoop;
class Profile;
class ResourceDispatcherHost;
-class URLRequestContext;
+namespace net {
+class URLRequestContext;
+} // namespace net
namespace webkit {
namespace npapi {
diff --git a/chrome/browser/policy/asynchronous_policy_loader.cc b/chrome/browser/policy/asynchronous_policy_loader.cc
index 6ccae7a..f06ead7 100644
--- a/chrome/browser/policy/asynchronous_policy_loader.cc
+++ b/chrome/browser/policy/asynchronous_policy_loader.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -38,6 +38,9 @@
if (!stopped_) {
stopped_ = true;
delegate_.reset();
+ FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer,
+ observer_list_,
+ OnProviderGoingAway());
BrowserThread::PostTask(
BrowserThread::FILE, FROM_HERE,
NewRunnableMethod(this, &AsynchronousPolicyLoader::StopOnFileThread));
diff --git a/chrome/browser/policy/asynchronous_policy_loader_unittest.cc b/chrome/browser/policy/asynchronous_policy_loader_unittest.cc
index 3cc416c..44ab3c2 100644
--- a/chrome/browser/policy/asynchronous_policy_loader_unittest.cc
+++ b/chrome/browser/policy/asynchronous_policy_loader_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -18,6 +18,7 @@
: public ConfigurationPolicyProvider::Observer {
public:
MOCK_METHOD0(OnUpdatePolicy, void());
+ void OnProviderGoingAway() {}
};
class AsynchronousPolicyLoaderTest : public AsynchronousPolicyTestBase {
@@ -120,8 +121,7 @@
AsynchronousPolicyProvider provider(NULL, loader);
// |registrar| must be declared last so that it is destroyed first.
ConfigurationPolicyObserverRegistrar registrar;
- registrar.Init(&provider);
- registrar.AddObserver(&observer);
+ registrar.Init(&provider, &observer);
loop_.RunAllPending();
loader->Reload();
loop_.RunAllPending();
diff --git a/chrome/browser/policy/asynchronous_policy_provider.h b/chrome/browser/policy/asynchronous_policy_provider.h
index 561fc37..a6079dc 100644
--- a/chrome/browser/policy/asynchronous_policy_provider.h
+++ b/chrome/browser/policy/asynchronous_policy_provider.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_POLICY_ASYNCHRONOUS_POLICY_PROVIDER_H_
#pragma once
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "base/weak_ptr.h"
#include "chrome/browser/policy/configuration_policy_provider.h"
@@ -21,7 +21,7 @@
// policy is handled by a delegate passed at construction time.
class AsynchronousPolicyProvider
: public ConfigurationPolicyProvider,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
// Must be implemented by subclasses of the asynchronous policy provider to
// provide the implementation details of how policy is loaded.
diff --git a/chrome/browser/policy/configuration_policy_loader_win.h b/chrome/browser/policy/configuration_policy_loader_win.h
index a898afc..5fa804d 100644
--- a/chrome/browser/policy/configuration_policy_loader_win.h
+++ b/chrome/browser/policy/configuration_policy_loader_win.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_LOADER_WIN_H_
#pragma once
-#include "base/object_watcher.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
+#include "base/win/object_watcher.h"
#include "chrome/browser/policy/asynchronous_policy_loader.h"
namespace policy {
@@ -16,7 +16,7 @@
// reload when Group Policy changes.
class ConfigurationPolicyLoaderWin
: public AsynchronousPolicyLoader,
- public base::ObjectWatcher::Delegate,
+ public base::win::ObjectWatcher::Delegate,
public MessageLoop::DestructionObserver {
public:
ConfigurationPolicyLoaderWin(
@@ -44,8 +44,8 @@
base::WaitableEvent user_policy_changed_event_;
base::WaitableEvent machine_policy_changed_event_;
- base::ObjectWatcher user_policy_watcher_;
- base::ObjectWatcher machine_policy_watcher_;
+ base::win::ObjectWatcher user_policy_watcher_;
+ base::win::ObjectWatcher machine_policy_watcher_;
bool user_policy_watcher_failed_;
bool machine_policy_watcher_failed_;
diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc
index 23e6510..a942bfc 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "chrome/browser/policy/configuration_policy_pref_store.h"
+#include <map>
#include <set>
#include <string>
#include <vector>
@@ -11,29 +12,21 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/logging.h"
-#include "base/path_service.h"
#include "base/stl_util-inl.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/policy/configuration_policy_provider.h"
-#if defined(OS_WIN)
-#include "chrome/browser/policy/configuration_policy_provider_win.h"
-#elif defined(OS_MACOSX)
-#include "chrome/browser/policy/configuration_policy_provider_mac.h"
-#elif defined(OS_POSIX)
-#include "chrome/browser/policy/config_dir_policy_provider.h"
-#endif
+#include "chrome/browser/policy/configuration_policy_provider_keeper.h"
#include "chrome/browser/policy/device_management_policy_provider.h"
-#include "chrome/browser/policy/dummy_configuration_policy_provider.h"
#include "chrome/browser/policy/profile_policy_context.h"
#include "chrome/browser/prefs/pref_value_map.h"
#include "chrome/browser/prefs/proxy_prefs.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/search_terms_data.h"
#include "chrome/browser/search_engines/template_url.h"
-#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/policy_constants.h"
@@ -527,24 +520,24 @@
}
break;
case kPolicyAutoDetectProxyMode:
- if (server || bypass_list) {
+ if (server || bypass_list || pac_url) {
LOG(WARNING) << "A centrally-administered policy dictates that a proxy"
<< " shall be auto configured but specifies fixed proxy"
- << " servers or a by-pass list.";
+ << " servers, a by-pass list or a .pac script URL.";
return false;
}
break;
case kPolicyManuallyConfiguredProxyMode:
- if (!server) {
+ if (server && pac_url) {
LOG(WARNING) << "A centrally-administered policy dictates that the"
- << " system proxy settings should use fixed proxy servers"
- << " without specifying which ones.";
+ << " system proxy settings should use both a fixed"
+ << " proxy server and a .pac url.";
return false;
}
- if (pac_url) {
+ if (!server && !pac_url) {
LOG(WARNING) << "A centrally-administered policy dictates that the"
- << " system proxy settings should use fixed proxy servers"
- << " but also specifies a PAC script.";
+ << " system proxy settings should use either a fixed"
+ << " proxy server or a .pac url, but specifies neither.";
return false;
}
break;
@@ -576,11 +569,11 @@
break;
case kPolicyAutoDetectProxyMode:
mode = ProxyPrefs::MODE_AUTO_DETECT;
- if (HasProxyPolicy(kPolicyProxyPacUrl))
- mode = ProxyPrefs::MODE_PAC_SCRIPT;
break;
case kPolicyManuallyConfiguredProxyMode:
mode = ProxyPrefs::MODE_FIXED_SERVERS;
+ if (HasProxyPolicy(kPolicyProxyPacUrl))
+ mode = ProxyPrefs::MODE_PAC_SCRIPT;
break;
case kPolicyUseSystemProxyMode:
mode = ProxyPrefs::MODE_SYSTEM;
@@ -620,94 +613,6 @@
iter->second && !iter->second->IsType(Value::TYPE_NULL);
}
-namespace {
-
-// Manages the lifecycle of the shared platform-specific policy providers for
-// managed platform, device management and recommended policy. Instantiated as a
-// Singleton.
-class ConfigurationPolicyProviderKeeper {
- public:
- ConfigurationPolicyProviderKeeper()
- : managed_platform_provider_(CreateManagedPlatformProvider()),
- device_management_provider_(CreateDeviceManagementProvider()),
- recommended_provider_(CreateRecommendedProvider()) {}
- virtual ~ConfigurationPolicyProviderKeeper() {}
-
- ConfigurationPolicyProvider* managed_platform_provider() const {
- return managed_platform_provider_.get();
- }
-
- ConfigurationPolicyProvider* device_management_provider() const {
- return device_management_provider_.get();
- }
-
- ConfigurationPolicyProvider* recommended_provider() const {
- return recommended_provider_.get();
- }
-
- private:
- scoped_ptr<ConfigurationPolicyProvider> managed_platform_provider_;
- scoped_ptr<ConfigurationPolicyProvider> device_management_provider_;
- scoped_ptr<ConfigurationPolicyProvider> recommended_provider_;
-
- static ConfigurationPolicyProvider* CreateManagedPlatformProvider();
- static ConfigurationPolicyProvider* CreateDeviceManagementProvider();
- static ConfigurationPolicyProvider* CreateRecommendedProvider();
-
- DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderKeeper);
-};
-
-static base::LazyInstance<ConfigurationPolicyProviderKeeper>
- g_configuration_policy_provider_keeper(base::LINKER_INITIALIZED);
-
-ConfigurationPolicyProvider*
-ConfigurationPolicyProviderKeeper::CreateManagedPlatformProvider() {
- const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list =
- ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList();
-#if defined(OS_WIN)
- return new ConfigurationPolicyProviderWin(policy_list);
-#elif defined(OS_MACOSX)
- return new ConfigurationPolicyProviderMac(policy_list);
-#elif defined(OS_POSIX)
- FilePath config_dir_path;
- if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) {
- return new ConfigDirPolicyProvider(
- policy_list,
- config_dir_path.Append(FILE_PATH_LITERAL("managed")));
- } else {
- return new DummyConfigurationPolicyProvider(policy_list);
- }
-#else
- return new DummyConfigurationPolicyProvider(policy_list);
-#endif
-}
-
-ConfigurationPolicyProvider*
-ConfigurationPolicyProviderKeeper::CreateDeviceManagementProvider() {
- return new DummyConfigurationPolicyProvider(
- ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList());
-}
-
-ConfigurationPolicyProvider*
-ConfigurationPolicyProviderKeeper::CreateRecommendedProvider() {
- const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list =
- ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList();
-#if defined(OS_POSIX) && !defined(OS_MACOSX)
- FilePath config_dir_path;
- if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) {
- return new ConfigDirPolicyProvider(
- policy_list,
- config_dir_path.Append(FILE_PATH_LITERAL("recommended")));
- } else {
- return new DummyConfigurationPolicyProvider(policy_list);
- }
-#else
- return new DummyConfigurationPolicyProvider(policy_list);
-#endif
-}
-
-} // namespace
-
ConfigurationPolicyPrefStore::ConfigurationPolicyPrefStore(
ConfigurationPolicyProvider* provider)
: provider_(provider),
@@ -715,8 +620,7 @@
// Read initial policy.
policy_keeper_.reset(new ConfigurationPolicyPrefKeeper(provider));
- registrar_.Init(provider_);
- registrar_.AddObserver(this);
+ registrar_.Init(provider_, this);
}
ConfigurationPolicyPrefStore::~ConfigurationPolicyPrefStore() {
@@ -745,11 +649,16 @@
Refresh();
}
+void ConfigurationPolicyPrefStore::OnProviderGoingAway() {
+ provider_ = NULL;
+}
+
// static
ConfigurationPolicyPrefStore*
ConfigurationPolicyPrefStore::CreateManagedPlatformPolicyPrefStore() {
- return new ConfigurationPolicyPrefStore(
- g_configuration_policy_provider_keeper.Get().managed_platform_provider());
+ ConfigurationPolicyProviderKeeper* keeper =
+ g_browser_process->configuration_policy_provider_keeper();
+ return new ConfigurationPolicyPrefStore(keeper->managed_platform_provider());
}
// static
@@ -757,7 +666,7 @@
ConfigurationPolicyPrefStore::CreateDeviceManagementPolicyPrefStore(
Profile* profile) {
ConfigurationPolicyProviderKeeper* keeper =
- g_configuration_policy_provider_keeper.Pointer();
+ g_browser_process->configuration_policy_provider_keeper();
ConfigurationPolicyProvider* provider = NULL;
if (profile)
provider = profile->GetPolicyContext()->GetDeviceManagementPolicyProvider();
@@ -769,8 +678,9 @@
// static
ConfigurationPolicyPrefStore*
ConfigurationPolicyPrefStore::CreateRecommendedPolicyPrefStore() {
- return new ConfigurationPolicyPrefStore(
- g_configuration_policy_provider_keeper.Get().recommended_provider());
+ ConfigurationPolicyProviderKeeper* keeper =
+ g_browser_process->configuration_policy_provider_keeper();
+ return new ConfigurationPolicyPrefStore(keeper->recommended_provider());
}
/* static */
@@ -878,6 +788,9 @@
}
void ConfigurationPolicyPrefStore::Refresh() {
+ if (!provider_)
+ return;
+
// Construct a new keeper, determine what changed and swap the keeper in.
scoped_ptr<ConfigurationPolicyPrefKeeper> new_keeper(
new ConfigurationPolicyPrefKeeper(provider_));
diff --git a/chrome/browser/policy/configuration_policy_pref_store.h b/chrome/browser/policy/configuration_policy_pref_store.h
index 526d884..93b2a4a 100644
--- a/chrome/browser/policy/configuration_policy_pref_store.h
+++ b/chrome/browser/policy/configuration_policy_pref_store.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -42,6 +42,7 @@
// ConfigurationPolicyProvider::Observer methods:
virtual void OnUpdatePolicy();
+ virtual void OnProviderGoingAway();
// Creates a ConfigurationPolicyPrefStore that reads managed platform policy.
static ConfigurationPolicyPrefStore* CreateManagedPlatformPolicyPrefStore();
diff --git a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
index 1896aaa..100c774 100644
--- a/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_pref_store_unittest.cc
@@ -318,8 +318,9 @@
MockConfigurationPolicyProvider provider;
provider.AddPolicy(kPolicyProxyPacUrl,
Value::CreateStringValue("http://short.org/proxy.pac"));
- provider.AddPolicy(kPolicyProxyMode,
- Value::CreateIntegerValue(kPolicyAutoDetectProxyMode));
+ provider.AddPolicy(
+ kPolicyProxyMode,
+ Value::CreateIntegerValue(kPolicyManuallyConfiguredProxyMode));
ConfigurationPolicyPrefStore store(&provider);
VerifyProxyPrefs(
diff --git a/chrome/browser/policy/configuration_policy_provider.cc b/chrome/browser/policy/configuration_policy_provider.cc
index 2aee046..3b82134 100644
--- a/chrome/browser/policy/configuration_policy_provider.cc
+++ b/chrome/browser/policy/configuration_policy_provider.cc
@@ -1,46 +1,13 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "chrome/browser/policy/configuration_policy_provider.h"
-#include <algorithm>
-
#include "base/values.h"
namespace policy {
-ConfigurationPolicyObserverRegistrar::ConfigurationPolicyObserverRegistrar() {}
-
-ConfigurationPolicyObserverRegistrar::~ConfigurationPolicyObserverRegistrar() {
- RemoveAll();
-}
-
-void ConfigurationPolicyObserverRegistrar::Init(
- ConfigurationPolicyProvider* provider) {
- provider_ = provider;
-}
-
-void ConfigurationPolicyObserverRegistrar::AddObserver(
- ConfigurationPolicyProvider::Observer* observer) {
- observers_.push_back(observer);
- provider_->AddObserver(observer);
-}
-
-void ConfigurationPolicyObserverRegistrar::RemoveObserver(
- ConfigurationPolicyProvider::Observer* observer) {
- std::remove(observers_.begin(), observers_.end(), observer);
- provider_->RemoveObserver(observer);
-}
-
-void ConfigurationPolicyObserverRegistrar::RemoveAll() {
- for (std::vector<ConfigurationPolicyProvider::Observer*>::iterator it =
- observers_.begin(); it != observers_.end(); ++it) {
- provider_->RemoveObserver(*it);
- }
- observers_.clear();
-}
-
// Class ConfigurationPolicyProvider.
ConfigurationPolicyProvider::ConfigurationPolicyProvider(
@@ -65,4 +32,31 @@
// supports it.
}
+// Class ConfigurationPolicyObserverRegistrar.
+
+ConfigurationPolicyObserverRegistrar::ConfigurationPolicyObserverRegistrar() {}
+
+ConfigurationPolicyObserverRegistrar::~ConfigurationPolicyObserverRegistrar() {
+ if (provider_)
+ provider_->RemoveObserver(this);
+}
+
+void ConfigurationPolicyObserverRegistrar::Init(
+ ConfigurationPolicyProvider* provider,
+ ConfigurationPolicyProvider::Observer* observer) {
+ provider_ = provider;
+ observer_ = observer;
+ provider_->AddObserver(this);
+}
+
+void ConfigurationPolicyObserverRegistrar::OnUpdatePolicy() {
+ observer_->OnUpdatePolicy();
+}
+
+void ConfigurationPolicyObserverRegistrar::OnProviderGoingAway() {
+ observer_->OnProviderGoingAway();
+ provider_->RemoveObserver(this);
+ provider_ = NULL;
+}
+
} // namespace policy
diff --git a/chrome/browser/policy/configuration_policy_provider.h b/chrome/browser/policy/configuration_policy_provider.h
index 5639235..81c1813 100644
--- a/chrome/browser/policy/configuration_policy_provider.h
+++ b/chrome/browser/policy/configuration_policy_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,7 +7,6 @@
#pragma once
#include <string>
-#include <vector>
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
@@ -25,6 +24,7 @@
public:
virtual ~Observer() {}
virtual void OnUpdatePolicy() = 0;
+ virtual void OnProviderGoingAway() = 0;
};
// Used for static arrays of policy values that is used to initialize an
@@ -83,17 +83,25 @@
// Manages observers for a ConfigurationPolicyProvider. Is used to register
// observers, and automatically removes them upon destruction.
-class ConfigurationPolicyObserverRegistrar {
+// Implementation detail: to avoid duplicate bookkeeping of registered
+// observers, this registrar class acts as a proxy for notifications (since it
+// needs to register itself anyway to get OnProviderGoingAway notifications).
+class ConfigurationPolicyObserverRegistrar
+ : ConfigurationPolicyProvider::Observer {
public:
ConfigurationPolicyObserverRegistrar();
~ConfigurationPolicyObserverRegistrar();
- void Init(ConfigurationPolicyProvider* provider);
- void AddObserver(ConfigurationPolicyProvider::Observer* observer);
- void RemoveObserver(ConfigurationPolicyProvider::Observer* observer);
- void RemoveAll();
+ void Init(ConfigurationPolicyProvider* provider,
+ ConfigurationPolicyProvider::Observer* observer);
+
+ // ConfigurationPolicyProvider::Observer implementation:
+ virtual void OnUpdatePolicy();
+ virtual void OnProviderGoingAway();
+
private:
ConfigurationPolicyProvider* provider_;
- std::vector<ConfigurationPolicyProvider::Observer*> observers_;
+ ConfigurationPolicyProvider::Observer* observer_;
+
DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyObserverRegistrar);
};
diff --git a/chrome/browser/policy/configuration_policy_provider_keeper.cc b/chrome/browser/policy/configuration_policy_provider_keeper.cc
new file mode 100644
index 0000000..768bb93
--- /dev/null
+++ b/chrome/browser/policy/configuration_policy_provider_keeper.cc
@@ -0,0 +1,98 @@
+// 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 "chrome/browser/policy/configuration_policy_provider_keeper.h"
+
+#include "base/path_service.h"
+#include "chrome/browser/policy/configuration_policy_pref_store.h"
+#include "chrome/browser/policy/configuration_policy_provider.h"
+#if defined(OS_WIN)
+#include "chrome/browser/policy/configuration_policy_provider_win.h"
+#elif defined(OS_MACOSX)
+#include "chrome/browser/policy/configuration_policy_provider_mac.h"
+#elif defined(OS_POSIX)
+#include "chrome/browser/policy/config_dir_policy_provider.h"
+#endif
+#include "chrome/browser/policy/dummy_configuration_policy_provider.h"
+#include "chrome/common/chrome_paths.h"
+
+namespace policy {
+
+ConfigurationPolicyProviderKeeper::ConfigurationPolicyProviderKeeper()
+ : managed_platform_provider_(CreateManagedPlatformProvider()),
+ device_management_provider_(CreateDeviceManagementProvider()),
+ recommended_provider_(CreateRecommendedProvider()) {
+}
+
+ConfigurationPolicyProviderKeeper::ConfigurationPolicyProviderKeeper(
+ ConfigurationPolicyProvider* managed_platform_provider,
+ ConfigurationPolicyProvider* device_management_provider,
+ ConfigurationPolicyProvider* recommended_provider)
+ : managed_platform_provider_(managed_platform_provider),
+ device_management_provider_(device_management_provider),
+ recommended_provider_(recommended_provider) {
+}
+
+ConfigurationPolicyProvider*
+ ConfigurationPolicyProviderKeeper::managed_platform_provider() const {
+ return managed_platform_provider_.get();
+}
+
+ConfigurationPolicyProvider*
+ ConfigurationPolicyProviderKeeper::device_management_provider() const {
+ return device_management_provider_.get();
+}
+
+ConfigurationPolicyProvider*
+ ConfigurationPolicyProviderKeeper::recommended_provider() const {
+ return recommended_provider_.get();
+}
+
+ConfigurationPolicyProvider*
+ ConfigurationPolicyProviderKeeper::CreateManagedPlatformProvider() {
+ const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list =
+ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList();
+#if defined(OS_WIN)
+ return new ConfigurationPolicyProviderWin(policy_list);
+#elif defined(OS_MACOSX)
+ return new ConfigurationPolicyProviderMac(policy_list);
+#elif defined(OS_POSIX)
+ FilePath config_dir_path;
+ if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) {
+ return new ConfigDirPolicyProvider(
+ policy_list,
+ config_dir_path.Append(FILE_PATH_LITERAL("managed")));
+ } else {
+ return new DummyConfigurationPolicyProvider(policy_list);
+ }
+#else
+ return new DummyConfigurationPolicyProvider(policy_list);
+#endif
+}
+
+ConfigurationPolicyProvider*
+ ConfigurationPolicyProviderKeeper::CreateDeviceManagementProvider() {
+ return new DummyConfigurationPolicyProvider(
+ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList());
+}
+
+ConfigurationPolicyProvider*
+ ConfigurationPolicyProviderKeeper::CreateRecommendedProvider() {
+ const ConfigurationPolicyProvider::PolicyDefinitionList* policy_list =
+ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList();
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+ FilePath config_dir_path;
+ if (PathService::Get(chrome::DIR_POLICY_FILES, &config_dir_path)) {
+ return new ConfigDirPolicyProvider(
+ policy_list,
+ config_dir_path.Append(FILE_PATH_LITERAL("recommended")));
+ } else {
+ return new DummyConfigurationPolicyProvider(policy_list);
+ }
+#else
+ return new DummyConfigurationPolicyProvider(policy_list);
+#endif
+}
+
+} // namespace
diff --git a/chrome/browser/policy/configuration_policy_provider_keeper.h b/chrome/browser/policy/configuration_policy_provider_keeper.h
new file mode 100644
index 0000000..6994de4
--- /dev/null
+++ b/chrome/browser/policy/configuration_policy_provider_keeper.h
@@ -0,0 +1,46 @@
+// 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.
+
+#ifndef CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_KEEPER_H_
+#define CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_KEEPER_H_
+#pragma once
+
+#include "base/scoped_ptr.h"
+#include "chrome/browser/policy/configuration_policy_provider.h"
+
+namespace policy {
+
+// Manages the lifecycle of the shared platform-specific policy providers for
+// managed platform, device management and recommended policy.
+class ConfigurationPolicyProviderKeeper {
+ public:
+ ConfigurationPolicyProviderKeeper();
+ // Tests can pass in their own (dummy) providers using this c'tor.
+ ConfigurationPolicyProviderKeeper(
+ ConfigurationPolicyProvider* managed_platform_provider,
+ ConfigurationPolicyProvider* device_management_provider,
+ ConfigurationPolicyProvider* recommended_provider);
+ virtual ~ConfigurationPolicyProviderKeeper() {}
+
+ ConfigurationPolicyProvider* managed_platform_provider() const;
+
+ ConfigurationPolicyProvider* device_management_provider() const;
+
+ ConfigurationPolicyProvider* recommended_provider() const;
+
+ private:
+ scoped_ptr<ConfigurationPolicyProvider> managed_platform_provider_;
+ scoped_ptr<ConfigurationPolicyProvider> device_management_provider_;
+ scoped_ptr<ConfigurationPolicyProvider> recommended_provider_;
+
+ static ConfigurationPolicyProvider* CreateManagedPlatformProvider();
+ static ConfigurationPolicyProvider* CreateDeviceManagementProvider();
+ static ConfigurationPolicyProvider* CreateRecommendedProvider();
+
+ DISALLOW_COPY_AND_ASSIGN(ConfigurationPolicyProviderKeeper);
+};
+
+} // namespace policy
+
+#endif // CHROME_BROWSER_POLICY_CONFIGURATION_POLICY_PROVIDER_KEEPER_H_
diff --git a/chrome/browser/policy/device_management_backend.h b/chrome/browser/policy/device_management_backend.h
index 24e7315..114c7b7 100644
--- a/chrome/browser/policy/device_management_backend.h
+++ b/chrome/browser/policy/device_management_backend.h
@@ -9,7 +9,7 @@
#include <string>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/browser/policy/proto/device_management_backend.pb.h"
namespace policy {
@@ -20,7 +20,7 @@
// server, which provides services to register Chrome installations and CrOS
// devices for the purpose of fetching centrally-administered policy from the
// cloud.
-class DeviceManagementBackend : NonThreadSafe {
+class DeviceManagementBackend : base::NonThreadSafe {
public:
enum ErrorCode {
// Request payload invalid.
diff --git a/chrome/browser/policy/device_management_backend_mock.cc b/chrome/browser/policy/device_management_backend_mock.cc
new file mode 100644
index 0000000..b8dcf5f
--- /dev/null
+++ b/chrome/browser/policy/device_management_backend_mock.cc
@@ -0,0 +1,21 @@
+// 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 "chrome/browser/policy/device_management_backend_mock.h"
+
+namespace policy {
+
+DeviceRegisterResponseDelegateMock::DeviceRegisterResponseDelegateMock() {}
+
+DeviceRegisterResponseDelegateMock::~DeviceRegisterResponseDelegateMock() {}
+
+DeviceUnregisterResponseDelegateMock::DeviceUnregisterResponseDelegateMock() {}
+
+DeviceUnregisterResponseDelegateMock::~DeviceUnregisterResponseDelegateMock() {}
+
+DevicePolicyResponseDelegateMock::DevicePolicyResponseDelegateMock() {}
+
+DevicePolicyResponseDelegateMock::~DevicePolicyResponseDelegateMock() {}
+
+} // namespace policy
diff --git a/chrome/browser/policy/device_management_backend_mock.h b/chrome/browser/policy/device_management_backend_mock.h
index 9e082a6..0533efc 100644
--- a/chrome/browser/policy/device_management_backend_mock.h
+++ b/chrome/browser/policy/device_management_backend_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -15,6 +15,9 @@
class DeviceRegisterResponseDelegateMock
: public DeviceManagementBackend::DeviceRegisterResponseDelegate {
public:
+ DeviceRegisterResponseDelegateMock();
+ virtual ~DeviceRegisterResponseDelegateMock();
+
MOCK_METHOD1(HandleRegisterResponse, void(const em::DeviceRegisterResponse&));
MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
};
@@ -22,6 +25,9 @@
class DeviceUnregisterResponseDelegateMock
: public DeviceManagementBackend::DeviceUnregisterResponseDelegate {
public:
+ DeviceUnregisterResponseDelegateMock();
+ virtual ~DeviceUnregisterResponseDelegateMock();
+
MOCK_METHOD1(HandleUnregisterResponse,
void(const em::DeviceUnregisterResponse&));
MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
@@ -30,6 +36,9 @@
class DevicePolicyResponseDelegateMock
: public DeviceManagementBackend::DevicePolicyResponseDelegate {
public:
+ DevicePolicyResponseDelegateMock();
+ virtual ~DevicePolicyResponseDelegateMock();
+
MOCK_METHOD1(HandlePolicyResponse, void(const em::DevicePolicyResponse&));
MOCK_METHOD1(OnError, void(DeviceManagementBackend::ErrorCode error));
};
diff --git a/chrome/browser/policy/device_management_policy_provider.cc b/chrome/browser/policy/device_management_policy_provider.cc
index 1a1f0c2..8b9d9b4 100644
--- a/chrome/browser/policy/device_management_policy_provider.cc
+++ b/chrome/browser/policy/device_management_policy_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -108,7 +108,11 @@
unmanaged_device_refresh_rate_ms);
}
-DeviceManagementPolicyProvider::~DeviceManagementPolicyProvider() {}
+DeviceManagementPolicyProvider::~DeviceManagementPolicyProvider() {
+ FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer,
+ observer_list_,
+ OnProviderGoingAway());
+}
bool DeviceManagementPolicyProvider::Provide(
ConfigurationPolicyStoreInterface* policy_store) {
@@ -183,12 +187,6 @@
StopWaitingForInitialPolicies();
}
-void DeviceManagementPolicyProvider::Shutdown() {
- profile_ = NULL;
- if (token_fetcher_)
- token_fetcher_->Shutdown();
-}
-
void DeviceManagementPolicyProvider::AddObserver(
ConfigurationPolicyProvider::Observer* observer) {
observer_list_.AddObserver(observer);
diff --git a/chrome/browser/policy/device_management_policy_provider.h b/chrome/browser/policy/device_management_policy_provider.h
index 17edf82..fd18bc3 100644
--- a/chrome/browser/policy/device_management_policy_provider.h
+++ b/chrome/browser/policy/device_management_policy_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -54,10 +54,6 @@
virtual void OnTokenError();
virtual void OnNotManaged();
- // Tells the provider that the passed in token service reference is about to
- // become invalid.
- void Shutdown();
-
private:
class InitializeAfterIOThreadExistsTask;
class RefreshTask;
diff --git a/chrome/browser/policy/device_management_policy_provider_unittest.cc b/chrome/browser/policy/device_management_policy_provider_unittest.cc
index 4886f9d..eac2c5b 100644
--- a/chrome/browser/policy/device_management_policy_provider_unittest.cc
+++ b/chrome/browser/policy/device_management_policy_provider_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -34,6 +34,7 @@
: public ConfigurationPolicyProvider::Observer {
public:
MOCK_METHOD0(OnUpdatePolicy, void());
+ void OnProviderGoingAway() {}
};
class DeviceManagementPolicyProviderTest : public testing::Test {
@@ -207,8 +208,7 @@
TEST_F(DeviceManagementPolicyProviderTest, FetchTriggersRefresh) {
MockConfigurationPolicyObserver observer;
ConfigurationPolicyObserverRegistrar registrar;
- registrar.Init(provider_.get());
- registrar.AddObserver(&observer);
+ registrar.Init(provider_.get(), &observer);
EXPECT_CALL(observer, OnUpdatePolicy()).Times(1);
SimulateSuccessfulInitialPolicyFetch();
}
diff --git a/chrome/browser/policy/device_management_service.h b/chrome/browser/policy/device_management_service.h
index eab4c21..76a3520 100644
--- a/chrome/browser/policy/device_management_service.h
+++ b/chrome/browser/policy/device_management_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -34,10 +34,10 @@
virtual ~DeviceManagementJob() {}
// Handles the URL request response.
- virtual void HandleResponse(const URLRequestStatus& status,
- int response_code,
- const ResponseCookies& cookies,
- const std::string& data) = 0;
+ virtual void HandleResponse(const net::URLRequestStatus& status,
+ int response_code,
+ const ResponseCookies& cookies,
+ const std::string& data) = 0;
// Gets the URL to contact.
virtual GURL GetURL(const std::string& server_url) = 0;
@@ -79,7 +79,7 @@
// URLFetcher::Delegate override.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/policy/device_token_fetcher.cc b/chrome/browser/policy/device_token_fetcher.cc
index 678c90f..2d514b6 100644
--- a/chrome/browser/policy/device_token_fetcher.cc
+++ b/chrome/browser/policy/device_token_fetcher.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -212,11 +212,6 @@
}
}
-void DeviceTokenFetcher::Shutdown() {
- profile_ = NULL;
- backend_ = NULL;
-}
-
void DeviceTokenFetcher::AttemptTokenLoadFromDisk() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
if (file_util::PathExists(token_path_)) {
diff --git a/chrome/browser/policy/device_token_fetcher.h b/chrome/browser/policy/device_token_fetcher.h
index c36af5b..ae22f3d 100644
--- a/chrome/browser/policy/device_token_fetcher.h
+++ b/chrome/browser/policy/device_token_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,7 +12,7 @@
#include "base/file_path.h"
#include "base/observer_list.h"
#include "base/ref_counted.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/policy/device_management_backend.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -79,10 +79,6 @@
// will need the token in the future. Must be called on the UI thread.
void StartFetching();
- // Instructs the fetcher to shut down, before the backend and token service
- // references become stale.
- void Shutdown();
-
// Returns true if there is a pending token request to the device management
// server.
bool IsTokenPending();
diff --git a/chrome/browser/policy/dummy_configuration_policy_provider.cc b/chrome/browser/policy/dummy_configuration_policy_provider.cc
index 9a8f491..973ee4c 100644
--- a/chrome/browser/policy/dummy_configuration_policy_provider.cc
+++ b/chrome/browser/policy/dummy_configuration_policy_provider.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,6 +12,9 @@
}
DummyConfigurationPolicyProvider::~DummyConfigurationPolicyProvider() {
+ FOR_EACH_OBSERVER(ConfigurationPolicyProvider::Observer,
+ observer_list_,
+ OnProviderGoingAway());
}
bool DummyConfigurationPolicyProvider::Provide(
@@ -19,4 +22,14 @@
return true;
}
+void DummyConfigurationPolicyProvider::AddObserver(
+ ConfigurationPolicyProvider::Observer* observer) {
+ observer_list_.AddObserver(observer);
+}
+
+void DummyConfigurationPolicyProvider::RemoveObserver(
+ ConfigurationPolicyProvider::Observer* observer) {
+ observer_list_.RemoveObserver(observer);
+}
+
} // namespace policy
diff --git a/chrome/browser/policy/dummy_configuration_policy_provider.h b/chrome/browser/policy/dummy_configuration_policy_provider.h
index 22ca152..119a74b 100644
--- a/chrome/browser/policy/dummy_configuration_policy_provider.h
+++ b/chrome/browser/policy/dummy_configuration_policy_provider.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_POLICY_DUMMY_CONFIGURATION_POLICY_PROVIDER_H_
#pragma once
+#include "base/observer_list.h"
#include "chrome/browser/policy/configuration_policy_provider.h"
namespace policy {
@@ -22,9 +23,10 @@
private:
// ConfigurationPolicyProvider overrides:
- virtual void AddObserver(ConfigurationPolicyProvider::Observer* observer) {}
- virtual void RemoveObserver(
- ConfigurationPolicyProvider::Observer* observer) {}
+ virtual void AddObserver(ConfigurationPolicyProvider::Observer* observer);
+ virtual void RemoveObserver(ConfigurationPolicyProvider::Observer* observer);
+
+ ObserverList<ConfigurationPolicyProvider::Observer, true> observer_list_;
DISALLOW_COPY_AND_ASSIGN(DummyConfigurationPolicyProvider);
};
diff --git a/chrome/browser/policy/profile_policy_context.cc b/chrome/browser/policy/profile_policy_context.cc
index c4b6e5b..c221529 100644
--- a/chrome/browser/policy/profile_policy_context.cc
+++ b/chrome/browser/policy/profile_policy_context.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -39,8 +39,6 @@
void ProfilePolicyContext::Shutdown() {
if (device_management_service_.get())
device_management_service_->Shutdown();
- if (device_management_policy_provider_.get())
- device_management_policy_provider_->Shutdown();
}
DeviceManagementPolicyProvider*
diff --git a/chrome/browser/possible_url_model.cc b/chrome/browser/possible_url_model.cc
index 3d4d662..31bfd2b 100644
--- a/chrome/browser/possible_url_model.cc
+++ b/chrome/browser/possible_url_model.cc
@@ -125,14 +125,14 @@
return results_[row].title;
}
-std::wstring PossibleURLModel::GetText(int row, int col_id) {
+string16 PossibleURLModel::GetText(int row, int col_id) {
if (row < 0 || row >= RowCount()) {
NOTREACHED();
- return std::wstring();
+ return string16();
}
if (col_id == IDS_ASI_PAGE_COLUMN) {
- std::wstring title = GetTitle(row);
+ string16 title = WideToUTF16Hack(GetTitle(row));
// TODO(xji): Consider adding a special case if the title text is a URL,
// since those should always have LTR directionality. Please refer to
// http://crbug.com/6726 for more information.
@@ -143,7 +143,7 @@
// TODO(brettw): this should probably pass the GURL up so the URL elider
// can be used at a higher level when we know the width.
string16 url = results_[row].display_url.display_url();
- return UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(url));
+ return base::i18n::GetDisplayStringInLTRDirectionality(url);
}
SkBitmap PossibleURLModel::GetIcon(int row) {
diff --git a/chrome/browser/possible_url_model.h b/chrome/browser/possible_url_model.h
index 0c0b531..8bd61c6 100644
--- a/chrome/browser/possible_url_model.h
+++ b/chrome/browser/possible_url_model.h
@@ -11,6 +11,7 @@
#include <vector>
#include "app/table_model.h"
+#include "base/compiler_specific.h"
#include "chrome/browser/history/history.h"
class SkBitmap;
@@ -32,25 +33,21 @@
void OnHistoryQueryComplete(HistoryService::Handle h,
history::QueryResults* result);
- virtual int RowCount();
-
const GURL& GetURL(int row);
-
const std::wstring& GetTitle(int row);
- virtual std::wstring GetText(int row, int col_id);
-
- virtual SkBitmap GetIcon(int row);
-
- virtual int CompareValues(int row1, int row2, int column_id);
-
virtual void OnFavIconAvailable(FaviconService::Handle h,
bool fav_icon_available,
scoped_refptr<RefCountedMemory> data,
bool expired,
GURL icon_url);
- virtual void SetObserver(TableModelObserver* observer);
+ // TableModel overrides
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int col_id) OVERRIDE;
+ virtual SkBitmap GetIcon(int row) OVERRIDE;
+ virtual int CompareValues(int row1, int row2, int column_id) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
private:
// The current profile.
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 1d21c1f..1aa3c9e 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -34,6 +34,7 @@
#include "chrome/browser/net/predictor_api.h"
#include "chrome/browser/net/pref_proxy_config_service.h"
#include "chrome/browser/net/net_pref_observer.h"
+#include "chrome/browser/notifications/notification_ui_manager.h"
#include "chrome/browser/notifications/desktop_notification_service.h"
#include "chrome/browser/page_info_model.h"
#include "chrome/browser/password_manager/password_manager.h"
@@ -100,6 +101,7 @@
geolocation::RegisterPrefs(local_state);
AutoFillManager::RegisterBrowserPrefs(local_state);
BackgroundPageTracker::RegisterPrefs(local_state);
+ NotificationUIManager::RegisterPrefs(local_state);
#if defined(OS_CHROMEOS)
chromeos::UserManager::RegisterPrefs(local_state);
chromeos::UserCrosSettingsProvider::RegisterPrefs(local_state);
diff --git a/chrome/browser/prefs/pref_notifier_impl.h b/chrome/browser/prefs/pref_notifier_impl.h
index 1d61830..085e547 100644
--- a/chrome/browser/prefs/pref_notifier_impl.h
+++ b/chrome/browser/prefs/pref_notifier_impl.h
@@ -9,8 +9,8 @@
#include <string>
#include "base/hash_tables.h"
-#include "base/non_thread_safe.h"
#include "base/observer_list.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/browser/prefs/pref_notifier.h"
class PrefService;
@@ -18,7 +18,7 @@
// The PrefNotifier implementation used by the PrefService.
class PrefNotifierImpl : public PrefNotifier,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
explicit PrefNotifierImpl(PrefService* pref_service);
virtual ~PrefNotifierImpl();
diff --git a/chrome/browser/prefs/pref_observer_mock.cc b/chrome/browser/prefs/pref_observer_mock.cc
new file mode 100644
index 0000000..a41ed5c
--- /dev/null
+++ b/chrome/browser/prefs/pref_observer_mock.cc
@@ -0,0 +1,19 @@
+// 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 "chrome/browser/prefs/pref_observer_mock.h"
+
+PrefObserverMock::PrefObserverMock() {}
+
+PrefObserverMock::~PrefObserverMock() {}
+
+void PrefObserverMock::Expect(const PrefService* prefs,
+ const std::string& pref_name,
+ const Value* value) {
+ EXPECT_CALL(*this, Observe(NotificationType(NotificationType::PREF_CHANGED),
+ Source<PrefService>(prefs),
+ Property(&Details<std::string>::ptr,
+ Pointee(pref_name))))
+ .With(PrefValueMatches(prefs, pref_name, value));
+}
diff --git a/chrome/browser/prefs/pref_observer_mock.h b/chrome/browser/prefs/pref_observer_mock.h
index f339841..0c651ca 100644
--- a/chrome/browser/prefs/pref_observer_mock.h
+++ b/chrome/browser/prefs/pref_observer_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -39,8 +39,8 @@
// A mock for testing preference notifications and easy setup of expectations.
class PrefObserverMock : public NotificationObserver {
public:
- PrefObserverMock() {}
- virtual ~PrefObserverMock() {}
+ PrefObserverMock();
+ virtual ~PrefObserverMock();
MOCK_METHOD3(Observe, void(NotificationType type,
const NotificationSource& source,
@@ -48,13 +48,7 @@
void Expect(const PrefService* prefs,
const std::string& pref_name,
- const Value* value) {
- EXPECT_CALL(*this, Observe(NotificationType(NotificationType::PREF_CHANGED),
- Source<PrefService>(prefs),
- Property(&Details<std::string>::ptr,
- Pointee(pref_name))))
- .With(PrefValueMatches(prefs, pref_name, value));
- }
+ const Value* value);
};
#endif // CHROME_BROWSER_PREFS_PREF_OBSERVER_MOCK_H_
diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h
index 178dce7..9e1bd33 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -11,9 +11,9 @@
#include <set>
#include <string>
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "base/values.h"
class DefaultPrefStore;
@@ -31,7 +31,7 @@
class PrefMemberBase;
};
-class PrefService : public NonThreadSafe {
+class PrefService : public base::NonThreadSafe {
public:
// A helper class to store all the information associated with a preference.
class Preference {
diff --git a/chrome/browser/prefs/pref_service_mock_builder.cc b/chrome/browser/prefs/pref_service_mock_builder.cc
index 005b700..b02a334 100644
--- a/chrome/browser/prefs/pref_service_mock_builder.cc
+++ b/chrome/browser/prefs/pref_service_mock_builder.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -15,6 +15,8 @@
: user_prefs_(new TestingPrefStore) {
}
+PrefServiceMockBuilder::~PrefServiceMockBuilder() {}
+
PrefServiceMockBuilder&
PrefServiceMockBuilder::WithManagedPlatformPrefs(PrefStore* store) {
managed_platform_prefs_.reset(store);
diff --git a/chrome/browser/prefs/pref_service_mock_builder.h b/chrome/browser/prefs/pref_service_mock_builder.h
index b8e3275..9cc4fcc 100644
--- a/chrome/browser/prefs/pref_service_mock_builder.h
+++ b/chrome/browser/prefs/pref_service_mock_builder.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -24,6 +24,7 @@
class PrefServiceMockBuilder {
public:
PrefServiceMockBuilder();
+ ~PrefServiceMockBuilder();
// Functions for setting the various parameters of the PrefService to build.
// These take ownership of the |store| parameter.
diff --git a/chrome/browser/prerender/prerender_manager.h b/chrome/browser/prerender/prerender_manager.h
index 045581c..2c49e68 100644
--- a/chrome/browser/prerender/prerender_manager.h
+++ b/chrome/browser/prerender/prerender_manager.h
@@ -8,8 +8,8 @@
#include <list>
-#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
@@ -19,7 +19,7 @@
// PrerenderManager is responsible for initiating and keeping prerendered
// views of webpages.
-class PrerenderManager : NonThreadSafe {
+class PrerenderManager : base::NonThreadSafe {
public:
// Owned by a Profile object for the lifetime of the profile.
explicit PrerenderManager(Profile* profile);
diff --git a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
index fddff26..d34d939 100644
--- a/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
+++ b/chrome/browser/printing/cloud_print/cloud_print_setup_flow.cc
@@ -170,7 +170,8 @@
}
std::wstring CloudPrintSetupFlow::GetDialogTitle() const {
- return l10n_util::GetString(IDS_CLOUD_PRINT_SETUP_DIALOG_TITLE);
+ return UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_CLOUD_PRINT_SETUP_DIALOG_TITLE));
}
bool CloudPrintSetupFlow::IsDialogModal() const {
@@ -270,10 +271,11 @@
void CloudPrintSetupFlow::ShowSetupDone() {
setup_done_ = true;
- std::wstring product_name = l10n_util::GetString(IDS_PRODUCT_NAME);
- std::wstring message = l10n_util::GetStringF(IDS_CLOUD_PRINT_SETUP_DONE,
- product_name,
- UTF8ToWide(login_));
+ string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
+ std::wstring message =
+ UTF16ToWideHack(l10n_util::GetStringFUTF16(IDS_CLOUD_PRINT_SETUP_DONE,
+ product_name,
+ UTF8ToUTF16(login_)));
std::wstring javascript = L"cloudprint.setMessage('" + message + L"');";
ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript);
diff --git a/chrome/browser/printing/print_dialog_cloud_uitest.cc b/chrome/browser/printing/print_dialog_cloud_uitest.cc
index 40824de..aee03ee 100644
--- a/chrome/browser/printing/print_dialog_cloud_uitest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_uitest.cc
@@ -11,7 +11,7 @@
#include "base/file_util.h"
#include "base/path_service.h"
#include "base/singleton.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_thread.h"
@@ -159,7 +159,7 @@
virtual void TearDown() {
if (handler_added_) {
- URLRequestFilter* filter = URLRequestFilter::GetInstance();
+ net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
filter->RemoveHostnameHandler(scheme_, host_name_);
handler_added_ = false;
TestController::GetInstance()->set_delegate(NULL);
@@ -173,7 +173,7 @@
// individual test functions seems to fix that.
void AddTestHandlers() {
if (!handler_added_) {
- URLRequestFilter* filter = URLRequestFilter::GetInstance();
+ net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance();
GURL cloud_print_service_url =
CloudPrintURL(browser()->profile()).
GetCloudPrintServiceURL();
diff --git a/chrome/browser/printing/print_dialog_gtk.cc b/chrome/browser/printing/print_dialog_gtk.cc
index 585daf4..eac9bbe 100644
--- a/chrome/browser/printing/print_dialog_gtk.cc
+++ b/chrome/browser/printing/print_dialog_gtk.cc
@@ -13,7 +13,7 @@
#include "base/lazy_instance.h"
#include "base/lock.h"
#include "base/logging.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc
index db57103..493d317 100644
--- a/chrome/browser/printing/print_job.cc
+++ b/chrome/browser/printing/print_job.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/printing/print_job.h"
#include "base/message_loop.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/timer.h"
#include "chrome/browser/printing/print_job_worker.h"
#include "chrome/common/notification_service.h"
diff --git a/chrome/browser/printing/print_job_worker.cc b/chrome/browser/printing/print_job_worker.cc
index 26b5fb3..201b2f7 100644
--- a/chrome/browser/printing/print_job_worker.cc
+++ b/chrome/browser/printing/print_job_worker.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -84,26 +84,14 @@
printing_context_->set_use_overlays(use_overlays);
if (ask_user_for_settings) {
-#if defined(OS_POSIX)
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &PrintJobWorker::GetSettingsWithUI,
parent_view, document_page_count,
has_selection));
-#else
- printing_context_->AskUserForSettings(
- parent_view,
- document_page_count,
- has_selection,
- NewCallback(this, &PrintJobWorker::GetSettingsDone));
-#endif // defined(OS_POSIX)
} else {
-#if defined(OS_POSIX)
BrowserThread::PostTask(BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &PrintJobWorker::UseDefaultSettings));
-#else
- UseDefaultSettings();
-#endif // defined(OS_POSIX)
}
}
@@ -122,7 +110,6 @@
result));
}
-#if defined(OS_POSIX)
void PrintJobWorker::GetSettingsWithUI(gfx::NativeView parent_view,
int document_page_count,
bool has_selection) {
@@ -139,7 +126,6 @@
message_loop()->PostTask(FROM_HERE, NewRunnableMethod(
this, &PrintJobWorker::GetSettingsDone, result));
}
-#endif // defined(OS_POSIX)
void PrintJobWorker::UseDefaultSettings() {
PrintingContext::Result result = printing_context_->UseDefaultSettings();
diff --git a/chrome/browser/printing/print_job_worker.h b/chrome/browser/printing/print_job_worker.h
index e568286..4087194 100644
--- a/chrome/browser/printing/print_job_worker.h
+++ b/chrome/browser/printing/print_job_worker.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,7 +9,7 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "gfx/native_widget_types.h"
#include "printing/page_number.h"
#include "printing/printing_context.h"
@@ -83,9 +83,9 @@
// context.
void OnFailure();
-#if defined(OS_POSIX)
// Asks the user for print settings. Must be called on the UI thread.
- // Mac and Linux-only since Windows can display UI from non-main threads.
+ // Required on Mac and Linux. Windows can display UI from non-main threads,
+ // but sticks with this for consistency.
void GetSettingsWithUI(gfx::NativeView parent_view,
int document_page_count,
bool has_selection);
@@ -94,7 +94,6 @@
// object that the print settings are set. This is needed in order to bounce
// back into the IO thread for GetSettingsDone().
void GetSettingsWithUIDone(PrintingContext::Result result);
-#endif // defined(OS_POSIX)
// Reports settings back to owner_.
void GetSettingsDone(PrintingContext::Result result);
diff --git a/chrome/browser/printing/printer_query.cc b/chrome/browser/printing/printer_query.cc
index 87ec00f..89f0e97 100644
--- a/chrome/browser/printing/printer_query.cc
+++ b/chrome/browser/printing/printer_query.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/printing/printer_query.h"
#include "base/message_loop.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/printing/print_job_worker.h"
namespace printing {
diff --git a/chrome/browser/printing/printing_layout_uitest.cc b/chrome/browser/printing/printing_layout_uitest.cc
index 754e8f5..d2cdf9d 100644
--- a/chrome/browser/printing/printing_layout_uitest.cc
+++ b/chrome/browser/printing/printing_layout_uitest.cc
@@ -4,8 +4,8 @@
#include "base/command_line.h"
#include "base/file_util.h"
-#include "base/simple_thread.h"
#include "base/test/test_file_util.h"
+#include "base/threading/simple_thread.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/ui/ui_test.h"
#include "net/test/test_server.h"
@@ -164,7 +164,7 @@
}
if (found_emf && found_prn)
break;
- PlatformThread::Sleep(100);
+ base::PlatformThread::Sleep(100);
}
EXPECT_TRUE(found_emf) << ".PRN file is: " << prn_file;
EXPECT_TRUE(found_prn) << ".EMF file is: " << emf_file;
@@ -256,13 +256,13 @@
break;
}
}
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
}
// Now verify that it indeed closed itself.
while (IsWindow(dialog_window)) {
CloseDialogWindow(dialog_window);
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
}
}
diff --git a/chrome/browser/process_info_snapshot_mac.cc b/chrome/browser/process_info_snapshot_mac.cc
index 0f20080..85adb19 100644
--- a/chrome/browser/process_info_snapshot_mac.cc
+++ b/chrome/browser/process_info_snapshot_mac.cc
@@ -10,7 +10,7 @@
#include "base/logging.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
// Implementation for the Mac; calls '/bin/ps' for information when
// |Sample()| is called.
diff --git a/chrome/browser/process_singleton.h b/chrome/browser/process_singleton.h
index 250d96b..9418c60 100644
--- a/chrome/browser/process_singleton.h
+++ b/chrome/browser/process_singleton.h
@@ -14,8 +14,8 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "gfx/native_widget_types.h"
#if defined(OS_POSIX)
@@ -40,7 +40,7 @@
// - the Windows implementation uses an invisible global message window;
// - the Linux implementation uses a Unix domain socket in the user data dir.
-class ProcessSingleton : public NonThreadSafe {
+class ProcessSingleton : public base::NonThreadSafe {
public:
enum NotifyResult {
PROCESS_NONE,
diff --git a/chrome/browser/process_singleton_linux.cc b/chrome/browser/process_singleton_linux.cc
index a95d668..982f370 100644
--- a/chrome/browser/process_singleton_linux.cc
+++ b/chrome/browser/process_singleton_linux.cc
@@ -64,7 +64,6 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/rand_util.h"
#include "base/safe_strerror_posix.h"
@@ -72,9 +71,10 @@
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/sys_string_conversions.h"
-#include "base/utf_string_conversions.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "base/timer.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#if defined(TOOLKIT_GTK)
@@ -298,16 +298,17 @@
void DisplayProfileInUseError(const std::string& lock_path,
const std::string& hostname,
int pid) {
- std::wstring error = l10n_util::GetStringF(IDS_PROFILE_IN_USE_LINUX,
- UTF8ToWide(base::IntToString(pid)),
- ASCIIToWide(hostname),
- base::SysNativeMBToWide(lock_path),
- l10n_util::GetString(IDS_PRODUCT_NAME));
- LOG(ERROR) << base::SysWideToNativeMB(error).c_str();
+ string16 error = l10n_util::GetStringFUTF16(
+ IDS_PROFILE_IN_USE_LINUX,
+ base::IntToString16(pid),
+ ASCIIToUTF16(hostname),
+ WideToUTF16(base::SysNativeMBToWide(lock_path)),
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
+ LOG(ERROR) << base::SysWideToNativeMB(UTF16ToWide(error)).c_str();
#if defined(TOOLKIT_GTK)
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kNoProcessSingletonDialog))
- ProcessSingletonDialog::ShowAndRun(WideToUTF8(error));
+ ProcessSingletonDialog::ShowAndRun(UTF16ToUTF8(error));
#endif
}
@@ -818,7 +819,7 @@
return PROCESS_NONE;
}
- PlatformThread::Sleep(1000 /* ms */);
+ base::PlatformThread::Sleep(1000 /* ms */);
}
timeval timeout = {timeout_seconds, 0};
diff --git a/chrome/browser/process_singleton_linux_uitest.cc b/chrome/browser/process_singleton_linux_uitest.cc
index 73e1365..6abcefe 100644
--- a/chrome/browser/process_singleton_linux_uitest.cc
+++ b/chrome/browser/process_singleton_linux_uitest.cc
@@ -14,7 +14,7 @@
#include "base/eintr_wrapper.h"
#include "base/path_service.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_constants.h"
diff --git a/chrome/browser/process_singleton_uitest.cc b/chrome/browser/process_singleton_uitest.cc
index f04b29f..235f181 100644
--- a/chrome/browser/process_singleton_uitest.cc
+++ b/chrome/browser/process_singleton_uitest.cc
@@ -18,8 +18,8 @@
#include "base/process_util.h"
#include "base/ref_counted.h"
#include "base/scoped_temp_dir.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc
index 1e86daa..47e28dd 100644
--- a/chrome/browser/process_singleton_win.cc
+++ b/chrome/browser/process_singleton_win.cc
@@ -1,18 +1,18 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "chrome/browser/process_singleton.h"
#include "app/l10n_util.h"
-#include "app/win_util.h"
+#include "app/win/hwnd_util.h"
#include "base/base_paths.h"
#include "base/command_line.h"
#include "base/file_path.h"
#include "base/path_service.h"
#include "base/process_util.h"
-#include "base/scoped_handle.h"
-#include "base/win_util.h"
+#include "base/utf_string_conversions.h"
+#include "base/win/scoped_handle.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/extensions/extensions_startup.h"
#include "chrome/browser/platform_util.h"
@@ -53,7 +53,8 @@
// since it isn't guaranteed we will get it. It is better to create it
// without ownership and explicitly get the ownership afterward.
std::wstring mutex_name(L"Local\\ChromeProcessSingletonStartup!");
- ScopedHandle only_me(CreateMutex(NULL, FALSE, mutex_name.c_str()));
+ base::win::ScopedHandle only_me(
+ CreateMutex(NULL, FALSE, mutex_name.c_str()));
DCHECK(only_me.Get() != NULL) << "GetLastError = " << GetLastError();
// This is how we acquire the mutex (as opposed to the initial ownership).
@@ -143,8 +144,10 @@
// If there is a visible browser window, ask the user before killing it.
if (visible_window) {
- std::wstring text = l10n_util::GetString(IDS_BROWSER_HUNGBROWSER_MESSAGE);
- std::wstring caption = l10n_util::GetString(IDS_PRODUCT_NAME);
+ std::wstring text =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BROWSER_HUNGBROWSER_MESSAGE));
+ std::wstring caption =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
if (!platform_util::SimpleYesNoBox(NULL, caption, text)) {
// The user denied. Quit silently.
return PROCESS_NOTIFIED;
@@ -192,7 +195,7 @@
0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0);
DCHECK(window_);
- win_util::SetWindowUserData(window_, this);
+ app::win::SetWindowUserData(window_, this);
return true;
}
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index 2c610e1..34a50fc 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -409,20 +409,16 @@
}
void ProfileImpl::InstallDefaultApps() {
- // The web store only supports en-US at the moment, so we don't install
- // default apps in other locales.
- if (g_browser_process->GetApplicationLocale() != "en-US")
+ ExtensionService* extension_service = GetExtensionService();
+ DefaultApps* default_apps = extension_service->default_apps();
+
+ if (!default_apps->ShouldInstallDefaultApps(extension_service->GetAppIds()))
return;
- ExtensionService* extensions_service = GetExtensionService();
- const ExtensionIdSet* app_ids =
- extensions_service->default_apps()->GetAppsToInstall();
- if (!app_ids)
- return;
-
- for (ExtensionIdSet::const_iterator iter = app_ids->begin();
- iter != app_ids->end(); ++iter) {
- extensions_service->AddPendingExtensionFromDefaultAppList(*iter);
+ const ExtensionIdSet& app_ids = default_apps->default_apps();
+ for (ExtensionIdSet::const_iterator iter = app_ids.begin();
+ iter != app_ids.end(); ++iter) {
+ extension_service->AddPendingExtensionFromDefaultAppList(*iter);
}
}
@@ -466,8 +462,8 @@
// DownloadManager is lazily created, so check before accessing it.
if (download_manager_.get()) {
- // The download manager queries the history system and should be shutdown
- // before the history is shutdown so it can properly cancel all requests.
+ // The download manager queries the history system and should be shut down
+ // before the history is shut down so it can properly cancel all requests.
download_manager_->Shutdown();
download_manager_ = NULL;
}
@@ -923,7 +919,7 @@
#elif defined(OS_POSIX)
// On POSIX systems, we try to use the "native" password management system of
// the desktop environment currently running, allowing GNOME Keyring in XFCE.
- // (In all cases we fall back on the default store in case of failure.)
+ // (In all cases we fall back on the basic store in case of failure.)
base::nix::DesktopEnvironment desktop_env;
std::string store_type =
CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
@@ -932,16 +928,13 @@
desktop_env = base::nix::DESKTOP_ENVIRONMENT_KDE4;
} else if (store_type == "gnome") {
desktop_env = base::nix::DESKTOP_ENVIRONMENT_GNOME;
- } else if (store_type == "detect") {
+ } else if (store_type == "basic") {
+ desktop_env = base::nix::DESKTOP_ENVIRONMENT_OTHER;
+ } else { // Detect the store to use automatically.
scoped_ptr<base::Environment> env(base::Environment::Create());
desktop_env = base::nix::GetDesktopEnvironment(env.get());
VLOG(1) << "Password storage detected desktop environment: "
<< base::nix::GetDesktopEnvironmentName(desktop_env);
- } else {
- // TODO(mdm): If the flag is not given, or has an unknown value, use the
- // default store for now. Once we're confident in the other stores, we can
- // default to detecting the desktop environment instead.
- desktop_env = base::nix::DESKTOP_ENVIRONMENT_OTHER;
}
scoped_ptr<PasswordStoreX::NativeBackend> backend;
@@ -964,9 +957,11 @@
backend.reset();
#endif // defined(USE_GNOME_KEYRING)
}
- // TODO(mdm): this can change to a WARNING when we detect by default.
- if (!backend.get())
- VLOG(1) << "Using default (unencrypted) store for password storage.";
+ if (!backend.get()) {
+ LOG(WARNING) << "Using basic (unencrypted) store for password storage. "
+ "See http://code.google.com/p/chromium/wiki/LinuxPasswordStorage for "
+ "more information about password storage options.";
+ }
ps = new PasswordStoreX(login_db, this,
GetWebDataService(Profile::IMPLICIT_ACCESS),
diff --git a/chrome/browser/profiles/profile_manager.h b/chrome/browser/profiles/profile_manager.h
index d46c900..1d6483d 100644
--- a/chrome/browser/profiles/profile_manager.h
+++ b/chrome/browser/profiles/profile_manager.h
@@ -13,14 +13,14 @@
#include "app/system_monitor.h"
#include "base/basictypes.h"
#include "base/message_loop.h"
-#include "base/non_thread_safe.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
class FilePath;
-class ProfileManager : public NonThreadSafe,
+class ProfileManager : public base::NonThreadSafe,
public SystemMonitor::PowerObserver,
public NotificationObserver {
public:
diff --git a/chrome/browser/remoting/directory_add_request.h b/chrome/browser/remoting/directory_add_request.h
index 2ec6ed2..c87cbf2 100644
--- a/chrome/browser/remoting/directory_add_request.h
+++ b/chrome/browser/remoting/directory_add_request.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -55,7 +55,7 @@
// URLFetcher::Delegate implementation.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/remoting/remoting_resources_source.cc b/chrome/browser/remoting/remoting_resources_source.cc
index 9057e1d..656763c 100644
--- a/chrome/browser/remoting/remoting_resources_source.cc
+++ b/chrome/browser/remoting/remoting_resources_source.cc
@@ -39,6 +39,7 @@
const char kRemotingGaiaLoginPath[] = "gaialogin";
const char kRemotingSetupFlowPath[] = "setup";
const char kRemotingSetupDonePath[] = "setupdone";
+ const char kRemotingSetupErrorPath[] = "setuperror";
std::string response;
if (path_raw == kRemotingGaiaLoginPath) {
@@ -93,14 +94,25 @@
} else if (path_raw == kRemotingSetupDonePath) {
DictionaryValue localized_strings;
localized_strings.SetString("success",
- l10n_util::GetStringUTF16(IDS_SYNC_SUCCESS));
+ l10n_util::GetStringUTF16(IDS_REMOTING_SUCCESS_TITLE));
localized_strings.SetString("okay",
- l10n_util::GetStringUTF16(IDS_SYNC_SETUP_OK_BUTTON_LABEL));
+ l10n_util::GetStringUTF16(IDS_OK));
static const base::StringPiece html(ResourceBundle::GetSharedInstance()
.GetRawDataResource(IDR_REMOTING_SETUP_DONE_HTML));
SetFontAndTextDirection(&localized_strings);
response = jstemplate_builder::GetI18nTemplateHtml(
html, &localized_strings);
+ } else if (path_raw == kRemotingSetupErrorPath) {
+ DictionaryValue localized_strings;
+ localized_strings.SetString("close",
+ l10n_util::GetStringUTF16(IDS_CLOSE));
+ localized_strings.SetString("retry",
+ l10n_util::GetStringUTF16(IDS_REMOTING_RETRY_BUTTON_TEXT));
+ static const base::StringPiece html(ResourceBundle::GetSharedInstance()
+ .GetRawDataResource(IDR_REMOTING_SETUP_ERROR_HTML));
+ SetFontAndTextDirection(&localized_strings);
+ response = jstemplate_builder::GetI18nTemplateHtml(
+ html, &localized_strings);
} else if (path_raw == kRemotingSetupFlowPath) {
static const base::StringPiece html(ResourceBundle::GetSharedInstance()
.GetRawDataResource(IDR_REMOTING_SETUP_FLOW_HTML));
diff --git a/chrome/browser/remoting/remoting_setup_flow.cc b/chrome/browser/remoting/remoting_setup_flow.cc
deleted file mode 100644
index 05c7590..0000000
--- a/chrome/browser/remoting/remoting_setup_flow.cc
+++ /dev/null
@@ -1,318 +0,0 @@
-// 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.
-
-#include "chrome/browser/remoting/remoting_setup_flow.h"
-
-#include "app/gfx/font_util.h"
-#include "base/json/json_writer.h"
-#include "base/singleton.h"
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
-#include "base/values.h"
-#include "chrome/browser/browser_thread.h"
-#include "chrome/browser/dom_ui/chrome_url_data_manager.h"
-#include "chrome/browser/dom_ui/dom_ui_util.h"
-#include "chrome/browser/platform_util.h"
-#include "chrome/browser/prefs/pref_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/remoting/remoting_resources_source.h"
-#include "chrome/browser/remoting/remoting_setup_message_handler.h"
-#include "chrome/browser/renderer_host/render_view_host.h"
-#include "chrome/browser/service/service_process_control.h"
-#include "chrome/browser/service/service_process_control_manager.h"
-#include "chrome/browser/tab_contents/tab_contents.h"
-#include "chrome/browser/ui/browser.h"
-#include "chrome/browser/ui/browser_list.h"
-#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
-#include "chrome/common/net/gaia/gaia_constants.h"
-#include "chrome/common/net/gaia/google_service_auth_error.h"
-#include "chrome/common/pref_names.h"
-#include "gfx/font.h"
-#include "grit/locale_settings.h"
-
-static const wchar_t kLoginIFrameXPath[] = L"//iframe[@id='login']";
-static const wchar_t kDoneIframeXPath[] = L"//iframe[@id='done']";
-
-////////////////////////////////////////////////////////////////////////////////
-// RemotingServiceProcessHelper
-//
-// This is a helper class to perform actions when the service process
-// is connected or launched. The events are sent back to RemotingSetupFlow
-// when the dialog is still active. RemotingSetupFlow can detach from this
-// helper class when the dialog is closed.
-class RemotingServiceProcessHelper
- : public base::RefCountedThreadSafe<RemotingServiceProcessHelper> {
- public:
- explicit RemotingServiceProcessHelper(RemotingSetupFlow* flow)
- : flow_(flow) {
- }
-
- void Detach() {
- flow_ = NULL;
- }
-
- void OnProcessLaunched() {
- DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- // If the flow is detached then show the done page.
- if (!flow_)
- return;
-
- flow_->OnProcessLaunched();
- }
-
- private:
- RemotingSetupFlow* flow_;
-
- DISALLOW_COPY_AND_ASSIGN(RemotingServiceProcessHelper);
-};
-
-////////////////////////////////////////////////////////////////////////////////
-// RemotingSetupFlow implementation.
-// static
-RemotingSetupFlow* RemotingSetupFlow::OpenDialog(Profile* profile) {
- // Set the arguments for showing the gaia login page.
- DictionaryValue args;
- args.SetString("iframeToShow", "login");
- args.SetString("user", "");
- args.SetInteger("error", 0);
- args.SetBoolean("editable_user", true);
-
- if (profile->GetPrefs()->GetBoolean(prefs::kRemotingHasSetupCompleted)) {
- args.SetString("iframeToShow", "done");
- }
-
- std::string json_args;
- base::JSONWriter::Write(&args, false, &json_args);
-
- Browser* b = BrowserList::GetLastActive();
- if (!b)
- return NULL;
-
- RemotingSetupFlow* flow = new RemotingSetupFlow(json_args, profile);
- b->BrowserShowHtmlDialog(flow, NULL);
- return flow;
-}
-
-RemotingSetupFlow::RemotingSetupFlow(const std::string& args, Profile* profile)
- : dom_ui_(NULL),
- dialog_start_args_(args),
- profile_(profile),
- process_control_(NULL) {
- // TODO(hclam): The data source should be added once.
- BrowserThread::PostTask(
- BrowserThread::IO, FROM_HERE,
- NewRunnableMethod(ChromeURLDataManager::GetInstance(),
- &ChromeURLDataManager::AddDataSource,
- make_scoped_refptr(new RemotingResourcesSource())));
-}
-
-RemotingSetupFlow::~RemotingSetupFlow() {
-}
-
-void RemotingSetupFlow::Focus() {
- // TODO(pranavk): implement this method.
- NOTIMPLEMENTED();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// HtmlDialogUIDelegate implementation.
-GURL RemotingSetupFlow::GetDialogContentURL() const {
- return GURL("chrome://remotingresources/setup");
-}
-
-void RemotingSetupFlow::GetDOMMessageHandlers(
- std::vector<DOMMessageHandler*>* handlers) const {
- // Create the message handler only after we are asked, the caller is
- // responsible for deleting the objects.
- handlers->push_back(
- new RemotingSetupMessageHandler(const_cast<RemotingSetupFlow*>(this)));
-}
-
-void RemotingSetupFlow::GetDialogSize(gfx::Size* size) const {
- PrefService* prefs = profile_->GetPrefs();
- gfx::Font approximate_web_font(
- UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
- prefs->GetInteger(prefs::kWebKitDefaultFontSize));
-
- // TODO(pranavk) Replace the following SYNC resources with REMOTING Resources.
- *size = gfx::GetLocalizedContentsSizeForFont(
- IDS_SYNC_SETUP_WIZARD_WIDTH_CHARS,
- IDS_SYNC_SETUP_WIZARD_HEIGHT_LINES,
- approximate_web_font);
-}
-
-// A callback to notify the delegate that the dialog closed.
-void RemotingSetupFlow::OnDialogClosed(const std::string& json_retval) {
- // If we are fetching the token then cancel the request.
- if (authenticator_.get())
- authenticator_->CancelRequest();
-
- // If the service process helper is still active then detach outself from it.
- // This is because the dialog is closing and this object is going to be
- // deleted but the service process launch is still in progress so we don't
- // the service process helper to call us when the process is launched.
- if (service_process_helper_.get())
- service_process_helper_->Detach();
- delete this;
-}
-
-std::string RemotingSetupFlow::GetDialogArgs() const {
- return dialog_start_args_;
-}
-
-void RemotingSetupFlow::OnCloseContents(TabContents* source,
- bool* out_close_dialog) {
-}
-
-std::wstring RemotingSetupFlow::GetDialogTitle() const {
- return l10n_util::GetString(IDS_REMOTING_SETUP_DIALOG_TITLE);
-}
-
-bool RemotingSetupFlow::IsDialogModal() const {
- return true;
-}
-
-bool RemotingSetupFlow::ShouldShowDialogTitle() const {
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// GaiaAuthConsumer implementation.
-void RemotingSetupFlow::OnClientLoginFailure(
- const GoogleServiceAuthError& error) {
- ShowGaiaFailed(error);
- authenticator_.reset();
-}
-
-void RemotingSetupFlow::OnClientLoginSuccess(
- const GaiaAuthConsumer::ClientLoginResult& credentials) {
- // Save the token for remoting.
- remoting_token_ = credentials.token;
-
- // After login has succeeded try to fetch the token for sync.
- // We need the token for sync to connect to the talk network.
- authenticator_->StartIssueAuthToken(credentials.sid, credentials.lsid,
- GaiaConstants::kSyncService);
-}
-
-void RemotingSetupFlow::OnIssueAuthTokenSuccess(const std::string& service,
- const std::string& auth_token) {
- // Show that Gaia login has succeeded.
- ShowGaiaSuccessAndSettingUp();
-
- // Save the sync token.
- sync_token_ = auth_token;
- authenticator_.reset();
-
- // And then launch the service process if it has not started yet.
- // If we have already connected to the service process then submit the tokens
- // to it to register the host.
- process_control_ =
- ServiceProcessControlManager::GetInstance()->GetProcessControl(profile_);
-
- if (process_control_->is_connected()) {
- // TODO(hclam): Need to figure out what to do when the service process is
- // already connected.
- } else {
-#if defined(OS_WIN)
- // TODO(hclam): This call only works on Windows. I need to make it work
- // on other platforms.
- service_process_helper_ = new RemotingServiceProcessHelper(this);
- Task* process_launched_task =
- NewRunnableMethod(service_process_helper_.get(),
- &RemotingServiceProcessHelper::OnProcessLaunched);
- process_control_->Launch(process_launched_task, process_launched_task);
-#else
- ShowSetupDone();
-#endif
- }
-}
-
-void RemotingSetupFlow::OnIssueAuthTokenFailure(const std::string& service,
- const GoogleServiceAuthError& error) {
- ShowGaiaFailed(error);
- authenticator_.reset();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Methods called by RemotingSetupMessageHandler
-void RemotingSetupFlow::Attach(DOMUI* dom_ui) {
- dom_ui_ = dom_ui;
-}
-
-void RemotingSetupFlow::OnUserSubmittedAuth(const std::string& user,
- const std::string& password,
- const std::string& captcha) {
- // Save the login name only.
- login_ = user;
-
- // Start the authenticator.
- authenticator_.reset(
- new GaiaAuthFetcher(this, GaiaConstants::kChromeSource,
- profile_->GetRequestContext()));
- authenticator_->StartClientLogin(user, password,
- GaiaConstants::kRemotingService,
- "", captcha,
- GaiaAuthFetcher::HostedAccountsAllowed);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Method called by RemotingServicePRocessHelper
-void RemotingSetupFlow::OnProcessLaunched() {
- DCHECK(process_control_->is_connected());
- // TODO(hclam): Need to wait for an ACK to be sure that it is actually active.
- process_control_->SetRemotingHostCredentials(login_, sync_token_);
- process_control_->EnableRemotingHost();
-
- // Save the preference that we have completed the setup of remoting.
- profile_->GetPrefs()->SetBoolean(prefs::kRemotingHasSetupCompleted, true);
- ShowSetupDone();
-}
-
-///////////////////////////////////////////////////////////////////////////////
-// Helper methods for showing contents of the DOM UI
-void RemotingSetupFlow::ShowGaiaLogin(const DictionaryValue& args) {
- if (dom_ui_)
- dom_ui_->CallJavascriptFunction(L"showGaiaLoginIframe");
-
- std::string json;
- base::JSONWriter::Write(&args, false, &json);
- std::wstring javascript = std::wstring(L"showGaiaLogin") +
- L"(" + UTF8ToWide(json) + L");";
- ExecuteJavascriptInIFrame(kLoginIFrameXPath, javascript);
-}
-
-void RemotingSetupFlow::ShowGaiaSuccessAndSettingUp() {
- ExecuteJavascriptInIFrame(kLoginIFrameXPath,
- L"showGaiaSuccessAndSettingUp();");
-}
-
-void RemotingSetupFlow::ShowGaiaFailed(const GoogleServiceAuthError& error) {
- DictionaryValue args;
- args.SetString("iframeToShow", "login");
- args.SetString("user", "");
- args.SetInteger("error", error.state());
- args.SetBoolean("editable_user", true);
- args.SetString("captchaUrl", error.captcha().image_url.spec());
- ShowGaiaLogin(args);
-}
-
-void RemotingSetupFlow::ShowSetupDone() {
- std::wstring javascript = L"setMessage('You are all set!');";
- ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript);
-
- if (dom_ui_)
- dom_ui_->CallJavascriptFunction(L"showSetupDone");
-
- ExecuteJavascriptInIFrame(kDoneIframeXPath, L"onPageShown();");
-}
-
-void RemotingSetupFlow::ExecuteJavascriptInIFrame(
- const std::wstring& iframe_xpath,
- const std::wstring& js) {
- if (dom_ui_) {
- RenderViewHost* rvh = dom_ui_->tab_contents()->render_view_host();
- rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js);
- }
-}
diff --git a/chrome/browser/remoting/remoting_setup_flow.h b/chrome/browser/remoting/remoting_setup_flow.h
deleted file mode 100644
index fb92715..0000000
--- a/chrome/browser/remoting/remoting_setup_flow.h
+++ /dev/null
@@ -1,127 +0,0 @@
-// 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.
-
-#ifndef CHROME_BROWSER_REMOTING_REMOTING_SETUP_FLOW_H_
-#define CHROME_BROWSER_REMOTING_REMOTING_SETUP_FLOW_H_
-
-#include <string>
-#include <vector>
-
-#include "app/l10n_util.h"
-#include "base/time.h"
-#include "chrome/browser/dom_ui/html_dialog_ui.h"
-#include "chrome/common/net/gaia/gaia_auth_consumer.h"
-#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
-#include "gfx/native_widget_types.h"
-#include "grit/generated_resources.h"
-
-class GaiaAuthFetcher;
-class RemotingServiceProcessHelper;
-class RemotingSetupMessageHandler;
-class ServiceProcessControl;
-class GoogleServiceAuthError;
-
-// This class is responsible for showing a remoting setup dialog and perform
-// operations to fill the content of the dialog and handle user actions
-// in the dialog.
-//
-// It is responsible for:
-// 1. Showing the setup dialog.
-// 2. Providing the URL for the content of the dialog.
-// 3. Providing a data source to provide the content HTML files.
-// 4. Providing a message handler to handle user actions in the DOM UI.
-// 5. Responding to actions received in the message handler.
-//
-// The architecture for DOMUI is designed such that only the message handler
-// can access the DOMUI. This splits the flow control across the message
-// handler and this class. In order to centralize all the flow control and
-// content in the DOMUI, the DOMUI object is given to this object by the
-// message handler through the Attach(DOMUI*) method.
-class RemotingSetupFlow : public HtmlDialogUIDelegate,
- public GaiaAuthConsumer {
- public:
- virtual ~RemotingSetupFlow();
-
- // Runs a flow from |start| to |end|, and does the work of actually showing
- // the HTML dialog. |container| is kept up-to-date with the lifetime of the
- // flow (e.g it is emptied on dialog close).
- static RemotingSetupFlow* OpenDialog(Profile* service);
-
- // Focuses the dialog. This is useful in cases where the dialog has been
- // obscured by a browser window.
- void Focus();
-
- // HtmlDialogUIDelegate implementation.
- virtual GURL GetDialogContentURL() const;
- virtual void GetDOMMessageHandlers(
- std::vector<DOMMessageHandler*>* handlers) const;
- virtual void GetDialogSize(gfx::Size* size) const;
- virtual std::string GetDialogArgs() const;
- virtual void OnDialogClosed(const std::string& json_retval);
- virtual void OnCloseContents(TabContents* source, bool* out_close_dialog);
- virtual std::wstring GetDialogTitle() const;
- virtual bool IsDialogModal() const;
- virtual bool ShouldShowDialogTitle() const;
-
- // GaiaAuthConsumer implementation.
- virtual void OnClientLoginFailure(
- const GoogleServiceAuthError& error);
- virtual void OnClientLoginSuccess(
- const GaiaAuthConsumer::ClientLoginResult& credentials);
- virtual void OnIssueAuthTokenSuccess(const std::string& service,
- const std::string& auth_token);
- virtual void OnIssueAuthTokenFailure(const std::string& service,
- const GoogleServiceAuthError& error);
-
- private:
- friend class RemotingServiceProcessHelper;
- friend class RemotingSetupMessageHandler;
-
- // Use static Run method to get an instance.
- RemotingSetupFlow(const std::string& args, Profile* profile);
-
- // Called RemotingSetupMessageHandler when a DOM is attached. This method
- // is called when the HTML page is fully loaded. We then operate on this
- // DOMUI object directly.
- void Attach(DOMUI* dom_ui);
-
- // Called by RemotingSetupMessageHandler when user authentication is
- // registered.
- void OnUserSubmittedAuth(const std::string& user,
- const std::string& password,
- const std::string& captcha);
-
- // Event triggered when the service process was launched.
- void OnProcessLaunched();
-
- // The following methods control which iframe is visible.
- void ShowGaiaLogin(const DictionaryValue& args);
- void ShowGaiaSuccessAndSettingUp();
- void ShowGaiaFailed(const GoogleServiceAuthError& error);
- void ShowSetupDone();
- void ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath,
- const std::wstring& js);
-
- // Pointer to the DOM UI. This is provided by RemotingSetupMessageHandler
- // when attached.
- DOMUI* dom_ui_;
-
- // The args to pass to the initial page.
- std::string dialog_start_args_;
- Profile* profile_;
-
- // Fetcher to obtain the Chromoting Directory token.
- scoped_ptr<GaiaAuthFetcher> authenticator_;
- std::string login_;
- std::string remoting_token_;
- std::string sync_token_;
-
- // Handle to the ServiceProcessControl which talks to the service process.
- ServiceProcessControl* process_control_;
- scoped_refptr<RemotingServiceProcessHelper> service_process_helper_;
-
- DISALLOW_COPY_AND_ASSIGN(RemotingSetupFlow);
-};
-
-#endif // CHROME_BROWSER_REMOTING_REMOTING_SETUP_FLOW_H_
diff --git a/chrome/browser/remoting/remoting_setup_message_handler.cc b/chrome/browser/remoting/remoting_setup_message_handler.cc
deleted file mode 100644
index 413f901..0000000
--- a/chrome/browser/remoting/remoting_setup_message_handler.cc
+++ /dev/null
@@ -1,47 +0,0 @@
-// 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.
-
-#include "chrome/browser/remoting/remoting_setup_message_handler.h"
-
-#include "base/scoped_ptr.h"
-#include "base/json/json_reader.h"
-#include "base/json/json_writer.h"
-#include "chrome/browser/dom_ui/dom_ui_util.h"
-#include "chrome/browser/remoting/remoting_setup_flow.h"
-
-DOMMessageHandler* RemotingSetupMessageHandler::Attach(DOMUI* dom_ui) {
- // Pass the DOMUI object to the setup flow.
- flow_->Attach(dom_ui);
- return DOMMessageHandler::Attach(dom_ui);
-}
-
-void RemotingSetupMessageHandler::RegisterMessages() {
- dom_ui_->RegisterMessageCallback("SubmitAuth",
- NewCallback(this, &RemotingSetupMessageHandler::HandleSubmitAuth));
-}
-
-void RemotingSetupMessageHandler::HandleSubmitAuth(const ListValue* args) {
- std::string json(dom_ui_util::GetJsonResponseFromFirstArgumentInList(args));
- std::string username, password, captcha;
- if (json.empty())
- return;
-
- scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
- if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) {
- NOTREACHED() << "Unable to parse auth data";
- return;
- }
-
- DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get());
- if (!result->GetString("user", &username) ||
- !result->GetString("pass", &password) ||
- !result->GetString("captcha", &captcha)) {
- NOTREACHED() << "Unable to parse auth data";
- return;
- }
-
- // Pass the information to the flow.
- if (flow_)
- flow_->OnUserSubmittedAuth(username, password, captcha);
-}
diff --git a/chrome/browser/remoting/remoting_setup_message_handler.h b/chrome/browser/remoting/remoting_setup_message_handler.h
deleted file mode 100644
index f90dfce..0000000
--- a/chrome/browser/remoting/remoting_setup_message_handler.h
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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.
-
-#ifndef CHROME_BROWSER_REMOTING_REMOTING_SETUP_MESSAGE_HANDLER_H_
-#define CHROME_BROWSER_REMOTING_REMOTING_SETUP_MESSAGE_HANDLER_H_
-
-#include <string>
-
-#include "base/values.h"
-#include "chrome/browser/dom_ui/html_dialog_ui.h"
-
-class RemotingSetupFlow;
-
-// This class is used to handle DOM messages from the setup dialog.
-class RemotingSetupMessageHandler : public DOMMessageHandler {
- public:
- explicit RemotingSetupMessageHandler(RemotingSetupFlow* flow) : flow_(flow) {}
- virtual ~RemotingSetupMessageHandler() {}
-
- // DOMMessageHandler implementation.
- virtual DOMMessageHandler* Attach(DOMUI* dom_ui);
-
- protected:
- // DOMMessageHandler implementation.
- virtual void RegisterMessages();
-
- // Callbacks from the page.
- void HandleSubmitAuth(const ListValue* args);
-
- private:
- RemotingSetupFlow* flow_;
-
- DISALLOW_COPY_AND_ASSIGN(RemotingSetupMessageHandler);
-};
-
-#endif // CHROME_BROWSER_REMOTING_REMOTING_SETUP_MESSAGE_HANDLER_H_
diff --git a/chrome/browser/remoting/resources/remoting_setup_done.html b/chrome/browser/remoting/resources/remoting_setup_done.html
index 673f40b..6d54e62 100644
--- a/chrome/browser/remoting/resources/remoting_setup_done.html
+++ b/chrome/browser/remoting/resources/remoting_setup_done.html
@@ -1,47 +1,7 @@
<html i18n-values="dir:textdirection;">
<head>
<title></title>
-<style type="text/css">
-body {
- background: #FFFFFF;
- font-size: 11pt;
- line-height: 1.5em;
- margin: 10px 15px;
- -webkit-user-select: none;
-}
-.remoting-header {
- font-size: 1.2em;
- font-weight: bold;
-}
-.remoting-success-image {
- text-align: center;
- margin: 20px;
-}
-#message {
- font-weight: bold;
-}
-.remoting-footer {
- position: fixed;
- right: 0px;
- bottom: 0px;
- margin-right: 10px;
- margin-bottom: 10px;
-}
-html[dir='rtl'] .remoting-footer {
- text-align: left;
- left: 0px;
- bottom: 0px;
- margin-left: 20px;
-}
-input[type='submit'] {
- min-width: 87px;
- min-height: 26px;
-}
-html[os='mac'] input[type='submit'] {
- font-size: 12pt;
-}
-
-</style>
+<link rel="stylesheet" type="text/css" href="remoting_setup_flow.css" />
<script>
function setShowFirstTimeSetupSummary() {
document.getElementById("summary").innerHTML =
diff --git a/chrome/browser/remoting/resources/remoting_setup_error.html b/chrome/browser/remoting/resources/remoting_setup_error.html
new file mode 100644
index 0000000..807b264
--- /dev/null
+++ b/chrome/browser/remoting/resources/remoting_setup_error.html
@@ -0,0 +1,23 @@
+<html i18n-values="dir:textdirection;">
+<head>
+<title></title>
+<link rel="stylesheet" type="text/css" href="remoting_setup_flow.css" />
+<script>
+ function setMessage(msg) {
+ document.getElementById('msgContent').innerHTML = msg;
+ }
+ function onPageShown() {
+ document.getElementById("close").focus();
+ }
+</script>
+</head>
+<body i18n-values=".style.fontFamily:fontfamily">
+ <div id="msgContent"></div>
+ <div class="remoting-footer">
+ <input id="retry" type="submit" i18n-values="value:retry"
+ onclick='chrome.send("RemotingSetup", ["Retry"])' />
+ <input id="close" type="submit" i18n-values="value:close"
+ onclick='chrome.send("DialogClose", [""])' />
+ </div>
+</body>
+</html>
diff --git a/chrome/browser/remoting/resources/remoting_setup_flow.css b/chrome/browser/remoting/resources/remoting_setup_flow.css
new file mode 100644
index 0000000..37094f0
--- /dev/null
+++ b/chrome/browser/remoting/resources/remoting_setup_flow.css
@@ -0,0 +1,38 @@
+body {
+ background: #FFFFFF;
+ font-size: 11pt;
+ line-height: 1.5em;
+ margin: 10px 15px;
+ -webkit-user-select: none;
+}
+.remoting-header {
+ font-size: 1.2em;
+ font-weight: bold;
+}
+.remoting-success-image {
+ text-align: center;
+ margin: 20px;
+}
+#message {
+ font-weight: bold;
+}
+.remoting-footer {
+ position: fixed;
+ right: 0px;
+ bottom: 0px;
+ margin-right: 10px;
+ margin-bottom: 10px;
+}
+html[dir='rtl'] .remoting-footer {
+ text-align: left;
+ left: 0px;
+ bottom: 0px;
+ margin-left: 20px;
+}
+input[type='submit'] {
+ min-width: 87px;
+ min-height: 26px;
+}
+html[os='mac'] input[type='submit'] {
+ font-size: 12pt;
+}
diff --git a/chrome/browser/remoting/resources/remoting_setup_flow.html b/chrome/browser/remoting/resources/remoting_setup_flow.html
index aafe008..13affed 100644
--- a/chrome/browser/remoting/resources/remoting_setup_flow.html
+++ b/chrome/browser/remoting/resources/remoting_setup_flow.html
@@ -13,14 +13,28 @@
function hideAllPages() {
document.getElementById('login').style.display = 'none';
document.getElementById('login').tabIndex = -1;
- document.getElementById('done').style.display = 'none';
+ document.getElementById('done').style.display = 'none';
document.getElementById('done').tabIndex = -1;
- }
+ document.getElementById('error').style.display = 'none';
+ document.getElementById('error').tabIndex = -1;
+ }
+
+ function showPage(page) {
+ hideAllPages();
+ document.getElementById(page).style.display = 'block';
+ document.getElementById(page).tabIndex = 0;
+ }
+
+ function showLogin() {
+ showPage('login')
+ }
function showSetupDone() {
- hideAllPages();
- document.getElementById('done').style.display = 'block';
- document.getElementById('done').tabIndex = 0;
+ showPage('done')
+ }
+
+ function showError() {
+ showPage('error')
}
</script>
</head>
@@ -31,5 +45,8 @@
<iframe id="done" frameborder="0" width="100%" scrolling="no" height="100%"
src="chrome://remotingresources/setupdone" style="display:none"
tabindex="-1"></iframe>
+ <iframe id="error" frameborder="0" width="100%" scrolling="no" height="100%"
+ src="chrome://remotingresources/setuperror" style="display:none"
+ tabindex="-1"></iframe>
</body>
</html>
diff --git a/chrome/browser/remoting/setup_flow.cc b/chrome/browser/remoting/setup_flow.cc
new file mode 100644
index 0000000..6070f1f
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow.cc
@@ -0,0 +1,268 @@
+// 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 "chrome/browser/remoting/setup_flow.h"
+
+#include "app/gfx/font_util.h"
+#include "app/l10n_util.h"
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
+#include "base/utf_string_conversions.h"
+#include "base/values.h"
+#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/remoting/remoting_resources_source.h"
+#include "chrome/browser/remoting/setup_flow_login_step.h"
+#include "chrome/browser/renderer_host/render_view_host.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/common/pref_names.h"
+#include "gfx/font.h"
+#include "grit/generated_resources.h"
+#include "grit/locale_settings.h"
+
+namespace remoting {
+
+static const wchar_t kDoneIframeXPath[] = L"//iframe[@id='done']";
+static const wchar_t kErrorIframeXPath[] = L"//iframe[@id='error']";
+
+SetupFlowStep::SetupFlowStep() { }
+SetupFlowStep::~SetupFlowStep() { }
+
+SetupFlowStepBase::SetupFlowStepBase()
+ : flow_(NULL) {
+}
+
+SetupFlowStepBase::~SetupFlowStepBase() { }
+
+void SetupFlowStepBase::Start(SetupFlow* flow, DoneCallback* done_callback) {
+ done_callback_.reset(done_callback);
+ flow_ = flow;
+ DoStart();
+}
+
+SetupFlowStep* SetupFlowStepBase::GetNextStep() {
+ DCHECK(done_);
+ return next_step_;
+}
+
+void SetupFlowStepBase::ExecuteJavascriptInIFrame(
+ const std::wstring& iframe_xpath, const std::wstring& js) {
+ DOMUI* dom_ui = flow()->dom_ui();
+ DCHECK(dom_ui);
+
+ RenderViewHost* rvh = dom_ui->tab_contents()->render_view_host();
+ rvh->ExecuteJavascriptInWebFrame(iframe_xpath, js);
+}
+
+void SetupFlowStepBase::FinishStep(SetupFlowStep* next_step) {
+ next_step_ = next_step;
+ done_ = true;
+ done_callback_->Run();
+}
+
+SetupFlowErrorStepBase::SetupFlowErrorStepBase() { }
+SetupFlowErrorStepBase::~SetupFlowErrorStepBase() { }
+
+void SetupFlowErrorStepBase::HandleMessage(const std::string& message,
+ const Value* arg) {
+ if (message == "Retry") {
+ Retry();
+ }
+}
+
+void SetupFlowErrorStepBase::Cancel() { }
+
+void SetupFlowErrorStepBase::DoStart() {
+ std::wstring javascript =
+ L"setMessage('" + UTF16ToWide(GetErrorMessage()) + L"');";
+ ExecuteJavascriptInIFrame(kErrorIframeXPath, javascript);
+
+ flow()->dom_ui()->CallJavascriptFunction(L"showError");
+
+ ExecuteJavascriptInIFrame(kErrorIframeXPath, L"onPageShown();");
+}
+
+SetupFlowDoneStep::SetupFlowDoneStep() {
+ message_ = l10n_util::GetStringUTF16(IDS_REMOTING_SUCCESS_MESSAGE);
+}
+
+SetupFlowDoneStep::SetupFlowDoneStep(const string16& message)
+ : message_(message) {
+}
+
+SetupFlowDoneStep::~SetupFlowDoneStep() { }
+
+void SetupFlowDoneStep::HandleMessage(const std::string& message,
+ const Value* arg) {
+}
+
+void SetupFlowDoneStep::Cancel() { }
+
+void SetupFlowDoneStep::DoStart() {
+ std::wstring javascript =
+ L"setMessage('" + UTF16ToWide(message_) + L"');";
+ ExecuteJavascriptInIFrame(kDoneIframeXPath, javascript);
+
+ flow()->dom_ui()->CallJavascriptFunction(L"showSetupDone");
+
+ ExecuteJavascriptInIFrame(kDoneIframeXPath, L"onPageShown();");
+}
+
+SetupFlowContext::SetupFlowContext() { }
+SetupFlowContext::~SetupFlowContext() { }
+
+SetupFlow::SetupFlow(const std::string& args, Profile* profile,
+ SetupFlowStep* first_step)
+ : dom_ui_(NULL),
+ dialog_start_args_(args),
+ profile_(profile),
+ current_step_(first_step) {
+ // TODO(hclam): The data source should be added once.
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
+ NewRunnableMethod(ChromeURLDataManager::GetInstance(),
+ &ChromeURLDataManager::AddDataSource,
+ make_scoped_refptr(new RemotingResourcesSource())));
+}
+
+SetupFlow::~SetupFlow() { }
+
+// static
+SetupFlow* SetupFlow::OpenSetupDialog(Profile* profile) {
+ // Set the arguments for showing the gaia login page.
+ DictionaryValue args;
+ args.SetString("iframeToShow", "login");
+ args.SetString("user", "");
+ args.SetInteger("error", 0);
+ args.SetBoolean("editable_user", true);
+
+ std::string json_args;
+ base::JSONWriter::Write(&args, false, &json_args);
+
+ Browser* b = BrowserList::GetLastActive();
+ if (!b)
+ return NULL;
+
+ SetupFlow *flow = new SetupFlow(json_args, profile, new SetupFlowLoginStep());
+ b->BrowserShowHtmlDialog(flow, NULL);
+ return flow;
+}
+
+GURL SetupFlow::GetDialogContentURL() const {
+ return GURL("chrome://remotingresources/setup");
+}
+
+void SetupFlow::GetDOMMessageHandlers(
+ std::vector<DOMMessageHandler*>* handlers) const {
+ // The called will be responsible for deleting this object.
+ handlers->push_back(const_cast<SetupFlow*>(this));
+}
+
+void SetupFlow::GetDialogSize(gfx::Size* size) const {
+ PrefService* prefs = profile_->GetPrefs();
+ gfx::Font approximate_web_font(
+ UTF8ToWide(prefs->GetString(prefs::kWebKitSansSerifFontFamily)),
+ prefs->GetInteger(prefs::kWebKitDefaultFontSize));
+
+ // TODO(pranavk) Replace the following SYNC resources with REMOTING Resources.
+ *size = gfx::GetLocalizedContentsSizeForFont(
+ IDS_SYNC_SETUP_WIZARD_WIDTH_CHARS,
+ IDS_SYNC_SETUP_WIZARD_HEIGHT_LINES,
+ approximate_web_font);
+}
+
+// A callback to notify the delegate that the dialog closed.
+void SetupFlow::OnDialogClosed(const std::string& json_retval) {
+ if (current_step_ != NULL)
+ current_step_->Cancel();
+}
+
+std::string SetupFlow::GetDialogArgs() const {
+ return dialog_start_args_;
+}
+
+void SetupFlow::OnCloseContents(TabContents* source,
+ bool* out_close_dialog) {
+}
+
+std::wstring SetupFlow::GetDialogTitle() const {
+ return UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_REMOTING_SETUP_DIALOG_TITLE));
+}
+
+bool SetupFlow::IsDialogModal() const {
+ return false;
+}
+
+bool SetupFlow::ShouldShowDialogTitle() const {
+ return true;
+}
+
+DOMMessageHandler* SetupFlow::Attach(DOMUI* dom_ui) {
+ dom_ui_ = dom_ui;
+ StartCurrentStep();
+ return DOMMessageHandler::Attach(dom_ui);
+}
+
+void SetupFlow::RegisterMessages() {
+ dom_ui_->RegisterMessageCallback(
+ "SubmitAuth", NewCallback(this, &SetupFlow::HandleSubmitAuth));
+ dom_ui_->RegisterMessageCallback(
+ "RemotingSetup", NewCallback(this, &SetupFlow::HandleUIMessage));
+}
+
+void SetupFlow::HandleSubmitAuth(const ListValue* args) {
+ Value* first_arg = NULL;
+ if (!args->Get(0, &first_arg)) {
+ NOTREACHED();
+ return;
+ }
+
+ current_step_->HandleMessage("SubmitAuth", first_arg);
+}
+
+void SetupFlow::HandleUIMessage(const ListValue* args) {
+ std::string message;
+ Value* message_value;
+ if (!args->Get(0, &message_value) ||
+ !message_value->GetAsString(&message)) {
+ NOTREACHED();
+ return;
+ }
+
+ // Message argument is optional and set to NULL if it is not
+ // provided by the sending page.
+ Value* arg_value = NULL;
+ if (args->GetSize() >= 2) {
+ if (!args->Get(1, &arg_value)) {
+ NOTREACHED();
+ return;
+ }
+ }
+
+ current_step_->HandleMessage(message, arg_value);
+}
+
+void SetupFlow::StartCurrentStep() {
+ current_step_->Start(this, NewCallback(this, &SetupFlow::OnStepDone));
+}
+
+void SetupFlow::OnStepDone() {
+ SetupFlowStep* next_step = current_step_->GetNextStep();
+
+ if (current_step_.get()) {
+ // Can't destroy current step here. Schedule it to be destroyed later.
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ new DeleteTask<SetupFlowStep>(current_step_.release()));
+ }
+
+ current_step_.reset(next_step);
+ StartCurrentStep();
+}
+
+} // namespace remoting
diff --git a/chrome/browser/remoting/setup_flow.h b/chrome/browser/remoting/setup_flow.h
new file mode 100644
index 0000000..d5d16dc
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow.h
@@ -0,0 +1,219 @@
+// 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.
+
+#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_H_
+#define CHROME_BROWSER_REMOTING_SETUP_FLOW_H_
+
+#include "base/callback.h"
+#include "base/scoped_ptr.h"
+#include "chrome/browser/dom_ui/html_dialog_ui.h"
+#include "chrome/common/remoting/chromoting_host_info.h"
+
+class ListValue;
+class ServiceProcessControl;
+
+namespace remoting {
+
+class SetupFlow;
+
+// SetupFlowStep represents a single step for SetupFlow, e.g. login or
+// host registration. When a step is finished, GetNextStep() is called
+// to get the step that must follow.
+class SetupFlowStep {
+ public:
+ typedef Callback0::Type DoneCallback;
+
+ SetupFlowStep();
+ virtual ~SetupFlowStep();
+
+ // Start the step. Ownership of |done_callback| is given to the
+ // function. |done_callback| is called when the step is finished,
+ // The callback must be called on the same thread as Start().
+ virtual void Start(SetupFlow* flow, DoneCallback* done_callback) = 0;
+
+ // Called to handle |message| received from UI. |args| may be set to
+ // NULL.
+ virtual void HandleMessage(const std::string& message, const Value* arg) = 0;
+
+ // Called if user closes the dialog.
+ virtual void Cancel() = 0;
+
+ // Returns SetupFlowStep object that corresponds to the next
+ // step. Must never return NULL.
+ virtual SetupFlowStep* GetNextStep() = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowStep);
+};
+
+// SetupFlowStepBase implements base functions common for all
+// SetupFlowStep implementations.
+class SetupFlowStepBase : public SetupFlowStep {
+ public:
+ SetupFlowStepBase();
+ ~SetupFlowStepBase();
+
+ // SetupFlowStep implementation.
+ virtual void Start(SetupFlow* flow, DoneCallback* done_callback);
+ virtual SetupFlowStep* GetNextStep();
+
+ protected:
+ SetupFlow* flow() { return flow_; }
+
+ void ExecuteJavascriptInIFrame(const std::wstring& iframe_xpath,
+ const std::wstring& js);
+
+ // Finish current step. Calls |done_callback| specified in Start().
+ // GetNextStep() will return the specified |next_step|.
+ void FinishStep(SetupFlowStep* next_step);
+
+ // Called from Start(). Child classes must override this method
+ // instead of Start().
+ virtual void DoStart() = 0;
+
+ private:
+ SetupFlow* flow_;
+ scoped_ptr<DoneCallback> done_callback_;
+ bool done_;
+
+ // Next step stored between Done() and GetNextStep();
+ SetupFlowStep* next_step_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowStepBase);
+};
+
+// Base class for error steps. It shows the error message returned by
+// GetErrorMessage() and Retry button.
+class SetupFlowErrorStepBase : public SetupFlowStepBase {
+ public:
+ SetupFlowErrorStepBase();
+ virtual ~SetupFlowErrorStepBase();
+
+ // SetupFlowStep implementation.
+ virtual void HandleMessage(const std::string& message, const Value* arg);
+ virtual void Cancel();
+
+ protected:
+ virtual void DoStart();
+
+ // Returns error message that is shown to the user.
+ virtual string16 GetErrorMessage() = 0;
+
+ // Called when user clicks Retry button. Normally this methoud just
+ // calls FinishStep() with an appropriate next step.
+ virtual void Retry() = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowErrorStepBase);
+};
+
+// The last step in the setup flow. This step never finishes, user is
+// expected to close dialog after that.
+class SetupFlowDoneStep : public SetupFlowStepBase {
+ public:
+ SetupFlowDoneStep();
+ explicit SetupFlowDoneStep(const string16& message);
+ virtual ~SetupFlowDoneStep();
+
+ // SetupFlowStep implementation.
+ virtual void HandleMessage(const std::string& message, const Value* arg);
+ virtual void Cancel();
+
+ protected:
+ void DoStart();
+
+ private:
+ string16 message_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowDoneStep);
+};
+
+// SetupFlowContext stores data that needs to be passed between
+// different setup flow steps.
+struct SetupFlowContext {
+ SetupFlowContext();
+ ~SetupFlowContext();
+
+ std::string login;
+ std::string remoting_token;
+ std::string talk_token;
+
+ ChromotingHostInfo host_info;
+};
+
+// This class is responsible for showing a remoting setup dialog and
+// perform operations to fill the content of the dialog and handle
+// user actions in the dialog.
+//
+// Each page in the setup flow may send message to the current
+// step. In order to do that it must use send a RemotingSetup message
+// and specify message name as the first value in the argument
+// list. For example the following code sends Retry message to the
+// current step:
+//
+// chrome.send("RemotingSetup", ["Retry"])
+//
+// Assitional message parameters may be provided via send value in the
+// arguments list, e.g.:
+//
+// chrome.send("RemotingSetup", ["SubmitAuth", auth_data])
+//
+// In this case auth_data would be passed in
+// SetupFlowStep::HandleMessage().
+class SetupFlow : public DOMMessageHandler,
+ public HtmlDialogUIDelegate {
+ public:
+ virtual ~SetupFlow();
+
+ static SetupFlow* OpenSetupDialog(Profile* profile);
+
+ DOMUI* dom_ui() { return dom_ui_; }
+ Profile* profile() { return profile_; }
+ SetupFlowContext* context() { return &context_; }
+
+ private:
+ explicit SetupFlow(const std::string& args, Profile* profile,
+ SetupFlowStep* first_step);
+
+ // HtmlDialogUIDelegate implementation.
+ virtual GURL GetDialogContentURL() const;
+ virtual void GetDOMMessageHandlers(
+ std::vector<DOMMessageHandler*>* handlers) const;
+ virtual void GetDialogSize(gfx::Size* size) const;
+ virtual std::string GetDialogArgs() const;
+ virtual void OnDialogClosed(const std::string& json_retval);
+ virtual void OnCloseContents(TabContents* source, bool* out_close_dialog);
+ virtual std::wstring GetDialogTitle() const;
+ virtual bool IsDialogModal() const;
+ virtual bool ShouldShowDialogTitle() const;
+
+ // DOMMessageHandler implementation.
+ virtual DOMMessageHandler* Attach(DOMUI* dom_ui);
+ virtual void RegisterMessages();
+
+ // Message handlers for the messages we receive from UI.
+ void HandleSubmitAuth(const ListValue* args);
+ void HandleUIMessage(const ListValue* args);
+
+ void StartCurrentStep();
+ void OnStepDone();
+
+ // Pointer to the DOM UI. This is provided by RemotingSetupMessageHandler
+ // when attached.
+ DOMUI* dom_ui_;
+
+ // The args to pass to the initial page.
+ std::string dialog_start_args_;
+ Profile* profile_;
+
+ SetupFlowContext context_;
+
+ scoped_ptr<SetupFlowStep> current_step_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetupFlow);
+};
+
+} // namespace remoting
+
+#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_H_
diff --git a/chrome/browser/remoting/setup_flow_get_status_step.cc b/chrome/browser/remoting/setup_flow_get_status_step.cc
new file mode 100644
index 0000000..1f03bb9
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow_get_status_step.cc
@@ -0,0 +1,92 @@
+// 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 "chrome/browser/remoting/setup_flow_get_status_step.h"
+
+#include "app/l10n_util.h"
+#include "chrome/browser/remoting/setup_flow_register_step.h"
+#include "chrome/browser/service/service_process_control.h"
+#include "chrome/browser/service/service_process_control_manager.h"
+#include "grit/generated_resources.h"
+
+namespace remoting {
+
+SetupFlowGetStatusStep::SetupFlowGetStatusStep()
+ : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
+ status_requested_(false) {
+}
+
+SetupFlowGetStatusStep::~SetupFlowGetStatusStep() {
+ if (process_control_)
+ process_control_->RemoveMessageHandler(this);
+}
+
+void SetupFlowGetStatusStep::HandleMessage(const std::string& message,
+ const Value* arg) {
+}
+
+void SetupFlowGetStatusStep::Cancel() {
+ if (process_control_)
+ process_control_->RemoveMessageHandler(this);
+}
+
+void SetupFlowGetStatusStep::OnRemotingHostInfo(
+ const remoting::ChromotingHostInfo& host_info) {
+ if (status_requested_) {
+ flow()->context()->host_info = host_info;
+ status_requested_ = false;
+ FinishStep(new SetupFlowRegisterStep());
+ }
+}
+
+void SetupFlowGetStatusStep::DoStart() {
+ process_control_ =
+ ServiceProcessControlManager::GetInstance()->GetProcessControl(
+ flow()->profile());
+ if (!process_control_->is_connected()) {
+ LaunchServiceProcess();
+ } else {
+ RequestStatus();
+ }
+}
+
+void SetupFlowGetStatusStep::LaunchServiceProcess() {
+ Task* done_task = task_factory_.NewRunnableMethod(
+ &SetupFlowGetStatusStep::OnServiceProcessLaunched);
+ process_control_->Launch(done_task, done_task);
+}
+
+void SetupFlowGetStatusStep::OnServiceProcessLaunched() {
+ if (!process_control_->is_connected()) {
+ // Failed to start service process.
+ FinishStep(new SetupFlowGetStatusErrorStep());
+ } else {
+ RequestStatus();
+ }
+}
+
+void SetupFlowGetStatusStep::RequestStatus() {
+ DCHECK(!status_requested_);
+
+ if (!process_control_->RequestRemotingHostStatus()) {
+ FinishStep(new SetupFlowGetStatusErrorStep());
+ return;
+ }
+
+ status_requested_ = true;
+ process_control_->AddMessageHandler(this);
+}
+
+SetupFlowGetStatusErrorStep::SetupFlowGetStatusErrorStep() { }
+SetupFlowGetStatusErrorStep::~SetupFlowGetStatusErrorStep() { }
+
+string16 SetupFlowGetStatusErrorStep::GetErrorMessage() {
+ return l10n_util::GetStringUTF16(IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE);
+}
+
+void SetupFlowGetStatusErrorStep::Retry() {
+ FinishStep(new SetupFlowGetStatusStep());
+}
+
+} // namespace remoting
diff --git a/chrome/browser/remoting/setup_flow_get_status_step.h b/chrome/browser/remoting/setup_flow_get_status_step.h
new file mode 100644
index 0000000..7968d78
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow_get_status_step.h
@@ -0,0 +1,61 @@
+// 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.
+
+#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_
+#define CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_
+
+#include "chrome/browser/remoting/setup_flow.h"
+#include "chrome/browser/service/service_process_control.h"
+#include "chrome/common/net/gaia/gaia_auth_consumer.h"
+#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
+
+namespace remoting {
+
+// SetupFlowGetStatusStep requests current host information from the service
+// process. It also starts service process if necessary.
+class SetupFlowGetStatusStep : public SetupFlowStepBase,
+ public ServiceProcessControl::MessageHandler {
+ public:
+ SetupFlowGetStatusStep();
+ virtual ~SetupFlowGetStatusStep();
+
+ // SetupFlowStep implementation.
+ virtual void HandleMessage(const std::string& message, const Value* arg);
+ virtual void Cancel();
+
+ // ServiceProcessControl::MessageHandler interface
+ virtual void OnRemotingHostInfo(
+ const remoting::ChromotingHostInfo& host_info);
+
+ protected:
+ virtual void DoStart();
+
+ private:
+ void LaunchServiceProcess();
+ void OnServiceProcessLaunched();
+ void RequestStatus();
+
+ ScopedRunnableMethodFactory<SetupFlowGetStatusStep> task_factory_;
+ ServiceProcessControl* process_control_;
+ bool status_requested_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowGetStatusStep);
+};
+
+class SetupFlowGetStatusErrorStep : public SetupFlowErrorStepBase {
+ public:
+ SetupFlowGetStatusErrorStep();
+ virtual ~SetupFlowGetStatusErrorStep();
+
+ protected:
+ virtual string16 GetErrorMessage();
+ virtual void Retry();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowGetStatusErrorStep);
+};
+
+} // namespace remoting
+
+#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_GET_STATUS_STEP_H_
diff --git a/chrome/browser/remoting/setup_flow_login_step.cc b/chrome/browser/remoting/setup_flow_login_step.cc
new file mode 100644
index 0000000..71ee79b
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow_login_step.cc
@@ -0,0 +1,140 @@
+// 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 "chrome/browser/remoting/setup_flow_login_step.h"
+
+#include "base/json/json_reader.h"
+#include "base/json/json_writer.h"
+#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
+#include "base/values.h"
+#include "chrome/browser/dom_ui/dom_ui_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/remoting/setup_flow_get_status_step.h"
+#include "chrome/common/net/gaia/gaia_constants.h"
+#include "chrome/common/net/gaia/google_service_auth_error.h"
+
+namespace remoting {
+
+static const wchar_t kLoginIFrameXPath[] = L"//iframe[@id='login']";
+
+SetupFlowLoginStep::SetupFlowLoginStep() { }
+SetupFlowLoginStep::~SetupFlowLoginStep() { }
+
+void SetupFlowLoginStep::HandleMessage(const std::string& message,
+ const Value* arg) {
+ if (message == "SubmitAuth") {
+ DCHECK(arg);
+
+ std::string json;
+ if (!arg->GetAsString(&json) || json.empty()) {
+ NOTREACHED();
+ return;
+ }
+
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
+ if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY)) {
+ NOTREACHED() << "Unable to parse auth data";
+ return;
+ }
+
+ CHECK(parsed_value->IsType(Value::TYPE_DICTIONARY));
+
+ std::string username, password, captcha;
+ const DictionaryValue* result =
+ static_cast<const DictionaryValue*>(parsed_value.get());
+ if (!result->GetString("user", &username) ||
+ !result->GetString("pass", &password) ||
+ !result->GetString("captcha", &captcha)) {
+ NOTREACHED() << "Unable to parse auth data";
+ return;
+ }
+
+ OnUserSubmittedAuth(username, password, captcha);
+ }
+}
+
+void SetupFlowLoginStep::Cancel() {
+ if (authenticator_.get())
+ authenticator_->CancelRequest();
+}
+
+void SetupFlowLoginStep::OnUserSubmittedAuth(const std::string& user,
+ const std::string& password,
+ const std::string& captcha) {
+ flow()->context()->login = user;
+
+ // Start the authenticator.
+ authenticator_.reset(
+ new GaiaAuthFetcher(this, GaiaConstants::kChromeSource,
+ flow()->profile()->GetRequestContext()));
+ authenticator_->StartClientLogin(user, password,
+ GaiaConstants::kRemotingService,
+ "", captcha,
+ GaiaAuthFetcher::HostedAccountsAllowed);
+}
+
+void SetupFlowLoginStep::OnClientLoginSuccess(
+ const GaiaAuthConsumer::ClientLoginResult& credentials) {
+ // Save the token for remoting.
+ flow()->context()->remoting_token = credentials.token;
+
+ // After login has succeeded try to fetch the token for sync.
+ // We need the token for sync to connect to the talk network.
+ authenticator_->StartIssueAuthToken(credentials.sid, credentials.lsid,
+ GaiaConstants::kSyncService);
+}
+
+void SetupFlowLoginStep::OnClientLoginFailure(
+ const GoogleServiceAuthError& error) {
+ ShowGaiaFailed(error);
+ authenticator_.reset();
+}
+
+void SetupFlowLoginStep::OnIssueAuthTokenSuccess(
+ const std::string& service, const std::string& auth_token) {
+ // Save the sync token.
+ flow()->context()->talk_token = auth_token;
+ authenticator_.reset();
+
+ FinishStep(new SetupFlowGetStatusStep());
+}
+
+void SetupFlowLoginStep::OnIssueAuthTokenFailure(const std::string& service,
+ const GoogleServiceAuthError& error) {
+ ShowGaiaFailed(error);
+ authenticator_.reset();
+}
+
+void SetupFlowLoginStep::DoStart() {
+ DictionaryValue args;
+ // TODO(sergeyu): Supply current login name if the service was started before.
+ args.SetString("user", "");
+ args.SetBoolean("editable_user", true);
+ ShowGaiaLogin(args);
+}
+
+void SetupFlowLoginStep::ShowGaiaLogin(const DictionaryValue& args) {
+ DOMUI* dom_ui = flow()->dom_ui();
+ DCHECK(dom_ui);
+
+ dom_ui->CallJavascriptFunction(L"showLogin");
+
+ std::string json;
+ base::JSONWriter::Write(&args, false, &json);
+ std::wstring javascript = std::wstring(L"showGaiaLogin") +
+ L"(" + UTF8ToWide(json) + L");";
+ ExecuteJavascriptInIFrame(kLoginIFrameXPath, javascript);
+}
+
+void SetupFlowLoginStep::ShowGaiaFailed(const GoogleServiceAuthError& error) {
+ DictionaryValue args;
+ args.SetString("user", "");
+ args.SetInteger("error", error.state());
+ args.SetBoolean("editable_user", true);
+ args.SetString("captchaUrl", error.captcha().image_url.spec());
+ ShowGaiaLogin(args);
+}
+
+} // namespace remoting
diff --git a/chrome/browser/remoting/setup_flow_login_step.h b/chrome/browser/remoting/setup_flow_login_step.h
new file mode 100644
index 0000000..a7d8911
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow_login_step.h
@@ -0,0 +1,53 @@
+// 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.
+
+#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_LOGIN_STEP_H_
+#define CHROME_BROWSER_REMOTING_SETUP_FLOW_LOGIN_STEP_H_
+
+#include "chrome/browser/remoting/setup_flow.h"
+#include "chrome/common/net/gaia/gaia_auth_consumer.h"
+#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
+
+namespace remoting {
+
+// Implementation of login step for remoting setup flow.
+class SetupFlowLoginStep : public SetupFlowStepBase, public GaiaAuthConsumer {
+ public:
+ SetupFlowLoginStep();
+ virtual ~SetupFlowLoginStep();
+
+ // SetupFlowStep implementation.
+ virtual void HandleMessage(const std::string& message, const Value* arg);
+ virtual void Cancel();
+
+ // GaiaAuthConsumer implementation.
+ virtual void OnClientLoginSuccess(
+ const GaiaAuthConsumer::ClientLoginResult& credentials);
+ virtual void OnClientLoginFailure(const GoogleServiceAuthError& error);
+ virtual void OnIssueAuthTokenSuccess(const std::string& service,
+ const std::string& auth_token);
+ virtual void OnIssueAuthTokenFailure(const std::string& service,
+ const GoogleServiceAuthError& error);
+
+ protected:
+ virtual void DoStart();
+
+ private:
+ void OnUserSubmittedAuth(const std::string& user,
+ const std::string& password,
+ const std::string& captcha);
+
+ void ShowGaiaLogin(const DictionaryValue& args);
+ void ShowGaiaSuccessAndSettingUp();
+ void ShowGaiaFailed(const GoogleServiceAuthError& error);
+
+ // Fetcher to obtain the Chromoting Directory token.
+ scoped_ptr<GaiaAuthFetcher> authenticator_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowLoginStep);
+};
+
+} // namespace remoting
+
+#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_LOGIN_STEP_H_
diff --git a/chrome/browser/remoting/setup_flow_register_step.cc b/chrome/browser/remoting/setup_flow_register_step.cc
new file mode 100644
index 0000000..95799b5
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow_register_step.cc
@@ -0,0 +1,70 @@
+// 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.
+
+#include "chrome/browser/remoting/setup_flow_register_step.h"
+
+#include "app/l10n_util.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/remoting/setup_flow_login_step.h"
+#include "chrome/browser/remoting/setup_flow_start_host_step.h"
+#include "grit/generated_resources.h"
+
+namespace remoting {
+
+SetupFlowRegisterStep::SetupFlowRegisterStep() { }
+SetupFlowRegisterStep::~SetupFlowRegisterStep() { }
+
+void SetupFlowRegisterStep::HandleMessage(const std::string& message,
+ const Value* arg) {
+}
+
+void SetupFlowRegisterStep::Cancel() {
+ // Don't need to do anything here. Ther request will canceled when
+ // |request_| is destroyed.
+}
+
+void SetupFlowRegisterStep::DoStart() {
+ request_.reset(new DirectoryAddRequest(
+ flow()->profile()->GetRequestContext()));
+ request_->AddHost(flow()->context()->host_info,
+ flow()->context()->remoting_token,
+ NewCallback(this, &SetupFlowRegisterStep::OnRequestDone));
+}
+
+void SetupFlowRegisterStep::OnRequestDone(DirectoryAddRequest::Result result,
+ const std::string& error_message) {
+ switch (result) {
+ case DirectoryAddRequest::SUCCESS:
+ FinishStep(new SetupFlowStartHostStep());
+ break;
+ case DirectoryAddRequest::ERROR_EXISTS:
+ LOG(INFO) << "Chromoting host is already reagistered.";
+ FinishStep(new SetupFlowStartHostStep());
+ break;
+ case DirectoryAddRequest::ERROR_AUTH:
+ LOG(ERROR) << "Chromoting Directory didn't accept auth token.";
+ FinishStep(new SetupFlowLoginStep());
+ break;
+ default:
+ LOG(ERROR) << "Chromoting Host registration failed: "
+ << error_message << " (" << result << ")";
+ FinishStep(new SetupFlowRegisterErrorStep());
+ break;
+ }
+}
+
+SetupFlowRegisterErrorStep::SetupFlowRegisterErrorStep() { }
+SetupFlowRegisterErrorStep::~SetupFlowRegisterErrorStep() { }
+
+string16 SetupFlowRegisterErrorStep::GetErrorMessage() {
+ return l10n_util::GetStringUTF16(IDS_REMOTING_REGISTRATION_FAILED_MESSAGE);
+}
+
+void SetupFlowRegisterErrorStep::Retry() {
+ // When retrying we retry from the GetStatus step because it may be
+ // necessary to start service process.
+ FinishStep(new SetupFlowRegisterStep());
+}
+
+} // namespace remoting
diff --git a/chrome/browser/remoting/setup_flow_register_step.h b/chrome/browser/remoting/setup_flow_register_step.h
new file mode 100644
index 0000000..d8b9fe7
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow_register_step.h
@@ -0,0 +1,53 @@
+// 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.
+
+#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_REGISTER_STEP_H_
+#define CHROME_BROWSER_REMOTING_SETUP_FLOW_REGISTER_STEP_H_
+
+#include "chrome/browser/remoting/directory_add_request.h"
+#include "chrome/browser/remoting/setup_flow.h"
+#include "chrome/common/net/gaia/gaia_auth_consumer.h"
+#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
+
+namespace remoting {
+
+// Implementation of host registration step for remoting setup flow.
+class SetupFlowRegisterStep : public SetupFlowStepBase {
+ public:
+ SetupFlowRegisterStep();
+ virtual ~SetupFlowRegisterStep();
+
+ // SetupFlowStep implementation.
+ virtual void HandleMessage(const std::string& message,
+ const Value* arg);
+ virtual void Cancel();
+
+ protected:
+ virtual void DoStart();
+
+ void OnRequestDone(DirectoryAddRequest::Result result,
+ const std::string& error_message);
+
+ private:
+ scoped_ptr<DirectoryAddRequest> request_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowRegisterStep);
+};
+
+class SetupFlowRegisterErrorStep : public SetupFlowErrorStepBase {
+ public:
+ SetupFlowRegisterErrorStep();
+ virtual ~SetupFlowRegisterErrorStep();
+
+ protected:
+ virtual string16 GetErrorMessage();
+ virtual void Retry();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowRegisterErrorStep);
+};
+
+} // namespace remoting
+
+#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_REGISTER_STEP_H_
diff --git a/chrome/browser/remoting/setup_flow_start_host_step.cc b/chrome/browser/remoting/setup_flow_start_host_step.cc
new file mode 100644
index 0000000..19094de
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow_start_host_step.cc
@@ -0,0 +1,85 @@
+// 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 "chrome/browser/remoting/setup_flow_start_host_step.h"
+
+#include "app/l10n_util.h"
+#include "chrome/browser/remoting/setup_flow_get_status_step.h"
+#include "chrome/browser/service/service_process_control.h"
+#include "chrome/browser/service/service_process_control_manager.h"
+#include "grit/generated_resources.h"
+
+namespace remoting {
+
+SetupFlowStartHostStep::SetupFlowStartHostStep()
+ : ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
+ status_requested_(false) {
+}
+
+SetupFlowStartHostStep::~SetupFlowStartHostStep() {
+ if (process_control_)
+ process_control_->RemoveMessageHandler(this);
+}
+
+void SetupFlowStartHostStep::HandleMessage(const std::string& message,
+ const Value* arg) {
+}
+
+void SetupFlowStartHostStep::Cancel() {
+ if (process_control_)
+ process_control_->RemoveMessageHandler(this);
+}
+
+void SetupFlowStartHostStep::OnRemotingHostInfo(
+ const remoting::ChromotingHostInfo& host_info) {
+ if (status_requested_) {
+ status_requested_ = false;
+ if (host_info.enabled) {
+ FinishStep(new SetupFlowDoneStep());
+ } else {
+ FinishStep(new SetupFlowStartHostErrorStep());
+ }
+ }
+}
+
+void SetupFlowStartHostStep::DoStart() {
+ process_control_ =
+ ServiceProcessControlManager::GetInstance()->GetProcessControl(
+ flow()->profile());
+ if (!process_control_ || !process_control_->is_connected()) {
+ FinishStep(new SetupFlowStartHostErrorStep());
+ }
+
+ process_control_->SetRemotingHostCredentials(flow()->context()->login,
+ flow()->context()->talk_token);
+ process_control_->EnableRemotingHost();
+ RequestStatus();
+}
+
+void SetupFlowStartHostStep::RequestStatus() {
+ DCHECK(!status_requested_);
+
+ if (!process_control_->RequestRemotingHostStatus()) {
+ FinishStep(new SetupFlowStartHostErrorStep());
+ return;
+ }
+
+ status_requested_ = true;
+ process_control_->AddMessageHandler(this);
+}
+
+SetupFlowStartHostErrorStep::SetupFlowStartHostErrorStep() { }
+SetupFlowStartHostErrorStep::~SetupFlowStartHostErrorStep() { }
+
+string16 SetupFlowStartHostErrorStep::GetErrorMessage() {
+ return l10n_util::GetStringUTF16(IDS_REMOTING_SERVICE_PROCESS_FAILED_MESSAGE);
+}
+
+void SetupFlowStartHostErrorStep::Retry() {
+ // When retrying we retry from the GetStatus step because it may be
+ // necessary to start service process.
+ FinishStep(new SetupFlowGetStatusStep());
+}
+
+} // namespace remoting
diff --git a/chrome/browser/remoting/setup_flow_start_host_step.h b/chrome/browser/remoting/setup_flow_start_host_step.h
new file mode 100644
index 0000000..2780ad7
--- /dev/null
+++ b/chrome/browser/remoting/setup_flow_start_host_step.h
@@ -0,0 +1,60 @@
+// 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.
+
+#ifndef CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_
+#define CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_
+
+#include "chrome/browser/remoting/setup_flow.h"
+#include "chrome/browser/service/service_process_control.h"
+#include "chrome/common/net/gaia/gaia_auth_consumer.h"
+#include "chrome/common/net/gaia/gaia_auth_fetcher.h"
+
+namespace remoting {
+
+// SetupFlowStartHostStep is the final step in the remoting setup
+// flow. It starts the chromoting hosts and then requests current
+// state to verify that it was started successfully.
+class SetupFlowStartHostStep : public SetupFlowStepBase,
+ public ServiceProcessControl::MessageHandler {
+ public:
+ SetupFlowStartHostStep();
+ virtual ~SetupFlowStartHostStep();
+
+ // SetupFlowStep implementation.
+ virtual void HandleMessage(const std::string& message, const Value* arg);
+ virtual void Cancel();
+
+ // ServiceProcessControl::MessageHandler interface
+ virtual void OnRemotingHostInfo(
+ const remoting::ChromotingHostInfo& host_info);
+
+ protected:
+ virtual void DoStart();
+
+ private:
+ void RequestStatus();
+
+ ScopedRunnableMethodFactory<SetupFlowStartHostStep> task_factory_;
+ ServiceProcessControl* process_control_;
+ bool status_requested_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowStartHostStep);
+};
+
+class SetupFlowStartHostErrorStep : public SetupFlowErrorStepBase {
+ public:
+ SetupFlowStartHostErrorStep();
+ virtual ~SetupFlowStartHostErrorStep();
+
+ protected:
+ virtual string16 GetErrorMessage();
+ virtual void Retry();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(SetupFlowStartHostErrorStep);
+};
+
+} // namespace remoting
+
+#endif // CHROME_BROWSER_REMOTING_SETUP_FLOW_START_HOST_STEP_H_
diff --git a/chrome/browser/renderer_host/async_resource_handler.h b/chrome/browser/renderer_host/async_resource_handler.h
index 2b0df7d..d5fa704 100644
--- a/chrome/browser/renderer_host/async_resource_handler.h
+++ b/chrome/browser/renderer_host/async_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -33,7 +33,7 @@
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
virtual void OnDataDownloaded(int request_id, int bytes_downloaded);
diff --git a/chrome/browser/renderer_host/audio_renderer_host.cc b/chrome/browser/renderer_host/audio_renderer_host.cc
index 1b5ce0a..fe3f3d0 100644
--- a/chrome/browser/renderer_host/audio_renderer_host.cc
+++ b/chrome/browser/renderer_host/audio_renderer_host.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -368,7 +368,8 @@
}
// Make sure the volume is valid.
- CHECK(volume >= 0 && volume <= 1.0);
+ if (volume < 0 || volume > 1.0)
+ return;
entry->controller->SetVolume(volume);
}
diff --git a/chrome/browser/renderer_host/backing_store_mac.mm b/chrome/browser/renderer_host/backing_store_mac.mm
index 5754839..ede4d19 100644
--- a/chrome/browser/renderer_host/backing_store_mac.mm
+++ b/chrome/browser/renderer_host/backing_store_mac.mm
@@ -8,7 +8,7 @@
#include "app/surface/transport_dib.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/sys_info.h"
#include "chrome/browser/renderer_host/render_process_host.h"
@@ -69,7 +69,7 @@
base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image(
CGImageCreate(bitmap_rect.width(), bitmap_rect.height(), 8, 32,
- 4 * bitmap_rect.width(), mac_util::GetSystemColorSpace(),
+ 4 * bitmap_rect.width(), base::mac::GetSystemColorSpace(),
kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
data_provider, NULL, false, kCGRenderingIntentDefault));
@@ -233,7 +233,7 @@
CGContextRef context = CGBitmapContextCreate(NULL,
size().width(), size().height(),
8, size().width() * 4,
- mac_util::GetSystemColorSpace(),
+ base::mac::GetSystemColorSpace(),
kCGImageAlphaPremultipliedFirst |
kCGBitmapByteOrder32Host);
DCHECK(context);
diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc
index e3849fb..3b97c4b 100644
--- a/chrome/browser/renderer_host/browser_render_process_host.cc
+++ b/chrome/browser/renderer_host/browser_render_process_host.cc
@@ -25,8 +25,8 @@
#include "base/platform_file.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/appcache/appcache_dispatcher_host.h"
#include "chrome/browser/browser_child_process_host.h"
#include "chrome/browser/browser_process.h"
@@ -54,6 +54,7 @@
#include "chrome/browser/renderer_host/database_message_filter.h"
#include "chrome/browser/renderer_host/file_utilities_message_filter.h"
#include "chrome/browser/renderer_host/pepper_file_message_filter.h"
+#include "chrome/browser/renderer_host/pepper_message_filter.h"
#include "chrome/browser/renderer_host/render_message_filter.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_view_host_delegate.h"
@@ -65,6 +66,7 @@
#include "chrome/browser/safe_browsing/client_side_detection_service.h"
#include "chrome/browser/search_engines/search_provider_install_state_message_filter.h"
#include "chrome/browser/speech/speech_input_dispatcher_host.h"
+#include "chrome/browser/speech/speech_input_manager.h"
#include "chrome/browser/spellcheck_host.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/visitedlink/visitedlink_master.h"
@@ -95,7 +97,8 @@
#include "webkit/plugins/plugin_switches.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
+#include <objbase.h>
+#include "app/win/win_util.h"
#endif
using WebKit::WebCache;
@@ -450,6 +453,7 @@
GeolocationDispatcherHost::New(
id(), profile()->GetGeolocationPermissionContext()));
channel_->AddFilter(new PepperFileMessageFilter(id(), profile()));
+ channel_->AddFilter(new PepperMessageFilter(profile()));
channel_->AddFilter(new speech_input::SpeechInputDispatcherHost(id()));
channel_->AddFilter(
new SearchProviderInstallStateMessageFilter(id(), profile()));
@@ -787,23 +791,8 @@
}
void BrowserRenderProcessHost::InitSpeechInput() {
- bool enabled = true;
- const CommandLine& command_line = *CommandLine::ForCurrentProcess();
-
- if (command_line.HasSwitch(switches::kDisableSpeechInput)) {
- enabled = false;
-#if defined(GOOGLE_CHROME_BUILD)
- } else if (!command_line.HasSwitch(switches::kEnableSpeechInput)) {
- // We need to evaluate whether IO is OK here. http://crbug.com/63335.
- base::ThreadRestrictions::ScopedAllowIO allow_io;
- // Official Chrome builds have speech input enabled by default only in the
- // dev channel.
- std::string channel = platform_util::GetVersionStringModifier();
- enabled = (channel == "dev");
-#endif
- }
-
- Send(new ViewMsg_SpeechInput_SetFeatureEnabled(enabled));
+ Send(new ViewMsg_SpeechInput_SetFeatureEnabled(
+ speech_input::SpeechInputManager::IsFeatureEnabled()));
}
void BrowserRenderProcessHost::SendUserScriptsUpdate(
@@ -910,7 +899,7 @@
TransportDIB::Id dib_id) {
#if defined(OS_WIN)
// On Windows we need to duplicate the handle from the remote process
- HANDLE section = win_util::GetSectionFromProcess(
+ HANDLE section = app::win::GetSectionFromProcess(
dib_id.handle, GetHandle(), false /* read write */);
return TransportDIB::Map(section);
#elif defined(OS_MACOSX)
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.h b/chrome/browser/renderer_host/buffered_resource_handler.h
index 05cbd48..029db3f 100644
--- a/chrome/browser/renderer_host/buffered_resource_handler.h
+++ b/chrome/browser/renderer_host/buffered_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -34,7 +34,7 @@
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/renderer_host/cross_site_resource_handler.h b/chrome/browser/renderer_host/cross_site_resource_handler.h
index 33c1109..00006bf 100644
--- a/chrome/browser/renderer_host/cross_site_resource_handler.h
+++ b/chrome/browser/renderer_host/cross_site_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -35,7 +35,7 @@
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
@@ -60,7 +60,7 @@
bool in_cross_site_transition_;
int request_id_;
bool completed_during_transition_;
- URLRequestStatus completed_status_;
+ net::URLRequestStatus completed_status_;
std::string completed_security_info_;
ResourceResponse* response_;
ResourceDispatcherHost* rdh_;
diff --git a/chrome/browser/renderer_host/database_message_filter.cc b/chrome/browser/renderer_host/database_message_filter.cc
index b8258f9..4ae0aca 100644
--- a/chrome/browser/renderer_host/database_message_filter.cc
+++ b/chrome/browser/renderer_host/database_message_filter.cc
@@ -7,7 +7,7 @@
#include <string>
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/net/chrome_url_request_context.h"
diff --git a/chrome/browser/renderer_host/download_resource_handler.h b/chrome/browser/renderer_host/download_resource_handler.h
index 5a66f66..bc26989 100644
--- a/chrome/browser/renderer_host/download_resource_handler.h
+++ b/chrome/browser/renderer_host/download_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -56,7 +56,7 @@
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/renderer_host/download_throttling_resource_handler.h b/chrome/browser/renderer_host/download_throttling_resource_handler.h
index 22de040..355bee1 100644
--- a/chrome/browser/renderer_host/download_throttling_resource_handler.h
+++ b/chrome/browser/renderer_host/download_throttling_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -51,7 +51,7 @@
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/renderer_host/offline_resource_handler.h b/chrome/browser/renderer_host/offline_resource_handler.h
index eb19072..82f15a9 100644
--- a/chrome/browser/renderer_host/offline_resource_handler.h
+++ b/chrome/browser/renderer_host/offline_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -40,7 +40,7 @@
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/renderer_host/pepper_message_filter.cc b/chrome/browser/renderer_host/pepper_message_filter.cc
new file mode 100644
index 0000000..62464af
--- /dev/null
+++ b/chrome/browser/renderer_host/pepper_message_filter.cc
@@ -0,0 +1,285 @@
+// 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 "chrome/browser/renderer_host/pepper_message_filter.h"
+
+#include "base/basictypes.h"
+#include "base/process_util.h"
+#include "base/threading/worker_pool.h"
+#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/net/chrome_url_request_context.h"
+#include "chrome/browser/profiles/profile.h"
+#include "chrome/browser/renderer_host/browser_render_process_host.h"
+#include "chrome/common/render_messages.h"
+#include "net/base/address_list.h"
+#include "net/base/host_port_pair.h"
+#include "net/base/host_resolver.h"
+#include "net/url_request/url_request_context.h"
+#include "webkit/plugins/ppapi/ppb_flash_impl.h"
+
+#if defined(ENABLE_FLAPPER_HACKS)
+#include <netdb.h>
+#include <string.h>
+#include <sys/socket.h>
+#include <sys/types.h>
+#include <unistd.h>
+
+// Make sure the storage in |PP_Flash_NetAddress| is big enough. (Do it here
+// since the data is opaque elsewhere.)
+COMPILE_ASSERT(sizeof(reinterpret_cast<PP_Flash_NetAddress*>(0)->data) >=
+ sizeof(sockaddr_storage), PP_Flash_NetAddress_data_too_small);
+#endif // ENABLE_FLAPPER_HACKS
+
+const PP_Flash_NetAddress kInvalidNetAddress = { 0 };
+
+PepperMessageFilter::PepperMessageFilter(Profile* profile)
+ : profile_(profile) {
+}
+
+bool PepperMessageFilter::OnMessageReceived(const IPC::Message& msg,
+ bool* message_was_ok) {
+#if defined(ENABLE_FLAPPER_HACKS)
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP_EX(PepperMessageFilter, msg, *message_was_ok)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_PepperConnectTcp, OnPepperConnectTcp)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_PepperConnectTcpAddress,
+ OnPepperConnectTcpAddress)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP_EX()
+ return handled;
+#else
+ return false;
+#endif // ENABLE_FLAPPER_HACKS
+}
+
+#if defined(ENABLE_FLAPPER_HACKS)
+
+namespace {
+
+bool ValidateNetAddress(const PP_Flash_NetAddress& addr) {
+ if (addr.size < sizeof(sa_family_t))
+ return false;
+
+ // TODO(viettrungluu): more careful validation?
+ // Just do a size check for AF_INET.
+ if (reinterpret_cast<const sockaddr*>(addr.data)->sa_family == AF_INET &&
+ addr.size >= sizeof(sockaddr_in))
+ return true;
+
+ // Ditto for AF_INET6.
+ if (reinterpret_cast<const sockaddr*>(addr.data)->sa_family == AF_INET6 &&
+ addr.size >= sizeof(sockaddr_in6))
+ return true;
+
+ // Reject everything else.
+ return false;
+}
+
+PP_Flash_NetAddress SockaddrToNetAddress(const struct sockaddr* sa,
+ socklen_t sa_length) {
+ PP_Flash_NetAddress addr;
+ CHECK_LE(sa_length, sizeof(addr.data));
+ addr.size = sa_length;
+ memcpy(addr.data, sa, addr.size);
+ return addr;
+}
+
+int ConnectTcpSocket(const PP_Flash_NetAddress& addr,
+ PP_Flash_NetAddress* local_addr_out,
+ PP_Flash_NetAddress* remote_addr_out) {
+ *local_addr_out = kInvalidNetAddress;
+ *remote_addr_out = kInvalidNetAddress;
+
+ const struct sockaddr* sa =
+ reinterpret_cast<const struct sockaddr*>(addr.data);
+ socklen_t sa_len = addr.size;
+ int fd = socket(sa->sa_family, SOCK_STREAM, IPPROTO_TCP);
+ if (fd == -1)
+ return -1;
+ if (connect(fd, sa, sa_len) != 0) {
+ close(fd);
+ return -1;
+ }
+
+ // Get the local address.
+ socklen_t local_length = sizeof(local_addr_out->data);
+ if (getsockname(fd, reinterpret_cast<struct sockaddr*>(local_addr_out->data),
+ &local_length) == -1 ||
+ local_length > sizeof(local_addr_out->data)) {
+ close(fd);
+ return -1;
+ }
+
+ // The remote address is just the address we connected to.
+ *remote_addr_out = addr;
+
+ return fd;
+}
+
+} // namespace
+
+class PepperMessageFilter::LookupRequest {
+ public:
+ LookupRequest(PepperMessageFilter* pepper_message_filter,
+ net::HostResolver* resolver,
+ int routing_id,
+ int request_id,
+ const net::HostResolver::RequestInfo& request_info)
+ : ALLOW_THIS_IN_INITIALIZER_LIST(
+ net_callback_(this, &LookupRequest::OnLookupFinished)),
+ pepper_message_filter_(pepper_message_filter),
+ resolver_(resolver),
+ routing_id_(routing_id),
+ request_id_(request_id),
+ request_info_(request_info) {
+ }
+
+ void Start() {
+ int result = resolver_.Resolve(request_info_, &addresses_, &net_callback_,
+ net::BoundNetLog());
+ if (result != net::ERR_IO_PENDING)
+ OnLookupFinished(result);
+ }
+
+ private:
+ void OnLookupFinished(int /*result*/) {
+ pepper_message_filter_->PepperConnectTcpLookupFinished(
+ routing_id_, request_id_, addresses_);
+ delete this;
+ }
+
+ // HostResolver will call us using this callback when resolution is complete.
+ net::CompletionCallbackImpl<LookupRequest> net_callback_;
+
+ PepperMessageFilter* pepper_message_filter_;
+ net::SingleRequestHostResolver resolver_;
+
+ int routing_id_;
+ int request_id_;
+ net::HostResolver::RequestInfo request_info_;
+
+ net::AddressList addresses_;
+
+ DISALLOW_COPY_AND_ASSIGN(LookupRequest);
+};
+
+void PepperMessageFilter::OnPepperConnectTcp(
+ int routing_id,
+ int request_id,
+ const std::string& host,
+ uint16 port) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ URLRequestContext* req_context =
+ profile_->GetRequestContext()->GetURLRequestContext();
+ net::HostResolver::RequestInfo request_info(net::HostPortPair(host, port));
+
+ // The lookup request will delete itself on completion.
+ LookupRequest* lookup_request =
+ new LookupRequest(this, req_context->host_resolver(),
+ routing_id, request_id, request_info);
+ lookup_request->Start();
+}
+
+void PepperMessageFilter::OnPepperConnectTcpAddress(
+ int routing_id,
+ int request_id,
+ const PP_Flash_NetAddress& addr) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ // Validate the address and then continue (doing |connect()|) on a worker
+ // thread.
+ if (!ValidateNetAddress(addr) ||
+ !base::WorkerPool::PostTask(FROM_HERE,
+ NewRunnableMethod(
+ this,
+ &PepperMessageFilter::PepperConnectTcpAddressOnWorkerThread,
+ routing_id, request_id, addr),
+ true)) {
+ SendPepperConnectTcpACKError(routing_id, request_id);
+ }
+}
+
+bool PepperMessageFilter::SendPepperConnectTcpACKError(int routing_id,
+ int request_id) {
+ return Send(new ViewMsg_PepperConnectTcpACK(
+ routing_id, request_id,
+ IPC::InvalidPlatformFileForTransit(),
+ kInvalidNetAddress, kInvalidNetAddress));
+}
+
+void PepperMessageFilter::PepperConnectTcpLookupFinished(
+ int routing_id,
+ int request_id,
+ const net::AddressList& addresses) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ // If the lookup returned addresses, continue (doing |connect()|) on a worker
+ // thread.
+ if (!addresses.head() ||
+ !base::WorkerPool::PostTask(FROM_HERE,
+ NewRunnableMethod(
+ this,
+ &PepperMessageFilter::PepperConnectTcpOnWorkerThread,
+ routing_id, request_id, addresses),
+ true)) {
+ SendPepperConnectTcpACKError(routing_id, request_id);
+ }
+}
+
+void PepperMessageFilter::PepperConnectTcpOnWorkerThread(
+ int routing_id,
+ int request_id,
+ net::AddressList addresses) {
+ DCHECK(!MessageLoop::current()); // Check we are on a worker thread.
+
+ IPC::PlatformFileForTransit socket_for_transit =
+ IPC::InvalidPlatformFileForTransit();
+ PP_Flash_NetAddress local_addr = kInvalidNetAddress;
+ PP_Flash_NetAddress remote_addr = kInvalidNetAddress;
+
+ for (const struct addrinfo* ai = addresses.head(); ai; ai = ai->ai_next) {
+ PP_Flash_NetAddress addr = SockaddrToNetAddress(ai->ai_addr,
+ ai->ai_addrlen);
+ int fd = ConnectTcpSocket(addr, &local_addr, &remote_addr);
+ if (fd != -1) {
+ socket_for_transit = base::FileDescriptor(fd, true);
+ break;
+ }
+ }
+
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ NewRunnableMethod(
+ this, &PepperMessageFilter::Send,
+ new ViewMsg_PepperConnectTcpACK(
+ routing_id, request_id,
+ socket_for_transit, local_addr, remote_addr)));
+}
+
+// TODO(vluu): Eliminate duplication between this and
+// |PepperConnectTcpOnWorkerThread()|.
+void PepperMessageFilter::PepperConnectTcpAddressOnWorkerThread(
+ int routing_id,
+ int request_id,
+ PP_Flash_NetAddress addr) {
+ DCHECK(!MessageLoop::current()); // Check we are on a worker thread.
+
+ IPC::PlatformFileForTransit socket_for_transit =
+ IPC::InvalidPlatformFileForTransit();
+ PP_Flash_NetAddress local_addr = kInvalidNetAddress;
+ PP_Flash_NetAddress remote_addr = kInvalidNetAddress;
+
+ int fd = ConnectTcpSocket(addr, &local_addr, &remote_addr);
+ if (fd != -1)
+ socket_for_transit = base::FileDescriptor(fd, true);
+
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ NewRunnableMethod(
+ this, &PepperMessageFilter::Send,
+ new ViewMsg_PepperConnectTcpACK(
+ routing_id, request_id,
+ socket_for_transit, local_addr, remote_addr)));
+}
+
+#endif // ENABLE_FLAPPER_HACKS
diff --git a/chrome/browser/renderer_host/pepper_message_filter.h b/chrome/browser/renderer_host/pepper_message_filter.h
new file mode 100644
index 0000000..ec36c08
--- /dev/null
+++ b/chrome/browser/renderer_host/pepper_message_filter.h
@@ -0,0 +1,67 @@
+// 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.
+
+#ifndef CHROME_BROWSER_RENDERER_HOST_PEPPER_MESSAGE_FILTER_H_
+#define CHROME_BROWSER_RENDERER_HOST_PEPPER_MESSAGE_FILTER_H_
+#pragma once
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/process.h"
+#include "chrome/browser/browser_message_filter.h"
+#include "ipc/ipc_channel_proxy.h"
+#include "ppapi/c/private/ppb_flash.h"
+
+class Profile;
+
+namespace net {
+class AddressList;
+}
+
+class PepperMessageFilter : public BrowserMessageFilter {
+ public:
+ explicit PepperMessageFilter(Profile* profile);
+
+ private:
+ // BrowserMessageFilter methods.
+ virtual bool OnMessageReceived(const IPC::Message& message,
+ bool* message_was_ok);
+
+#if defined(ENABLE_FLAPPER_HACKS)
+ // Message handlers.
+ void OnPepperConnectTcp(int routing_id,
+ int request_id,
+ const std::string& host,
+ uint16 port);
+ void OnPepperConnectTcpAddress(int routing_id,
+ int request_id,
+ const PP_Flash_NetAddress& address);
+
+ // |Send()| a |ViewMsg_PepperConnectTcpACK|, which reports an error.
+ bool SendPepperConnectTcpACKError(int routing_id,
+ int request_id);
+
+ // Used by |OnPepperConnectTcp()| (below).
+ class LookupRequest;
+ friend class LookupRequest;
+
+ // Continuation of |OnPepperConnectTcp()|.
+ void PepperConnectTcpLookupFinished(int routing_id,
+ int request_id,
+ const net::AddressList& addresses);
+ void PepperConnectTcpOnWorkerThread(int routing_id,
+ int request_id,
+ net::AddressList addresses);
+
+ // Continuation of |OnPepperConnectTcpAddress()|.
+ void PepperConnectTcpAddressOnWorkerThread(int routing_id,
+ int request_id,
+ PP_Flash_NetAddress addr);
+#endif // ENABLE_FLAPPER_HACKS
+
+ Profile* profile_;
+};
+
+#endif // CHROME_BROWSER_RENDERER_HOST_PEPPER_MESSAGE_FILTER_H_
diff --git a/chrome/browser/renderer_host/redirect_to_file_resource_handler.h b/chrome/browser/renderer_host/redirect_to_file_resource_handler.h
index 5e8624a..2d7ceed 100644
--- a/chrome/browser/renderer_host/redirect_to_file_resource_handler.h
+++ b/chrome/browser/renderer_host/redirect_to_file_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -44,7 +44,7 @@
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/renderer_host/render_message_filter.cc b/chrome/browser/renderer_host/render_message_filter.cc
index b5adbaa..1f86ca8 100644
--- a/chrome/browser/renderer_host/render_message_filter.cc
+++ b/chrome/browser/renderer_host/render_message_filter.cc
@@ -12,9 +12,9 @@
#include "base/process_util.h"
#include "base/shared_memory.h"
#include "base/sys_string_conversions.h"
-#include "base/thread.h"
+#include "base/threading/worker_pool.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
-#include "base/worker_pool.h"
#include "chrome/browser/automation/automation_resource_message_filter.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
@@ -1352,7 +1352,7 @@
VLOG(1) << "Dispatching keygen task to worker pool.";
// Dispatch to worker pool, so we do not block the IO thread.
- if (!WorkerPool::PostTask(
+ if (!base::WorkerPool::PostTask(
FROM_HERE,
NewRunnableMethod(
this, &RenderMessageFilter::OnKeygenOnWorkerThread,
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 950c60e..ccbd57a 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/json/json_reader.h"
-#include "base/metrics/stats_counters.h"
#include "base/string_util.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
@@ -81,25 +80,6 @@
namespace {
-void FilterURL(ChildProcessSecurityPolicy* policy, int renderer_id, GURL* url) {
- if (!url->is_valid())
- return; // We don't need to block invalid URLs.
-
- if (url->SchemeIs(chrome::kAboutScheme)) {
- // The renderer treats all URLs in the about: scheme as being about:blank.
- // Canonicalize about: URLs to about:blank.
- *url = GURL(chrome::kAboutBlankURL);
- }
-
- if (!policy->CanRequestURL(renderer_id, *url)) {
- // If this renderer is not permitted to request this URL, we invalidate the
- // URL. This prevents us from storing the blocked URL and becoming confused
- // later.
- VLOG(1) << "Blocked URL " << url->spec();
- *url = GURL();
- }
-}
-
// Delay to wait on closing the tab for a beforeunload/unload handler to fire.
const int kUnloadTimeoutMS = 1000;
@@ -760,6 +740,9 @@
}
#endif
+ if (delegate_->OnMessageReceived(msg))
+ return true;
+
bool handled = true;
bool msg_is_ok = true;
IPC_BEGIN_MESSAGE_MAP_EX(RenderViewHost, msg, msg_is_ok)
@@ -778,7 +761,7 @@
IPC_MESSAGE_HANDLER(ViewHostMsg_Thumbnail, OnMsgThumbnail)
IPC_MESSAGE_HANDLER(ViewHostMsg_Snapshot, OnMsgScreenshot)
IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateInspectorSetting,
- OnUpdateInspectorSetting);
+ OnUpdateInspectorSetting)
IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartLoading, OnMsgDidStartLoading)
@@ -789,18 +772,6 @@
OnMsgDocumentAvailableInMainFrame)
IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentOnLoadCompletedInMainFrame,
OnMsgDocumentOnLoadCompletedInMainFrame)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache,
- OnMsgDidLoadResourceFromMemoryCache)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent,
- OnMsgDidDisplayInsecureContent)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent,
- OnMsgDidRunInsecureContent)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad,
- OnMsgDidRedirectProvisionalLoad)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame,
- OnMsgDidStartProvisionalLoadForFrame)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError,
- OnMsgDidFailProvisionalLoadWithError)
IPC_MESSAGE_HANDLER(ViewHostMsg_Find_Reply, OnMsgFindReply)
IPC_MESSAGE_HANDLER(ViewMsg_ExecuteCodeFinished,
OnExecuteCodeFinished)
@@ -812,16 +783,10 @@
OnMsgDidContentsPreferredSizeChange)
IPC_MESSAGE_HANDLER(ViewHostMsg_DomOperationResponse,
OnMsgDomOperationResponse)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend,
- OnMsgDOMUISend)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DOMUISend, OnMsgDOMUISend)
IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardMessageToExternalHost,
OnMsgForwardMessageToExternalHost)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame,
- OnMsgDocumentLoadedInFrame)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad,
- OnMsgDidFinishLoad)
- IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset,
- OnMsgGoToEntryAtOffset)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_GoToEntryAtOffset, OnMsgGoToEntryAtOffset)
IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText)
IPC_MESSAGE_HANDLER(ViewHostMsg_RunFileChooser, OnMsgRunFileChooser)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_RunJavaScriptMessage,
@@ -844,34 +809,34 @@
IPC_MESSAGE_HANDLER(ViewHostMsg_DidPrintPage, DidPrintPage)
IPC_MESSAGE_HANDLER(ViewHostMsg_AddMessageToConsole, OnAddMessageToConsole)
IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsAgent,
- OnForwardToDevToolsAgent);
+ OnForwardToDevToolsAgent)
IPC_MESSAGE_HANDLER(ViewHostMsg_ForwardToDevToolsClient,
- OnForwardToDevToolsClient);
+ OnForwardToDevToolsClient)
IPC_MESSAGE_HANDLER(ViewHostMsg_ActivateDevToolsWindow,
- OnActivateDevToolsWindow);
+ OnActivateDevToolsWindow)
IPC_MESSAGE_HANDLER(ViewHostMsg_CloseDevToolsWindow,
- OnCloseDevToolsWindow);
+ OnCloseDevToolsWindow)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestDockDevToolsWindow,
- OnRequestDockDevToolsWindow);
+ OnRequestDockDevToolsWindow)
IPC_MESSAGE_HANDLER(ViewHostMsg_RequestUndockDevToolsWindow,
- OnRequestUndockDevToolsWindow);
+ OnRequestUndockDevToolsWindow)
IPC_MESSAGE_HANDLER(ViewHostMsg_DevToolsRuntimePropertyChanged,
- OnDevToolsRuntimePropertyChanged);
- IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus);
- IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin);
+ OnDevToolsRuntimePropertyChanged)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_MissingPluginStatus, OnMissingPluginStatus)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_CrashedPlugin, OnCrashedPlugin)
IPC_MESSAGE_HANDLER(ViewHostMsg_BlockedOutdatedPlugin,
- OnBlockedOutdatedPlugin);
+ OnBlockedOutdatedPlugin)
IPC_MESSAGE_HANDLER(ViewHostMsg_SendCurrentPageAllSavableResourceLinks,
- OnReceivedSavableResourceLinksForCurrentPage);
+ OnReceivedSavableResourceLinksForCurrentPage)
IPC_MESSAGE_HANDLER(ViewHostMsg_SendSerializedHtmlData,
- OnReceivedSerializedHtmlData);
+ OnReceivedSerializedHtmlData)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidGetApplicationInfo,
- OnDidGetApplicationInfo);
+ OnDidGetApplicationInfo)
IPC_MESSAGE_HANDLER(ViewHostMsg_InstallApplication,
- OnInstallApplication);
+ OnInstallApplication)
IPC_MESSAGE_FORWARD(ViewHostMsg_JSOutOfMemory, delegate_,
- RenderViewHostDelegate::OnJSOutOfMemory);
- IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK);
+ RenderViewHostDelegate::OnJSOutOfMemory)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_ShouldClose_ACK, OnMsgShouldCloseACK)
IPC_MESSAGE_HANDLER(ViewHostMsg_QueryFormFieldAutoFill,
OnQueryFormFieldAutoFill)
IPC_MESSAGE_HANDLER(ViewHostMsg_DidShowAutoFillSuggestions,
@@ -1155,17 +1120,6 @@
Send(new ViewMsg_Move_ACK(routing_id()));
}
-void RenderViewHost::OnMsgDidRedirectProvisionalLoad(int32 page_id,
- const GURL& source_url,
- const GURL& target_url) {
- RenderViewHostDelegate::Resource* resource_delegate =
- delegate_->GetResourceDelegate();
- if (resource_delegate) {
- resource_delegate->DidRedirectProvisionalLoad(page_id,
- source_url, target_url);
- }
-}
-
void RenderViewHost::OnMsgDidStartLoading() {
delegate_->DidStartLoading();
}
@@ -1186,77 +1140,6 @@
delegate_->DocumentOnLoadCompletedInMainFrame(this, page_id);
}
-void RenderViewHost::OnMsgDidLoadResourceFromMemoryCache(
- const GURL& url,
- const std::string& frame_origin,
- const std::string& main_frame_origin,
- const std::string& security_info) {
- static base::StatsCounter cache("WebKit.CacheHit");
- cache.Increment();
-
- RenderViewHostDelegate::Resource* resource_delegate =
- delegate_->GetResourceDelegate();
- if (resource_delegate) {
- resource_delegate->DidLoadResourceFromMemoryCache(
- url, frame_origin, main_frame_origin, security_info);
- }
-}
-
-void RenderViewHost::OnMsgDidDisplayInsecureContent() {
- RenderViewHostDelegate::Resource* resource_delegate =
- delegate_->GetResourceDelegate();
- if (resource_delegate)
- resource_delegate->DidDisplayInsecureContent();
-}
-
-void RenderViewHost::OnMsgDidRunInsecureContent(
- const std::string& security_origin) {
- RenderViewHostDelegate::Resource* resource_delegate =
- delegate_->GetResourceDelegate();
- if (resource_delegate)
- resource_delegate->DidRunInsecureContent(security_origin);
-}
-
-void RenderViewHost::OnMsgDidStartProvisionalLoadForFrame(int64 frame_id,
- bool is_main_frame,
- const GURL& url) {
- bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL);
- GURL validated_url(url);
- FilterURL(ChildProcessSecurityPolicy::GetInstance(),
- process()->id(), &validated_url);
-
- RenderViewHostDelegate::Resource* resource_delegate =
- delegate_->GetResourceDelegate();
- if (resource_delegate) {
- resource_delegate->DidStartProvisionalLoadForFrame(
- this, frame_id, is_main_frame, is_error_page, validated_url);
- }
-}
-
-void RenderViewHost::OnMsgDidFailProvisionalLoadWithError(
- int64 frame_id,
- bool is_main_frame,
- int error_code,
- const GURL& url,
- bool showing_repost_interstitial) {
- VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec()
- << ", error_code: " << error_code
- << " is_main_frame: " << is_main_frame
- << " showing_repost_interstitial: " << showing_repost_interstitial
- << " frame_id: " << frame_id;
- GURL validated_url(url);
- FilterURL(ChildProcessSecurityPolicy::GetInstance(),
- process()->id(), &validated_url);
-
- RenderViewHostDelegate::Resource* resource_delegate =
- delegate_->GetResourceDelegate();
- if (resource_delegate) {
- resource_delegate->DidFailProvisionalLoadWithError(
- this, frame_id, is_main_frame, error_code, validated_url,
- showing_repost_interstitial);
- }
-}
-
void RenderViewHost::OnMsgFindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
@@ -1396,20 +1279,6 @@
delegate_->ProcessExternalHostMessage(message, origin, target);
}
-void RenderViewHost::OnMsgDocumentLoadedInFrame(int64 frame_id) {
- RenderViewHostDelegate::Resource* resource_delegate =
- delegate_->GetResourceDelegate();
- if (resource_delegate)
- resource_delegate->DocumentLoadedInFrame(frame_id);
-}
-
-void RenderViewHost::OnMsgDidFinishLoad(int64 frame_id) {
- RenderViewHostDelegate::Resource* resource_delegate =
- delegate_->GetResourceDelegate();
- if (resource_delegate)
- resource_delegate->DidFinishLoad(frame_id);
-}
-
void RenderViewHost::DisassociateFromPopupCount() {
Send(new ViewMsg_DisassociateFromPopupCount(routing_id()));
}
@@ -1771,8 +1640,8 @@
}
void RenderViewHost::OnShowAutoFillDialog() {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
Browser* browser = BrowserList::GetLastActive();
if (!browser)
return;
@@ -2093,6 +1962,27 @@
verbatim));
}
+void RenderViewHost::FilterURL(ChildProcessSecurityPolicy* policy,
+ int renderer_id,
+ GURL* url) {
+ if (!url->is_valid())
+ return; // We don't need to block invalid URLs.
+
+ if (url->SchemeIs(chrome::kAboutScheme)) {
+ // The renderer treats all URLs in the about: scheme as being about:blank.
+ // Canonicalize about: URLs to about:blank.
+ *url = GURL(chrome::kAboutBlankURL);
+ }
+
+ if (!policy->CanRequestURL(renderer_id, *url)) {
+ // If this renderer is not permitted to request this URL, we invalidate the
+ // URL. This prevents us from storing the blocked URL and becoming confused
+ // later.
+ VLOG(1) << "Blocked URL " << url->spec();
+ *url = GURL();
+ }
+}
+
void RenderViewHost::OnExtensionPostMessage(
int port_id, const std::string& message) {
if (process()->profile()->GetExtensionMessageService()) {
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 02c08d1..2174f2f 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -26,6 +26,7 @@
#include "webkit/glue/webaccessibility.h"
#include "webkit/glue/window_open_disposition.h"
+class ChildProcessSecurityPolicy;
class FilePath;
class GURL;
class ListValue;
@@ -152,7 +153,7 @@
// Returns whether navigation messages are currently suspended for this
// RenderViewHost. Only true during a cross-site navigation, while waiting
// for the onbeforeunload handler.
- bool are_navigations_suspended() { return navigations_suspended_; }
+ bool are_navigations_suspended() const { return navigations_suspended_; }
// Suspends (or unsuspends) any navigation messages from being sent from this
// RenderViewHost. This is called when a pending RenderViewHost is created
@@ -349,10 +350,10 @@
// Returns a bitwise OR of bindings types that have been enabled for this
// RenderView. See BindingsPolicy for details.
- int enabled_bindings() { return enabled_bindings_; }
+ int enabled_bindings() const { return enabled_bindings_; }
// See variable comment.
- bool is_extension_process() { return is_extension_process_; }
+ bool is_extension_process() const { return is_extension_process_; }
void set_is_extension_process(bool is_extension_process) {
is_extension_process_ = is_extension_process;
}
@@ -538,6 +539,12 @@
bool is_waiting_for_unload_ack() { return is_waiting_for_unload_ack_; }
#endif
+ // Checks that the given renderer can request |url|, if not it sets it to an
+ // empty url.
+ static void FilterURL(ChildProcessSecurityPolicy* policy,
+ int renderer_id,
+ GURL* url);
+
protected:
// RenderWidgetHost protected overrides.
virtual bool PreHandleKeyboardEvent(const NativeWebKeyboardEvent& event,
@@ -572,28 +579,11 @@
void OnMsgScreenshot(const SkBitmap& bitmap);
void OnMsgClose();
void OnMsgRequestMove(const gfx::Rect& pos);
- void OnMsgDidRedirectProvisionalLoad(int32 page_id,
- const GURL& source_url,
- const GURL& target_url);
void OnMsgDidStartLoading();
void OnMsgDidStopLoading();
void OnMsgDidChangeLoadProgress(double load_progress);
void OnMsgDocumentAvailableInMainFrame();
void OnMsgDocumentOnLoadCompletedInMainFrame(int32 page_id);
- void OnMsgDidLoadResourceFromMemoryCache(const GURL& url,
- const std::string& frame_origin,
- const std::string& main_frame_origin,
- const std::string& security_info);
- void OnMsgDidDisplayInsecureContent();
- void OnMsgDidRunInsecureContent(const std::string& security_origin);
- void OnMsgDidStartProvisionalLoadForFrame(int64 frame_id,
- bool main_frame,
- const GURL& url);
- void OnMsgDidFailProvisionalLoadWithError(int64 frame_id,
- bool main_frame,
- int error_code,
- const GURL& url,
- bool showing_repost_interstitial);
void OnMsgFindReply(int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
@@ -617,8 +607,6 @@
void OnMsgForwardMessageToExternalHost(const std::string& message,
const std::string& origin,
const std::string& target);
- void OnMsgDocumentLoadedInFrame(int64 frame_id);
- void OnMsgDidFinishLoad(int64 frame_id);
void OnMsgGoToEntryAtOffset(int offset);
void OnMsgSetTooltipText(const std::wstring& tooltip_text,
WebKit::WebTextDirection text_direction_hint);
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.cc b/chrome/browser/renderer_host/render_view_host_delegate.cc
index 738a1ec..a58eea5 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.cc
+++ b/chrome/browser/renderer_host/render_view_host_delegate.cc
@@ -30,10 +30,6 @@
return NULL;
}
-RenderViewHostDelegate::Resource*
-RenderViewHostDelegate::GetResourceDelegate() {
- return NULL;
-}
RenderViewHostDelegate::ContentSettings*
RenderViewHostDelegate::GetContentSettingsDelegate() {
@@ -84,6 +80,10 @@
return NULL;
}
+bool RenderViewHostDelegate::OnMessageReceived(const IPC::Message& message) {
+ return false;
+}
+
const GURL& RenderViewHostDelegate::GetURL() const {
return GURL::EmptyGURL();
}
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index d769d05..34c206b 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -18,6 +18,7 @@
#include "chrome/common/translate_errors.h"
#include "chrome/common/view_types.h"
#include "chrome/common/window_container_type.h"
+#include "ipc/ipc_channel.h"
#include "net/base/load_states.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h"
@@ -94,7 +95,7 @@
// exposing a more generic Send function on RenderViewHost and a response
// listener here to serve that need.
//
-class RenderViewHostDelegate {
+class RenderViewHostDelegate : public IPC::Channel::Listener {
public:
// View ----------------------------------------------------------------------
// Functions that can be routed directly to a view-specific class.
@@ -322,71 +323,6 @@
virtual ~BrowserIntegration() {}
};
- // Resource ------------------------------------------------------------------
- // Notifications of resource loading events.
-
- class Resource {
- public:
- // The RenderView is starting a provisional load.
- virtual void DidStartProvisionalLoadForFrame(
- RenderViewHost* render_view_host,
- int64 frame_id,
- bool is_main_frame,
- bool is_error_page,
- const GURL& url) = 0;
-
- // Notification by the resource loading system (not the renderer) that it
- // has started receiving a resource response. This is different than
- // DidStartProvisionalLoadForFrame above because this is called for every
- // resource (images, automatically loaded subframes, etc.) and provisional
- // loads are only for user-initiated navigations.
- virtual void DidStartReceivingResourceResponse(
- const ResourceRequestDetails& details) = 0;
-
- // Sent when a provisional load is redirected.
- virtual void DidRedirectProvisionalLoad(int32 page_id,
- const GURL& source_url,
- const GURL& target_url) = 0;
-
- // Notification by the resource loading system (not the renderer) that a
- // resource was redirected. This is different than
- // DidRedirectProvisionalLoad above because this is called for every
- // resource (images, automatically loaded subframes, etc.) and provisional
- // loads are only for user-initiated navigations.
- virtual void DidRedirectResource(
- const ResourceRedirectDetails& details) = 0;
-
- // The RenderView loaded a resource from an in-memory cache.
- // |security_info| contains the security info if this resource was
- // originally loaded over a secure connection.
- virtual void DidLoadResourceFromMemoryCache(
- const GURL& url,
- const std::string& frame_origin,
- const std::string& main_frame_origin,
- const std::string& security_info) = 0;
-
- virtual void DidDisplayInsecureContent() = 0;
- virtual void DidRunInsecureContent(const std::string& security_origin) = 0;
-
- // The RenderView failed a provisional load with an error.
- virtual void DidFailProvisionalLoadWithError(
- RenderViewHost* render_view_host,
- int64 frame_id,
- bool is_main_frame,
- int error_code,
- const GURL& url,
- bool showing_repost_interstitial) = 0;
-
- // Notification that a document has been loaded in a frame.
- virtual void DocumentLoadedInFrame(int64 frame_id) = 0;
-
- // Notification that a frame finished loading.
- virtual void DidFinishLoad(int64 frame_id) = 0;
-
- protected:
- virtual ~Resource() {}
- };
-
// ContentSettings------------------------------------------------------------
// Interface for content settings related events.
@@ -672,7 +608,6 @@
virtual View* GetViewDelegate();
virtual RendererManagement* GetRendererManagementDelegate();
virtual BrowserIntegration* GetBrowserIntegrationDelegate();
- virtual Resource* GetResourceDelegate();
virtual ContentSettings* GetContentSettingsDelegate();
virtual Save* GetSaveDelegate();
virtual Printing* GetPrintingDelegate();
@@ -688,6 +623,10 @@
virtual AutomationResourceRoutingDelegate*
GetAutomationResourceRoutingDelegate();
+ // IPC::Channel::Listener implementation.
+ // This is used to give the delegate a chance to filter IPC messages.
+ virtual bool OnMessageReceived(const IPC::Message& message);
+
// Gets the URL that is currently being displayed, if there is one.
virtual const GURL& GetURL() const;
diff --git a/chrome/browser/renderer_host/render_view_host_notification_task.h b/chrome/browser/renderer_host/render_view_host_notification_task.h
index 1aab02b..fb06112 100644
--- a/chrome/browser/renderer_host/render_view_host_notification_task.h
+++ b/chrome/browser/renderer_host/render_view_host_notification_task.h
@@ -70,31 +70,6 @@
params));
}
-// For proxying calls to RenderViewHostDelegate::Resource
-
-class RenderViewHostToResourceDelegate {
- public:
- typedef RenderViewHostDelegate::Resource MappedType;
- static MappedType* Map(RenderViewHost* rvh) {
- return rvh ? rvh->delegate()->GetResourceDelegate() : NULL;
- }
-};
-
-template <typename Method, typename Params>
-inline void CallRenderViewHostResourceDelegateHelper(int render_process_id,
- int render_view_id,
- Method method,
- const Params& params) {
-
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- new RenderViewHostNotificationTask<
- Method, Params, RenderViewHostToResourceDelegate>(render_process_id,
- render_view_id,
- method,
- params));
-}
-
// For proxying calls to RenderViewHostDelegate::ContentSettings
class RenderViewHostToContentSettingsDelegate {
@@ -213,42 +188,6 @@
}
// ----------------------------------------------------------------------------
-// Proxy calls to the specified RenderViewHost's Resource delegate.
-
-template <typename Method>
-inline void CallRenderViewHostResourceDelegate(int render_process_id,
- int render_view_id,
- Method method) {
- internal::CallRenderViewHostResourceDelegateHelper(render_process_id,
- render_view_id,
- method,
- MakeTuple());
-}
-
-template <typename Method, typename A>
-inline void CallRenderViewHostResourceDelegate(int render_process_id,
- int render_view_id,
- Method method,
- const A& a) {
- internal::CallRenderViewHostResourceDelegateHelper(render_process_id,
- render_view_id,
- method,
- MakeTuple(a));
-}
-
-template <typename Method, typename A, typename B>
-inline void CallRenderViewHostResourceDelegate(int render_process_id,
- int render_view_id,
- Method method,
- const A& a,
- const B& b) {
- internal::CallRenderViewHostResourceDelegateHelper(render_process_id,
- render_view_id,
- method,
- MakeTuple(a, b));
-}
-
-// ----------------------------------------------------------------------------
// Proxy calls to the specified RenderViewHost's ContentSettings delegate.
template <typename Method>
diff --git a/chrome/browser/renderer_host/render_widget_helper.cc b/chrome/browser/renderer_host/render_widget_helper.cc
index c3abe80..0ea4f8c 100644
--- a/chrome/browser/renderer_host/render_widget_helper.cc
+++ b/chrome/browser/renderer_host/render_widget_helper.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/renderer_host/render_widget_helper.h"
#include "base/eintr_wrapper.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/renderer_host/render_view_host.h"
diff --git a/chrome/browser/renderer_host/render_widget_helper.h b/chrome/browser/renderer_host/render_widget_helper.h
index 6d3dcfa..882a349 100644
--- a/chrome/browser/renderer_host/render_widget_helper.h
+++ b/chrome/browser/renderer_host/render_widget_helper.h
@@ -14,7 +14,7 @@
#include "base/process.h"
#include "base/ref_counted.h"
#include "base/lock.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/common/window_container_type.h"
#include "third_party/WebKit/WebKit/chromium/public/WebPopupType.h"
diff --git a/chrome/browser/renderer_host/render_widget_host.cc b/chrome/browser/renderer_host/render_widget_host.cc
index 28862af..7a7a5d6 100644
--- a/chrome/browser/renderer_host/render_widget_host.cc
+++ b/chrome/browser/renderer_host/render_widget_host.cc
@@ -714,13 +714,11 @@
}
void RenderWidgetHost::ImeConfirmComposition(const string16& text) {
- Send(new ViewMsg_ImeSetComposition(routing_id(),
- text, std::vector<WebKit::WebCompositionUnderline>(), 0, 0));
- Send(new ViewMsg_ImeConfirmComposition(routing_id()));
+ Send(new ViewMsg_ImeConfirmComposition(routing_id(), text));
}
void RenderWidgetHost::ImeConfirmComposition() {
- Send(new ViewMsg_ImeConfirmComposition(routing_id()));
+ Send(new ViewMsg_ImeConfirmComposition(routing_id(), string16()));
}
void RenderWidgetHost::ImeCancelComposition() {
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
index 1616378..2d10e4e 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.cc
@@ -1106,15 +1106,17 @@
host_->ForwardKeyboardEvent(event);
}
-void RenderWidgetHostViewGtk::AnimationEnded(const Animation* animation) {
+void RenderWidgetHostViewGtk::AnimationEnded(const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
-void RenderWidgetHostViewGtk::AnimationProgressed(const Animation* animation) {
+void RenderWidgetHostViewGtk::AnimationProgressed(
+ const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
-void RenderWidgetHostViewGtk::AnimationCanceled(const Animation* animation) {
+void RenderWidgetHostViewGtk::AnimationCanceled(
+ const ui::Animation* animation) {
gtk_widget_queue_draw(view_.get());
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_gtk.h b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
index 2c47c01..fcc5e75 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_gtk.h
+++ b/chrome/browser/renderer_host/render_widget_host_view_gtk.h
@@ -11,14 +11,14 @@
#include <vector>
#include <string>
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
#include "chrome/browser/gtk/owned_widget_gtk.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
#include "gfx/native_widget_types.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
#include "webkit/glue/webcursor.h"
#include "webkit/plugins/npapi/gtk_plugin_container_manager.h"
@@ -43,7 +43,7 @@
// See comments in render_widget_host_view.h about this class and its members.
// -----------------------------------------------------------------------------
class RenderWidgetHostViewGtk : public RenderWidgetHostView,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit RenderWidgetHostViewGtk(RenderWidgetHost* widget);
~RenderWidgetHostViewGtk();
@@ -92,10 +92,10 @@
virtual bool ContainsNativeView(gfx::NativeView native_view) const;
virtual void AcceleratedCompositingActivated(bool activated);
- // AnimationDelegate implementation.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
gfx::NativeView native_view() const { return view_.get(); }
@@ -179,7 +179,7 @@
// The animation used for the abovementioned shade effect. The animation's
// value affects the alpha we use for |overlay_color_|.
- SlideAnimation overlay_animation_;
+ ui::SlideAnimation overlay_animation_;
// Variables used only for popups --------------------------------------------
// Our parent widget.
diff --git a/chrome/browser/renderer_host/render_widget_host_view_mac.mm b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
index 14b4d82..7c803a7 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_mac.mm
+++ b/chrome/browser/renderer_host/render_widget_host_view_mac.mm
@@ -2074,14 +2074,8 @@
// SpellCheckerPlatform::CheckSpelling remembers the last tag and
// SpellCheckerPlatform::IgnoreWord assumes that is the correct tag.
NSString* wordToIgnore = [sender stringValue];
- if (wordToIgnore != nil) {
+ if (wordToIgnore != nil)
SpellCheckerPlatform::IgnoreWord(base::SysNSStringToUTF16(wordToIgnore));
-
- // Strangely, the spellingPanel doesn't send checkSpelling after a word is
- // ignored, so we have to explicitly call AdvanceToNextMisspelling here.
- RenderWidgetHostViewMac* thisHostView = [self renderWidgetHostViewMac];
- thisHostView->GetRenderWidgetHost()->AdvanceToNextMisspelling();
- }
}
- (void)showGuessPanel:(id)sender {
diff --git a/chrome/browser/renderer_host/render_widget_host_view_views.cc b/chrome/browser/renderer_host/render_widget_host_view_views.cc
index c48a1a9..a8049cf 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_views.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_views.cc
@@ -504,9 +504,22 @@
bool RenderWidgetHostViewViews::OnKeyPressed(const views::KeyEvent &e) {
// Send key event to input method.
// TODO host_view->im_context_->ProcessKeyEvent(event);
- NativeWebKeyboardEvent wke;
- wke.type = WebKit::WebInputEvent::KeyDown;
+ // This is how it works:
+ // (1) If a RawKeyDown event is an accelerator for a reserved command (see
+ // Browser::IsReservedCommand), then the command is executed. Otherwise,
+ // the event is first sent off to the renderer. The renderer is also
+ // notified whether the event would trigger an accelerator in the browser.
+ // (2) A Char event is then sent to the renderer.
+ // (3) If the renderer does not process the event in step (1), and the event
+ // triggers an accelerator, then it will ignore the event in step (2). The
+ // renderer also sends back notification to the browser for both steps (1)
+ // and (2) about whether the events were processed or not. If the event
+ // for (1) is not processed by the renderer, then it is processed by the
+ // browser, and (2) is ignored.
+
+ NativeWebKeyboardEvent wke;
+ wke.type = WebKit::WebInputEvent::RawKeyDown;
wke.windowsKeyCode = e.GetKeyCode();
wke.setKeyIdentifierFromWindowsKeyCode();
@@ -520,11 +533,7 @@
// send the keypress event
wke.type = WebKit::WebInputEvent::Char;
-
- // TODO(anicolao): fear this comment from GTK land
- // We return TRUE because we did handle the event. If it turns out webkit
- // can't handle the event, we'll deal with it in
- // RenderView::UnhandledKeyboardEvent().
+ ForwardKeyboardEvent(wke);
return TRUE;
}
diff --git a/chrome/browser/renderer_host/render_widget_host_view_win.cc b/chrome/browser/renderer_host/render_widget_host_view_win.cc
index 72804de..46d341d 100644
--- a/chrome/browser/renderer_host/render_widget_host_view_win.cc
+++ b/chrome/browser/renderer_host/render_widget_host_view_win.cc
@@ -9,14 +9,14 @@
#include "app/l10n_util.h"
#include "app/l10n_util_win.h"
#include "app/resource_bundle.h"
+#include "app/win/hwnd_util.h"
#include "app/view_prop.h"
#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/metrics/histogram.h"
#include "base/process_util.h"
#include "base/scoped_comptr_win.h"
-#include "base/thread.h"
-#include "base/win_util.h"
+#include "base/threading/thread.h"
#include "base/win/scoped_gdi_object.h"
#include "chrome/browser/accessibility/browser_accessibility_win.h"
#include "chrome/browser/accessibility/browser_accessibility_manager.h"
@@ -1448,7 +1448,7 @@
::ScreenToClient(m_hWnd, &cursor_pos);
HWND child_window = ::RealChildWindowFromPoint(m_hWnd, cursor_pos);
if (::IsWindow(child_window) && child_window != m_hWnd) {
- if (win_util::GetClassName(child_window) ==
+ if (app::win::GetClassName(child_window) ==
webkit::npapi::kWrapperNativeWindowClassName)
child_window = ::GetWindow(child_window, GW_CHILD);
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index cad4560..93749f3 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -54,6 +54,7 @@
#include "chrome/browser/ui/login/login_prompt.h"
#include "chrome/browser/worker_host/worker_service.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/notification_service.h"
#include "chrome/common/render_messages.h"
#include "chrome/common/render_messages_params.h"
#include "chrome/common/url_constants.h"
@@ -1571,10 +1572,14 @@
return;
// Notify the observers on the UI thread.
- CallRenderViewHostResourceDelegate(
- render_process_id, render_view_id,
- &RenderViewHostDelegate::Resource::DidStartReceivingResourceResponse,
- ResourceRequestDetails(request, GetCertID(request, child_id)));
+ ResourceRequestDetails* detail = new ResourceRequestDetails(
+ request, GetCertID(request, child_id));
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(
+ &ResourceDispatcherHost::NotifyOnUI<ResourceRequestDetails>,
+ NotificationType::RESOURCE_RESPONSE_STARTED,
+ render_process_id, render_view_id, detail));
}
void ResourceDispatcherHost::NotifyResponseCompleted(net::URLRequest* request,
@@ -1596,10 +1601,29 @@
return;
// Notify the observers on the UI thread.
- CallRenderViewHostResourceDelegate(
- render_process_id, render_view_id,
- &RenderViewHostDelegate::Resource::DidRedirectResource,
- ResourceRedirectDetails(request, GetCertID(request, child_id), new_url));
+ ResourceRedirectDetails* detail = new ResourceRedirectDetails(
+ request, GetCertID(request, child_id), new_url);
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableFunction(
+ &ResourceDispatcherHost::NotifyOnUI<ResourceRedirectDetails>,
+ NotificationType::RESOURCE_RECEIVED_REDIRECT,
+ render_process_id, render_view_id, detail));
+}
+
+template <class T>
+void ResourceDispatcherHost::NotifyOnUI(NotificationType type,
+ int render_process_id,
+ int render_view_id,
+ T* detail) {
+ RenderViewHost* rvh =
+ RenderViewHost::FromID(render_process_id, render_view_id);
+ if (!rvh)
+ return;
+ RenderViewHostDelegate* rvhd = rvh->delegate();
+ NotificationService::current()->Notify(
+ type, Source<RenderViewHostDelegate>(rvhd), Details<T>(detail));
+ delete detail;
}
namespace {
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.h b/chrome/browser/renderer_host/resource_dispatcher_host.h
index 9d1924d..cbd62c2 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.h
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -23,6 +23,7 @@
#include "base/scoped_ptr.h"
#include "base/timer.h"
#include "chrome/common/child_process_info.h"
+#include "chrome/common/notification_type.h"
#include "chrome/browser/renderer_host/resource_queue.h"
#include "ipc/ipc_message.h"
#include "net/url_request/url_request.h"
@@ -32,6 +33,7 @@
class DownloadFileManager;
class DownloadRequestLimiter;
class LoginHandler;
+class NotificationDetails;
class PluginService;
class ResourceDispatcherHostRequestInfo;
class ResourceHandler;
@@ -40,13 +42,16 @@
class SaveFileManager;
class SSLClientAuthHandler;
class UserScriptListener;
-class URLRequestContext;
class WebKitThread;
struct DownloadSaveInfo;
struct GlobalRequestID;
struct ViewHostMsg_Resource_Request;
struct ViewMsg_ClosePage_Params;
+namespace net {
+class URLRequestContext;
+} // namespace net
+
namespace webkit_blob {
class DeletableFileReference;
}
@@ -89,7 +94,7 @@
bool prompt_for_save_location,
int process_unique_id,
int route_id,
- URLRequestContext* request_context);
+ net::URLRequestContext* request_context);
// Initiates a save file from the browser process (as opposed to a resource
// request from the renderer or another child process).
@@ -97,7 +102,7 @@
const GURL& referrer,
int process_unique_id,
int route_id,
- URLRequestContext* request_context);
+ net::URLRequestContext* request_context);
// Cancels the given request if it still exists. We ignore cancels from the
// renderer in the event of a download.
@@ -420,6 +425,14 @@
// is to user-perceived page load performance.
static net::RequestPriority DetermineRequestPriority(ResourceType::Type type);
+ // Sends the given notification on the UI thread. The RenderViewHost's
+ // controller is used as the source.
+ template <class T>
+ static void NotifyOnUI(NotificationType type,
+ int render_process_id,
+ int render_view_id,
+ T* detail);
+
PendingRequestList pending_requests_;
// Collection of temp files downloaded for child processes via
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
index 48390f6..2b6c5a6 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_uitest.cc
@@ -202,7 +202,7 @@
// strip the app on the build bots, this is bad times.
TEST_F(ResourceDispatcherTest, CrossSiteAfterCrash) {
// This test only works in multi-process mode
- if (in_process_renderer())
+ if (ProxyLauncher::in_process_renderer())
return;
scoped_refptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0));
@@ -216,7 +216,7 @@
#endif
ASSERT_TRUE(tab->NavigateToURLAsync(GURL(chrome::kAboutCrashURL)));
// Wait for browser to notice the renderer crash.
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
// Navigate to a new cross-site page. The browser should not wait around for
// the old renderer's on{before}unload handlers to run.
diff --git a/chrome/browser/renderer_host/resource_handler.h b/chrome/browser/renderer_host/resource_handler.h
index bc05b17..c231406 100644
--- a/chrome/browser/renderer_host/resource_handler.h
+++ b/chrome/browser/renderer_host/resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -19,11 +19,11 @@
namespace net {
class IOBuffer;
-}
+class URLRequestStatus;
+} // namespace net
struct ResourceResponse;
class GURL;
-class URLRequestStatus;
// The resource dispatcher host uses this interface to push load events to the
// renderer, allowing for differences in the types of IPC messages generated.
@@ -73,7 +73,7 @@
// The response is complete. The final response status is given.
// Returns false if the handler is deferring the call to a later time.
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info) = 0;
// Signals that the request is closed (i.e. finished successfully, cancelled).
diff --git a/chrome/browser/renderer_host/resource_message_filter.h b/chrome/browser/renderer_host/resource_message_filter.h
index 69af8a9..471c60a 100644
--- a/chrome/browser/renderer_host/resource_message_filter.h
+++ b/chrome/browser/renderer_host/resource_message_filter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,7 +12,10 @@
class ChromeURLRequestContext;
class ResourceDispatcherHost;
+
+namespace net {
class URLRequestContext;
+} // namespace net
// This class filters out incoming IPC messages for network requests and
// processes them on the IPC thread. As a result, network requests are not
@@ -27,7 +30,7 @@
public:
URLRequestContextOverride() {}
- virtual URLRequestContext* GetRequestContext(
+ virtual net::URLRequestContext* GetRequestContext(
uint32 request_id, ResourceType::Type resource_type) = 0;
protected:
diff --git a/chrome/browser/renderer_host/resource_request_details.cc b/chrome/browser/renderer_host/resource_request_details.cc
index 07183d4..75da0d9 100644
--- a/chrome/browser/renderer_host/resource_request_details.cc
+++ b/chrome/browser/renderer_host/resource_request_details.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/renderer_host/resource_request_details.h"
+#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
+#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "chrome/browser/worker_host/worker_service.h"
ResourceRequestDetails::ResourceRequestDetails(const net::URLRequest* request,
diff --git a/chrome/browser/renderer_host/resource_request_details.h b/chrome/browser/renderer_host/resource_request_details.h
index 6f53de3..f11a77a 100644
--- a/chrome/browser/renderer_host/resource_request_details.h
+++ b/chrome/browser/renderer_host/resource_request_details.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,11 +12,9 @@
#include <string>
-#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
-#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
-#include "chrome/browser/worker_host/worker_service.h"
#include "googleurl/src/gurl.h"
#include "net/url_request/url_request_status.h"
+#include "webkit/glue/resource_type.h"
namespace net {
class URLRequest;
@@ -38,7 +36,7 @@
bool has_upload() const { return has_upload_; }
int load_flags() const { return load_flags_; }
int origin_child_id() const { return origin_child_id_; }
- const URLRequestStatus& status() const { return status_; }
+ const net::URLRequestStatus& status() const { return status_; }
int ssl_cert_id() const { return ssl_cert_id_; }
int ssl_cert_status() const { return ssl_cert_status_; }
ResourceType::Type resource_type() const { return resource_type_; }
@@ -53,7 +51,7 @@
bool has_upload_;
int load_flags_;
int origin_child_id_;
- URLRequestStatus status_;
+ net::URLRequestStatus status_;
int ssl_cert_id_;
int ssl_cert_status_;
ResourceType::Type resource_type_;
diff --git a/chrome/browser/renderer_host/safe_browsing_resource_handler.h b/chrome/browser/renderer_host/safe_browsing_resource_handler.h
index 724297f..723a32b 100644
--- a/chrome/browser/renderer_host/safe_browsing_resource_handler.h
+++ b/chrome/browser/renderer_host/safe_browsing_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -58,7 +58,7 @@
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/renderer_host/save_file_resource_handler.h b/chrome/browser/renderer_host/save_file_resource_handler.h
index 7475bef..3519eb1 100644
--- a/chrome/browser/renderer_host/save_file_resource_handler.h
+++ b/chrome/browser/renderer_host/save_file_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -44,7 +44,7 @@
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/renderer_host/socket_stream_dispatcher_host.h b/chrome/browser/renderer_host/socket_stream_dispatcher_host.h
index b57d7ce..5c1b47c 100644
--- a/chrome/browser/renderer_host/socket_stream_dispatcher_host.h
+++ b/chrome/browser/renderer_host/socket_stream_dispatcher_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -54,7 +54,7 @@
void DeleteSocketStreamHost(int socket_id);
// Returns the URLRequestContext.
- URLRequestContext* GetURLRequestContext();
+ net::URLRequestContext* GetURLRequestContext();
IDMap<SocketStreamHost> hosts_;
scoped_refptr<ResourceMessageFilter::URLRequestContextOverride>
diff --git a/chrome/browser/renderer_host/socket_stream_host.h b/chrome/browser/renderer_host/socket_stream_host.h
index 06b3e9f..50afad2 100644
--- a/chrome/browser/renderer_host/socket_stream_host.h
+++ b/chrome/browser/renderer_host/socket_stream_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,11 +12,11 @@
#include "net/socket_stream/socket_stream.h"
class GURL;
-class URLRequestContext;
namespace net {
class SocketStreamJob;
-}
+class URLRequestContext;
+} // namespace net
// Host of SocketStreamHandle.
// Each SocketStreamHandle will have an unique socket_id assigned by
@@ -37,7 +37,7 @@
int socket_id() const { return socket_id_; }
// Starts to open connection to |url|.
- void Connect(const GURL& url, URLRequestContext* request_context);
+ void Connect(const GURL& url, net::URLRequestContext* request_context);
// Sends |data| over the socket stream.
// socket stream must be open to send data.
diff --git a/chrome/browser/renderer_host/sync_resource_handler.h b/chrome/browser/renderer_host/sync_resource_handler.h
index 174d1d8..d0e3d5c 100644
--- a/chrome/browser/renderer_host/sync_resource_handler.h
+++ b/chrome/browser/renderer_host/sync_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -40,7 +40,7 @@
int min_size);
virtual bool OnReadCompleted(int request_id, int* bytes_read);
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/renderer_host/test/render_process_host_browsertest.cc b/chrome/browser/renderer_host/test/render_process_host_browsertest.cc
index 38e5361..46a960c 100644
--- a/chrome/browser/renderer_host/test/render_process_host_browsertest.cc
+++ b/chrome/browser/renderer_host/test/render_process_host_browsertest.cc
@@ -2,10 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/command_line.h"
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
@@ -28,6 +30,58 @@
}
};
+IN_PROC_BROWSER_TEST_F(RenderProcessHostTest, ProcessPerTab) {
+ // Set max renderers to 1 to force running out of processes.
+ RenderProcessHost::SetMaxRendererProcessCount(1);
+
+ CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
+ parsed_command_line.AppendSwitch(switches::kProcessPerTab);
+
+ int tab_count = 1;
+ int host_count = 1;
+
+ // Change the first tab to be the new tab page (TYPE_DOMUI).
+ GURL newtab(chrome::kChromeUINewTabURL);
+ ui_test_utils::NavigateToURL(browser(), newtab);
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+
+ // Create a new TYPE_NORMAL tab. It should be in its own process.
+ GURL page1("data:text/html,hello world1");
+ browser()->ShowSingletonTab(page1, false);
+ if (browser()->tab_count() == tab_count)
+ ui_test_utils::WaitForNewTab(browser());
+ tab_count++;
+ host_count++;
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+
+ // Create another TYPE_NORMAL tab. It should share the previous process.
+ GURL page2("data:text/html,hello world2");
+ browser()->ShowSingletonTab(page2, false);
+ if (browser()->tab_count() == tab_count)
+ ui_test_utils::WaitForNewTab(browser());
+ tab_count++;
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+
+ // Create another new tab. It should share the process with the other DOMUI.
+ browser()->NewTab();
+ if (browser()->tab_count() == tab_count)
+ ui_test_utils::WaitForNewTab(browser());
+ tab_count++;
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+
+ // Create another new tab. It should share the process with the other DOMUI.
+ browser()->NewTab();
+ if (browser()->tab_count() == tab_count)
+ ui_test_utils::WaitForNewTab(browser());
+ tab_count++;
+ EXPECT_EQ(tab_count, browser()->tab_count());
+ EXPECT_EQ(host_count, RenderProcessHostCount());
+}
+
// When we hit the max number of renderers, verify that the way we do process
// sharing behaves correctly. In particular, this test is verifying that even
// when we hit the max process limit, that renderers of each type will wind up
diff --git a/chrome/browser/renderer_host/x509_user_cert_resource_handler.h b/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
index 8ae25f8..1c20cce 100644
--- a/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
+++ b/chrome/browser/renderer_host/x509_user_cert_resource_handler.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -14,10 +14,10 @@
namespace net {
class URLRequest;
+class URLRequestStatus;
} // namespace net
class ResourceDispatcherHost;
-class URLRequestStatus;
struct DownloadBuffer;
// This class handles the "application/x-x509-user-cert" mime-type
@@ -51,7 +51,7 @@
// Done downloading the certificate.
virtual bool OnResponseCompleted(int request_id,
- const URLRequestStatus& urs,
+ const net::URLRequestStatus& urs,
const std::string& sec_info);
virtual void OnRequestClosed();
diff --git a/chrome/browser/resources/about_conflicts.html b/chrome/browser/resources/about_conflicts.html
index 301fb49..9eb6e3a 100644
--- a/chrome/browser/resources/about_conflicts.html
+++ b/chrome/browser/resources/about_conflicts.html
@@ -144,65 +144,65 @@
border-bottom: 1px solid #aaa;
}
</style>
-<script>
-
+<script>
+
/**
* This variable structure is here to document the structure that the template
* expects to correctly populate the page.
- */
- var moduleListDataFormat = {
- 'moduleList': [
- {
- 'type': 'The type of module found',
- 'type_description':
- 'The type of module (string), defaults to blank for regular modules',
- 'status': 'The module status',
- 'location': 'The module path, not including filename',
+ */
+ var moduleListDataFormat = {
+ 'moduleList': [
+ {
+ 'type': 'The type of module found',
+ 'type_description':
+ 'The type of module (string), defaults to blank for regular modules',
+ 'status': 'The module status',
+ 'location': 'The module path, not including filename',
'name': 'The name of the module',
'product_name': 'The name of the product the module belongs to',
'description': 'The module description',
'version': 'The module version',
- 'digital_signer': 'The signer of the digital certificate for the module',
- 'recommended_action': 'The help tips bitmask',
- 'possible_resolution': 'The help tips in string form',
+ 'digital_signer': 'The signer of the digital certificate for the module',
+ 'recommended_action': 'The help tips bitmask',
+ 'possible_resolution': 'The help tips in string form',
'help_url': 'The link to the Help Center article'
- }
- ]
- };
-
+ }
+ ]
+ };
+
/**
* Takes the |moduleListData| input argument which represents data about
* the currently available modules and populates the html jstemplate
* with that data. It expects an object structure like the above.
* @param {Object} moduleListData Information about available modules
- */
- function renderTemplate(moduleListData) {
- // This is the javascript code that processes the template:
- var input = new JsEvalContext(moduleListData);
- var output = document.getElementById('modulesTemplate');
- jstProcess(input, output);
- }
-
+ */
+ function renderTemplate(moduleListData) {
+ // This is the javascript code that processes the template:
+ var input = new JsEvalContext(moduleListData);
+ var output = document.getElementById('modulesTemplate');
+ jstProcess(input, output);
+ }
+
/**
* Asks the C++ ConflictsDOMHandler to get details about the available modules
* and return detailed data about the configuration. The ConflictsDOMHandler
* should reply to returnModuleList() (below).
- */
- function requestModuleListData() {
- chrome.send('requestModuleList', []);
- }
-
+ */
+ function requestModuleListData() {
+ chrome.send('requestModuleList', []);
+ }
+
/**
* Called by the dom_ui to re-populate the page with data representing the
* current state of installed modules.
- */
- function returnModuleList(moduleListData) {
- var bodyContainer = document.getElementById('body-container');
- renderTemplate(moduleListData);
- bodyContainer.style.visibility = 'visible';
- }
-
- // Get data and have it displayed upon loading.
+ */
+ function returnModuleList(moduleListData) {
+ var bodyContainer = document.getElementById('body-container');
+ renderTemplate(moduleListData);
+ bodyContainer.style.visibility = 'visible';
+ }
+
+ // Get data and have it displayed upon loading.
document.addEventListener('DOMContentLoaded', requestModuleListData);
</script>
@@ -244,6 +244,16 @@
<tr class="module-loaded">
<td valign="top">
<table cellpadding="2" cellspacing="0" border="0">
+ <tr>
+ <td class="datacell"><span dir="ltr" i18n-content="headerSoftware"
+ >SOFTWARE</span></td>
+ <td class="datacell"><span dir="ltr" i18n-content="headerSignedBy"
+ >SIGNER</span></td>
+ <td class="datacell"><span dir="ltr" i18n-content="headerVersion"
+ >VERSION</span></td>
+ <td class="datacell"><span dir="ltr" i18n-content="headerLocation"
+ >LOCATION</span></td>
+ </tr>
<tr jsselect="moduleList">
<td valign="top" class="datacell">
<span dir="ltr"
@@ -258,14 +268,16 @@
<span jsdisplay="status == 3"
i18n-content="moduleConfirmedBad"
class="confirmed-bad">CONFIRMED_BAD</span>
+ </span>
+ <span class="clearing">
+ <span jsdisplay="possibleResolution.length > 0">
+ <span jscontent="possibleResolution"
+ >POSSIBLE_RESOLUTION</span>
+ </span>
<a jsdisplay="help_url.length > 0"
jsvalues=".href:help_url"
i18n-content="helpCenterLink">HELP_CENTER</a>
</span>
- <span jsdisplay="possibleResolution.length > 0">
- <span jscontent="possibleResolution" class="clearing"
- >POSSIBLE_RESOLUTION</span>
- </span>
</div>
</td>
<td valign="top" class="datacell"><span dir="ltr"
diff --git a/chrome/browser/resources/browser_signin.html b/chrome/browser/resources/browser_signin.html
index 17ead4e..ef4afed 100644
--- a/chrome/browser/resources/browser_signin.html
+++ b/chrome/browser/resources/browser_signin.html
@@ -2,7 +2,7 @@
<style>
body {
margin: 0;
- font-family: sans-serif;
+ font-family: arial,sans-serif;
}
#message {
position: absolute;
@@ -13,6 +13,12 @@
position: absolute;
left: 50%;
}
+#message h1 {
+ font-size: medium;
+}
+#message p {
+ font-size: smaller;
+}
</style>
<script>
function initmessage() {
diff --git a/chrome/browser/resources/bookmark_manager_resources.grd b/chrome/browser/resources/component_extension_resources.grd
similarity index 60%
rename from chrome/browser/resources/bookmark_manager_resources.grd
rename to chrome/browser/resources/component_extension_resources.grd
index 94bf63f..6afb147 100644
--- a/chrome/browser/resources/bookmark_manager_resources.grd
+++ b/chrome/browser/resources/component_extension_resources.grd
@@ -3,18 +3,22 @@
without changes to the corresponding grd file. -->
<grit latest_public_release="0" current_release="1">
<outputs>
- <output filename="grit/bookmark_manager_resources.h" type="rc_header">
+ <output filename="grit/component_extension_resources.h" type="rc_header">
<emit emit_type='prepend'></emit>
</output>
- <output filename="grit/bookmark_manager_resources_map.cc" type="resource_file_map_source" />
- <output filename="grit/bookmark_manager_resources_map.h" type="resource_map_header" />
- <output filename="bookmark_manager_resources.pak" type="data_package" />
+ <output filename="grit/component_extension_resources_map.cc" type="resource_file_map_source" />
+ <output filename="grit/component_extension_resources_map.h" type="resource_map_header" />
+ <output filename="component_extension_resources.pak" type="data_package" />
</outputs>
<release seq="1">
<includes>
<include name="IDR_BOOKMARK_MANAGER_BOOKMARK_MANAGER_RECENT" file="bookmark_manager/images/bookmark_manager_recent.png" type="BINDATA" />
<include name="IDR_BOOKMARK_MANAGER_BOOKMARK_MANAGER_SEARCH" file="bookmark_manager/images/bookmark_manager_search.png" type="BINDATA" />
<include name="IDR_BOOKMARK_MANAGER_MAIN" file="bookmark_manager/main.html" flattenhtml="true" type="BINDATA" />
+
+ <if expr="pp_ifdef('touchui')">
+ <include name="IDR_KEYBOARD_INDEX" file="keyboard/index.html" flattenhtml="true" type="BINDATA" />
+ </if>
</includes>
</release>
</grit>
diff --git a/chrome/browser/resources/extensions_infobar.css b/chrome/browser/resources/extensions_infobar.css
index dcf4303..b451818 100644
--- a/chrome/browser/resources/extensions_infobar.css
+++ b/chrome/browser/resources/extensions_infobar.css
@@ -3,8 +3,7 @@
*/
body {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#DAE7F9), to(#B5CBE8));
+ background: -webkit-linear-gradient(#DAE7F9, #B5CBE8);
font-family: Segoe UI, Tahoma;
font-size: 11px;
height: 36px; /* Infobars are limited to 36-72px */
diff --git a/chrome/browser/resources/extensions_infobar_mac.css b/chrome/browser/resources/extensions_infobar_mac.css
index 92a130e..6ce98f3 100644
--- a/chrome/browser/resources/extensions_infobar_mac.css
+++ b/chrome/browser/resources/extensions_infobar_mac.css
@@ -3,8 +3,7 @@
*/
body {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#EBEBEB), to(#CFCFCF));
+ background: -webkit-linear-gradient(#EBEBEB, #CFCFCF);
font-family: 'Lucida Grande', Helvetica, sans-serif;
font-size: 12px;
height: 36px; /* Infobars are limited to 36-72px */
diff --git a/chrome/browser/resources/filebrowse.html b/chrome/browser/resources/filebrowse.html
index f6a5050..078b7a2 100644
--- a/chrome/browser/resources/filebrowse.html
+++ b/chrome/browser/resources/filebrowse.html
@@ -15,11 +15,7 @@
height: 32px;
position: absolute;
box-sizing: border-box;
- background-image: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#D0DAF8),
- to(#A6BAF7));
+ background-image: -webkit-linear-gradient(#D0DAF8, #A6BAF7);
border-bottom-color: #999;
border-bottom-width: 1px;
border-left-color: #999;
@@ -55,24 +51,21 @@
border-top-width: 1px;
padding-top: 6px;
padding-left: 10px;
- background-image: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#D0DAF8),
- to(#A6BAF7));
+ background-image: -webkit-linear-gradient(#D0DAF8, #A6BAF7);
+}
+.deleteYesNoContainer {
+ display: -webkit-box;
+ -webkit-box-align: center;
+ -webkit-box-pack: center;
}
.deleteYes {
- width: 40px;
- height: 30px;
- float: left;
+ margin: 4px;
text-decoration: underline;
color: blue;
}
.deleteNo {
- width: 40px;
- height: 30px;
- float: left;
+ margin: 4px;
text-decoration: underline;
color: blue;
}
@@ -81,7 +74,7 @@
text-align: center;
border: 1px solid rgba(0, 0, 0, 0.25);
border-radius: 2px;
- height: 36px;
+ min-height: 36px;
padding: 4px;
}
@@ -322,20 +315,12 @@
cursor: pointer;
padding: 4px;
padding-bottom: 0;
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#F4F6FB),
- to(#CCD7F8));
+ background: -webkit-linear-gradient(#F4F6FB, #CCD7F8);
}
div.controlbutton:hover {
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#FFF),
- to(#D9E0F6));
+ background: -webkit-linear-gradient(#FFF, #D9E0F6);
}
div.column {
@@ -456,11 +441,7 @@
left: 0;
height: 30px;
position: absolute;
- background-image: -webkit-gradient(linear,
- 0% 0%,
- 0% 90%,
- from(#fcfcfc),
- to(#eff1f2));
+ background-image: -webkit-linear-gradient(#fcfcfc, #eff1f2 90%);
}
div.savecontainer {
@@ -469,11 +450,7 @@
left: 0;
height: 60px;
position: absolute;
- background-image: -webkit-gradient(linear,
- 0% 0%,
- 0% 90%,
- from(#fcfcfc),
- to(#eff1f2));
+ background-image: -webkit-linear-gradient(#fcfcfc, #eff1f2 90%);
}
div.container {
@@ -541,7 +518,7 @@
.menu {
top: 14px;
right: 2px;
- width: 100px;
+ width: 180px;
-webkit-box-shadow: rgba(0, 0, 0, 0.3) 0px 3px 3px;
border-bottom-left-radius: 4px 4px;
border-bottom-right-radius: 4px 4px;
@@ -1111,6 +1088,8 @@
var askingDiv = document.createElement('div');
askingDiv.className = 'confirmdelete';
askingDiv.textContent = localStrings.getString('confirmdelete');
+ yesNoDiv = document.createElement('div');
+ yesNoDiv.className = 'deleteYesNoContainer';
var yes = document.createElement('div');
yes.className = 'deleteYes';
yes.textContent = localStrings.getString('confirmyes');
@@ -1119,8 +1098,9 @@
no.onclick = partial(removeDeleteConfirm, path);
no.textContent = localStrings.getString('confirmcancel');
no.className = 'deleteNo';
- askingDiv.appendChild(yes);
- askingDiv.appendChild(no);
+ yesNoDiv.appendChild(yes);
+ yesNoDiv.appendChild(no);
+ askingDiv.appendChild(yesNoDiv);
element.firstChild.appendChild(askingDiv);
askingDiv.scrollIntoView();
window.event.stopPropagation();
diff --git a/chrome/browser/resources/host_registration_page.html b/chrome/browser/resources/host_registration_page.html
index 4b7d75f..058c4c0 100644
--- a/chrome/browser/resources/host_registration_page.html
+++ b/chrome/browser/resources/host_registration_page.html
@@ -13,7 +13,7 @@
overflow: hidden;
width: 100%;
height: 100%;
- background: -webkit-gradient(linear, left top, left bottom, from(#FAFBFB), to(#CCD1D4));
+ background: -webkit-linear-gradient(#FAFBFB, #CCD1D4);
}
</style>
@@ -32,23 +32,23 @@
return document.getElementById(o);
}
-function processMessage(e) {
+function processMessage(e) {
if (e.data.domain != registrationUrl){
skipRegistration();
return;
- }
-
+ }
+
if (e.data.type == 'get_user_info') {
- chrome.send('getUserInfo', []);
+ chrome.send('getUserInfo', []);
} else if (e.data.type == 'complete_registration') {
location.replace(e.data.payload.registration_status ? registerDoneUrl :
- registerSkipUrl);
+ registerSkipUrl);
}
}
function setRegistrationUrl(url) {
- registrationUrl = url;
- $('form').contentWindow.location.href = url;
+ registrationUrl = url;
+ $('form').contentWindow.location.href = url;
}
function setUserInfo(userInfo) {
@@ -57,7 +57,7 @@
domain: hostPageDomain,
payload: userInfo
};
- $('form').contentWindow.postMessage(msg, registrationUrl);
+ $('form').contentWindow.postMessage(msg, registrationUrl);
}
// Called by DOMUI handler when startup manifest is not defined.
diff --git a/chrome/browser/resources/imageburner.html b/chrome/browser/resources/imageburner.html
index 365143d..a90aaef 100644
--- a/chrome/browser/resources/imageburner.html
+++ b/chrome/browser/resources/imageburner.html
@@ -4,19 +4,15 @@
<meta charset=UTF-8">
<title i18n-content="title"></title>
<style>
-body {
+body {
-webkit-user-select: none;
}
-
+
h1 {
border-bottom: 1px solid #7289E2;
padding: 8px;
height: 32px;
- background-image: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#D0DAF8),
- to(#A6BAF7));
+ background-image: -webkit-linear-gradient(#D0DAF8, #A6BAF7);
border: 1px solid #999;
border-top: 0;
color: black;
@@ -25,13 +21,9 @@
html[dir='rtl'] h1 {
left: auto;
right: 0;
- background-image: -webkit-gradient(linear,
- right top,
- right bottom,
- from(#D0DAF8),
- to(#A6BAF7));
+ background-image: -webkit-linear-gradient(#D0DAF8, #A6BAF7);
}
-
+
.rowlink {
height: 100%;
-webkit-margin-end: 2px;
@@ -161,7 +153,7 @@
}
#statusColumn:not(.burningColumn) {
- height: 50%;
+ height: 50%;
border-top: 1px solid #7289E2;
}
</style>
@@ -196,11 +188,11 @@
function burnUnsuccessful(){
alert(localStrings.getString('burnUnsuccessfulMessage'));
}
-
+
function rootsChanged(){
chrome.send('getRoots', []);
}
-
+
function browseFileResult(info, results) {
var path = info.path;
var list = $('rootsList');
@@ -240,12 +232,12 @@
var statusDiv = document.createElement('div');
statusDiv.id = id;
statusDiv.className = 'statusDiv';
-
+
var statusText = document.createElement('div');
statusText.id = id + 'StatusText';
statusText.className = 'statusText';
statusDiv.appendChild(statusText);
-
+
var progressBar = document.createElement('progress');
progressBar.id = id + 'ProgressBar';
progressBar.className = 'progressBar';
@@ -255,7 +247,7 @@
progressText.id = id + 'ProgressText';
progressText.className = 'progressText'
statusDiv.appendChild(progressText);
-
+
return statusDiv;
}
@@ -275,21 +267,21 @@
progressTextDiv = element.children[i];
break;
}
- }
+ }
if (event == 'COMPLETE')
statusTextDiv.textContent = statuses['finished'];
else
statusTextDiv.textContent = statuses['canceled'];
-
+
var progressBarParent = progressBarDiv.parentNode;
- progressBarParent.removeChild(progressBarDiv);
-
+ progressBarParent.removeChild(progressBarDiv);
+
var progressTextParent = progressTextDiv.parentNode;
progressTextParent.removeChild(progressTextDiv);
return element;
}
-function setProgressElementValues(element, statuses, amountFinished,
+function setProgressElementValues(element, statuses, amountFinished,
amountTotal, progressText){
var statusTextDiv;
var progressBarDiv;
@@ -306,10 +298,10 @@
progressTextDiv = element.children[i];
break;
}
- }
-
+ }
+
if (!(amountFinished > 0)) {
- amountFinished = 0;
+ amountFinished = 0;
statusTextDiv.textContent = statuses["start"];
progressTextDiv.textContent = "";
} else {
@@ -320,7 +312,7 @@
amountFinished = amountTotal;
progressBarDiv.value = amountFinished;
if (amountTotal)
- progressBarDiv.max = amountTotal;
+ progressBarDiv.max = amountTotal;
return element;
}
@@ -333,20 +325,20 @@
}
var errorOccurred = (progressInfo.state == 'CANCELLED');
if (progressInfo.state == 'IN_PROGRESS') {
- setProgressElementValues(element, statusMessages[progressType],
- progressInfo.received, progressInfo.total,
- progressInfo.progress_status_text);
+ setProgressElementValues(element, statusMessages[progressType],
+ progressInfo.received, progressInfo.total,
+ progressInfo.progress_status_text);
} else {
setProgressElementFinalValues(element, statusMessages[progressType],
progressInfo.state);
- }
+ }
}
-function downloadUpdated(result) {
+function downloadUpdated(result) {
updateProgressElement('download', result);
}
-function burnProgressUpdated(result) {
+function burnProgressUpdated(result) {
if (!burnStarted) {
$('rootsList').style.display = 'none';
$('rootsListTitle').textContent = result.path;
@@ -398,26 +390,26 @@
list.removeChild(list.firstChild);
}
}
-
+
document.addEventListener('DOMContentLoaded', function() {
- localStrings = new LocalStrings();
+ localStrings = new LocalStrings();
burnStarted = false;
chrome.send("getRoots", []);
- // Initialize messages that will be displayed as download
+ // Initialize messages that will be displayed as download
// or burn progress is updated.
statusMessages = [];
-
+
var downloadStatuses = [];
downloadStatuses['start'] = localStrings.getString('downloadStatusStart');
- downloadStatuses['inProgress'] =
+ downloadStatuses['inProgress'] =
localStrings.getString('downloadStatusInProgress');
- downloadStatuses['finished'] =
+ downloadStatuses['finished'] =
localStrings.getString('downloadStatusComplete');
- downloadStatuses['canceled'] =
+ downloadStatuses['canceled'] =
localStrings.getString('downloadStatusCanceled');
statusMessages['download'] = downloadStatuses;
-
+
var burnStatuses = [];
burnStatuses['start'] = localStrings.getString('burnStatusStart');
burnStatuses['inProgress'] = localStrings.getString('burnStatusInProgress');
@@ -430,12 +422,12 @@
<body>
<div id="main" class="fullcontainer">
<div id="rootsColumn" class="columnlist">
- <h1 id="rootsListTitle" class="title" i18n-content="listTitle"></h1>
+ <h1 id="rootsListTitle" class="title" i18n-content="listTitle"></h1>
<div id="rootsList"></div>
</div>
<div id="statusColumn" class="columnlist">
<div id="statusList"></div>
- </div>
+ </div>
</div>
</body>
</html>
diff --git a/chrome/browser/resources/keyboard/manifest.json b/chrome/browser/resources/keyboard/manifest.json
index 31f31e3..fca0c0a 100644
--- a/chrome/browser/resources/keyboard/manifest.json
+++ b/chrome/browser/resources/keyboard/manifest.json
@@ -3,6 +3,7 @@
"name": "Virtual Keyboard",
"version": "0.1",
"description": "Virtual Keyboard",
+ "incognito" : "split",
"permissions": [
"experimental"
],
diff --git a/chrome/browser/resources/keyboard_overlay.css b/chrome/browser/resources/keyboard_overlay.css
index 2827254..239cb4e 100644
--- a/chrome/browser/resources/keyboard_overlay.css
+++ b/chrome/browser/resources/keyboard_overlay.css
@@ -7,15 +7,13 @@
.keyboard-overlay-keyboard {
border-radius: 6px;
- background: -webkit-gradient(linear, left top, left bottom,
- from(#484848), to(#252525)) no-repeat;
+ background: -webkit-linear-gradient(#484848, #252525) no-repeat;
font-family: 'Droid Sans', Arial;
}
.keyboard-overlay-instructions {
border-radius: 5px;
- background: -webkit-gradient(linear, left top, left bottom,
- from(#334c7e), to(#0d172b));
+ background: -webkit-linear-gradient(#334c7e, #0d172b);
border: 2px solid #576ccf;
color: #fff;
display: table;
@@ -44,9 +42,8 @@
}
.keyboard-overlay-key.is-shortcut {
- background: -webkit-gradient(linear, left top, left bottom,
- from(rgba(61, 61, 61, 0.8)),
- to(rgba(27, 27, 27, 0.8)));
+ background: -webkit-linear-gradient(rgba(61, 61, 61, 0.8),
+ rgba(27, 27, 27, 0.8));
color: #9e9e9e;
}
@@ -85,63 +82,51 @@
}
.keyboard-overlay-key.pressed.is-shift {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#44a142), to(#3e5f37));
+ background: -webkit-linear-gradient(#44a142, #3e5f37);
}
.keyboard-overlay-key.pressed.is-shift.modifier-ctrl {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#42a143), to(#2e5c53));
+ background: -webkit-linear-gradient(#42a143, #2e5c53);
}
.keyboard-overlay-key.pressed.is-shift.modifier-alt {
- background: -webkit-gradient(linear, left top, right bottom,
- from(#45a343), to(#515134));
+ background: -webkit-linear-gradient(#45a343, #515134);
}
.keyboard-overlay-key.pressed.is-shift.modifier-ctrl.modifier-alt {
- background: -webkit-gradient(linear, left top, right bottom,
- from(#52a12a), to(#4f4d2e));
+ background: -webkit-linear-gradient(#52a12a, #4f4d2e);
}
.keyboard-overlay-key.pressed.is-ctrl {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#1f37a2), to(#19265a));
+ background: -webkit-linear-gradient(#1f37a2, #19265a);
}
.keyboard-overlay-key.pressed.is-ctrl.modifier-shift {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#439fa5), to(#1e3760));
+ background: -webkit-linear-gradient(#439fa5, #1e3760);
}
.keyboard-overlay-key.pressed.is-ctrl.modifier-alt {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#733690), to(#22255e));
+ background: -webkit-linear-gradient(#733690, #22255e);
}
.keyboard-overlay-key.pressed.is-ctrl.modifier-shift.modifier-alt {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#733690), to(#21255d));
+ background: -webkit-linear-gradient(#733690, #21255d);
}
.keyboard-overlay-key.pressed.is-alt {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#842c2a), to(#541e1c));
+ background: -webkit-linear-gradient(#842c2a, #541e1c);
}
.keyboard-overlay-key.pressed.is-alt.modifier-shift {
- background: -webkit-gradient(linear, left top, right bottom,
- from(#745e31), to(#55241e));
+ background: -webkit-linear-gradient(top left, #745e31, #55241e);
}
.keyboard-overlay-key.pressed.is-alt.modifier-ctrl {
- background: -webkit-gradient(linear, left top, left bottom,
- from(#76368f), to(#522128));
+ background: -webkit-linear-gradient(#76368f, #522128);
}
.keyboard-overlay-key.pressed.is-alt.modifier-shift.modifier-ctrl {
- background: -webkit-gradient(linear, left top, right bottom,
- from(#735f29), to(#50241b));
+ background: -webkit-linear-gradient(top left, #735f29, #50241b);
}
.keyboard-overlay-shortcut-text {
diff --git a/chrome/browser/resources/login_ui.css b/chrome/browser/resources/login_ui.css
index bb8a66a..864001d 100644
--- a/chrome/browser/resources/login_ui.css
+++ b/chrome/browser/resources/login_ui.css
@@ -1,8 +1,7 @@
body {
- background: -webkit-gradient(
- radial, 50% 50%, 5, 50% 50%, 1000,
- from(darkblue), to(black)
- );
+ background: -webkit-radial-gradient(circle contain,
+ darkblue 5px,
+ black 1000px);
font-family: 'Times New Roman';
font-size: 15px;
}
diff --git a/chrome/browser/resources/mediaplayer.html b/chrome/browser/resources/mediaplayer.html
index effa78b..094a263 100644
--- a/chrome/browser/resources/mediaplayer.html
+++ b/chrome/browser/resources/mediaplayer.html
@@ -25,11 +25,7 @@
height: 8px;
opacity: .4;
position: absolute;
- background: -webkit-gradient(linear,
- left bottom,
- left top,
- from(white),
- to(transparent));
+ background: -webkit-linear-gradient(transparent, white);
}
.audiotitle {
@@ -61,11 +57,7 @@
opacity: .9;
right: 0;
position: absolute;
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#323232),
- to(#070707));
+ background: -webkit-linear-gradient(#323232, #070707);
}
.sliderback {
@@ -75,11 +67,7 @@
height: 5px;
position: absolute;
border-radius: 3px;
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#ced9fa),
- to(#e8ecf9));
+ background: -webkit-linear-gradient(#ced9fa, #e8ecf9);
border: 1px solid #ffffff;
}
@@ -91,11 +79,7 @@
border-radius: 3px;
border: 1px solid #9ca5b7;
position: absolute;
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#4a5d84),
- to(#232c3d));
+ background: -webkit-linear-gradient(#4a5d84, #232c3d);
}
.sliderloaded {
@@ -117,11 +101,7 @@
opacity: .9;
right: 0;
position: absolute;
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#323232),
- to(#070707));
+ background: -webkit-linear-gradient(#323232, #070707);
}
.soundbutton {
@@ -154,11 +134,7 @@
right: 30px;
z-index: 99999;
background: black;
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#323232),
- to(#070707));
+ background: -webkit-linear-gradient(#323232, #070707);
}
.fullscreen {
@@ -286,11 +262,7 @@
}
.controlbutton:hover {
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#6a7eac),
- to(#000000));
+ background: -webkit-linear-gradient(#6a7eac, #000);
}
.icon {
@@ -358,7 +330,7 @@
function onMediaError(e) {
console.log('Got new error' + e);
- chrome.send('playbackError', ['Error playing back',
+ chrome.send('playbackError', ['Error playing back',
currentPlaylist[currentItem].path]);
if (currentPlaylist.length == 1) {
$('error').textContent = localStrings.getString('errorstring');
diff --git a/chrome/browser/resources/menu.css b/chrome/browser/resources/menu.css
index 43ea18a..16ade9f 100644
--- a/chrome/browser/resources/menu.css
+++ b/chrome/browser/resources/menu.css
@@ -1,7 +1,5 @@
body {
- background: -webkit-gradient(linear, left top, left bottom,
- from(white),
- to(#EEE));
+ background: -webkit-linear-gradient(white, #EEE);
cursor: default;
margin: 0;
-webkit-user-select: none;
@@ -47,8 +45,9 @@
}
.separator {
- background: -webkit-gradient(linear, 0 0, 96% 0, from(rgba(0, 0, 0, .10)),
- to(rgba(0, 0, 0, .02)));
+ background: -webkit-linear-gradient(left,
+ rgba(0, 0, 0, .10),
+ rgba(0, 0, 0, .02) 96%);
border: 0;
height: 1px;
margin: 4px 0;
@@ -91,4 +90,3 @@
.hidden {
display: none;
}
-
diff --git a/chrome/browser/resources/net_internals/logviewpainter.js b/chrome/browser/resources/net_internals/logviewpainter.js
index 82686c6..28df383 100644
--- a/chrome/browser/resources/net_internals/logviewpainter.js
+++ b/chrome/browser/resources/net_internals/logviewpainter.js
@@ -49,10 +49,9 @@
function canCollapseBeginWithEnd(beginEntry) {
return beginEntry &&
beginEntry.isBegin() &&
- !beginEntry.orig.params &&
beginEntry.end &&
beginEntry.end.index == beginEntry.index + 1 &&
- !beginEntry.end.orig.params &&
+ (!beginEntry.orig.params || !beginEntry.end.orig.params) &&
beginEntry.orig.wasPassivelyCaptured ==
beginEntry.end.orig.wasPassivelyCaptured;
}
@@ -70,43 +69,43 @@
for (var i = 0; i < entries.length; ++i) {
var entry = entries[i];
- // Avoid printing the END for a BEGIN that was immediately before.
- if (entry.isEnd() && canCollapseBeginWithEnd(entry.begin))
- continue;
+ // Avoid printing the END for a BEGIN that was immediately before, unless
+ // both have extra parameters.
+ if (!entry.isEnd() || !canCollapseBeginWithEnd(entry.begin)) {
+ tablePrinter.addRow();
- tablePrinter.addRow();
+ // Annotate this entry with "(P)" if it was passively captured.
+ tablePrinter.addCell(entry.orig.wasPassivelyCaptured ? '(P) ' : '');
- // Annotate this entry with "(P)" if it was passively captured.
- tablePrinter.addCell(entry.orig.wasPassivelyCaptured ? '(P) ' : '');
+ tablePrinter.addCell('t=');
+ var date = g_browser.convertTimeTicksToDate(entry.orig.time) ;
+ var tCell = tablePrinter.addCell(date.getTime());
+ tCell.alignRight = true;
+ tablePrinter.addCell(' [st=');
+ var stCell = tablePrinter.addCell(date.getTime() - startTime);
+ stCell.alignRight = true;
+ tablePrinter.addCell('] ');
- tablePrinter.addCell('t=');
- var date = g_browser.convertTimeTicksToDate(entry.orig.time) ;
- var tCell = tablePrinter.addCell(date.getTime());
- tCell.alignRight = true;
- tablePrinter.addCell(' [st=');
- var stCell = tablePrinter.addCell(date.getTime() - startTime);
- stCell.alignRight = true;
- tablePrinter.addCell('] ');
+ var indentationStr = makeRepeatedString(' ', entry.getDepth() * 3);
+ var mainCell =
+ tablePrinter.addCell(indentationStr + getTextForEvent(entry));
+ tablePrinter.addCell(' ');
- var indentationStr = makeRepeatedString(' ', entry.getDepth() * 3);
- var mainCell =
- tablePrinter.addCell(indentationStr + getTextForEvent(entry));
- tablePrinter.addCell(' ');
+ // Get the elapsed time.
+ if (entry.isBegin()) {
+ tablePrinter.addCell('[dt=');
+ var dt = '?';
+ // Definite time.
+ if (entry.end) {
+ dt = entry.end.orig.time - entry.orig.time;
+ }
+ var dtCell = tablePrinter.addCell(dt);
+ dtCell.alignRight = true;
- // Get the elapsed time.
- if (entry.isBegin()) {
- tablePrinter.addCell('[dt=');
- var dt = '?';
- // Definite time.
- if (entry.end) {
- dt = entry.end.orig.time - entry.orig.time;
+ tablePrinter.addCell(']');
+ } else {
+ mainCell.allowOverflow = true;
}
- var dtCell = tablePrinter.addCell(dt);
- dtCell.alignRight = true;
-
- tablePrinter.addCell(']');
- } else {
- mainCell.allowOverflow = true;
}
// Output the extra parameters.
diff --git a/chrome/browser/resources/net_internals/main.css b/chrome/browser/resources/net_internals/main.css
index be3abee..8c6982c 100644
--- a/chrome/browser/resources/net_internals/main.css
+++ b/chrome/browser/resources/net_internals/main.css
@@ -92,6 +92,10 @@
color: #308080;
}
+#eventsListTableBody .source_DISK_CACHE_ENTRY {
+ color: gray;
+}
+
#eventsListTableBody .source_SOCKET {
color: purple;
}
diff --git a/chrome/browser/resources/net_internals/main.js b/chrome/browser/resources/net_internals/main.js
index 70a1b51..d879c87 100644
--- a/chrome/browser/resources/net_internals/main.js
+++ b/chrome/browser/resources/net_internals/main.js
@@ -306,15 +306,19 @@
// Messages received from the browser
//------------------------------------------------------------------------------
-BrowserBridge.prototype.receivedLogEntry = function(logEntry) {
- // Assign unique ID, if needed.
- if (logEntry.source.id == 0) {
- logEntry.source.id = this.nextSourcelessEventId_;
- --this.nextSourcelessEventId_;
+BrowserBridge.prototype.receivedLogEntries = function(logEntries) {
+ for (var e = 0; e < logEntries.length; ++e) {
+ var logEntry = logEntries[e];
+
+ // Assign unique ID, if needed.
+ if (logEntry.source.id == 0) {
+ logEntry.source.id = this.nextSourcelessEventId_;
+ --this.nextSourcelessEventId_;
+ }
+ this.capturedEvents_.push(logEntry);
+ for (var i = 0; i < this.logObservers_.length; ++i)
+ this.logObservers_[i].onLogEntryAdded(logEntry);
}
- this.capturedEvents_.push(logEntry);
- for (var i = 0; i < this.logObservers_.length; ++i)
- this.logObservers_[i].onLogEntryAdded(logEntry);
};
BrowserBridge.prototype.receivedLogEventTypeConstants = function(constantsMap) {
@@ -395,16 +399,13 @@
this.deleteAllEvents();
this.numPassivelyCapturedEvents_ = entries.length;
- for (var i = 0; i < entries.length; ++i) {
- var entry = entries[i];
- entry.wasPassivelyCaptured = true;
- this.receivedLogEntry(entry);
- }
+ for (var i = 0; i < entries.length; ++i)
+ entries[i].wasPassivelyCaptured = true;
+ this.receivedLogEntries(entries);
// Add back early actively captured events, if any.
- for (var i = 0; i < earlyActivelyCapturedEvents.length; ++i) {
- this.receivedLogEntry(earlyActivelyCapturedEvents[i]);
- }
+ if (earlyActivelyCapturedEvents.length)
+ this.receivedLogEntries(earlyActivelyCapturedEvents);
};
diff --git a/chrome/browser/resources/net_internals/sourceentry.js b/chrome/browser/resources/net_internals/sourceentry.js
index 4a4df6e..6c02c03 100644
--- a/chrome/browser/resources/net_internals/sourceentry.js
+++ b/chrome/browser/resources/net_internals/sourceentry.js
@@ -232,6 +232,9 @@
case LogSourceType.HOST_RESOLVER_IMPL_JOB:
description = e.params.host;
break;
+ case LogSourceType.DISK_CACHE_ENTRY:
+ description = e.params.key;
+ break;
case LogSourceType.SPDY_SESSION:
if (e.params.host)
description = e.params.host + ' (' + e.params.proxy + ')';
diff --git a/chrome/browser/resources/new_new_tab.css b/chrome/browser/resources/new_new_tab.css
index 1716fb4..44ca39c 100644
--- a/chrome/browser/resources/new_new_tab.css
+++ b/chrome/browser/resources/new_new_tab.css
@@ -206,9 +206,7 @@
border: 1px solid rgb(118, 118, 118);
border-radius: 3px;
padding: 0 3px;
- background: -webkit-gradient(linear, left top, left bottom,
- from(white),
- to(rgb(228, 229, 240)));
+ background: -webkit-linear-gradient(white, rgb(228, 229, 240));
width: auto;
max-width: 300px;
}
diff --git a/chrome/browser/resources/new_new_tab.js b/chrome/browser/resources/new_new_tab.js
index 315b54b..a2dbc6b 100644
--- a/chrome/browser/resources/new_new_tab.js
+++ b/chrome/browser/resources/new_new_tab.js
@@ -148,7 +148,7 @@
// For each client, create entries and append the lists together.
sessionItems.forEach(function(item, i) {
- // TODO(zea): Get real client names. See issue 59672
+ // TODO(zea): Get real client names. See crbug/59672.
var name = 'Client ' + i;
parentSessionElement.appendChild(createForeignSession(item, name));
});
@@ -172,28 +172,51 @@
function createForeignSession(client, name) {
// Vertically stack the windows in a client.
var stack = document.createElement('div');
- stack.className = 'foreign-session-client';
+ stack.className = 'foreign-session-client item link';
stack.textContent = name;
+ stack.sessionTag = client[0].sessionTag;
- client.forEach(function(win) {
- // We know these are lists of multiple tabs, don't need the special case for
- // single url + favicon.
- var el = document.createElement('p');
- el.className = 'item link window';
- el.tabItems = win.tabs;
- el.tabIndex = 0;
- el.textContent = formatTabsText(win.tabs.length);
+ client.forEach(function(win, i) {
+ // Create a window entry.
+ var winSpan = document.createElement('span');
+ var winEl = document.createElement('p');
+ winEl.className = 'item link window';
+ winEl.tabItems = win.tabs;
+ winEl.tabIndex = 0;
+ winEl.textContent = formatTabsText(win.tabs.length);
+ winEl.xtitle = win.title;
+ winEl.sessionTag = win.sessionTag;
+ winEl.winNum = i;
+ winEl.addEventListener('click', maybeOpenForeignWindow);
+ winEl.addEventListener('keydown',
+ handleIfEnterKey(maybeOpenForeignWindow));
+ winSpan.appendChild(winEl);
- el.sessionId = win.sessionId;
- el.xtitle = win.title;
- el.sessionTag = win.sessionTag;
+ // Sort tabs by MRU order
+ win.tabs.sort(function(a, b) {
+ return a.timestamp < b.timestamp;
+ })
- // Add the actual tab listing.
- stack.appendChild(el);
+ // Create individual tab information.
+ win.tabs.forEach(function(data) {
+ var tabEl = document.createElement('a');
+ tabEl.className = 'item link tab';
+ tabEl.href = data.timestamp;
+ tabEl.style.backgroundImage = url('chrome://favicon/' + data.url);
+ tabEl.dir = data.direction;
+ tabEl.textContent = data.title;
+ tabEl.sessionTag = win.sessionTag;
+ tabEl.winNum = i;
+ tabEl.sessionId = data.sessionId;
+ tabEl.addEventListener('click', maybeOpenForeignTab);
+ tabEl.addEventListener('keydown',
+ handleIfEnterKey(maybeOpenForeignTab));
- // TODO(zea): Should there be a clickHandler as well? We appear to be
- // breaking windowTooltip's hide: removeEventListener(onMouseOver) when we
- // click.
+ winSpan.appendChild(tabEl);
+ })
+
+ // Append the window.
+ stack.appendChild(winSpan);
});
return stack;
}
@@ -516,23 +539,22 @@
var third = fourth - gradientHeightPx / window.innerHeight;
var gradientArguments = [
- 'linear',
- '0 0',
- '0 100%',
- 'from(transparent)',
+ 'transparent',
getColorStopString(first, 'transparent'),
getColorStopString(second, gradientDestination),
getColorStopString(third, gradientDestination),
getColorStopString(fourth, 'transparent'),
- 'to(transparent)'
+ 'transparent'
];
- var gradient = '-webkit-gradient(' + gradientArguments.join(', ') + ')';
+ var gradient = '-webkit-linear-gradient(' + gradientArguments.join(',') + ')';
maxiview.style.WebkitMaskImage = gradient;
}
function getColorStopString(height, color) {
- return 'color-stop(' + height + ', ' + color + ')';
+ // TODO(arv): The CSS3 gradient syntax allows px units so we should simplify
+ // this to use pixels instead.
+ return color + ' ' + height * 100 + '%';
}
window.addEventListener('resize', handleWindowResize);
@@ -921,15 +943,15 @@
notification.classList.remove('first-run');
notification.classList.remove('promo');
- var notificationNode = notificationElement.firstElementChild;
- notificationNode.removeChild(notificationNode.firstChild);
-
+ var messageContainer = notificationElement.firstElementChild;
var actionLink = notificationElement.querySelector('.link-color');
- if (typeof message == 'string')
- notificationElement.firstElementChild.textContent = message;
- else
- notificationElement.firstElementChild.appendChild(message);
+ if (typeof message == 'string') {
+ messageContainer.textContent = message;
+ } else {
+ messageContainer.textContent = ''; // Remove all children.
+ messageContainer.appendChild(message);
+ }
actionLink.textContent = actionText;
@@ -1041,13 +1063,42 @@
}
}
-function maybeReopenSession(e) {
+// Note that the openForeignSession calls can fail, resulting this method to
+// not have any action (hence the maybe).
+function maybeOpenForeignSession(e) {
var el = findAncestor(e.target, function(el) {
- return el.sessionId;
+ return el.sessionTag !== undefined;
});
if (el) {
- chrome.send('reopenForeignSession', [String(el.sessionTag)]);
+ chrome.send('openForeignSession', [String(el.sessionTag)]);
+ e.stopPropagation();
+ e.preventDefault();
+ setWindowTooltipTimeout();
+ }
+}
+function maybeOpenForeignWindow(e) {
+ var el = findAncestor(e.target, function(el) {
+ return el.winNum !== undefined;
+ });
+ if (el) {
+ chrome.send('openForeignSession', [String(el.sessionTag),
+ String(el.winNum)]);
+ e.stopPropagation();
+ e.preventDefault();
+ setWindowTooltipTimeout();
+ }
+}
+
+function maybeOpenForeignTab(e) {
+ var el = findAncestor(e.target, function(el) {
+ return el.sessionId !== undefined;
+ });
+ if (el) {
+ chrome.send('openForeignSession', [String(el.sessionTag), String(el.winNum),
+ String(el.sessionId)]);
+ e.stopPropagation();
+ e.preventDefault();
setWindowTooltipTimeout();
}
}
@@ -1084,9 +1135,10 @@
var foreignSessionElement = $('foreign-sessions');
-foreignSessionElement.addEventListener('click', maybeReopenSession);
+foreignSessionElement.addEventListener('click', maybeOpenForeignSession);
foreignSessionElement.addEventListener('keydown',
- handleIfEnterKey(maybeReopenSession));
+ handleIfEnterKey(
+ maybeOpenForeignSession));
foreignSessionElement.addEventListener('mouseover', maybeShowWindowTooltip);
foreignSessionElement.addEventListener('focus', maybeShowWindowTooltip, true);
diff --git a/chrome/browser/resources/new_tab_theme.css b/chrome/browser/resources/new_tab_theme.css
index 77b53b0..e2add06 100644
--- a/chrome/browser/resources/new_tab_theme.css
+++ b/chrome/browser/resources/new_tab_theme.css
@@ -52,9 +52,9 @@
.thumbnail-container:focus .edit-bar,
.thumbnail-container:hover .edit-bar {
background-color: $6; /* COLOR_NTP_HEADER */
- background-image: -webkit-gradient(linear, left top, left bottom,
- from($7), /* color_header_gradient_light */
- to($6)); /* COLOR_NTP_HEADER */
+ background-image: -webkit-linear-gradient(
+ $7, /* COLOR_HEADER_GRADIENT_LIGHT */
+ $6); /* COLOR_NTP_HEADER */
}
.thumbnail-container:hover > .edit-mode-border {
background-color: $6; /* COLOR_NTP_HEADER */
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js
index 32b8a4a..973dada 100644
--- a/chrome/browser/resources/ntp/apps.js
+++ b/chrome/browser/resources/ntp/apps.js
@@ -36,7 +36,7 @@
// The "Create App Shortcut" menu option.
$('apps-create-shortcut-command-menu-item').style.display =
$('apps-create-shortcut-command-separator').style.display =
- (data.disableCreateAppShortcut ? 'none' : 'inline');
+ (data.disableCreateAppShortcut ? 'none' : '');
appsMiniview.textContent = '';
appsSectionContent.textContent = '';
@@ -81,7 +81,7 @@
$('apps-promo-link').setAttribute('ping', appsPromoPing);
maybeDoneLoading();
- if (data.apps.length > 0 && isDoneLoading()) {
+ if (isDoneLoading()) {
if (!apps.showPromo && data.apps.length >= MAX_APPS_PER_ROW[layoutMode])
webStoreEntry.classList.add('loner');
else
diff --git a/chrome/browser/resources/ntp/most_visited.css b/chrome/browser/resources/ntp/most_visited.css
index 44933b1..2f875e2 100644
--- a/chrome/browser/resources/ntp/most_visited.css
+++ b/chrome/browser/resources/ntp/most_visited.css
@@ -100,9 +100,8 @@
/* We need background-color as well to get the fade out animation correct */
background-color: hsl(213, 66%, 57%);
- background-image: -webkit-gradient(linear, left top, left bottom,
- from(hsl(213, 87%, 67%)),
- to(hsl(213, 66%, 57%)));
+ background-image: -webkit-linear-gradient(hsl(213, 87%, 67%),
+ hsl(213, 66%, 57%));
}
.edit-bar > .spacer {
@@ -198,11 +197,9 @@
border-top-left-radius: 0;
border-top-right-radius: 0;
- background-image: -webkit-gradient(linear, left top, left bottom,
- from(hsla(0, 0%, 0%, 0)),
- color-stop(0.85, hsla(0, 0%, 47%, 0)),
- to(hsla(0, 0%, 47%, 0.2))
- );
+ background-image: -webkit-linear-gradient(hsla(0, 0%, 0%, 0),
+ hsla(0, 0%, 47%, 0) 85%,
+ hsla(0, 0%, 47%, 0.2));
/* delay border radius transition as much as the edit bar slide delay */
-webkit-transition-delay: 0, 0, 0, .5s, .5s, 0;
diff --git a/chrome/browser/resources/offline_load.html b/chrome/browser/resources/offline_load.html
index a9756bd..9a06022 100644
--- a/chrome/browser/resources/offline_load.html
+++ b/chrome/browser/resources/offline_load.html
@@ -10,13 +10,7 @@
body {
color: #000;
font-family: Helvetica, Arial, sans-serif;
- background-image: -webkit-gradient(
- linear,
- left bottom,
- left top,
- color-stop(0, rgb(236,244,255)),
- color-stop(0.50, rgb(255,255,255))
- );
+ background-image: -webkit-linear-gradient(white 50%, rgb(236, 244, 255));
height: 100%;
padding: 0;
margin: 0;
diff --git a/chrome/browser/resources/options/about_page.html b/chrome/browser/resources/options/about_page.html
index 9c753aa..282b76e 100644
--- a/chrome/browser/resources/options/about_page.html
+++ b/chrome/browser/resources/options/about_page.html
@@ -67,14 +67,24 @@
<div>
<!-- Odd formatting to avoid unwanted spaces between elements. -->
<span i18n-content="license_content_0">
- </span><a i18n-values="href:license_link_0"
+ </span><a target="_blank"
+ i18n-values="href:license_link_0"
i18n-content="license_link_content_0">
</a><span i18n-content="license_content_1">
- </span><a i18n-values="href:license_link_1"
+ </span><a target="_blank"
+ i18n-values="href:license_link_1"
i18n-content="license_link_content_1">
</a><span i18n-content="license_content_2">
</span>
- </div>
+ </div>
+ <div>
+ <span i18n-content="cros_license_content_0">
+ </span><a target="_blank"
+ i18n-values="href:cros_license_link_0"
+ i18n-content="cros_license_link_content_0">
+ </a><span i18n-content="cros_license_content_1">
+ </span>
+ </div>
</div>
</section>
<section>
diff --git a/chrome/browser/resources/options/advanced_options.html b/chrome/browser/resources/options/advanced_options.html
index 06b1473..50e18cd 100644
--- a/chrome/browser/resources/options/advanced_options.html
+++ b/chrome/browser/resources/options/advanced_options.html
@@ -201,4 +201,11 @@
</div>
</section>
</if>
+ <section id="remoting-section">
+ <h3 i18n-content="advancedSectionTitleRemoting"></h3>
+ <div>
+ <button id="remotingSetupButton"
+ i18n-content="remotingSetupButton"></button>
+ </div>
+ </section>
</div>
diff --git a/chrome/browser/resources/options/advanced_options.js b/chrome/browser/resources/options/advanced_options.js
index 0d52a90..8133d7b 100644
--- a/chrome/browser/resources/options/advanced_options.js
+++ b/chrome/browser/resources/options/advanced_options.js
@@ -137,6 +137,10 @@
chrome.send('showCloudPrintManagePage');
};
}
+
+ $('remotingSetupButton').onclick = function(event) {
+ chrome.send('showRemotingSetupDialog');
+ }
}
};
@@ -251,12 +255,18 @@
}
};
- AdvancedOptions.HideCloudPrintProxySection = function() {
+ AdvancedOptions.RemoveCloudPrintProxySection = function() {
if (!cr.isChromeOS) {
- $('cloud-print-proxy-section').style.display = 'none';
+ var proxySectionElm = $('cloud-print-proxy-section');
+ proxySectionElm.parentNode.removeChild(proxySectionElm);
}
};
+ AdvancedOptions.RemoveRemotingSection = function() {
+ var proxySectionElm = $('remoting-section');
+ proxySectionElm.parentNode.removeChild(proxySectionElm);
+ };
+
// Export
return {
AdvancedOptions: AdvancedOptions
diff --git a/chrome/browser/resources/options/amex.png b/chrome/browser/resources/options/amex.png
new file mode 100644
index 0000000..7cfa9cb
--- /dev/null
+++ b/chrome/browser/resources/options/amex.png
Binary files differ
diff --git a/chrome/browser/resources/options/autofill_options.css b/chrome/browser/resources/options/autofill_options.css
index 7ca1d45..5320dd7 100644
--- a/chrome/browser/resources/options/autofill_options.css
+++ b/chrome/browser/resources/options/autofill_options.css
@@ -1,7 +1,13 @@
.autofill-list-item {
+ -webkit-box-flex: 1;
-webkit-padding-start: 8px;
}
+.autofill-list-item + img {
+ -webkit-padding-end: 20px;
+ vertical-align: middle;
+}
+
#autofill-options > div:last-child {
margin-top: 15px;
}
diff --git a/chrome/browser/resources/options/autofill_options.js b/chrome/browser/resources/options/autofill_options.js
index a3637c4..2e129bb 100644
--- a/chrome/browser/resources/options/autofill_options.js
+++ b/chrome/browser/resources/options/autofill_options.js
@@ -5,7 +5,6 @@
cr.define('options', function() {
const OptionsPage = options.OptionsPage;
const ArrayDataModel = cr.ui.ArrayDataModel;
- const ListSingleSelectionModel = cr.ui.ListSingleSelectionModel;
/////////////////////////////////////////////////////////////////////////////
// AutoFillOptions class:
@@ -64,8 +63,7 @@
*/
createAddressList_: function() {
this.addressList_ = $('address-list');
- options.autoFillOptions.AutoFillList.decorate(this.addressList_);
- this.addressList_.selectionModel = new ListSingleSelectionModel;
+ options.autoFillOptions.AutoFillAddressList.decorate(this.addressList_);
this.addressList_.autoExpands = true;
},
@@ -75,8 +73,8 @@
*/
createCreditCardList_: function() {
this.creditCardList_ = $('creditcard-list');
- options.autoFillOptions.AutoFillList.decorate(this.creditCardList_);
- this.creditCardList_.selectionModel = new ListSingleSelectionModel;
+ options.autoFillOptions.AutoFillCreditCardList.decorate(
+ this.creditCardList_);
this.creditCardList_.autoExpands = true;
},
@@ -125,24 +123,43 @@
},
/**
- * Removes the AutoFill profile represented by |guid|.
- * @param {String} guid The GUID of the profile to remove.
+ * Removes the AutoFill address represented by |guid|.
+ * @param {String} guid The GUID of the address to remove.
* @private
*/
- removeAutoFillProfile_: function(guid) {
- chrome.send('removeAutoFillProfile', [guid]);
+ removeAddress_: function(guid) {
+ chrome.send('removeAddress', [guid]);
},
/**
- * Requests profile data for the profile represented by |guid| from the
- * PersonalDataManager. Once the data is loaded, the AutoFillOptionsHandler
- * calls showEdit[Address,CreditCard]Overlay(), depending on the type of the
- * profile.
- * @param {String} guid The GUID of the profile to edit.
+ * Removes the AutoFill credit card represented by |guid|.
+ * @param {String} guid The GUID of the credit card to remove.
* @private
*/
- loadProfileEditor_: function(guid) {
- chrome.send('loadProfileEditor', [guid]);
+ removeCreditCard_: function(guid) {
+ chrome.send('removeCreditCard', [guid]);
+ },
+
+ /**
+ * Requests profile data for the address represented by |guid| from the
+ * PersonalDataManager. Once the data is loaded, the AutoFillOptionsHandler
+ * calls showEditAddressOverlay().
+ * @param {String} guid The GUID of the address to edit.
+ * @private
+ */
+ loadAddressEditor_: function(guid) {
+ chrome.send('loadAddressEditor', [guid]);
+ },
+
+ /**
+ * Requests profile data for the credit card represented by |guid| from the
+ * PersonalDataManager. Once the data is loaded, the AutoFillOptionsHandler
+ * calls showEditCreditCardOverlay().
+ * @param {String} guid The GUID of the credit card to edit.
+ * @private
+ */
+ loadCreditCardEditor_: function(guid) {
+ chrome.send('loadCreditCardEditor', [guid]);
},
/**
@@ -180,12 +197,20 @@
AutoFillOptions.getInstance().setCreditCardList_(entries);
};
- AutoFillOptions.removeAutoFillProfile = function(guid) {
- AutoFillOptions.getInstance().removeAutoFillProfile_(guid);
+ AutoFillOptions.removeAddress = function(guid) {
+ AutoFillOptions.getInstance().removeAddress_(guid);
};
- AutoFillOptions.loadProfileEditor = function(guid) {
- AutoFillOptions.getInstance().loadProfileEditor_(guid);
+ AutoFillOptions.removeCreditCard = function(guid) {
+ AutoFillOptions.getInstance().removeCreditCard_(guid);
+ };
+
+ AutoFillOptions.loadAddressEditor = function(guid) {
+ AutoFillOptions.getInstance().loadAddressEditor_(guid);
+ };
+
+ AutoFillOptions.loadCreditCardEditor = function(guid) {
+ AutoFillOptions.getInstance().loadCreditCardEditor_(guid);
};
AutoFillOptions.editAddress = function(address) {
diff --git a/chrome/browser/resources/options/autofill_options_list.js b/chrome/browser/resources/options/autofill_options_list.js
index 10e0b64..c2173d5 100644
--- a/chrome/browser/resources/options/autofill_options_list.js
+++ b/chrome/browser/resources/options/autofill_options_list.js
@@ -3,27 +3,26 @@
// found in the LICENSE file.
cr.define('options.autoFillOptions', function() {
- const DeletableItemList = options.DeletableItemList;
const DeletableItem = options.DeletableItem;
- const List = cr.ui.List;
+ const DeletableItemList = options.DeletableItemList;
/**
- * Creates a new AutoFill list item.
+ * Creates a new address list item.
* @param {Array} entry An array of the form [guid, label].
* @constructor
* @extends {options.DeletableItem}
*/
- function AutoFillListItem(entry) {
+ function AddressListItem(entry) {
var el = cr.doc.createElement('div');
el.guid = entry[0];
el.label = entry[1];
- el.__proto__ = AutoFillListItem.prototype;
+ el.__proto__ = AddressListItem.prototype;
el.decorate();
return el;
}
- AutoFillListItem.prototype = {
+ AddressListItem.prototype = {
__proto__: DeletableItem.prototype,
/** @inheritDoc */
@@ -39,33 +38,126 @@
};
/**
- * Create a new AutoFill list.
+ * Creates a new credit card list item.
+ * @param {Array} entry An array of the form [guid, label, icon].
+ * @constructor
+ * @extends {options.DeletableItem}
+ */
+ function CreditCardListItem(entry) {
+ var el = cr.doc.createElement('div');
+ el.guid = entry[0];
+ el.label = entry[1];
+ el.icon = entry[2];
+ el.__proto__ = CreditCardListItem.prototype;
+ el.decorate();
+
+ return el;
+ }
+
+ CreditCardListItem.prototype = {
+ __proto__: DeletableItem.prototype,
+
+ /** @inheritDoc */
+ decorate: function() {
+ DeletableItem.prototype.decorate.call(this);
+
+ // The stored label.
+ var label = this.ownerDocument.createElement('div');
+ label.className = 'autofill-list-item';
+ label.textContent = this.label;
+ this.contentElement.appendChild(label);
+
+ // The credit card icon.
+ var icon = this.ownerDocument.createElement('image');
+ icon.src = this.icon;
+ this.contentElement.appendChild(icon);
+ },
+ };
+
+ /**
+ * Create a new address list.
* @constructor
* @extends {options.DeletableItemList}
*/
- var AutoFillList = cr.ui.define('list');
+ var AutoFillAddressList = cr.ui.define('list');
- AutoFillList.prototype = {
+ AutoFillAddressList.prototype = {
__proto__: DeletableItemList.prototype,
+ decorate: function() {
+ DeletableItemList.prototype.decorate.call(this);
+
+ this.addEventListener('blur', this.onBlur_);
+ },
+
+ /**
+ * When the list loses focus, unselect all items in the list.
+ * @private
+ */
+ onBlur_: function() {
+ this.selectionModel.unselectAll();
+ },
+
/** @inheritDoc */
createItem: function(entry) {
- return new AutoFillListItem(entry);
+ return new AddressListItem(entry);
},
/** @inheritDoc */
activateItemAtIndex: function(index) {
- AutoFillOptions.loadProfileEditor(this.dataModel.item(index)[0]);
+ AutoFillOptions.loadAddressEditor(this.dataModel.item(index)[0]);
},
/** @inheritDoc */
deleteItemAtIndex: function(index) {
- AutoFillOptions.removeAutoFillProfile(this.dataModel.item(index)[0]);
+ AutoFillOptions.removeAddress(this.dataModel.item(index)[0]);
+ },
+ };
+
+ /**
+ * Create a new credit card list.
+ * @constructor
+ * @extends {options.DeletableItemList}
+ */
+ var AutoFillCreditCardList = cr.ui.define('list');
+
+ AutoFillCreditCardList.prototype = {
+ __proto__: DeletableItemList.prototype,
+
+ decorate: function() {
+ DeletableItemList.prototype.decorate.call(this);
+
+ this.addEventListener('blur', this.onBlur_);
+ },
+
+ /**
+ * When the list loses focus, unselect all items in the list.
+ * @private
+ */
+ onBlur_: function() {
+ this.selectionModel.unselectAll();
+ },
+
+ /** @inheritDoc */
+ createItem: function(entry) {
+ return new CreditCardListItem(entry);
+ },
+
+ /** @inheritDoc */
+ activateItemAtIndex: function(index) {
+ AutoFillOptions.loadCreditCardEditor(this.dataModel.item(index)[0]);
+ },
+
+ /** @inheritDoc */
+ deleteItemAtIndex: function(index) {
+ AutoFillOptions.removeCreditCard(this.dataModel.item(index)[0]);
},
};
return {
- AutoFillListItem: AutoFillListItem,
- AutoFillList: AutoFillList,
+ AddressListItem: AddressListItem,
+ CreditCardListItem: CreditCardListItem,
+ AutoFillAddressList: AutoFillAddressList,
+ AutoFillCreditCardList: AutoFillCreditCardList,
};
});
diff --git a/chrome/browser/resources/options/cc-generic.png b/chrome/browser/resources/options/cc-generic.png
new file mode 100644
index 0000000..f32fd92
--- /dev/null
+++ b/chrome/browser/resources/options/cc-generic.png
Binary files differ
diff --git a/chrome/browser/resources/options/chromeos_accounts_options.html b/chrome/browser/resources/options/chromeos_accounts_options.html
index 42b5f2e..2f5af2a 100644
--- a/chrome/browser/resources/options/chromeos_accounts_options.html
+++ b/chrome/browser/resources/options/chromeos_accounts_options.html
@@ -3,7 +3,6 @@
<section>
<div class="option">
<div id="ownerOnlyWarning" class="hidden">
- <span id="warningIcon"></span>
<span i18n-content="owner_only"></span>
<span i18n-content="owner_user_id"></span>
</div>
diff --git a/chrome/browser/resources/options/chromeos_accounts_options_page.css b/chrome/browser/resources/options/chromeos_accounts_options_page.css
index 10aa695..ea316db 100644
--- a/chrome/browser/resources/options/chromeos_accounts_options_page.css
+++ b/chrome/browser/resources/options/chromeos_accounts_options_page.css
@@ -80,16 +80,7 @@
#ownerOnlyWarning {
margin-bottom: 10px;
-}
-
-#ownerOnlyWarning > * {
- vertical-align: middle;
-}
-
-#warningIcon {
- width: 17px;
- height: 17px;
- display: inline-block;
+ -webkit-padding-start: 20px;
background-repeat: no-repeat;
background-image: url('warning.png');
}
diff --git a/chrome/browser/resources/options/chromeos_internet_options_page.css b/chrome/browser/resources/options/chromeos_internet_options_page.css
index 82e1fc2..d2ba444 100644
--- a/chrome/browser/resources/options/chromeos_internet_options_page.css
+++ b/chrome/browser/resources/options/chromeos_internet_options_page.css
@@ -53,8 +53,8 @@
}
.network-item[connected] {
- background-image: -webkit-gradient(linear, left top, left bottom,
- from(rgba(255,255,255,0.8)), to(rgba(255,255,255,0)));
+ background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.8),
+ rgba(255, 255, 255, 0));
background-color: hsl(214,91%,89%);
border-color: hsl(214, 91%, 65%);
}
diff --git a/chrome/browser/resources/options/chromeos_language_chewing_options.html b/chrome/browser/resources/options/chromeos_language_chewing_options.html
index e71838b..dd11a85 100644
--- a/chrome/browser/resources/options/chromeos_language_chewing_options.html
+++ b/chrome/browser/resources/options/chromeos_language_chewing_options.html
@@ -97,7 +97,7 @@
<td class="option-value">
<select id="chewing-cand-per-page" class="control"
pref="settings.language.chewing_cand_per_page"
- data-values="Chewing_candPerPageValue"></select>
+ i18n-options="Chewing_candPerPageValue"></select>
</td>
</tr>
<tr>
@@ -105,7 +105,7 @@
<td class="option-value">
<select id="chewing-keyboard-type" class="control"
pref="settings.language.chewing_keyboard_type"
- data-values="Chewing_KBTypeValue"></select>
+ i18n-options="Chewing_KBTypeValue"></select>
</td>
</tr>
<tr>
@@ -113,7 +113,7 @@
<td class="option-value">
<select id="chewing-sel-keys" class="control"
pref="settings.language.chewing_sel_keys"
- data-values="Chewing_selKeysValue"></select>
+ i18n-options="Chewing_selKeysValue"></select>
</td>
</tr>
<tr>
@@ -121,7 +121,7 @@
<td class="option-value">
<select id="chewing-sel-key-type" class="control"
pref="settings.language.chewing_hsu_sel_key_type"
- data-values="Chewing_hsuSelKeyTypeValue"></select>
+ i18n-options="Chewing_hsuSelKeyTypeValue"></select>
</td>
</tr>
</table>
diff --git a/chrome/browser/resources/options/chromeos_language_customize_modifier_keys_overlay.html b/chrome/browser/resources/options/chromeos_language_customize_modifier_keys_overlay.html
index 2d20806..af29a3a 100644
--- a/chrome/browser/resources/options/chromeos_language_customize_modifier_keys_overlay.html
+++ b/chrome/browser/resources/options/chromeos_language_customize_modifier_keys_overlay.html
@@ -6,7 +6,7 @@
<td class="option-value">
<select id="xkb-remap-search-key-to" class="control"
pref="settings.language.xkb_remap_search_key_to"
- data-values="xkbRemapSearchKeyToValue"></select>
+ i18n-options="xkbRemapSearchKeyToValue"></select>
</td>
</tr>
<tr>
@@ -15,7 +15,7 @@
<td class="option-value">
<select id="xkb-remap-control-key-to" class="control"
pref="settings.language.xkb_remap_control_key_to"
- data-values="xkbRemapControlKeyToValue"></select>
+ i18n-options="xkbRemapControlKeyToValue"></select>
</td>
</tr>
<tr>
@@ -23,7 +23,7 @@
<td class="option-value">
<select id="xkb-remap-alt-key-to" class="control"
pref="settings.language.xkb_remap_alt_key_to"
- data-values="xkbRemapAltKeyToValue"></select>
+ i18n-options="xkbRemapAltKeyToValue"></select>
</td>
</tr>
</table>
diff --git a/chrome/browser/resources/options/chromeos_language_hangul_options.html b/chrome/browser/resources/options/chromeos_language_hangul_options.html
index 140e40f..7746a7b 100644
--- a/chrome/browser/resources/options/chromeos_language_hangul_options.html
+++ b/chrome/browser/resources/options/chromeos_language_hangul_options.html
@@ -8,7 +8,7 @@
<td class="option-value">
<select id="keyboard-layout-select" class="control"
pref="settings.language.hangul_keyboard"
- data-values="HangulkeyboardLayoutList"></select>
+ i18n-options="HangulkeyboardLayoutList"></select>
</td>
</tr>
</table>
diff --git a/chrome/browser/resources/options/chromeos_language_mozc_options.html b/chrome/browser/resources/options/chromeos_language_mozc_options.html
index 77a6898..0b40fc5 100644
--- a/chrome/browser/resources/options/chromeos_language_mozc_options.html
+++ b/chrome/browser/resources/options/chromeos_language_mozc_options.html
@@ -87,31 +87,31 @@
<td class="option-value">
<select id="mozc-preedit-method" class="control"
pref="settings.language.mozc_preedit_method"
- data-values="mozc_preedit_methodValue"></select>
+ i18n-options="mozc_preedit_methodValue"></select>
</td>
</tr>
<tr>
<td class="option-name" i18n-content="mozc_session_keymap"></td>
<td class="option-value">
<select id="mozc-session-keymap" class="control"
- pref="settings.language.mozc_session_keymap"
- data-values="mozc_session_keymapValue"></select>
+ pref="settings.language.mozc_session_keymap"
+ i18n-options="mozc_session_keymapValue"></select>
</td>
</tr>
<tr>
<td class="option-name" i18n-content="mozc_punctuation_method"></td>
<td class="option-value">
<select id="mozc-punctuation-method" class="control"
- pref="settings.language.mozc_punctuation_method"
- data-values="mozc_punctuation_methodValue"></select>
+ pref="settings.language.mozc_punctuation_method"
+ i18n-options="mozc_punctuation_methodValue"></select>
</td>
</tr>
<tr>
<td class="option-name" i18n-content="mozc_symbol_method"></td>
<td class="option-value">
<select id="mozc-symbol-method" class="control"
- pref="settings.language.mozc_symbol_method"
- data-values="mozc_symbol_methodValue"></select>
+ pref="settings.language.mozc_symbol_method"
+ i18n-options="mozc_symbol_methodValue"></select>
</td>
</tr>
<tr>
@@ -119,8 +119,8 @@
</td>
<td class="option-value">
<select id="mozc-space-character-form" class="control"
- pref="settings.language.mozc_space_character_form"
- data-values="mozc_space_character_formValue"></select>
+ pref="settings.language.mozc_space_character_form"
+ i18n-options="mozc_space_character_formValue"></select>
</td>
</tr>
<tr>
@@ -128,8 +128,8 @@
</td>
<td class="option-value">
<select id="mozc-history-learning-level" class="control"
- pref="settings.language.mozc_history_learning_level"
- data-values="mozc_history_learning_levelValue"></select>
+ pref="settings.language.mozc_history_learning_level"
+ i18n-options="mozc_history_learning_levelValue"></select>
</td>
</tr>
<tr>
@@ -137,8 +137,8 @@
</td>
<td class="option-value">
<select id="mozc-shift-key-mode-switch" class="control"
- pref="settings.language.mozc_shift_key_mode_switch"
- data-values="mozc_shift_key_mode_switchValue"></select>
+ pref="settings.language.mozc_shift_key_mode_switch"
+ i18n-options="mozc_shift_key_mode_switchValue"></select>
</td>
</tr>
<tr>
@@ -146,8 +146,8 @@
</td>
<td class="option-value">
<select id="mozc-numpad-character-form" class="control"
- pref="settings.language.mozc_numpad_character_form"
- data-values="mozc_numpad_character_formValue"></select>
+ pref="settings.language.mozc_numpad_character_form"
+ i18n-options="mozc_numpad_character_formValue"></select>
</td>
</tr>
<tr>
@@ -155,8 +155,8 @@
</td>
<td class="option-value">
<select id="mozc-suggestions-size" class="control"
- pref="settings.language.mozc_suggestions_size"
- data-values="mozc_suggestions_sizeValue"></select>
+ pref="settings.language.mozc_suggestions_size"
+ i18n-options="mozc_suggestions_sizeValue"></select>
</td>
</tr>
</table>
diff --git a/chrome/browser/resources/options/chromeos_language_pinyin_options.html b/chrome/browser/resources/options/chromeos_language_pinyin_options.html
index e2cd757..8b0e68c 100644
--- a/chrome/browser/resources/options/chromeos_language_pinyin_options.html
+++ b/chrome/browser/resources/options/chromeos_language_pinyin_options.html
@@ -118,7 +118,7 @@
<td class="option-value">
<select id="pinyin-double-pinyin-schema" class="control"
pref="settings.language.pinyin_double_pinyin_schema"
- data-values="PinyinDoublePinyinSchemaValue"></select>
+ i18n-options="PinyinDoublePinyinSchemaValue"></select>
</td>
</tr>
</table>
diff --git a/chrome/browser/resources/options/chromeos_system_options.html b/chrome/browser/resources/options/chromeos_system_options.html
index 0035341..e43b40a 100644
--- a/chrome/browser/resources/options/chromeos_system_options.html
+++ b/chrome/browser/resources/options/chromeos_system_options.html
@@ -7,6 +7,7 @@
<td class="option-name" i18n-content="timezone"></td>
<td class="option-value">
<select id="timezone-select" class="control"
+ i18n-options="timezoneList"
pref="cros.system.timezone"></select>
</td>
</tr>
diff --git a/chrome/browser/resources/options/chromeos_system_options.js b/chrome/browser/resources/options/chromeos_system_options.js
index fa69ad4..52ffd70 100644
--- a/chrome/browser/resources/options/chromeos_system_options.js
+++ b/chrome/browser/resources/options/chromeos_system_options.js
@@ -31,8 +31,6 @@
OptionsPage.prototype.initializePage.call(this);
var timezone = $('timezone-select');
if (timezone) {
- timezone.initializeValues(templateData.timezoneList);
-
// Disable the timezone setting for non-owners, as this is a
// system wide setting.
if (!AccountsOptions.currentUserIsOwner())
diff --git a/chrome/browser/resources/options/clear_browser_data_overlay.html b/chrome/browser/resources/options/clear_browser_data_overlay.html
index 7bf216a..66d3739 100644
--- a/chrome/browser/resources/options/clear_browser_data_overlay.html
+++ b/chrome/browser/resources/options/clear_browser_data_overlay.html
@@ -42,6 +42,7 @@
<div>
<label for="" i18n-content="clearBrowsingDataTimeLabel"></label>
<select id="clearBrowsingDataTimePeriod"
+ i18n-options="clearBrowsingDataTimeList"
pref="browser.clear_data.time_period"></select>
</div>
<div class="action-area">
diff --git a/chrome/browser/resources/options/clear_browser_data_overlay.js b/chrome/browser/resources/options/clear_browser_data_overlay.js
index 501e462..6b1cf05 100644
--- a/chrome/browser/resources/options/clear_browser_data_overlay.js
+++ b/chrome/browser/resources/options/clear_browser_data_overlay.js
@@ -32,10 +32,6 @@
// Call base class implementation to starts preference initialization.
OptionsPage.prototype.initializePage.call(this);
- // Setup option values for the time period select control.
- $('clearBrowsingDataTimePeriod').initializeValues(
- templateData.clearBrowsingDataTimeList);
-
var f = this.updateCommitButtonState_.bind(this);
var types = ['browser.clear_data.browsing_history',
'browser.clear_data.download_history',
diff --git a/chrome/browser/resources/options/content_settings.css b/chrome/browser/resources/options/content_settings.css
index be2cc17..f788261 100644
--- a/chrome/browser/resources/options/content_settings.css
+++ b/chrome/browser/resources/options/content_settings.css
@@ -4,53 +4,59 @@
found in the LICENSE file.
*/
-.exceptionPattern {
+.exception-pattern {
+ -webkit-box-flex: 1;
+ -webkit-margin-end: 10px;
+ -webkit-margin-start: 14px;
display: -webkit-box;
margin-right: 4px;
overflow: hidden;
- -webkit-box-flex: 1;
white-space: nowrap;
}
-.exceptionSetting {
+.exception-setting {
+ -webkit-margin-end: 20px;
display: inline-block;
width: 100px;
- margin-right: 20px;
}
-select.exceptionSetting {
+select.exception-setting {
vertical-align: middle;
}
/* Hacks to make the <select> align better with the <input>. */
-html[toolkit=gtk] select.exceptionSetting {
+html[toolkit=gtk] select.exception-setting {
height: 22px;
margin-top: 1px;
}
-#exceptionColumnHeaders {
+#exception-column-headers {
+ -webkit-margin-start: 17px;
display: -webkit-box;
margin-top: 17px;
- -webkit-margin-start: 3px;
}
-#exceptionColumnHeaders > div {
+#exception-column-headers > div {
font-weight: bold;
}
-#exceptionPatternColumn {
+#exception-pattern-column {
-webkit-box-flex: 1;
}
-#exceptionBehaviorColumn {
+#exception-behavior-column {
width: 140px;
}
-.otr_explanation {
+.otr-explanation {
font-style: italic;
}
-#contentSettingsExceptionsArea list {
+#content-settings-exceptions-area list {
margin-bottom: 10px;
margin-top: 4px;
}
+
+#content-settings-exceptions-area input:invalid {
+ background-color: pink;
+}
diff --git a/chrome/browser/resources/options/content_settings.html b/chrome/browser/resources/options/content_settings.html
index c2693f3..f150024 100644
--- a/chrome/browser/resources/options/content_settings.html
+++ b/chrome/browser/resources/options/content_settings.html
@@ -1,4 +1,4 @@
-<div class="page hidden" id="contentSettingsPage">
+<div class="page hidden" id="content-settings-page">
<h1 i18n-content="contentSettingsPage"></h1>
<!-- Cookie filter tab contents -->
<section>
@@ -24,7 +24,7 @@
<span i18n-content="cookies_clear_on_exit"></span>
</label>
- <button class="exceptionsListButton" contentType="cookies"
+ <button class="exceptions-list-button" contentType="cookies"
i18n-content="manage_exceptions"></button>
<button id="show-cookies-button"
i18n-content="cookies_show_cookies"></button>
@@ -44,7 +44,7 @@
<span i18n-content="images_block"></span>
</label>
- <button class="exceptionsListButton" contentType="images"
+ <button class="exceptions-list-button" contentType="images"
i18n-content="manage_exceptions"></button>
</div>
</section>
@@ -62,7 +62,7 @@
<span i18n-content="javascript_block"></span>
</label>
- <button class="exceptionsListButton" contentType="javascript"
+ <button class="exceptions-list-button" contentType="javascript"
i18n-content="manage_exceptions"></button>
</div>
</section>
@@ -84,14 +84,14 @@
<span i18n-content="plugins_block"></span>
</label>
- <button class="exceptionsListButton" contentType="plugins"
+ <button class="exceptions-list-button" contentType="plugins"
i18n-content="manage_exceptions"></button>
</div>
</section>
<!-- Pop-ups filter -->
<section>
- <h3 i18n-content="popups_tab_label" class="contentSettingsHeader"></h3>
+ <h3 i18n-content="popups_tab_label" class="content-settings-header"></h3>
<div>
<label class="radio">
<input type="radio" name="popups" value="allow">
@@ -102,7 +102,7 @@
<span i18n-content="popups_block"></span>
</label>
- <button class="exceptionsListButton" contentType="popups"
+ <button class="exceptions-list-button" contentType="popups"
i18n-content="manage_exceptions"></button>
</div>
</section>
@@ -124,7 +124,7 @@
<span i18n-content="location_block"></span>
</label>
- <button class="exceptionsListButton" contentType="location"
+ <button class="exceptions-list-button" contentType="location"
i18n-content="manage_exceptions"></button>
</div>
</section>
@@ -146,7 +146,7 @@
<span i18n-content="notifications_block"></span>
</label>
- <button class="exceptionsListButton" contentType="notifications"
+ <button class="exceptions-list-button" contentType="notifications"
i18n-content="manage_exceptions"></button>
</div>
</section>
diff --git a/chrome/browser/resources/options/content_settings.js b/chrome/browser/resources/options/content_settings.js
index 787386e..a9a80bb 100644
--- a/chrome/browser/resources/options/content_settings.js
+++ b/chrome/browser/resources/options/content_settings.js
@@ -16,7 +16,7 @@
function ContentSettings() {
this.activeNavTab = null;
OptionsPage.call(this, 'content', templateData.contentSettingsPage,
- 'contentSettingsPage');
+ 'content-settings-page');
}
cr.addSingletonGetter(ContentSettings);
@@ -30,7 +30,7 @@
chrome.send('getContentFilterSettings');
var exceptionsButtons =
- this.pageDiv.querySelectorAll('.exceptionsListButton');
+ this.pageDiv.querySelectorAll('.exceptions-list-button');
for (var i = 0; i < exceptionsButtons.length; i++) {
exceptionsButtons[i].onclick = function(event) {
ContentSettingsExceptionsArea.getInstance().showList(
diff --git a/chrome/browser/resources/options/content_settings_exceptions_area.html b/chrome/browser/resources/options/content_settings_exceptions_area.html
index d4289bb..59db53f 100644
--- a/chrome/browser/resources/options/content_settings_exceptions_area.html
+++ b/chrome/browser/resources/options/content_settings_exceptions_area.html
@@ -1,15 +1,15 @@
-<div class="page hidden" id="contentSettingsExceptionsArea">
+<div class="page hidden" id="content-settings-exceptions-area">
<h1></h1>
- <div id="exceptionColumnHeaders">
- <div id="exceptionPatternColumn">Pattern</div>
- <div id="exceptionBehaviorColumn">Behavior</div>
+ <div id="exception-column-headers">
+ <div id="exception-pattern-column">Pattern</div>
+ <div id="exception-behavior-column">Behavior</div>
</div>
<div contentType="cookies">
<list mode="normal"></list>
<div>
- <span class="otr_explanation"
+ <span class="otr-explanation"
i18n-content="otr_exceptions_explanation"></span>
<list mode="otr"></list>
</div>
@@ -20,7 +20,7 @@
<div contentType="images">
<list mode="normal"></list>
<div>
- <span class="otr_explanation"
+ <span class="otr-explanation"
i18n-content="otr_exceptions_explanation"></span>
<list mode="otr"></list>
</div>
@@ -29,7 +29,7 @@
<div contentType="javascript">
<list mode="normal"></list>
<div>
- <span class="otr_explanation"
+ <span class="otr-explanation"
i18n-content="otr_exceptions_explanation"></span>
<list mode="otr"></list>
</div>
@@ -38,7 +38,7 @@
<div contentType="plugins">
<list mode="normal"></list>
<div>
- <span class="otr_explanation"
+ <span class="otr-explanation"
i18n-content="otr_exceptions_explanation"></span>
<list mode="otr"></list>
</div>
@@ -48,7 +48,7 @@
<div contentType="popups">
<list mode="normal"></list>
<div>
- <span class="otr_explanation"
+ <span class="otr-explanation"
i18n-content="otr_exceptions_explanation"></span>
<list mode="otr"></list>
</div>
diff --git a/chrome/browser/resources/options/content_settings_exceptions_area.js b/chrome/browser/resources/options/content_settings_exceptions_area.js
index ddc85a0..da67d01 100644
--- a/chrome/browser/resources/options/content_settings_exceptions_area.js
+++ b/chrome/browser/resources/options/content_settings_exceptions_area.js
@@ -44,13 +44,13 @@
if (this.pattern) {
var patternLabel = cr.doc.createElement('span');
patternLabel.textContent = this.pattern;
- patternLabel.className = 'exceptionPattern';
+ patternLabel.className = 'exception-pattern';
this.contentElement.appendChild(patternLabel);
this.patternLabel = patternLabel;
var settingLabel = cr.doc.createElement('span');
settingLabel.textContent = this.settingForDisplay();
- settingLabel.className = 'exceptionSetting';
+ settingLabel.className = 'exception-setting';
this.contentElement.appendChild(settingLabel);
this.settingLabel = settingLabel;
}
@@ -59,7 +59,7 @@
var input = cr.doc.createElement('input');
input.type = 'text';
this.contentElement.appendChild(input);
- input.className = 'exceptionPattern hidden';
+ input.className = 'exception-pattern hidden';
var select = cr.doc.createElement('select');
var optionAllow = cr.doc.createElement('option');
@@ -85,7 +85,7 @@
select.appendChild(optionBlock);
this.contentElement.appendChild(select);
- select.className = 'exceptionSetting hidden';
+ select.className = 'exception-setting hidden';
// Used to track whether the URL pattern in the input is valid.
// This will be true if the browser process has informed us that the
@@ -402,6 +402,7 @@
decorate: function() {
DeletableItemList.prototype.decorate.call(this);
+ this.selectionModel = new cr.ui.ListSingleSelectionModel;
this.classList.add('settings-list');
for (var parentNode = this.parentNode; parentNode;
@@ -547,7 +548,7 @@
*/
function ContentSettingsExceptionsArea() {
OptionsPage.call(this, 'contentExceptions',
- '', 'contentSettingsExceptionsArea');
+ '', 'content-settings-exceptions-area');
}
cr.addSingletonGetter(ContentSettingsExceptionsArea);
diff --git a/chrome/browser/resources/options/deletable_item_list.js b/chrome/browser/resources/options/deletable_item_list.js
index 6781c50..5d5b35b 100644
--- a/chrome/browser/resources/options/deletable_item_list.js
+++ b/chrome/browser/resources/options/deletable_item_list.js
@@ -61,7 +61,9 @@
this.closeButtonElement_ = this.ownerDocument.createElement('button');
this.closeButtonElement_.className = 'close-button';
this.closeButtonElement_.addEventListener('mousedown',
- this.handleMouseDownOnClose_);
+ this.handleMouseDownUpOnClose_);
+ this.closeButtonElement_.addEventListener('mouseup',
+ this.handleMouseDownUpOnClose_);
this.appendChild(this.closeButtonElement_);
},
@@ -86,11 +88,11 @@
/**
* Don't let the list have a crack at the event. We don't want clicking the
- * close button to select the list.
- * @param {Event} e The mouse down event object.
+ * close button to change the selection of the list.
+ * @param {Event} e The mouse down/up event object.
* @private
*/
- handleMouseDownOnClose_: function(e) {
+ handleMouseDownUpOnClose_: function(e) {
if (!e.target.disabled)
e.stopPropagation();
},
@@ -119,8 +121,20 @@
var target = e.target;
if (target.className == 'close-button') {
var listItem = this.getListItemAncestor(target);
- if (listItem)
- this.deleteItemAtIndex(this.getIndexOfListItem(listItem));
+ var selected = this.selectionModel.selectedIndexes;
+
+ // Check if the list item that contains the close button being clicked
+ // is not in the list of selected items. Only delete this item in that
+ // case.
+ var idx = this.getIndexOfListItem(listItem);
+ if (selected.indexOf(idx) == -1) {
+ this.deleteItemAtIndex(idx);
+ } else {
+ // Reverse through the list of selected indexes to maintain the
+ // correct index values after deletion.
+ for (var j = selected.length - 1; j >= 0; j--)
+ this.deleteItemAtIndex(selected[j]);
+ }
}
},
diff --git a/chrome/browser/resources/options/diners.png b/chrome/browser/resources/options/diners.png
new file mode 100644
index 0000000..ee709d3
--- /dev/null
+++ b/chrome/browser/resources/options/diners.png
Binary files differ
diff --git a/chrome/browser/resources/options/discover.png b/chrome/browser/resources/options/discover.png
new file mode 100644
index 0000000..e1fdbac
--- /dev/null
+++ b/chrome/browser/resources/options/discover.png
Binary files differ
diff --git a/chrome/browser/resources/options/font_settings.html b/chrome/browser/resources/options/font_settings.html
index 24b080f..97ba0f7 100644
--- a/chrome/browser/resources/options/font_settings.html
+++ b/chrome/browser/resources/options/font_settings.html
@@ -1,4 +1,4 @@
-<div class="page hidden" id="fontSettings">
+<div id="font-settings" class="page hidden">
<h1 i18n-content="fontSettingsTitle"></h1>
<section>
<h3 i18n-content="fontSettingsFontTitle"></h3>
@@ -7,12 +7,14 @@
<label style="display:inline;">
<span i18n-content="fontSettingsSerifLabel"></span>
<select id="fontSettingsSerifSelector"
+ i18n-options="fontSettingsFontList"
pref="webkit.webprefs.serif_font_family"
metric="Options_ChangeSerifFont"></select>
</label>
<label style="display:inline;">
<span i18n-content="fontSettingsSizeLabel"></span>
<select id="fontSettingsSerifSizeSelector"
+ i18n-options="fontSettingsFontSizeList"
pref="webkit.webprefs.default_font_size"
metric="Options_ChangeSerifFontSize"></select>
</label>
@@ -22,12 +24,14 @@
<label style="display:inline;">
<span i18n-content="fontSettingsSansSerifLabel"></span>
<select id="fontSettingsSansSerifSelector"
+ i18n-options="fontSettingsFontList"
pref="webkit.webprefs.sansserif_font_family"
metric="Options_ChangeSansSerifFont"></select>
</label>
<label style="display:inline;">
<span i18n-content="fontSettingsSizeLabel"></span>
<select id="fontSettingsSansSerifSizeSelector"
+ 18n-options="fontSettingsFontSizeList"
pref="webkit.webprefs.default_font_size"
metric="Options_ChangeSansSerifFontSize"></select>
</label>
@@ -37,12 +41,14 @@
<label style="display:inline;">
<span i18n-content="fontSettingsFixedWidthLabel"></span>
<select id="fontSettingsFixedWidthSelector"
+ i18n-options="fontSettingsFontList"
pref="webkit.webprefs.fixed_font_family"
metric="Options_ChangeFixedFont"></select>
</label>
<label style="display:inline;">
<span i18n-content="fontSettingsSizeLabel"></span>
<select id="fontSettingsFixedWidthSizeSelector"
+ i18n-options="fontSettingsFontSizeList"
pref="webkit.webprefs.default_fixed_font_size"
metric="Options_ChangeFixedFontSize"></select>
</label>
@@ -53,13 +59,16 @@
<section>
<h3 i18n-content="fontSettingsMinimumSizeTitle"></h3>
<div>
- <select id="fontSettingsMinimumSizeSelector"></select>
+ <select id="fontSettingsMinimumSizeSelector"
+ i18n-options="fontSettingsMinimumFontSizeList"></select>
</div>
</section>
<section>
<h3 i18n-content="fontSettingsEncodingTitle"></h3>
<div>
- <select id="fontSettingsEncodingSelector" pref="intl.charset_default"
+ <select id="fontSettingsEncodingSelector"
+ i18n-options="fontSettingsEncodingList"
+ pref="intl.charset_default"
metric="Options_ChangeFontEncoding"></select>
</div>
</section>
diff --git a/chrome/browser/resources/options/font_settings.js b/chrome/browser/resources/options/font_settings.js
index 50445ce..e828635 100644
--- a/chrome/browser/resources/options/font_settings.js
+++ b/chrome/browser/resources/options/font_settings.js
@@ -12,15 +12,15 @@
* @class
*/
function FontSettings() {
- OptionsPage.call(this, 'fontSettings',
+ OptionsPage.call(this,
+ 'fontSettings',
templateData.fontSettingsTitle,
- 'fontSettings');
+ 'font-settings');
}
cr.addSingletonGetter(FontSettings);
FontSettings.prototype = {
- // Inherit FontSettings from OptionsPage.
__proto__: OptionsPage.prototype,
/**
@@ -29,24 +29,6 @@
initializePage: function() {
// Call base class implementation to starts preference initialization.
OptionsPage.prototype.initializePage.call(this);
-
- // Initialize values for selector controls.
- $('fontSettingsSerifSelector').initializeValues(
- templateData.fontSettingsFontList)
- $('fontSettingsSerifSizeSelector').initializeValues(
- templateData.fontSettingsFontSizeList)
- $('fontSettingsSansSerifSelector').initializeValues(
- templateData.fontSettingsFontList)
- $('fontSettingsSansSerifSizeSelector').initializeValues(
- templateData.fontSettingsFontSizeList)
- $('fontSettingsFixedWidthSelector').initializeValues(
- templateData.fontSettingsFontList)
- $('fontSettingsFixedWidthSizeSelector').initializeValues(
- templateData.fontSettingsFontSizeList)
- $('fontSettingsMinimumSizeSelector').initializeValues(
- templateData.fontSettingsMinimumFontSizeList)
- $('fontSettingsEncodingSelector').initializeValues(
- templateData.fontSettingsEncodingList)
}
};
diff --git a/chrome/browser/resources/options/font_settings_ui.js b/chrome/browser/resources/options/font_settings_ui.js
index d53557a..4af8141 100644
--- a/chrome/browser/resources/options/font_settings_ui.js
+++ b/chrome/browser/resources/options/font_settings_ui.js
@@ -58,20 +58,6 @@
}
});
},
-
- /**
- * Sets up options in select element.
- * @param {Array} options List of option and their display text.
- * Each element in the array is an array of length 2 which contains options
- * value in the first element and display text in the second element.
- *
- * TODO(zelidrag): move this to that i18n template classes.
- */
- initializeValues: function(options) {
- options.forEach(function(values) {
- this.appendChild(new Option(values[1], values[0]));
- }, this);
- }
};
// Export
diff --git a/chrome/browser/resources/options/jcb.png b/chrome/browser/resources/options/jcb.png
new file mode 100644
index 0000000..7c915b3
--- /dev/null
+++ b/chrome/browser/resources/options/jcb.png
Binary files differ
diff --git a/chrome/browser/resources/options/mastercard.png b/chrome/browser/resources/options/mastercard.png
new file mode 100644
index 0000000..9d7a31f
--- /dev/null
+++ b/chrome/browser/resources/options/mastercard.png
Binary files differ
diff --git a/chrome/browser/resources/options/options.js b/chrome/browser/resources/options/options.js
index 4d77b26..b72f8b5 100644
--- a/chrome/browser/resources/options/options.js
+++ b/chrome/browser/resources/options/options.js
@@ -39,7 +39,7 @@
cr.ui.decorate('select[pref]', options.PrefSelect);
cr.ui.decorate('input[pref][type=text]', options.PrefTextField);
cr.ui.decorate('input[pref][type=url]', options.PrefTextField);
- cr.ui.decorate('#contentSettingsPage input[type=radio]',
+ cr.ui.decorate('#content-settings-page input[type=radio]',
options.ContentSettingsRadio);
cr.ui.decorate('#fontSettingsMinimumSizeSelector',
options.MinimumFontSizeSelect);
diff --git a/chrome/browser/resources/options/options_page.css b/chrome/browser/resources/options/options_page.css
index 684ab56..47447f4 100644
--- a/chrome/browser/resources/options/options_page.css
+++ b/chrome/browser/resources/options/options_page.css
@@ -75,13 +75,17 @@
}
.action-area {
- -webkit-box-orient: horizontal;
-webkit-box-align: center;
+ -webkit-box-orient: horizontal;
+ bottom: 0;
+ display: -webkit-box;
padding: 12px;
position: absolute;
- right: 0px;
- bottom: 0px;
- display: -webkit-box;
+ right: 0;
+}
+
+html[dir='rtl'] .action-area {
+ left: 0;
}
.button-strip {
@@ -114,17 +118,8 @@
#navbar-container {
-webkit-border-end: 1px solid #c6c9ce;
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(rgba(234, 238, 243, 0)),
- to(#eaeef3)),
- -webkit-gradient(linear,
- left top,
- right top,
- from(#eaeef3),
- color-stop(0.97, #eaeef3),
- to(#d3d7db));
+ background: -webkit-linear-gradient(rgba(234, 238, 243, 0), #eaeef3),
+ -webkit-linear-gradient(left, #eaeef3, #eaeef3 97%, #d3d7db);
bottom: 0;
cursor: pointer;
display: none;
@@ -136,18 +131,10 @@
}
html[dir='rtl'] #navbar-container {
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(rgba(255, 255, 255, 0)),
- color-stop(0.7, rgba(255, 255, 255, 0)),
- to(white)),
- -webkit-gradient(linear,
- right top,
- left top,
- from(white),
- color-stop(0.8, white),
- to(#f3f3f3));
+ background: -webkit-linear-gradient(rgba(255, 255, 255, 0)),
+ rgba(255, 255, 255, 0) 70%,
+ white),
+ -webkit-linear-gradient(right, white, white 80%, #f3f3f3);
left: auto;
right: 0;
}
@@ -251,12 +238,7 @@
}
#managed-prefs-banner {
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#fff2b7),
- color-stop(0.97, #fae691),
- to(#878787));
+ background: -webkit-linear-gradient(#fff2b7, #fae691 97%, #878787);
height: 31px;
width: 100%;
}
@@ -352,7 +334,7 @@
}
select {
- margin: 0px;
+ margin: 0;
}
.link-button {
@@ -368,10 +350,6 @@
border-color: transparent;
}
-#contentSettingsPage :invalid {
- background-color: pink;
-}
-
.settings-list {
border: 1px solid #d9d9d9;
border-radius: 2px;
@@ -381,7 +359,7 @@
-webkit-box-align: center;
-webkit-transition: .15s background-color;
box-sizing: border-box;
- border-radius: 0px;
+ border-radius: 0;
display: -webkit-box;
height: 32px;
border: none;
@@ -484,8 +462,8 @@
}
list .favicon-cell {
- -webkit-padding-start: 33px;
- background-position: 7px;
+ -webkit-margin-start: 7px;
+ -webkit-padding-start: 26px;
display: block;
text-overflow: ellipsis;
overflow: hidden;
@@ -493,9 +471,6 @@
}
html[dir=rtl] list .favicon-cell {
- /* TODO(stuartmorgan): position this 7px from the right (and remove the
- padding override) once the CSS support is available */
- -webkit-padding-start: 26px;
background-position: right;
}
diff --git a/chrome/browser/resources/options/personal_options.html b/chrome/browser/resources/options/personal_options.html
index 3fba146..a028945 100644
--- a/chrome/browser/resources/options/personal_options.html
+++ b/chrome/browser/resources/options/personal_options.html
@@ -26,7 +26,8 @@
<section id="sync-section">
<h3 i18n-content="syncSection"></h3>
<div>
- <select id="sync-select" pref="sync.keep_everything_synced"></select>
+ <select id="sync-select" pref="sync.keep_everything_synced"
+ i18n-options="syncSelectList"></select>
<table id="sync-table">
<tr>
<td class="option-name">
diff --git a/chrome/browser/resources/options/personal_options.js b/chrome/browser/resources/options/personal_options.js
index 3600f07..7a92a94 100644
--- a/chrome/browser/resources/options/personal_options.js
+++ b/chrome/browser/resources/options/personal_options.js
@@ -59,7 +59,6 @@
};
// Initialize sync select control.
- $('sync-select').initializeValues(templateData.syncSelectList);
$('sync-select').onchange = function(event) {
self.updateSyncSelection_();
}
diff --git a/chrome/browser/resources/options/pref_ui.js b/chrome/browser/resources/options/pref_ui.js
index 6372776..0734b6b 100644
--- a/chrome/browser/resources/options/pref_ui.js
+++ b/chrome/browser/resources/options/pref_ui.js
@@ -293,11 +293,6 @@
decorate: function() {
var self = this;
- var values = self.getAttribute('data-values');
- if (values) {
- self.initializeValues(templateData[values]);
- }
-
// Listen to pref changes.
Preferences.getInstance().addEventListener(this.pref,
function(event) {
@@ -353,24 +348,6 @@
}
});
},
-
- /**
- * Sets up options in select element.
- * @param {Array} options List of option and their display text.
- * Each element in the array is an array of length 2 which contains
- * options value in the first element and display text in the second
- * element. May be undefined.
- *
- * TODO(zelidrag): move this to that i18n template classes.
- */
- initializeValues: function(options) {
- options.forEach(function (values) {
- if (this.dataType == undefined)
- this.dataType = typeof values[0];
-
- this.appendChild(new Option(values[1], values[0]));
- }, this);
- }
};
/**
diff --git a/chrome/browser/resources/options/search_engine_manager.js b/chrome/browser/resources/options/search_engine_manager.js
index 0443ed0..7a56bad 100644
--- a/chrome/browser/resources/options/search_engine_manager.js
+++ b/chrome/browser/resources/options/search_engine_manager.js
@@ -29,7 +29,7 @@
this.list_ = $('searchEngineList')
options.search_engines.SearchEngineList.decorate(this.list_);
- var selectionModel = new ListSingleSelectionModel
+ var selectionModel = new ListSingleSelectionModel;
this.list_.selectionModel = selectionModel;
this.list_.autoExpands = true;
diff --git a/chrome/browser/resources/options/solo.png b/chrome/browser/resources/options/solo.png
new file mode 100644
index 0000000..5f20eef
--- /dev/null
+++ b/chrome/browser/resources/options/solo.png
Binary files differ
diff --git a/chrome/browser/resources/options/subpages_tab_controls.css b/chrome/browser/resources/options/subpages_tab_controls.css
index c9eb94d..5d74b6e 100644
--- a/chrome/browser/resources/options/subpages_tab_controls.css
+++ b/chrome/browser/resources/options/subpages_tab_controls.css
@@ -51,11 +51,7 @@
.subpages-nav-tabs {
padding: 4px;
border-bottom: 1px solid #A0A0A0; /* light gray */
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(white),
- to(#F3F3F3)); /* very light gray */
+ background: -webkit-linear-gradient(white, #F3F3F3); /* very light gray */
margin-bottom: 15px;
}
diff --git a/chrome/browser/resources/options/visa.png b/chrome/browser/resources/options/visa.png
new file mode 100644
index 0000000..9518614
--- /dev/null
+++ b/chrome/browser/resources/options/visa.png
Binary files differ
diff --git a/chrome/browser/resources/print_preview.css b/chrome/browser/resources/print_preview.css
index f338b98..f56a3cb 100644
--- a/chrome/browser/resources/print_preview.css
+++ b/chrome/browser/resources/print_preview.css
@@ -39,11 +39,7 @@
}
#separator {
- background: -webkit-gradient(linear,
- left top,
- right top,
- from(#a4a4a4),
- to(#ccc));
+ background: -webkit-linear-gradient(left, #a4a4a4, #ccc);
height: 100%;
width: 6px;
}
diff --git a/chrome/browser/resources/safe_browsing_malware_block.html b/chrome/browser/resources/safe_browsing_malware_block.html
index 0dd7952..c62350a 100644
--- a/chrome/browser/resources/safe_browsing_malware_block.html
+++ b/chrome/browser/resources/safe_browsing_malware_block.html
@@ -46,6 +46,11 @@
.main {
margin:0px 90px 10px;
}
+.footer {
+ margin-top: 40px;
+ padding-top: 10px;
+ border-top: 1px solid #ddd;
+}
.submission {
margin:15px 5px 15px 0px;
padding:0px;
@@ -53,8 +58,6 @@
input {
margin:0px;
}
-.proceedbutton {
-}
.helpbutton {
float:right;
}
@@ -69,9 +72,8 @@
margin-right:5px;
}
-
.green {
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#83c260), color-stop(44%,#71b44c), color-stop(100%,#549d2c));
+ background: -webkit-linear-gradient(#83c260, #71b44c 44%, #549d2c);
border: 1px solid #4c7336;
border-bottom: 1px solid #44692f;
border-radius: 3px;
@@ -90,14 +92,14 @@
}
.green:hover, .green:focus {
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#8bc968), color-stop(44%,#7bbc57), color-stop(100%,#4f9727)); /* webkit */
+ background: -webkit-linear-gradient(#8bc968, #7bbc57 44%, #4f9727);
border: 1px solid #456a2f;
border-bottom: 1px solid #456a2f;
-webkit-box-shadow: inset 0 1px 0 0 #a0d186, 0px 1px 2px rgba(0,0,0,0.3);;
}
.green:active {
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#83c260), color-stop(44%,#71b44c), color-stop(100%,#549d2c)); /* webkit */
+ background: -webkit-linear-gradient(#83c260, #71b44c 44%, #549d2c);
border: 1px solid #3e612a;
border-top:1px solid #4c7336;
border-bottom:1px solid #547b3f;
@@ -107,6 +109,20 @@
.green:focus {
border: 1px solid #000;
}
+
+label.checkbox {
+ position: relative;
+}
+
+label.checkbox > input {
+ margin-top: 3px;
+ position: absolute;
+}
+
+label.checkbox > span {
+ -webkit-margin-start: 20px;
+ display: block;
+}
</style>
<script>
@@ -114,6 +130,15 @@
window.domAutomationController.setAutomationId(1);
window.domAutomationController.send(cmd);
}
+
+ function savePreference() {
+ var checkBox = document.getElementById('checkreport');
+ if (checkBox.checked) {
+ sendCommand('doReport');
+ } else {
+ sendCommand('dontReport');
+ }
+ }
</script>
</head>
@@ -137,6 +162,14 @@
<div class="main" i18n-values=".innerHTML:description3"></div>
+ <div class="main footer" jsdisplay="displaycheckbox">
+ <label class="checkbox" for="checkreport">
+ <input name="checked" id="checkreport" type="checkbox"
+ jsvalues=".checked:boxchecked" onclick="savePreference()">
+ <span i18n-content="confirm_text"></span>
+ </label>
+ </div>
+
</div>
</td>
</table>
diff --git a/chrome/browser/resources/safe_browsing_phishing_block.html b/chrome/browser/resources/safe_browsing_phishing_block.html
index 52ca6a8..448548e 100644
--- a/chrome/browser/resources/safe_browsing_phishing_block.html
+++ b/chrome/browser/resources/safe_browsing_phishing_block.html
@@ -67,7 +67,7 @@
}
.green {
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#83c260), color-stop(44%,#71b44c), color-stop(100%,#549d2c));
+ background: -webkit-linear-gradient(#83c260, #71b44c 44%, #549d2c);
border: 1px solid #4c7336;
border-bottom: 1px solid #44692f;
border-radius: 3px;
@@ -86,14 +86,14 @@
}
.green:hover, .green:focus {
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#8bc968), color-stop(44%,#7bbc57), color-stop(100%,#4f9727)); /* webkit */
+ background: -webkit-linear-gradient(#8bc968, #7bbc57 44%, #4f9727);
border: 1px solid #456a2f;
border-bottom: 1px solid #456a2f;
-webkit-box-shadow: inset 0 1px 0 0 #a0d186, 0px 1px 2px rgba(0,0,0,0.3);;
}
.green:active {
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#83c260), color-stop(44%,#71b44c), color-stop(100%,#549d2c)); /* webkit */
+ background: -webkit-linear-gradient(#83c260, #71b44c 44%, #549d2c);
border: 1px solid #3e612a;
border-top:1px solid #4c7336;
border-bottom:1px solid #547b3f;
diff --git a/chrome/browser/resources/shared/css/button.css b/chrome/browser/resources/shared/css/button.css
index 1d1c25a..ca48855 100644
--- a/chrome/browser/resources/shared/css/button.css
+++ b/chrome/browser/resources/shared/css/button.css
@@ -3,13 +3,11 @@
border: 1px solid rgba(0, 0, 0, .50);
border-radius: 3px;
-webkit-box-shadow: 1px 1px 0px rgba(0, 0, 0, .10);
- background: -webkit-gradient(linear, 0 50%, 0 100%,
- from(#ffffff), to(#e3e3e3));
+ background: -webkit-linear-gradient(#fff 50%, #e3e3e3);
}
button:active {
- background: -webkit-gradient(linear, 0 4%, 0 100%,
- from(#c3c3c3), to(#f5f5f5));
+ background: -webkit-linear-gradient(#c3c3c3 4%, #f5f5f5);
}
button:focus {
@@ -23,8 +21,7 @@
border: 1px solid #2e4987;
font-weight: bold;
color: #ffffff;
- background: -webkit-gradient(linear, 0 0, 0 100%,
- from(#6391de), to(#426dc9));
+ background: -webkit-linear-gradient(#6391de, #426dc9);
}
button.action:focus {
@@ -35,13 +32,11 @@
/* make sure we do not use active when disabled */
button.action:active:not(:disabled) {
- background: -webkit-gradient(linear, 0 0, 0 100%,
- from(#426dc9), to(#6391de));
+ background: -webkit-linear-gradient(#426dc9, #6391de);
}
button:disabled {
border: 1px solid rgba(0, 0, 0, .35);
color: rgba(0, 0, 0, .30);
- background: -webkit-gradient(linear, 0 0, 0 100%,
- from(#ffffff), to(#e3e3e3));
+ background: -webkit-linear-gradient(#fff, #e3e3e3);
}
diff --git a/chrome/browser/resources/shared/css/list.css b/chrome/browser/resources/shared/css/list.css
index 15be68e..bcbc2ab 100644
--- a/chrome/browser/resources/shared/css/list.css
+++ b/chrome/browser/resources/shared/css/list.css
@@ -43,8 +43,8 @@
}
list > [selected] {
- background-image: -webkit-gradient(linear, left top, left bottom,
- from(rgba(255,255,255,0.8)), to(rgba(255,255,255,0)));
+ background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.8),
+ rgba(255, 255, 255, 0));
}
list > [selected] {
diff --git a/chrome/browser/resources/shared/css/menu.css b/chrome/browser/resources/shared/css/menu.css
index 2aeac3e..b28af86 100644
--- a/chrome/browser/resources/shared/css/menu.css
+++ b/chrome/browser/resources/shared/css/menu.css
@@ -4,7 +4,7 @@
border: 1px solid rgba(0, 0, 0, .50);
-webkit-box-shadow: 0px 2px 4px rgba(0, 0, 0, .50);
color: black;
- background: -webkit-gradient(linear, 0 0, 0 100%, from(#fff), to(#eee));
+ background: -webkit-linear-gradient(#fff, #eee);
left: 0;
white-space: nowrap;
padding: 8px 0;
@@ -34,8 +34,9 @@
}
menu > hr {
- background: -webkit-gradient(linear, 0 0, 96% 0, from(rgba(0, 0, 0, .10)),
- to(rgba(0, 0, 0, .02)));
+ background: -webkit-linear-gradient(left,
+ rgba(0, 0, 0, .10),
+ rgba(0, 0, 0, .02) 96%);
border: 0;
height: 1px;
margin: 8px 0;
@@ -73,4 +74,4 @@
menu > [selected][checked]:active:before {
content: url("../images/checkbox_white.png");
-}
\ No newline at end of file
+}
diff --git a/chrome/browser/resources/shared/css/tree.css b/chrome/browser/resources/shared/css/tree.css
index 5ea5f86..0b66262 100644
--- a/chrome/browser/resources/shared/css/tree.css
+++ b/chrome/browser/resources/shared/css/tree.css
@@ -69,8 +69,8 @@
*/
.tree-row[selected] {
- background-image: -webkit-gradient(linear, left top, left bottom,
- from(rgba(255,255,255,0.8)), to(rgba(255,255,255,0)));
+ background-image: -webkit-linear-gradient(rgba(255, 255, 255, 0.8),
+ rgba(255,255,255,0));
}
.tree-row[selected] {
@@ -150,4 +150,3 @@
margin: -2px -3px -2px -8px;
padding: 1px 1px 1px 7px;
}
-
diff --git a/chrome/browser/resources/shared/js/cr/ui/list.js b/chrome/browser/resources/shared/js/cr/ui/list.js
index 9a579d8..6fbe1cc 100644
--- a/chrome/browser/resources/shared/js/cr/ui/list.js
+++ b/chrome/browser/resources/shared/js/cr/ui/list.js
@@ -482,8 +482,9 @@
* @return {number} The index of the list item, or -1 if not found.
*/
getIndexOfListItem: function(item) {
+ var paddingTop = parseFloat(getComputedStyle(this).paddingTop);
var cs = getComputedStyle(item);
- var top = item.offsetTop - parseFloat(cs.marginTop);
+ var top = item.offsetTop - parseFloat(cs.marginTop) - paddingTop;
var index = Math.floor(top / this.getItemHeight_());
var childIndex = index - this.firstIndex_ + 1;
if (childIndex >= 0 && childIndex < this.children.length &&
diff --git a/chrome/browser/resources/shared/js/cr/ui/list_selection_controller.js b/chrome/browser/resources/shared/js/cr/ui/list_selection_controller.js
index 72aada6..fa1f3c2 100644
--- a/chrome/browser/resources/shared/js/cr/ui/list_selection_controller.js
+++ b/chrome/browser/resources/shared/js/cr/ui/list_selection_controller.js
@@ -141,13 +141,13 @@
(e.ctrlKey && !e.shiftKey))) {
// Selection is handled at mouseUp on windows/linux, mouseDown on mac.
if (cr.isMac? isDown : !isDown) {
- // toggle the current one and make it anchor index
+ // Toggle the current one and make it anchor index.
sm.setIndexSelected(index, !sm.getIndexSelected(index));
sm.leadIndex = index;
sm.anchorIndex = index;
}
} else if (e.shiftKey && anchorIndex != -1 && anchorIndex != index) {
- // Shift is done in mousedown
+ // Shift is done in mousedown.
if (isDown) {
sm.unselectAll();
sm.leadIndex = index;
@@ -157,7 +157,7 @@
sm.setIndexSelected(index, true);
}
} else {
- // Right click for a context menu need to not clear the selection.
+ // Right click for a context menu needs to not clear the selection.
var isRightClick = e.button == 2;
// If the index is selected this is handled in mouseup.
@@ -176,7 +176,7 @@
},
/**
- * Called by the view when it recieves a keydown event.
+ * Called by the view when it receives a keydown event.
* @param {Event} e The keydown event.
*/
handleKeyDown: function(e) {
@@ -246,7 +246,7 @@
sm.selectRange(anchorIndex, newIndex);
}
} else if (e.ctrlKey && !cr.isMac) {
- // Setting the lead index is done above
+ // Setting the lead index is done above.
// Mac does not allow you to change the lead.
} else {
if (sm.multiple)
diff --git a/chrome/browser/resources/shared/js/i18n_template.js b/chrome/browser/resources/shared/js/i18n_template.js
index 2645bdb..c646c17 100644
--- a/chrome/browser/resources/shared/js/i18n_template.js
+++ b/chrome/browser/resources/shared/js/i18n_template.js
@@ -39,6 +39,18 @@
},
/**
+ * This handler adds options to a select element.
+ */
+ 'i18n-options': function(element, attributeValue, obj) {
+ var options = obj[attributeValue];
+ options.forEach(function(values) {
+ var option = typeof values == 'string' ? new Option(values) :
+ new Option(values[1], values[0]);
+ element.appendChild(option);
+ });
+ },
+
+ /**
* This is used to set HTML attributes and DOM properties,. The syntax is:
* attributename:key;
* .domProperty:key;
diff --git a/chrome/browser/resources/slideshow.html b/chrome/browser/resources/slideshow.html
index 10ed4cb..b93d5ba 100644
--- a/chrome/browser/resources/slideshow.html
+++ b/chrome/browser/resources/slideshow.html
@@ -9,7 +9,7 @@
overflow: hidden;
background: black;
}
-
+
#glow {
left: 0;
right: 0;
@@ -17,11 +17,7 @@
height: 8px;
opacity: .4;
position: absolute;
- background: -webkit-gradient(linear,
- left bottom,
- left top,
- from(white),
- to(transparent));
+ background: -webkit-linear-gradient(transparent, white);
}
#main {
@@ -45,11 +41,7 @@
-webkit-box-pack: center;
display: -webkit-box;
position: absolute;
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#323232),
- to(#070707));
+ background: -webkit-linear-gradient(#323232, #070707);
}
#prevbutton > div {
@@ -103,11 +95,7 @@
}
button:hover {
- background: -webkit-gradient(linear,
- left top,
- left bottom,
- from(#6a7eac),
- to(#000000));
+ background: -webkit-linear-gradient(#6a7eac, #000000);
}
</style>
diff --git a/chrome/browser/rlz/rlz.cc b/chrome/browser/rlz/rlz.cc
index 48ac262..e0798fc 100644
--- a/chrome/browser/rlz/rlz.cc
+++ b/chrome/browser/rlz/rlz.cc
@@ -18,8 +18,8 @@
#include "base/path_service.h"
#include "base/string_util.h"
#include "base/task.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/safe_browsing/client_side_detection_service.h b/chrome/browser/safe_browsing/client_side_detection_service.h
index 41c87f6..7e048e5 100644
--- a/chrome/browser/safe_browsing/client_side_detection_service.h
+++ b/chrome/browser/safe_browsing/client_side_detection_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -35,7 +35,10 @@
class SkBitmap;
class URLRequestContextGetter;
+
+namespace net {
class URLRequestStatus;
+} // namespace net
namespace safe_browsing {
@@ -58,7 +61,7 @@
// From the URLFetcher::Delegate interface.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
@@ -149,7 +152,7 @@
// model.
void HandleModelResponse(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
@@ -158,7 +161,7 @@
// sending the client-side phishing request.
void HandlePhishingVerdict(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 8e29489..69f8583 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -125,6 +125,12 @@
version_ = version_info.Version();
}
+// static
+void SafeBrowsingProtocolManager::RecordGetHashResult(ResultType result_type) {
+ UMA_HISTOGRAM_ENUMERATION("SB2.GetHashResult", result_type,
+ GET_HASH_RESULT_MAX);
+}
+
SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() {
// Delete in-progress SafeBrowsing requests.
STLDeleteContainerPairFirstPointers(hash_requests_.begin(),
@@ -225,9 +231,9 @@
// For tracking our GetHash false positive (204) rate, compared to real
// (200) responses.
if (response_code == 200)
- UMA_HISTOGRAM_COUNTS("SB2.GetHash200", 1);
+ RecordGetHashResult(GET_HASH_STATUS_200);
else
- UMA_HISTOGRAM_COUNTS("SB2.GetHash204", 1);
+ RecordGetHashResult(GET_HASH_STATUS_204);
can_cache = true;
gethash_error_count_ = 0;
gethash_back_off_mult_ = 1;
diff --git a/chrome/browser/safe_browsing/protocol_manager.h b/chrome/browser/safe_browsing/protocol_manager.h
index 7869e0f..7205b53 100644
--- a/chrome/browser/safe_browsing/protocol_manager.h
+++ b/chrome/browser/safe_browsing/protocol_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -27,7 +27,9 @@
#include "chrome/browser/safe_browsing/safe_browsing_util.h"
#include "chrome/common/net/url_fetcher.h"
+namespace net {
class URLRequestStatus;
+} // namespace net
#if defined(COMPILER_GCC)
// Allows us to use URLFetchers in a hash_map with gcc (MSVC is okay without
@@ -103,7 +105,7 @@
// URLFetcher::Delegate interface.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
@@ -158,6 +160,37 @@
return additional_query_;
}
+ // Enumerate failures for histogramming purposes. DO NOT CHANGE THE
+ // ORDERING OF THESE VALUES.
+ enum ResultType {
+ // 200 response code means that the server recognized the hash
+ // prefix, while 204 is an empty response indicating that the
+ // server did not recognize it.
+ GET_HASH_STATUS_200,
+ GET_HASH_STATUS_204,
+
+ // Subset of successful responses which returned no full hashes.
+ // This includes the 204 case, and also 200 responses for stale
+ // prefixes (deleted at the server but yet deleted on the client).
+ GET_HASH_FULL_HASH_EMPTY,
+
+ // Subset of successful responses for which one or more of the
+ // full hashes matched (should lead to an interstitial).
+ GET_HASH_FULL_HASH_HIT,
+
+ // Subset of successful responses which weren't empty and have no
+ // matches. It means that there was a prefix collision which was
+ // cleared up by the full hashes.
+ GET_HASH_FULL_HASH_MISS,
+
+ // Memory space for histograms is determined by the max. ALWAYS
+ // ADD NEW VALUES BEFORE THIS ONE.
+ GET_HASH_RESULT_MAX
+ };
+
+ // Record a GetHash result.
+ static void RecordGetHashResult(ResultType result_type);
+
protected:
// Constructs a SafeBrowsingProtocolManager for |sb_service| that issues
// network requests using |request_context_getter|. When |disable_auto_update|
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
index d683d97..95baed4 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.cc
@@ -15,6 +15,7 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/dom_operation_notification_details.h"
#include "chrome/browser/dom_ui/new_tab_ui.h"
@@ -58,13 +59,13 @@
static const char* const kLearnMorePhishingUrl =
"http://www.google.com/support/bin/answer.py?answer=106318";
-static const wchar_t* const kSbDiagnosticHtml =
- L"<a href=\"\" onclick=\"sendCommand('showDiagnostic'); return false;\" "
- L"onmousedown=\"return false;\">%ls</a>";
+static const char* const kSbDiagnosticHtml =
+ "<a href=\"\" onclick=\"sendCommand('showDiagnostic'); return false;\" "
+ "onmousedown=\"return false;\">%s</a>";
-static const wchar_t* const kPLinkHtml =
- L"<a href=\"\" onclick=\"sendCommand('proceed'); return false;\" "
- L"onmousedown=\"return false;\">%ls</a>";
+static const char* const kPLinkHtml =
+ "<a href=\"\" onclick=\"sendCommand('proceed'); return false;\" "
+ "onmousedown=\"return false;\">%s</a>";
// The commands returned by the page when the user performs an action.
static const char* const kShowDiagnosticCommand = "showDiagnostic";
@@ -72,6 +73,10 @@
static const char* const kLearnMoreCommand = "learnMore";
static const char* const kProceedCommand = "proceed";
static const char* const kTakeMeBackCommand = "takeMeBack";
+static const char* const kDoReportCommand = "doReport";
+static const char* const kDontReportCommand = "dontReport";
+static const char* const kDisplayCheckBox = "displaycheckbox";
+static const char* const kBoxChecked = "boxchecked";
// static
SafeBrowsingBlockingPageFactory* SafeBrowsingBlockingPage::factory_ = NULL;
@@ -175,16 +180,16 @@
void SafeBrowsingBlockingPage::PopulateStringDictionary(
DictionaryValue* strings,
- const std::wstring& title,
- const std::wstring& headline,
- const std::wstring& description1,
- const std::wstring& description2,
- const std::wstring& description3) {
- strings->SetString("title", WideToUTF16Hack(title));
- strings->SetString("headLine", WideToUTF16Hack(headline));
- strings->SetString("description1", WideToUTF16Hack(description1));
- strings->SetString("description2", WideToUTF16Hack(description2));
- strings->SetString("description3", WideToUTF16Hack(description3));
+ const string16& title,
+ const string16& headline,
+ const string16& description1,
+ const string16& description2,
+ const string16& description3) {
+ strings->SetString("title", title);
+ strings->SetString("headLine", headline);
+ strings->SetString("description1", description1);
+ strings->SetString("description2", description2);
+ strings->SetString("description3", description3);
}
void SafeBrowsingBlockingPage::PopulateMultipleThreatStringDictionary(
@@ -228,31 +233,34 @@
PopulateStringDictionary(
strings,
// Use the malware headline, it is the scariest one.
- l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_THREAT_TITLE),
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
- l10n_util::GetStringF(IDS_SAFE_BROWSING_MULTI_THREAT_DESCRIPTION1,
- UTF8ToWide(tab()->GetURL().host())),
- l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_THREAT_DESCRIPTION2),
- L"");
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MULTI_THREAT_TITLE),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
+ l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MULTI_THREAT_DESCRIPTION1,
+ UTF8ToUTF16(tab()->GetURL().host())),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MULTI_THREAT_DESCRIPTION2),
+ string16());
} else if (malware) {
// Just malware.
PopulateStringDictionary(
strings,
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_TITLE),
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
- l10n_util::GetStringF(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION1,
- UTF8ToWide(tab()->GetURL().host())),
- l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION2),
- l10n_util::GetString(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION3));
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_TITLE),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
+ l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION1,
+ UTF8ToUTF16(tab()->GetURL().host())),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION2),
+ l10n_util::GetStringUTF16(
+ IDS_SAFE_BROWSING_MULTI_MALWARE_DESCRIPTION3));
} else {
// Just phishing.
PopulateStringDictionary(
strings,
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE),
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_HEADLINE),
- l10n_util::GetStringF(IDS_SAFE_BROWSING_MULTI_PHISHING_DESCRIPTION1,
- UTF8ToWide(tab()->GetURL().host())),
- L"", L"");
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_TITLE),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_HEADLINE),
+ l10n_util::GetStringFUTF16(
+ IDS_SAFE_BROWSING_MULTI_PHISHING_DESCRIPTION1,
+ UTF8ToUTF16(tab()->GetURL().host())),
+ string16(),
+ string16());
}
strings->SetString("confirm_text",
@@ -268,65 +276,89 @@
void SafeBrowsingBlockingPage::PopulateMalwareStringDictionary(
DictionaryValue* strings) {
- std::wstring diagnostic_link = StringPrintf(kSbDiagnosticHtml,
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str());
+ std::string diagnostic_link = StringPrintf(kSbDiagnosticHtml,
+ l10n_util::GetStringUTF8(
+ IDS_SAFE_BROWSING_MALWARE_DIAGNOSTIC_PAGE).c_str());
strings->SetString("badURL", url().host());
// Check to see if we're blocking the main page, or a sub-resource on the
// main page.
- std::wstring description1, description3, description5;
+ string16 description1, description3, description5;
if (is_main_frame_) {
- description1 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION1,
- UTF8ToWide(url().host()));
+ description1 = l10n_util::GetStringFUTF16(
+ IDS_SAFE_BROWSING_MALWARE_DESCRIPTION1, UTF8ToUTF16(url().host()));
} else {
- description1 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION4,
- UTF8ToWide(tab()->GetURL().host()),
- UTF8ToWide(url().host()));
+ description1 = l10n_util::GetStringFUTF16(
+ IDS_SAFE_BROWSING_MALWARE_DESCRIPTION4,
+ UTF8ToUTF16(tab()->GetURL().host()),
+ UTF8ToUTF16(url().host()));
}
- std::wstring proceed_link = StringPrintf(kPLinkHtml,
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_PROCEED_LINK).c_str());
- description3 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3,
- proceed_link);
+ std::string proceed_link = StringPrintf(kPLinkHtml,
+ l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_MALWARE_PROCEED_LINK).c_str());
+ description3 =
+ l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION3,
+ UTF8ToUTF16(proceed_link));
PopulateStringDictionary(
strings,
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_TITLE),
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_TITLE),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_HEADLINE),
description1,
- l10n_util::GetString(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION2),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION2),
description3);
- description5 = l10n_util::GetStringF(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION5,
- UTF8ToWide(url().host()),
- UTF8ToWide(url().host()),
- diagnostic_link);
+ description5 =
+ l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_MALWARE_DESCRIPTION5,
+ UTF8ToUTF16(url().host()),
+ UTF8ToUTF16(url().host()),
+ UTF8ToUTF16(diagnostic_link));
- strings->SetString("description5", WideToUTF16Hack(description5));
+ strings->SetString("description5", description5);
strings->SetString("back_button",
l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON));
strings->SetString("proceed_link",
l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_PROCEED_LINK));
strings->SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr");
+
+ if (!CanShowMalwareDetailsOption()) {
+ strings->SetBoolean(kDisplayCheckBox, false);
+ } else {
+ // Show the checkbox for sending malware details.
+ strings->SetBoolean(kDisplayCheckBox, true);
+ strings->SetString(
+ "confirm_text",
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_REPORTING_AGREE));
+
+ const PrefService::Preference* pref =
+ tab()->profile()->GetPrefs()->FindPreference(
+ prefs::kSafeBrowsingReportingEnabled);
+
+ bool value;
+ if (pref && pref->GetValue()->GetAsBoolean(&value) && value) {
+ strings->SetString(kBoxChecked, "yes");
+ } else {
+ strings->SetString(kBoxChecked, "");
+ }
+ }
}
void SafeBrowsingBlockingPage::PopulatePhishingStringDictionary(
DictionaryValue* strings) {
- std::wstring proceed_link = StringPrintf(
- kPLinkHtml,
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_PROCEED_LINK).c_str());
- std::wstring description3 = l10n_util::GetStringF(
+ std::string proceed_link = StringPrintf(kPLinkHtml, l10n_util::GetStringUTF8(
+ IDS_SAFE_BROWSING_PHISHING_PROCEED_LINK).c_str());
+ string16 description3 = l10n_util::GetStringFUTF16(
IDS_SAFE_BROWSING_PHISHING_DESCRIPTION3,
- proceed_link);
+ UTF8ToUTF16(proceed_link));
PopulateStringDictionary(
strings,
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_TITLE),
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_HEADLINE),
- l10n_util::GetStringF(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION1,
- UTF8ToWide(url().host())),
- l10n_util::GetString(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION2),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_TITLE),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_HEADLINE),
+ l10n_util::GetStringFUTF16(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION1,
+ UTF8ToUTF16(url().host())),
+ l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_PHISHING_DESCRIPTION2),
description3);
strings->SetString("back_button",
@@ -343,6 +375,16 @@
command = command.substr(1, command.length() - 2);
}
+ if (command == kDoReportCommand) {
+ SetReportingPreference(true);
+ return;
+ }
+
+ if (command == kDontReportCommand) {
+ SetReportingPreference(false);
+ return;
+ }
+
if (command == kLearnMoreCommand) {
// User pressed "Learn more".
GURL url;
@@ -418,6 +460,11 @@
NOTREACHED() << "Unexpected command: " << command;
}
+void SafeBrowsingBlockingPage::SetReportingPreference(bool report) {
+ PrefService* pref = tab()->profile()->GetPrefs();
+ pref->SetBoolean(prefs::kSafeBrowsingReportingEnabled, report);
+}
+
void SafeBrowsingBlockingPage::Proceed() {
RecordUserAction(PROCEED);
FinishMalwareDetails(); // Send the malware details, if we opted to.
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
index cfe2358..2cadfc1 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page.h
@@ -66,6 +66,7 @@
// InterstitialPage method:
virtual std::string GetHTMLContents();
+ virtual void SetReportingPreference(bool report);
virtual void Proceed();
virtual void DontProceed();
@@ -96,17 +97,17 @@
// A helper method used by the Populate methods above used to populate common
// fields.
void PopulateStringDictionary(DictionaryValue* strings,
- const std::wstring& title,
- const std::wstring& headline,
- const std::wstring& description1,
- const std::wstring& description2,
- const std::wstring& description3);
+ const string16& title,
+ const string16& headline,
+ const string16& description1,
+ const string16& description2,
+ const string16& description3);
// Records a user action for this interstitial, using the form
// SBInterstitial[Phishing|Malware|Multiple][Show|Proceed|DontProceed].
void RecordUserAction(BlockingPageEvent event);
- // See if we should even show the malware details option. For example, we
+ // Checks if we should even show the malware details option. For example, we
// don't show it in incognito mode.
bool CanShowMalwareDetailsOption();
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
index 19eae29..318e6ac 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_test.cc
@@ -280,7 +280,9 @@
browser()->GetSelectedTabContents()->GetURL());
}
-IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest, MalwareIframeProceed) {
+// Crashy, http://crbug.com/68834.
+IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
+ DISABLED_MalwareIframeProceed) {
GURL url = test_server()->GetURL(kMalwarePage);
GURL iframe_url = test_server()->GetURL(kMalwareIframe);
AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE);
@@ -295,19 +297,17 @@
IN_PROC_BROWSER_TEST_F(SafeBrowsingBlockingPageTest,
MalwareIframeReportDetails) {
- // Enable reporting of malware details.
- browser()->GetProfile()->GetPrefs()->SetBoolean(
- prefs::kSafeBrowsingReportingEnabled, true);
- EXPECT_TRUE(browser()->GetProfile()->GetPrefs()->GetBoolean(
- prefs::kSafeBrowsingReportingEnabled));
-
GURL url = test_server()->GetURL(kMalwarePage);
GURL iframe_url = test_server()->GetURL(kMalwareIframe);
AddURLResult(iframe_url, SafeBrowsingService::URL_MALWARE);
ui_test_utils::NavigateToURL(browser(), url);
- SendCommand("\"proceed\""); // Simulate the user clicking "back"
+ SendCommand("\"doReport\""); // Simulate the user checking the checkbox.
+ EXPECT_TRUE(browser()->GetProfile()->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingReportingEnabled));
+
+ SendCommand("\"proceed\""); // Simulate the user clicking "back"
AssertNoInterstitial(); // Assert the interstitial is gone
EXPECT_EQ(url, browser()->GetSelectedTabContents()->GetURL());
diff --git a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
index 195f5c0..5b8163b 100644
--- a/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_blocking_page_unittest.cc
@@ -548,3 +548,35 @@
EXPECT_EQ(0u, service_->GetDetails()->size());
service_->GetDetails()->clear();
}
+
+// Test setting the malware report preferance
+TEST_F(SafeBrowsingBlockingPageTest, MalwareReports) {
+ // Disable malware reports.
+ contents()->profile()->GetPrefs()->SetBoolean(
+ prefs::kSafeBrowsingReportingEnabled, false);
+
+ // Start a load.
+ controller().LoadURL(GURL(kBadURL), GURL(), PageTransition::TYPED);
+
+ // Simulate the load causing a safe browsing interstitial to be shown.
+ ShowInterstitial(ResourceType::MAIN_FRAME, kBadURL);
+ SafeBrowsingBlockingPage* sb_interstitial = GetSafeBrowsingBlockingPage();
+ ASSERT_TRUE(sb_interstitial);
+
+ MessageLoop::current()->RunAllPending();
+
+ EXPECT_FALSE(contents()->profile()->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingReportingEnabled));
+
+ // Simulate the user check the report agreement checkbox.
+ sb_interstitial->SetReportingPreference(true);
+
+ EXPECT_TRUE(contents()->profile()->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingReportingEnabled));
+
+ // Simulate the user uncheck the report agreement checkbox.
+ sb_interstitial->SetReportingPreference(false);
+
+ EXPECT_FALSE(contents()->profile()->GetPrefs()->GetBoolean(
+ prefs::kSafeBrowsingReportingEnabled));
+}
diff --git a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
index 32ef6d2..249c44c 100644
--- a/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_database_unittest.cc
@@ -36,6 +36,155 @@
return hash;
}
+// Same as InsertAddChunkHostPrefixUrl, but with pre-computed
+// prefix values.
+void InsertAddChunkHostPrefixValue(SBChunk* chunk,
+ int chunk_number,
+ const SBPrefix& host_prefix,
+ const SBPrefix& url_prefix) {
+ chunk->chunk_number = chunk_number;
+ chunk->is_add = true;
+ SBChunkHost host;
+ host.host = host_prefix;
+ host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
+ host.entry->set_chunk_id(chunk->chunk_number);
+ host.entry->SetPrefixAt(0, url_prefix);
+ chunk->hosts.push_back(host);
+}
+
+// A helper function that appends one AddChunkHost to chunk with
+// one url for prefix.
+void InsertAddChunkHostPrefixUrl(SBChunk* chunk,
+ int chunk_number,
+ const std::string& host_name,
+ const std::string& url) {
+ InsertAddChunkHostPrefixValue(chunk, chunk_number,
+ Sha256Prefix(host_name),
+ Sha256Prefix(url));
+}
+
+// Same as InsertAddChunkHostPrefixUrl, but with two urls for prefixes.
+void InsertAddChunkHost2PrefixUrls(SBChunk* chunk,
+ int chunk_number,
+ const std::string& host_name,
+ const std::string& url1,
+ const std::string& url2) {
+ chunk->chunk_number = chunk_number;
+ chunk->is_add = true;
+ SBChunkHost host;
+ host.host = Sha256Prefix(host_name);
+ host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
+ host.entry->set_chunk_id(chunk->chunk_number);
+ host.entry->SetPrefixAt(0, Sha256Prefix(url1));
+ host.entry->SetPrefixAt(1, Sha256Prefix(url2));
+ chunk->hosts.push_back(host);
+}
+
+// Same as InsertAddChunkHost2PrefixUrls, but with full hashes.
+void InsertAddChunkHost2FullHashes(SBChunk* chunk,
+ int chunk_number,
+ const std::string& host_name,
+ const std::string& url1,
+ const std::string& url2) {
+ chunk->chunk_number = chunk_number;
+ chunk->is_add = true;
+ SBChunkHost host;
+ host.host = Sha256Prefix(host_name);
+ host.entry = SBEntry::Create(SBEntry::ADD_FULL_HASH, 2);
+ host.entry->set_chunk_id(chunk->chunk_number);
+ host.entry->SetFullHashAt(0, Sha256Hash(url1));
+ host.entry->SetFullHashAt(1, Sha256Hash(url2));
+ chunk->hosts.push_back(host);
+}
+
+// Same as InsertSubChunkHostPrefixUrl, but with pre-computed
+// prefix values.
+void InsertSubChunkHostPrefixValue(SBChunk* chunk,
+ int chunk_number,
+ int chunk_id_to_sub,
+ const SBPrefix& host_prefix,
+ const SBPrefix& url_prefix) {
+ chunk->chunk_number = chunk_number;
+ chunk->is_add = false;
+ SBChunkHost host;
+ host.host = host_prefix;
+ host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 1);
+ host.entry->set_chunk_id(chunk->chunk_number);
+ host.entry->SetChunkIdAtPrefix(0, chunk_id_to_sub);
+ host.entry->SetPrefixAt(0, url_prefix);
+ chunk->hosts.push_back(host);
+}
+
+// A helper function that adds one SubChunkHost to chunk with
+// one url for prefix.
+void InsertSubChunkHostPrefixUrl(SBChunk* chunk,
+ int chunk_number,
+ int chunk_id_to_sub,
+ const std::string& host_name,
+ const std::string& url) {
+ InsertSubChunkHostPrefixValue(chunk, chunk_number,
+ chunk_id_to_sub,
+ Sha256Prefix(host_name),
+ Sha256Prefix(url));
+}
+
+// Same as InsertSubChunkHostPrefixUrl, but with two urls for prefixes.
+void InsertSubChunkHost2PrefixUrls(SBChunk* chunk,
+ int chunk_number,
+ int chunk_id_to_sub,
+ const std::string& host_name,
+ const std::string& url1,
+ const std::string& url2) {
+ chunk->chunk_number = chunk_number;
+ chunk->is_add = false;
+ SBChunkHost host;
+ host.host = Sha256Prefix(host_name);
+ host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 2);
+ host.entry->set_chunk_id(chunk->chunk_number);
+ host.entry->SetPrefixAt(0, Sha256Prefix(url1));
+ host.entry->SetChunkIdAtPrefix(0, chunk_id_to_sub);
+ host.entry->SetPrefixAt(1, Sha256Prefix(url2));
+ host.entry->SetChunkIdAtPrefix(1, chunk_id_to_sub);
+ chunk->hosts.push_back(host);
+}
+
+// Same as InsertSubChunkHost2PrefixUrls, but with full hashes.
+void InsertSubChunkHost2FullHashes(SBChunk* chunk,
+ int chunk_number,
+ int chunk_id_to_sub,
+ const std::string& host_name,
+ const std::string& url1,
+ const std::string& url2) {
+ chunk->chunk_number = chunk_number;
+ chunk->is_add = false;
+ SBChunkHost host;
+ host.host = Sha256Prefix(host_name);
+ host.entry = SBEntry::Create(SBEntry::SUB_FULL_HASH, 2);
+ host.entry->set_chunk_id(chunk->chunk_number);
+ host.entry->SetFullHashAt(0, Sha256Hash(url1));
+ host.entry->SetChunkIdAtPrefix(0, chunk_id_to_sub);
+ host.entry->SetFullHashAt(1, Sha256Hash(url2));
+ host.entry->SetChunkIdAtPrefix(1, chunk_id_to_sub);
+ chunk->hosts.push_back(host);
+}
+
+// Same as InsertSubChunkHost2PrefixUrls, but with full hashes.
+void InsertSubChunkHostFullHash(SBChunk* chunk,
+ int chunk_number,
+ int chunk_id_to_sub,
+ const std::string& host_name,
+ const std::string& url) {
+ chunk->chunk_number = chunk_number;
+ chunk->is_add = false;
+ SBChunkHost host;
+ host.host = Sha256Prefix(host_name);
+ host.entry = SBEntry::Create(SBEntry::SUB_FULL_HASH, 2);
+ host.entry->set_chunk_id(chunk->chunk_number);
+ host.entry->SetFullHashAt(0, Sha256Hash(url));
+ host.entry->SetChunkIdAtPrefix(0, chunk_id_to_sub);
+ chunk->hosts.push_back(host);
+}
+
// Prevent DCHECK from killing tests.
// TODO(shess): Pawel disputes the use of this, so the test which uses
// it is DISABLED. http://crbug.com/56448
@@ -179,43 +328,26 @@
// Tests retrieving list name information.
TEST_F(SafeBrowsingDatabaseTest, ListNameForBrowse) {
SBChunkList chunks;
-
- // Insert some malware add chunks.
- SBChunkHost host;
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/malware.html"));
SBChunk chunk;
- chunk.chunk_number = 1;
- chunk.is_add = true;
- chunk.hosts.push_back(host);
+
+ InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
+ "www.evil.com/malware.html");
chunks.clear();
chunks.push_back(chunk);
std::vector<SBListChunkRanges> lists;
EXPECT_TRUE(database_->UpdateStarted(&lists));
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
- host.host = Sha256Prefix("www.foo.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.foo.com/malware.html"));
- chunk.chunk_number = 2;
- chunk.is_add = true;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertAddChunkHostPrefixUrl(&chunk, 2, "www.foo.com/",
+ "www.foo.com/malware.html");
chunks.clear();
chunks.push_back(chunk);
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
- host.host = Sha256Prefix("www.whatever.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(3);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.whatever.com/malware.html"));
- chunk.chunk_number = 3;
- chunk.is_add = true;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertAddChunkHostPrefixUrl(&chunk, 3, "www.whatever.com/",
+ "www.whatever.com/malware.html");
chunks.clear();
chunks.push_back(chunk);
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
@@ -227,15 +359,9 @@
EXPECT_TRUE(lists[0].subs.empty());
// Insert a malware sub chunk.
- host.host = Sha256Prefix("www.subbed.com/");
- host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 1);
- host.entry->set_chunk_id(7);
- host.entry->SetChunkIdAtPrefix(0, 19);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.subbed.com/notevil1.html"));
- chunk.chunk_number = 7;
- chunk.is_add = false;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertSubChunkHostPrefixUrl(&chunk, 7, 19, "www.subbed.com/",
+ "www.subbed.com/noteveil1.html");
chunks.clear();
chunks.push_back(chunk);
@@ -257,42 +383,25 @@
}
// Add a phishing add chunk.
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(47);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/phishing.html"));
- chunk.chunk_number = 47;
- chunk.is_add = true;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertAddChunkHostPrefixUrl(&chunk, 47, "www.evil.com/",
+ "www.evil.com/phishing.html");
chunks.clear();
chunks.push_back(chunk);
EXPECT_TRUE(database_->UpdateStarted(&lists));
database_->InsertChunks(safe_browsing_util::kPhishingList, chunks);
// Insert some phishing sub chunks.
- host.host = Sha256Prefix("www.phishy.com/");
- host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 1);
- host.entry->set_chunk_id(200);
- host.entry->SetChunkIdAtPrefix(0, 1999);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.phishy.com/notevil1.html"));
- chunk.chunk_number = 200;
- chunk.is_add = false;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertSubChunkHostPrefixUrl(&chunk, 200, 1999, "www.phishy.com/",
+ "www.phishy.com/notevil1.html");
chunks.clear();
chunks.push_back(chunk);
database_->InsertChunks(safe_browsing_util::kPhishingList, chunks);
- host.host = Sha256Prefix("www.phishy2.com/");
- host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 1);
- host.entry->set_chunk_id(201);
- host.entry->SetChunkIdAtPrefix(0, 1999);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.phishy2.com/notevil1.html"));
- chunk.chunk_number = 201;
- chunk.is_add = false;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertSubChunkHostPrefixUrl(&chunk, 201, 1999, "www.phishy2.com/",
+ "www.phishy2.com/notevil1.html");
chunks.clear();
chunks.push_back(chunk);
database_->InsertChunks(safe_browsing_util::kPhishingList, chunks);
@@ -316,56 +425,34 @@
database_->Init(database_filename_);
SBChunkList chunks;
+ SBChunk chunk;
// Insert malware, phish, binurl and bindownload add chunks.
- SBChunkHost host;
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/malware.html"));
- SBChunk chunk;
- chunk.chunk_number = 1;
- chunk.is_add = true;
- chunk.hosts.push_back(host);
- chunks.clear();
+ InsertAddChunkHostPrefixUrl(&chunk, 1, "www.evil.com/",
+ "www.evil.com/malware.html");
chunks.push_back(chunk);
- std::vector<SBListChunkRanges> lists;
+ std::vector<SBListChunkRanges> lists;
EXPECT_TRUE(database_->UpdateStarted(&lists));
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
- host.host = Sha256Prefix("www.foo.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.foo.com/malware.html"));
- chunk.chunk_number = 2;
- chunk.is_add = true;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertAddChunkHostPrefixUrl(&chunk, 2, "www.foo.com/",
+ "www.foo.com/malware.html");
chunks.clear();
chunks.push_back(chunk);
database_->InsertChunks(safe_browsing_util::kPhishingList, chunks);
- host.host = Sha256Prefix("www.whatever.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(3);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.whatever.com/download.html"));
- chunk.chunk_number = 3;
- chunk.is_add = true;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertAddChunkHostPrefixUrl(&chunk, 3, "www.whatever.com/",
+ "www.whatever.com/download.html");
chunks.clear();
chunks.push_back(chunk);
database_->InsertChunks(safe_browsing_util::kBinUrlList, chunks);
- host.host = Sha256Prefix("www.forhash.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(4);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.forhash.com/download.html"));
- chunk.chunk_number = 4;
- chunk.is_add = true;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertAddChunkHostPrefixUrl(&chunk, 4, "www.forhash.com/",
+ "www.forhash.com/download.html");
chunks.clear();
chunks.push_back(chunk);
database_->InsertChunks(safe_browsing_util::kBinHashList, chunks);
@@ -392,60 +479,32 @@
// Checks database reading and writing for browse.
TEST_F(SafeBrowsingDatabaseTest, BrowseDatabase) {
SBChunkList chunks;
+ SBChunk chunk;
// Add a simple chunk with one hostkey.
- SBChunkHost host;
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->set_chunk_id(1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/phishing.html"));
- host.entry->SetPrefixAt(1, Sha256Prefix("www.evil.com/malware.html"));
-
- SBChunk chunk;
- chunk.chunk_number = 1;
- chunk.is_add = true;
- chunk.hosts.push_back(host);
-
- chunks.clear();
+ InsertAddChunkHost2PrefixUrls(&chunk, 1, "www.evil.com/",
+ "www.evil.com/phishing.html",
+ "www.evil.com/malware.html");
chunks.push_back(chunk);
std::vector<SBListChunkRanges> lists;
EXPECT_TRUE(database_->UpdateStarted(&lists));
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
- // Add another chunk with two different hostkeys.
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->set_chunk_id(2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/notevil1.html"));
- host.entry->SetPrefixAt(1, Sha256Prefix("www.evil.com/notevil2.html"));
-
- chunk.chunk_number = 2;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
-
- host.host = Sha256Prefix("www.good.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->set_chunk_id(2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.good.com/good1.html"));
- host.entry->SetPrefixAt(1, Sha256Prefix("www.good.com/good2.html"));
-
- chunk.hosts.push_back(host);
-
+ InsertAddChunkHost2PrefixUrls(&chunk, 2, "www.evil.com/",
+ "www.evil.com/notevil1.html",
+ "www.evil.com/notevil2.html");
+ InsertAddChunkHost2PrefixUrls(&chunk, 2, "www.good.com/",
+ "www.good.com/good1.html",
+ "www.good.com/good2.html");
chunks.clear();
chunks.push_back(chunk);
-
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
// and a chunk with an IP-based host
- host.host = Sha256Prefix("192.168.0.1/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(3);
- host.entry->SetPrefixAt(0, Sha256Prefix("192.168.0.1/malware.html"));
-
- chunk.chunk_number = 3;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
-
+ InsertAddChunkHostPrefixUrl(&chunk, 3, "192.168.0.1/",
+ "192.168.0.1/malware.html");
chunks.clear();
chunks.push_back(chunk);
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
@@ -509,21 +568,12 @@
&matching_list, &prefix_hits,
&full_hashes, now));
-
-
// Attempt to re-add the first chunk (should be a no-op).
// see bug: http://code.google.com/p/chromium/issues/detail?id=4522
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->set_chunk_id(1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/phishing.html"));
- host.entry->SetPrefixAt(1, Sha256Prefix("www.evil.com/malware.html"));
-
- chunk.chunk_number = 1;
- chunk.is_add = true;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
-
+ InsertAddChunkHost2PrefixUrls(&chunk, 1, "www.evil.com/",
+ "www.evil.com/phishing.html",
+ "www.evil.com/malware.html");
chunks.clear();
chunks.push_back(chunk);
EXPECT_TRUE(database_->UpdateStarted(&lists));
@@ -535,24 +585,15 @@
EXPECT_EQ(lists[0].adds, "1-3");
EXPECT_TRUE(lists[0].subs.empty());
-
// Test removing a single prefix from the add chunk.
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 1);
- host.entry->set_chunk_id(2);
- host.entry->SetChunkIdAtPrefix(0, 2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/notevil1.html"));
-
- chunk.is_add = false;
- chunk.chunk_number = 4;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
-
+ InsertSubChunkHostPrefixUrl(&chunk, 4, 2, "www.evil.com/",
+ "www.evil.com/notevil1.html");
chunks.clear();
chunks.push_back(chunk);
-
EXPECT_TRUE(database_->UpdateStarted(&lists));
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
+
database_->UpdateFinished(true);
EXPECT_TRUE(database_->ContainsBrowseUrl(
@@ -589,17 +630,9 @@
// Test the same sub chunk again. This should be a no-op.
// see bug: http://code.google.com/p/chromium/issues/detail?id=4522
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 1);
- host.entry->set_chunk_id(2);
- host.entry->SetChunkIdAtPrefix(0, 2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/notevil1.html"));
-
- chunk.is_add = false;
- chunk.chunk_number = 4;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
-
+ InsertSubChunkHostPrefixUrl(&chunk, 4, 2, "www.evil.com/",
+ "www.evil.com/notevil1.html");
chunks.clear();
chunks.push_back(chunk);
@@ -639,16 +672,9 @@
// The adddel command exposed a bug in the transaction code where any
// transaction after it would fail. Add a dummy entry and remove it to
// make sure the transcation works fine.
- host.host = Sha256Prefix("www.redherring.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->set_chunk_id(1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.redherring.com/index.html"));
-
- chunk.is_add = true;
- chunk.chunk_number = 44;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
-
+ InsertAddChunkHostPrefixUrl(&chunk, 44, "www.redherring.com/",
+ "www.redherring.com/index.html");
chunks.clear();
chunks.push_back(chunk);
EXPECT_TRUE(database_->UpdateStarted(&lists));
@@ -668,19 +694,11 @@
EXPECT_EQ(lists[0].subs, "");
// Test a sub command coming in before the add.
- host.host = Sha256Prefix("www.notevilanymore.com/");
- host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 2);
- host.entry->set_chunk_id(10);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.notevilanymore.com/index.html"));
- host.entry->SetChunkIdAtPrefix(0, 10);
- host.entry->SetPrefixAt(1, Sha256Prefix("www.notevilanymore.com/good.html"));
- host.entry->SetChunkIdAtPrefix(1, 10);
-
- chunk.is_add = false;
- chunk.chunk_number = 5;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
-
+ InsertSubChunkHost2PrefixUrls(&chunk, 5, 10,
+ "www.notevilanymore.com/",
+ "www.notevilanymore.com/index.html",
+ "www.notevilanymore.com/good.html");
chunks.clear();
chunks.push_back(chunk);
EXPECT_TRUE(database_->UpdateStarted(&lists));
@@ -691,17 +709,12 @@
GURL("http://www.notevilanymore.com/index.html"),
&matching_list, &prefix_hits, &full_hashes, now));
- // Now insert the tardy add chunk.
- host.host = Sha256Prefix("www.notevilanymore.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.notevilanymore.com/index.html"));
- host.entry->SetPrefixAt(1, Sha256Prefix("www.notevilanymore.com/good.html"));
-
- chunk.is_add = true;
- chunk.chunk_number = 10;
+ // Now insert the tardy add chunk and we don't expect them to appear
+ // in database because of the previous sub chunk.
chunk.hosts.clear();
- chunk.hosts.push_back(host);
-
+ InsertAddChunkHost2PrefixUrls(&chunk, 10, "www.notevilanymore.com/",
+ "www.notevilanymore.com/index.html",
+ "www.notevilanymore.com/good.html");
chunks.clear();
chunks.push_back(chunk);
EXPECT_TRUE(database_->UpdateStarted(&lists));
@@ -721,31 +734,19 @@
// Test adding zero length chunks to the database.
TEST_F(SafeBrowsingDatabaseTest, ZeroSizeChunk) {
SBChunkList chunks;
+ SBChunk chunk;
// Populate with a couple of normal chunks.
- SBChunkHost host;
- host.host = Sha256Prefix("www.test.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.test.com/test1.html"));
- host.entry->SetPrefixAt(1, Sha256Prefix("www.test.com/test2.html"));
- host.entry->set_chunk_id(1);
-
- SBChunk chunk;
- chunk.is_add = true;
- chunk.chunk_number = 1;
- chunk.hosts.push_back(host);
-
+ InsertAddChunkHost2PrefixUrls(&chunk, 1, "www.test.com/",
+ "www.test.com/test1.html",
+ "www.test.com/test2.html");
chunks.clear();
chunks.push_back(chunk);
- host.host = Sha256Prefix("www.random.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.random.com/random1.html"));
- host.entry->SetPrefixAt(1, Sha256Prefix("www.random.com/random2.html"));
- host.entry->set_chunk_id(10);
- chunk.chunk_number = 10;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertAddChunkHost2PrefixUrls(&chunk, 10, "www.random.com/",
+ "www.random.com/random1.html",
+ "www.random.com/random2.html");
chunks.push_back(chunk);
std::vector<SBListChunkRanges> lists;
@@ -777,14 +778,9 @@
// Add an empty chunk along with a couple that contain data. This should
// result in the chunk range being reduced in size.
- host.host = Sha256Prefix("www.notempty.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.notempty.com/full1.html"));
- host.entry->set_chunk_id(20);
- empty_chunk.chunk_number = 20;
- empty_chunk.is_add = true;
empty_chunk.hosts.clear();
- empty_chunk.hosts.push_back(host);
+ InsertAddChunkHostPrefixUrl(&empty_chunk, 20, "www.notempy.com/",
+ "www.notempty.com/full1.html");
chunks.clear();
chunks.push_back(empty_chunk);
@@ -793,14 +789,9 @@
empty_chunk.hosts.clear();
chunks.push_back(empty_chunk);
- host.host = Sha256Prefix("www.notempty.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.notempty.com/full2.html"));
- host.entry->set_chunk_id(22);
empty_chunk.hosts.clear();
- empty_chunk.hosts.push_back(host);
- empty_chunk.chunk_number = 22;
- empty_chunk.is_add = true;
+ InsertAddChunkHostPrefixUrl(&empty_chunk, 22, "www.notempy.com/",
+ "www.notempty.com/full2.html");
chunks.push_back(empty_chunk);
EXPECT_TRUE(database_->UpdateStarted(&lists));
@@ -844,22 +835,15 @@
// Utility function for setting up the database for the caching test.
void SafeBrowsingDatabaseTest::PopulateDatabaseForCacheTest() {
- // Add a simple chunk with one hostkey and cache it.
- SBChunkHost host;
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->set_chunk_id(1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/phishing.html"));
- host.entry->SetPrefixAt(1, Sha256Prefix("www.evil.com/malware.html"));
-
- SBChunk chunk;
- chunk.chunk_number = 1;
- chunk.is_add = true;
- chunk.hosts.push_back(host);
-
SBChunkList chunks;
- std::vector<SBListChunkRanges> lists;
+ SBChunk chunk;
+ // Add a simple chunk with one hostkey and cache it.
+ InsertAddChunkHost2PrefixUrls(&chunk, 1, "www.evil.com/",
+ "www.evil.com/phishing.html",
+ "www.evil.com/malware.html");
chunks.push_back(chunk);
+
+ std::vector<SBListChunkRanges> lists;
EXPECT_TRUE(database_->UpdateStarted(&lists));
database_->InsertChunks(safe_browsing_util::kMalwareList, chunks);
database_->UpdateFinished(true);
@@ -912,19 +896,10 @@
full_hashes.clear();
// Test removing a prefix via a sub chunk.
- SBChunkHost host;
- host.host = Sha256Prefix("www.evil.com/");
- host.entry = SBEntry::Create(SBEntry::SUB_PREFIX, 1);
- host.entry->set_chunk_id(1);
- host.entry->SetChunkIdAtPrefix(0, 1);
- host.entry->SetPrefixAt(0, Sha256Prefix("www.evil.com/phishing.html"));
-
SBChunk chunk;
- chunk.chunk_number = 2;
- chunk.is_add = false;
- chunk.hosts.clear();
- chunk.hosts.push_back(host);
SBChunkList chunks;
+ InsertSubChunkHostPrefixUrl(&chunk, 2, 1, "www.evil.com/",
+ "www.evil.com/phishing.html");
chunks.push_back(chunk);
std::vector<SBListChunkRanges> lists;
@@ -939,7 +914,6 @@
EXPECT_EQ(full_hashes.size(), 1U);
EXPECT_TRUE(SBFullHashEq(full_hashes[0].hash,
Sha256Hash("www.evil.com/malware.html")));
-
prefixes.clear();
full_hashes.clear();
@@ -1038,16 +1012,10 @@
full_hashes.clear();
// Test receiving a full add chunk.
- host.host = Sha256Prefix("www.fullevil.com/");
- host.entry = SBEntry::Create(SBEntry::ADD_FULL_HASH, 2);
- host.entry->set_chunk_id(20);
- host.entry->SetFullHashAt(0, Sha256Hash("www.fullevil.com/bad1.html"));
- host.entry->SetFullHashAt(1, Sha256Hash("www.fullevil.com/bad2.html"));
-
- chunk.chunk_number = 20;
- chunk.is_add = true;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertAddChunkHost2FullHashes(&chunk, 20, "www.fullevil.com/",
+ "www.fullevil.com/bad1.html",
+ "www.fullevil.com/bad2.html");
chunks.clear();
chunks.push_back(chunk);
EXPECT_TRUE(database_->UpdateStarted(&lists));
@@ -1075,16 +1043,10 @@
full_hashes.clear();
// Test receiving a full sub chunk, which will remove one of the full adds.
- host.host = Sha256Prefix("www.fullevil.com/");
- host.entry = SBEntry::Create(SBEntry::SUB_FULL_HASH, 1);
- host.entry->set_chunk_id(200);
- host.entry->SetChunkIdAtPrefix(0, 20);
- host.entry->SetFullHashAt(0, Sha256Hash("www.fullevil.com/bad1.html"));
-
- chunk.chunk_number = 200;
- chunk.is_add = false;
chunk.hosts.clear();
- chunk.hosts.push_back(host);
+ InsertSubChunkHostFullHash(&chunk, 200, 20,
+ "www.fullevil.com/",
+ "www.fullevil.com/bad1.html");
chunks.clear();
chunks.push_back(chunk);
EXPECT_TRUE(database_->UpdateStarted(&lists));
@@ -1289,18 +1251,10 @@
const char kEvil1Url2[] = "www.evil1.com/download2.html";
SBChunkList chunks;
- // Add a simple chunk with one hostkey for download url list.
- SBChunkHost host;
- host.host = Sha256Prefix(kEvil1Host);
- host.entry = SBEntry::Create(SBEntry::ADD_PREFIX, 2);
- host.entry->set_chunk_id(1);
- host.entry->SetPrefixAt(0, Sha256Prefix(kEvil1Url1));
- host.entry->SetPrefixAt(1, Sha256Prefix(kEvil1Url2));
SBChunk chunk;
- chunk.chunk_number = 1;
- chunk.is_add = true;
- chunk.hosts.push_back(host);
- chunks.clear();
+ // Add a simple chunk with one hostkey for download url list.
+ InsertAddChunkHost2PrefixUrls(&chunk, 1, kEvil1Host,
+ kEvil1Url1, kEvil1Url2);
chunks.push_back(chunk);
std::vector<SBListChunkRanges> lists;
EXPECT_TRUE(database_->UpdateStarted(&lists));
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc
index 9e24b03..c4e8eff 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_service.cc
@@ -35,23 +35,42 @@
using base::Time;
using base::TimeDelta;
+namespace {
+
// The default URL prefix where browser fetches chunk updates, hashes,
// and reports safe browsing hits.
-static const char* const kSbDefaultInfoURLPrefix =
+const char* const kSbDefaultInfoURLPrefix =
"http://safebrowsing.clients.google.com/safebrowsing";
// The default URL prefix where browser fetches MAC client key and reports
// malware details.
-static const char* const kSbDefaultMacKeyURLPrefix =
+const char* const kSbDefaultMacKeyURLPrefix =
"https://sb-ssl.google.com/safebrowsing";
-static Profile* GetDefaultProfile() {
+Profile* GetDefaultProfile() {
FilePath user_data_dir;
PathService::Get(chrome::DIR_USER_DATA, &user_data_dir);
ProfileManager* profile_manager = g_browser_process->profile_manager();
return profile_manager->GetDefaultProfile(user_data_dir);
}
+// Records disposition information about the check. |hit| should be
+// |true| if there were any prefix hits in |full_hashes|.
+void RecordGetHashCheckStatus(
+ bool hit, const std::vector<SBFullHashResult>& full_hashes) {
+ SafeBrowsingProtocolManager::ResultType result;
+ if (full_hashes.empty()) {
+ result = SafeBrowsingProtocolManager::GET_HASH_FULL_HASH_EMPTY;
+ } else if (hit) {
+ result = SafeBrowsingProtocolManager::GET_HASH_FULL_HASH_HIT;
+ } else {
+ result = SafeBrowsingProtocolManager::GET_HASH_FULL_HASH_MISS;
+ }
+ SafeBrowsingProtocolManager::RecordGetHashResult(result);
+}
+
+} // namespace
+
// static
SafeBrowsingServiceFactory* SafeBrowsingService::factory_ = NULL;
@@ -640,7 +659,8 @@
check->start = Time::Now();
protocol_manager_->GetFullHash(check, check->prefix_hits);
} else {
- // We may have cached results for previous GetHash queries.
+ // We may have cached results for previous GetHash queries. Since
+ // this data comes from cache, don't histogram hits.
HandleOneCheck(check, check->full_hits);
}
}
@@ -817,36 +837,37 @@
SBPrefix prefix = check->prefix_hits[0];
GetHashRequests::iterator it = gethash_requests_.find(prefix);
if (check->prefix_hits.size() > 1 || it == gethash_requests_.end()) {
- HandleOneCheck(check, full_hashes);
+ const bool hit = HandleOneCheck(check, full_hashes);
+ RecordGetHashCheckStatus(hit, full_hashes);
return;
}
- // Call back all interested parties.
+ // Call back all interested parties, noting if any has a hit.
GetHashRequestors& requestors = it->second;
+ bool hit = false;
for (GetHashRequestors::iterator r = requestors.begin();
r != requestors.end(); ++r) {
- HandleOneCheck(*r, full_hashes);
+ if (HandleOneCheck(*r, full_hashes))
+ hit = true;
}
+ RecordGetHashCheckStatus(hit, full_hashes);
gethash_requests_.erase(it);
}
-void SafeBrowsingService::HandleOneCheck(
+bool SafeBrowsingService::HandleOneCheck(
SafeBrowsingCheck* check,
const std::vector<SBFullHashResult>& full_hashes) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
+
+ // Always calculate the index, for recording hits.
+ int index = safe_browsing_util::CompareFullHashes(check->url, full_hashes);
+
+ // |client| is NULL if the request was cancelled.
if (check->client) {
UrlCheckResult result = URL_SAFE;
- int index = safe_browsing_util::CompareFullHashes(check->url, full_hashes);
- if (index != -1) {
+ if (index != -1)
result = GetResultFromListname(full_hashes[index].list_name);
- } else {
- // Log the case where the SafeBrowsing servers return full hashes in the
- // GetHash response that match the prefix we're looking up, but don't
- // match the full hash of the URL.
- if (!full_hashes.empty())
- UMA_HISTOGRAM_COUNTS("SB2.GetHashServerMiss", 1);
- }
// Let the client continue handling the original request.
check->client->OnSafeBrowsingResult(check->url, result);
@@ -854,6 +875,8 @@
checks_.erase(check);
delete check;
+
+ return (index != -1);
}
void SafeBrowsingService::DoDisplayBlockingPage(
diff --git a/chrome/browser/safe_browsing/safe_browsing_service.h b/chrome/browser/safe_browsing/safe_browsing_service.h
index e87fc9c..73eb201 100644
--- a/chrome/browser/safe_browsing/safe_browsing_service.h
+++ b/chrome/browser/safe_browsing/safe_browsing_service.h
@@ -307,7 +307,9 @@
void OnHandleGetHashResults(SafeBrowsingCheck* check,
const std::vector<SBFullHashResult>& full_hashes);
- void HandleOneCheck(SafeBrowsingCheck* check,
+ // Run one check against |full_hashes|. Returns |true| if the check
+ // finds a match in |full_hashes|.
+ bool HandleOneCheck(SafeBrowsingCheck* check,
const std::vector<SBFullHashResult>& full_hashes);
// Invoked on the UI thread to show the blocking page.
diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc
index 259d3ff..7cc8f86 100644
--- a/chrome/browser/safe_browsing/safe_browsing_test.cc
+++ b/chrome/browser/safe_browsing/safe_browsing_test.cc
@@ -17,14 +17,14 @@
#include <vector>
#include "base/command_line.h"
-#include "base/condition_variable.h"
#include "base/environment.h"
-#include "base/lock.h"
#include "base/path_service.h"
#include "base/process_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/string_split.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
@@ -206,7 +206,7 @@
void UpdateSafeBrowsingStatus() {
ASSERT_TRUE(safe_browsing_service_);
- AutoLock lock(update_status_mutex_);
+ base::AutoLock lock(update_status_mutex_);
is_initial_request_ =
safe_browsing_service_->protocol_manager_->is_initial_request();
last_update_ = safe_browsing_service_->protocol_manager_->last_update();
@@ -220,14 +220,14 @@
}
void CheckIsDatabaseReady() {
- AutoLock lock(update_status_mutex_);
+ base::AutoLock lock(update_status_mutex_);
is_database_ready_ =
!safe_browsing_service_->database_update_in_progress_;
}
void CheckUrl(SafeBrowsingService::Client* helper, const GURL& url) {
ASSERT_TRUE(safe_browsing_service_);
- AutoLock lock(update_status_mutex_);
+ base::AutoLock lock(update_status_mutex_);
if (safe_browsing_service_->CheckBrowseUrl(url, helper)) {
is_checked_url_in_db_ = false;
is_checked_url_safe_ = true;
@@ -240,37 +240,37 @@
}
bool is_checked_url_in_db() {
- AutoLock l(update_status_mutex_);
+ base::AutoLock l(update_status_mutex_);
return is_checked_url_in_db_;
}
void set_is_checked_url_safe(bool safe) {
- AutoLock l(update_status_mutex_);
+ base::AutoLock l(update_status_mutex_);
is_checked_url_safe_ = safe;
}
bool is_checked_url_safe() {
- AutoLock l(update_status_mutex_);
+ base::AutoLock l(update_status_mutex_);
return is_checked_url_safe_;
}
bool is_database_ready() {
- AutoLock l(update_status_mutex_);
+ base::AutoLock l(update_status_mutex_);
return is_database_ready_;
}
bool is_initial_request() {
- AutoLock l(update_status_mutex_);
+ base::AutoLock l(update_status_mutex_);
return is_initial_request_;
}
base::Time last_update() {
- AutoLock l(update_status_mutex_);
+ base::AutoLock l(update_status_mutex_);
return last_update_;
}
bool is_update_scheduled() {
- AutoLock l(update_status_mutex_);
+ base::AutoLock l(update_status_mutex_);
return is_update_scheduled_;
}
@@ -315,7 +315,7 @@
// Protects all variables below since they are read on UI thread
// but updated on IO thread or safebrowsing thread.
- Lock update_status_mutex_;
+ base::Lock update_status_mutex_;
// States associated with safebrowsing service updates.
bool is_database_ready_;
@@ -452,7 +452,7 @@
// Wait and try again if last fetch was failed. The loop will hit the
// timeout in OutOfProcTestRunner if the fetch can not get success
// response.
- PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
+ base::PlatformThread::Sleep(TestTimeouts::action_timeout_ms());
}
}
diff --git a/chrome/browser/sanity_uitest.cc b/chrome/browser/sanity_uitest.cc
index 36bc372..cd02db2 100644
--- a/chrome/browser/sanity_uitest.cc
+++ b/chrome/browser/sanity_uitest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,7 +9,6 @@
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "base/platform_thread.h"
#include "chrome/common/chrome_switches.h"
#include "net/base/net_util.h"
@@ -18,7 +17,7 @@
GoogleTest() : UITest() {
FilePath test_file =
test_data_directory_.AppendASCII("google").AppendASCII("google.html");
- homepage_ = GURL(net::FilePathToFileURL(test_file)).spec();
+ set_homepage(GURL(net::FilePathToFileURL(test_file)).spec());
}
};
@@ -35,7 +34,7 @@
protected:
ColumnLayout() : UITest() {
FilePath test_file = test_data_directory_.AppendASCII("columns.html");
- homepage_ = GURL(net::FilePathToFileURL(test_file)).spec();
+ set_homepage(GURL(net::FilePathToFileURL(test_file)).spec());
}
};
diff --git a/chrome/browser/search_engines/search_terms_data.cc b/chrome/browser/search_engines/search_terms_data.cc
index 834d09a..7e5b9ff 100644
--- a/chrome/browser/search_engines/search_terms_data.cc
+++ b/chrome/browser/search_engines/search_terms_data.cc
@@ -5,7 +5,7 @@
#include "chrome/browser/search_engines/search_terms_data.h"
#include "base/logging.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/google/google_url_tracker.h"
diff --git a/chrome/browser/search_engines/template_url_model_test_util.cc b/chrome/browser/search_engines/template_url_model_test_util.cc
index e6ebc8d..7803b12 100644
--- a/chrome/browser/search_engines/template_url_model_test_util.cc
+++ b/chrome/browser/search_engines/template_url_model_test_util.cc
@@ -7,7 +7,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/search_engines/template_url.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/common/notification_service.h"
diff --git a/chrome/browser/search_engines/template_url_model_unittest.cc b/chrome/browser/search_engines/template_url_model_unittest.cc
index 532fce6..9e5477c 100644
--- a/chrome/browser/search_engines/template_url_model_unittest.cc
+++ b/chrome/browser/search_engines/template_url_model_unittest.cc
@@ -7,7 +7,7 @@
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/ref_counted.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_notifications.h"
diff --git a/chrome/browser/search_engines/template_url_table_model.cc b/chrome/browser/search_engines/template_url_table_model.cc
index 6ab7794..12189f1 100644
--- a/chrome/browser/search_engines/template_url_table_model.cc
+++ b/chrome/browser/search_engines/template_url_table_model.cc
@@ -4,9 +4,6 @@
#include "chrome/browser/search_engines/template_url_table_model.h"
-#include <string>
-#include <vector>
-
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "app/table_model_observer.h"
@@ -177,32 +174,35 @@
return static_cast<int>(entries_.size());
}
-std::wstring TemplateURLTableModel::GetText(int row, int col_id) {
+string16 TemplateURLTableModel::GetText(int row, int col_id) {
DCHECK(row >= 0 && row < RowCount());
const TemplateURL& url = entries_[row]->template_url();
switch (col_id) {
case IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN: {
- std::wstring url_short_name = url.short_name();
+ string16 url_short_name = WideToUTF16Hack(url.short_name());
// TODO(xji): Consider adding a special case if the short name is a URL,
// since those should always be displayed LTR. Please refer to
// http://crbug.com/6726 for more information.
base::i18n::AdjustStringForLocaleDirection(&url_short_name);
- return (template_url_model_->GetDefaultSearchProvider() == &url) ?
- l10n_util::GetStringF(IDS_SEARCH_ENGINES_EDITOR_DEFAULT_ENGINE,
- url_short_name) : url_short_name;
+ if (template_url_model_->GetDefaultSearchProvider() == &url) {
+ return l10n_util::GetStringFUTF16(
+ IDS_SEARCH_ENGINES_EDITOR_DEFAULT_ENGINE,
+ url_short_name);
+ }
+ return url_short_name;
}
case IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN: {
// Keyword should be domain name. Force it to have LTR directionality.
string16 keyword = WideToUTF16(url.keyword());
keyword = base::i18n::GetDisplayStringInLTRDirectionality(keyword);
- return UTF16ToWide(keyword);
+ return keyword;
}
default:
NOTREACHED();
- return std::wstring();
+ return string16();
}
}
@@ -224,13 +224,13 @@
Group search_engine_group;
search_engine_group.title =
- l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_MAIN_SEPARATOR);
+ l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_MAIN_SEPARATOR);
search_engine_group.id = kMainGroupID;
groups.push_back(search_engine_group);
Group other_group;
other_group.title =
- l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_OTHER_SEPARATOR);
+ l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_OTHER_SEPARATOR);
other_group.id = kOtherGroupID;
groups.push_back(other_group);
diff --git a/chrome/browser/search_engines/template_url_table_model.h b/chrome/browser/search_engines/template_url_table_model.h
index 03bb43a..95ca739 100644
--- a/chrome/browser/search_engines/template_url_table_model.h
+++ b/chrome/browser/search_engines/template_url_table_model.h
@@ -6,7 +6,11 @@
#define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_TABLE_MODEL_H_
#pragma once
+#include <string>
+#include <vector>
+
#include "app/table_model.h"
+#include "base/compiler_specific.h"
#include "base/string16.h"
#include "chrome/browser/search_engines/template_url_model_observer.h"
@@ -38,13 +42,13 @@
void Reload();
// TableModel overrides.
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column);
- virtual SkBitmap GetIcon(int row);
- virtual void SetObserver(TableModelObserver* observer);
- virtual bool HasGroups();
- virtual Groups GetGroups();
- virtual int GetGroupID(int row);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column) OVERRIDE;
+ virtual SkBitmap GetIcon(int row) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
+ virtual bool HasGroups() OVERRIDE;
+ virtual Groups GetGroups() OVERRIDE;
+ virtual int GetGroupID(int row) OVERRIDE;
// Removes the entry at the specified index.
void Remove(int index);
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc
index 27e3a2d..0ca4729 100644
--- a/chrome/browser/service/service_process_control.cc
+++ b/chrome/browser/service/service_process_control.cc
@@ -8,8 +8,8 @@
#include "base/file_path.h"
#include "base/process_util.h"
#include "base/stl_util-inl.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/io_thread.h"
@@ -96,8 +96,7 @@
// ServiceProcessControl implementation.
ServiceProcessControl::ServiceProcessControl(Profile* profile)
- : profile_(profile),
- message_handler_(NULL) {
+ : profile_(profile) {
}
ServiceProcessControl::~ServiceProcessControl() {
@@ -239,9 +238,8 @@
}
bool ServiceProcessControl::OnMessageReceived(const IPC::Message& message) {
- bool handled = true;;
+ bool handled = true;
IPC_BEGIN_MESSAGE_MAP(ServiceProcessControl, message)
- IPC_MESSAGE_HANDLER(ServiceHostMsg_GoodDay, OnGoodDay)
IPC_MESSAGE_HANDLER(ServiceHostMsg_CloudPrintProxy_IsEnabled,
OnCloudPrintProxyIsEnabled)
IPC_MESSAGE_HANDLER(ServiceHostMsg_RemotingHost_HostInfo,
@@ -278,13 +276,6 @@
}
}
-void ServiceProcessControl::OnGoodDay() {
- if (!message_handler_)
- return;
-
- message_handler_->OnGoodDay();
-}
-
void ServiceProcessControl::OnCloudPrintProxyIsEnabled(bool enabled,
std::string email) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -297,9 +288,9 @@
void ServiceProcessControl::OnRemotingHostInfo(
remoting::ChromotingHostInfo host_info) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (remoting_host_status_callback_ != NULL) {
- remoting_host_status_callback_->Run(host_info);
- remoting_host_status_callback_.reset();
+ for (std::set<MessageHandler*>::iterator it = message_handlers_.begin();
+ it != message_handlers_.end(); ++it) {
+ (*it)->OnRemotingHostInfo(host_info);
}
}
@@ -310,10 +301,6 @@
return Send(new ServiceMsg_IsCloudPrintProxyEnabled);
}
-bool ServiceProcessControl::SendHello() {
- return Send(new ServiceMsg_Hello());
-}
-
bool ServiceProcessControl::Shutdown() {
bool ret = Send(new ServiceMsg_Shutdown());
channel_.reset();
@@ -335,11 +322,18 @@
return Send(new ServiceMsg_DisableRemotingHost());
}
-bool ServiceProcessControl::GetRemotingHostStatus(
- GetRemotingHostStatusCallback* status_callback) {
- DCHECK(status_callback);
- remoting_host_status_callback_.reset(status_callback);
+bool ServiceProcessControl::RequestRemotingHostStatus() {
return Send(new ServiceMsg_GetRemotingHostInfo);
}
+void ServiceProcessControl::AddMessageHandler(
+ MessageHandler* message_handler) {
+ message_handlers_.insert(message_handler);
+}
+
+void ServiceProcessControl::RemoveMessageHandler(
+ MessageHandler* message_handler) {
+ message_handlers_.erase(message_handler);
+}
+
DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControl);
diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h
index 9162736..c2f18ba 100644
--- a/chrome/browser/service/service_process_control.h
+++ b/chrome/browser/service/service_process_control.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_SERVICE_SERVICE_PROCESS_CONTROL_H_
#include <queue>
+#include <set>
#include <string>
#include <vector>
@@ -41,15 +42,16 @@
typedef IDMap<ServiceProcessControl>::iterator iterator;
typedef std::queue<IPC::Message> MessageQueue;
typedef Callback1<const remoting::ChromotingHostInfo&>::Type
- GetRemotingHostStatusCallback;
+ RemotingHostStatusHandler;
// An interface for handling messages received from the service process.
class MessageHandler {
public:
virtual ~MessageHandler() {}
- // This is a test signal sent from the service process. This can be used
- // the healthiness of the service.
- virtual void OnGoodDay() = 0;
+
+ // Called when we receive reply to remoting host status request.
+ virtual void OnRemotingHostInfo(
+ const remoting::ChromotingHostInfo& host_info) = 0;
};
// Construct a ServiceProcessControl with |profile|..
@@ -90,42 +92,38 @@
const NotificationDetails& details);
// Message handlers
- void OnGoodDay();
void OnCloudPrintProxyIsEnabled(bool enabled, std::string email);
void OnRemotingHostInfo(remoting::ChromotingHostInfo host_info);
- // Send a hello message to the service process for testing purpose.
- // Return true if the message was sent.
- bool SendHello();
-
// Send a shutdown message to the service process. IPC channel will be
// destroyed after calling this method.
// Return true if the message was sent.
bool Shutdown();
- // Send a message to the service process to request a response
- // containing the enablement status of the cloud print proxy and the
- // registered email address. The callback gets the information when
- // received.
+ // Send request for cloud print proxy status and the registered
+ // email address. The callback gets the information when received.
bool GetCloudPrintProxyStatus(
Callback2<bool, std::string>::Type* cloud_print_status_callback);
// Send a message to enable the remoting service in the service process.
// Return true if the message was sent.
bool SetRemotingHostCredentials(const std::string& user,
- const std::string& auth_token);
+ const std::string& auth_token);
bool EnableRemotingHost();
bool DisableRemotingHost();
- bool GetRemotingHostStatus(
- GetRemotingHostStatusCallback* status_callback);
+ // Send request for current status of the remoting service.
+ bool RequestRemotingHostStatus();
- // Set the message handler for receiving messages from the service process.
- // TODO(hclam): Allow more than 1 handler.
- void SetMessageHandler(MessageHandler* message_handler) {
- message_handler_ = message_handler;
- }
+ // Add a message handler for receiving messages from the service
+ // process.
+ void AddMessageHandler(MessageHandler* message_handler);
+
+ // Remove a message handler from the list of message handlers. Must
+ // not be called from a message handler (i.e. while a message is
+ // being processed).
+ void RemoveMessageHandler(MessageHandler* message_handler);
private:
class Launcher;
@@ -161,10 +159,9 @@
// Callback that gets invoked when a status message is received from
// the cloud print proxy.
scoped_ptr<Callback2<bool, std::string>::Type> cloud_print_status_callback_;
- scoped_ptr<GetRemotingHostStatusCallback> remoting_host_status_callback_;
// Handler for messages from service process.
- MessageHandler* message_handler_;
+ std::set<MessageHandler*> message_handlers_;
NotificationRegistrar registrar_;
};
diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc
index 8cf596c..9087b8d 100644
--- a/chrome/browser/service/service_process_control_browsertest.cc
+++ b/chrome/browser/service/service_process_control_browsertest.cc
@@ -13,8 +13,7 @@
#include "chrome/test/ui_test_utils.h"
class ServiceProcessControlBrowserTest
- : public InProcessBrowserTest,
- public ServiceProcessControl::MessageHandler {
+ : public InProcessBrowserTest {
public:
ServiceProcessControlBrowserTest()
: service_process_handle_(base::kNullProcessHandle) {
@@ -46,12 +45,18 @@
ui_test_utils::RunMessageLoop();
}
- void SayHelloAndWait() {
- // Send a hello message to the service process and wait for a reply.
- process()->SendHello();
+ // Send a remoting host status request and wait reply from the service.
+ void SendRequestAndWait() {
+ process()->GetCloudPrintProxyStatus(NewCallback(
+ this, &ServiceProcessControlBrowserTest::CloudPrintStatusCallback));
ui_test_utils::RunMessageLoop();
}
+ void CloudPrintStatusCallback(
+ bool enabled, std::string email) {
+ MessageLoop::current()->Quit();
+ }
+
void Disconnect() {
// This will delete all instances of ServiceProcessControl and close the IPC
// connections.
@@ -72,7 +77,6 @@
service_pid,
base::kProcessAccessWaitForTermination,
&service_process_handle_));
- process()->SetMessageHandler(this);
// Quit the current message. Post a QuitTask instead of just calling Quit()
// because this can get invoked in the context of a Launch() call and we
// may not be in Run() yet.
@@ -85,11 +89,6 @@
MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
}
- // ServiceProcessControl::MessageHandler implementations.
- virtual void OnGoodDay() {
- MessageLoop::current()->Quit();
- }
-
ServiceProcessControl* process() { return process_; }
private:
@@ -105,7 +104,7 @@
// Make sure we are connected to the service process.
EXPECT_TRUE(process()->is_connected());
- SayHelloAndWait();
+ SendRequestAndWait();
// And then shutdown the service process.
EXPECT_TRUE(process()->Shutdown());
@@ -119,12 +118,12 @@
// Make sure we are connected to the service process.
EXPECT_TRUE(process()->is_connected());
- SayHelloAndWait();
+ SendRequestAndWait();
// Launch the service process again.
LaunchServiceProcessControl();
EXPECT_TRUE(process()->is_connected());
- SayHelloAndWait();
+ SendRequestAndWait();
// And then shutdown the service process.
EXPECT_TRUE(process()->Shutdown());
diff --git a/chrome/browser/session_history_uitest.cc b/chrome/browser/session_history_uitest.cc
index 871ea6d..1553b1d 100644
--- a/chrome/browser/session_history_uitest.cc
+++ b/chrome/browser/session_history_uitest.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/platform_thread.h"
#include "base/string_util.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/automation/tab_proxy.h"
@@ -157,7 +156,7 @@
ASSERT_TRUE(test_server_.Start());
// about:blank should be loaded first.
- GURL home(homepage_);
+ GURL home(homepage());
ASSERT_FALSE(tab_->GoBack());
EXPECT_EQ(L"", GetTabTitle());
EXPECT_EQ(home, GetTabURL());
diff --git a/chrome/browser/sessions/base_session_service.cc b/chrome/browser/sessions/base_session_service.cc
index aa981f9..795761a 100644
--- a/chrome/browser/sessions/base_session_service.cc
+++ b/chrome/browser/sessions/base_session_service.cc
@@ -6,7 +6,7 @@
#include "base/pickle.h"
#include "base/stl_util-inl.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sessions/session_backend.h"
diff --git a/chrome/browser/sessions/session_id.h b/chrome/browser/sessions/session_id.h
index 91f6d6f..248d602 100644
--- a/chrome/browser/sessions/session_id.h
+++ b/chrome/browser/sessions/session_id.h
@@ -10,6 +10,9 @@
class NavigationController;
class SessionService;
+namespace browser_sync {
+ class SessionModelAssociator;
+}
// Uniquely identifies a tab or window for the duration of a session.
class SessionID {
@@ -25,6 +28,7 @@
private:
friend class NavigationController;
friend class SessionService;
+ friend class browser_sync::SessionModelAssociator;
explicit SessionID(id_type id) : id_(id) {}
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index 43f677a..929042b 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -300,31 +300,40 @@
}
}
- void RestoreForeignSession(std::vector<SessionWindow*>* windows) {
- tab_loader_.reset(new TabLoader());
+ // Restore window(s) from a foreign session.
+ void RestoreForeignSession(
+ std::vector<SessionWindow*>::const_iterator begin,
+ std::vector<SessionWindow*>::const_iterator end) {
+ StartTabCreation();
// Create a browser instance to put the restored tabs in.
- bool has_tabbed_browser = false;
- for (std::vector<SessionWindow*>::iterator i = (*windows).begin();
- i != (*windows).end(); ++i) {
- Browser* browser = NULL;
- if (!has_tabbed_browser && (*i)->type == Browser::TYPE_NORMAL)
- has_tabbed_browser = true;
- browser = new Browser(static_cast<Browser::Type>((*i)->type),
- profile_);
- browser->set_override_bounds((*i)->bounds);
- browser->set_maximized_state((*i)->is_maximized ?
- Browser::MAXIMIZED_STATE_MAXIMIZED :
- Browser::MAXIMIZED_STATE_UNMAXIMIZED);
- browser->CreateBrowserWindow();
+ for (std::vector<SessionWindow*>::const_iterator i = begin;
+ i != end; ++i) {
+ Browser* browser = CreateRestoredBrowser(
+ static_cast<Browser::Type>((*i)->type),
+ (*i)->bounds,
+ (*i)->is_maximized);
// Restore and show the browser.
const int initial_tab_count = browser->tab_count();
RestoreTabsToBrowser(*(*i), browser);
- ShowBrowser(browser, initial_tab_count,
- (*i)->selected_tab_index);
+ ShowBrowser(browser, initial_tab_count, (*i)->selected_tab_index);
NotifySessionServiceOfRestoredTabs(browser, initial_tab_count);
}
- FinishedTabCreation(true, has_tabbed_browser);
+
+ // Always create in a new window
+ FinishedTabCreation(true, true);
+ }
+
+ // Restore a single tab from a foreign session.
+ // Note: we currently restore the tab to the last active browser.
+ void RestoreForeignTab(const SessionTab& tab) {
+ StartTabCreation();
+ Browser* current_browser =
+ browser_ ? browser_ : BrowserList::GetLastActive();
+ RestoreTab(tab, current_browser->tab_count(), current_browser);
+ NotifySessionServiceOfRestoredTabs(current_browser,
+ current_browser->tab_count());
+ FinishedTabCreation(true, true);
}
~SessionRestoreImpl() {
@@ -347,6 +356,11 @@
}
private:
+ // Invoked when beginning to create new tabs. Resets the tab_loader_.
+ void StartTabCreation() {
+ tab_loader_.reset(new TabLoader());
+ }
+
// Invoked when done with creating all the tabs/browsers.
//
// |created_tabbed_browser| indicates whether a tabbed browser was created,
@@ -401,7 +415,7 @@
return;
}
- tab_loader_.reset(new TabLoader());
+ StartTabCreation();
Browser* current_browser =
browser_ ? browser_ : BrowserList::GetLastActive();
@@ -425,12 +439,10 @@
}
}
if (!browser) {
- browser = new Browser(static_cast<Browser::Type>((*i)->type), profile_);
- browser->set_override_bounds((*i)->bounds);
- browser->set_maximized_state((*i)->is_maximized ?
- Browser::MAXIMIZED_STATE_MAXIMIZED :
- Browser::MAXIMIZED_STATE_UNMAXIMIZED);
- browser->CreateBrowserWindow();
+ browser = CreateRestoredBrowser(
+ static_cast<Browser::Type>((*i)->type),
+ (*i)->bounds,
+ (*i)->is_maximized);
}
if ((*i)->type == Browser::TYPE_NORMAL)
last_browser = browser;
@@ -460,24 +472,42 @@
for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin();
i != window.tabs.end(); ++i) {
const SessionTab& tab = *(*i);
- DCHECK(!tab.navigations.empty());
- int selected_index = tab.current_navigation_index;
- selected_index = std::max(
- 0,
- std::min(selected_index,
- static_cast<int>(tab.navigations.size() - 1)));
- tab_loader_->ScheduleLoad(
- &browser->AddRestoredTab(tab.navigations,
- static_cast<int>(i - window.tabs.begin()),
- selected_index,
- tab.extension_app_id,
- false,
- tab.pinned,
- true,
- NULL)->controller());
+ RestoreTab(tab, static_cast<int>(i - window.tabs.begin()), browser);
}
}
+ void RestoreTab(const SessionTab& tab,
+ const int tab_index,
+ Browser* browser) {
+ DCHECK(!tab.navigations.empty());
+ int selected_index = tab.current_navigation_index;
+ selected_index = std::max(
+ 0,
+ std::min(selected_index,
+ static_cast<int>(tab.navigations.size() - 1)));
+ tab_loader_->ScheduleLoad(
+ &browser->AddRestoredTab(tab.navigations,
+ tab_index,
+ selected_index,
+ tab.extension_app_id,
+ false,
+ tab.pinned,
+ true,
+ NULL)->controller());
+ }
+
+ Browser* CreateRestoredBrowser(Browser::Type type,
+ gfx::Rect bounds,
+ bool is_maximized) {
+ Browser* browser = new Browser(type, profile_);
+ browser->set_override_bounds(bounds);
+ browser->set_maximized_state(is_maximized ?
+ Browser::MAXIMIZED_STATE_MAXIMIZED :
+ Browser::MAXIMIZED_STATE_UNMAXIMIZED);
+ browser->CreateBrowserWindow();
+ return browser;
+ }
+
void ShowBrowser(Browser* browser,
int initial_tab_count,
int selected_session_index) {
@@ -601,13 +631,25 @@
}
// static
-void SessionRestore::RestoreForeignSessionWindows(Profile* profile,
- std::vector<SessionWindow*>* windows) {
+void SessionRestore::RestoreForeignSessionWindows(
+ Profile* profile,
+ std::vector<SessionWindow*>::const_iterator begin,
+ std::vector<SessionWindow*>::const_iterator end) {
// Create a SessionRestore object to eventually restore the tabs.
std::vector<GURL> gurls;
SessionRestoreImpl restorer(profile,
static_cast<Browser*>(NULL), true, false, true, gurls);
- restorer.RestoreForeignSession(windows);
+ restorer.RestoreForeignSession(begin, end);
+}
+
+// static
+void SessionRestore::RestoreForeignSessionTab(Profile* profile,
+ const SessionTab& tab) {
+ // Create a SessionRestore object to eventually restore the tabs.
+ std::vector<GURL> gurls;
+ SessionRestoreImpl restorer(profile,
+ static_cast<Browser*>(NULL), true, false, true, gurls);
+ restorer.RestoreForeignTab(tab);
}
// static
diff --git a/chrome/browser/sessions/session_restore.h b/chrome/browser/sessions/session_restore.h
index bb08868..a2bc569 100644
--- a/chrome/browser/sessions/session_restore.h
+++ b/chrome/browser/sessions/session_restore.h
@@ -38,8 +38,15 @@
// Specifically used in the restoration of a foreign session. This method
// restores the given session windows to a browser.
- static void RestoreForeignSessionWindows(Profile* profile,
- std::vector<SessionWindow*>* windows);
+ static void RestoreForeignSessionWindows(
+ Profile* profile,
+ std::vector<SessionWindow*>::const_iterator begin,
+ std::vector<SessionWindow*>::const_iterator end);
+
+ // Specifically used in the restoration of a foreign session. This method
+ // restores the given session tab to a browser.
+ static void RestoreForeignSessionTab(Profile* profile,
+ const SessionTab& tab);
// Synchronously restores the last session. At least one tabbed browser is
// created, even if there is an error in restoring.
diff --git a/chrome/browser/sessions/session_restore_uitest.cc b/chrome/browser/sessions/session_restore_uitest.cc
index 051ecf7..5dcbb77 100644
--- a/chrome/browser/sessions/session_restore_uitest.cc
+++ b/chrome/browser/sessions/session_restore_uitest.cc
@@ -32,7 +32,7 @@
virtual void QuitBrowserAndRestore(int expected_tab_count) {
#if defined(OS_MACOSX)
- shutdown_type_ = UITestBase::USER_QUIT;
+ shutdown_type_ = ProxyLauncher::USER_QUIT;
#endif
UITest::TearDown();
@@ -444,7 +444,7 @@
// process.)
// Flaky as per http://crbug.com/52022
TEST_F(SessionRestoreUITest, FLAKY_ShareProcessesOnRestore) {
- if (in_process_renderer()) {
+ if (ProxyLauncher::in_process_renderer()) {
// No point in running this test in single process mode.
return;
}
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 35ddee5..f6c9efa 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -14,7 +14,7 @@
#include "base/metrics/histogram.h"
#include "base/pickle.h"
#include "base/scoped_vector.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/prefs/session_startup_pref.h"
diff --git a/chrome/browser/sessions/session_types.h b/chrome/browser/sessions/session_types.h
index a16b680..563663c 100644
--- a/chrome/browser/sessions/session_types.h
+++ b/chrome/browser/sessions/session_types.h
@@ -11,6 +11,7 @@
#include "base/stl_util-inl.h"
#include "base/string16.h"
+#include "base/time.h"
#include "chrome/browser/sessions/session_id.h"
#include "chrome/common/page_transition_types.h"
#include "gfx/rect.h"
@@ -121,6 +122,10 @@
// NOTE: when the service is creating SessionTabs, initially this
// corresponds to TabNavigation.index, not the index in navigations. When done
// creating though, this is set to the index in navigations.
+ //
+ // NOTE 2: this value can be larger than the size of |navigations|, due to
+ // only valid url's being stored (ie chrome://newtab is not stored). Bounds
+ // checking must be performed before indexing into |navigations|.
int current_navigation_index;
// True if the tab is pinned.
@@ -129,6 +134,9 @@
// If non-empty, this tab is an app tab and this is the id of the extension.
std::string extension_app_id;
+ // Timestamp for when this tab was last modified.
+ base::Time timestamp;
+
std::vector<TabNavigation> navigations;
private:
@@ -168,6 +176,9 @@
// restore does not attempt to restore them.
bool is_constrained;
+ // Timestamp for when this window was last modified.
+ base::Time timestamp;
+
// The tabs, ordered by visual order.
std::vector<SessionTab*> tabs;
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index b74df15..accbd58 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -27,7 +27,7 @@
#include "base/string_tokenizer.h"
#include "base/string_util.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/common/chrome_constants.h"
diff --git a/chrome/browser/shell_integration_mac.mm b/chrome/browser/shell_integration_mac.mm
index 035507b..15258a9 100644
--- a/chrome/browser/shell_integration_mac.mm
+++ b/chrome/browser/shell_integration_mac.mm
@@ -4,13 +4,13 @@
#include "chrome/browser/shell_integration.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import "third_party/mozilla/NSWorkspace+Utils.h"
// Sets Chromium as default browser (only for current user). Returns false if
// this operation fails (which we can't check for).
bool ShellIntegration::SetAsDefaultBrowser() {
- // We really do want the main bundle here, not mac_util::MainAppBundle(),
+ // We really do want the main bundle here, not base::mac::MainAppBundle(),
// which is the bundle for the framework.
NSString* identifier = [[NSBundle mainBundle] bundleIdentifier];
[[NSWorkspace sharedWorkspace] setDefaultBrowserWithIdentifier:identifier];
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index ad1f653..aaf1d78 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -17,7 +17,6 @@
#include "base/string_util.h"
#include "base/task.h"
#include "base/utf_string_conversions.h"
-#include "base/win_util.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/speech/speech_input_bubble.cc b/chrome/browser/speech/speech_input_bubble.cc
index 655415f..77619e9 100644
--- a/chrome/browser/speech/speech_input_bubble.cc
+++ b/chrome/browser/speech/speech_input_bubble.cc
@@ -32,9 +32,10 @@
return CreateNativeBubble(tab_contents, delegate, element_rect);
}
-SpeechInputBubbleBase::SpeechInputBubbleBase()
+SpeechInputBubbleBase::SpeechInputBubbleBase(TabContents* tab_contents)
: ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)),
- display_mode_(DISPLAY_MODE_RECORDING) {
+ display_mode_(DISPLAY_MODE_RECORDING),
+ tab_contents_(tab_contents) {
if (!mic_empty_) { // Static variables.
mic_empty_ = ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_SPEECH_INPUT_MIC_EMPTY);
diff --git a/chrome/browser/speech/speech_input_bubble.h b/chrome/browser/speech/speech_input_bubble.h
index 3faabe0..436e6bb 100644
--- a/chrome/browser/speech/speech_input_bubble.h
+++ b/chrome/browser/speech/speech_input_bubble.h
@@ -99,6 +99,9 @@
// Updates the current captured audio volume displayed on screen.
virtual void SetInputVolume(float volume) = 0;
+ // Returns the TabContents for which this bubble gets displayed.
+ virtual TabContents* tab_contents() = 0;
+
// The horizontal distance between the start of the html widget and the speech
// bubble's arrow.
static const int kBubbleTargetOffsetX;
@@ -119,7 +122,7 @@
DISPLAY_MODE_MESSAGE
};
- SpeechInputBubbleBase();
+ explicit SpeechInputBubbleBase(TabContents* tab_contents);
virtual ~SpeechInputBubbleBase();
// SpeechInputBubble methods
@@ -127,6 +130,7 @@
virtual void SetRecognizingMode();
virtual void SetMessage(const string16& text);
virtual void SetInputVolume(float volume);
+ virtual TabContents* tab_contents() { return tab_contents_; }
protected:
// Updates the platform specific UI layout for the current display mode.
@@ -159,6 +163,8 @@
scoped_ptr<SkBitmap> mic_image_;
// A temporary buffer image used in creating the above mic image.
scoped_ptr<SkBitmap> buffer_image_;
+ // TabContents in which this this bubble gets displayed.
+ TabContents* tab_contents_;
static SkBitmap* mic_full_; // Mic image with full volume.
static SkBitmap* mic_empty_; // Mic image with zero volume.
diff --git a/chrome/browser/speech/speech_input_bubble_controller.cc b/chrome/browser/speech/speech_input_bubble_controller.cc
index 682d028..b048589 100644
--- a/chrome/browser/speech/speech_input_bubble_controller.cc
+++ b/chrome/browser/speech/speech_input_bubble_controller.cc
@@ -7,13 +7,17 @@
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_util.h"
+#include "chrome/common/notification_registrar.h"
+#include "chrome/common/notification_source.h"
+#include "chrome/common/notification_type.h"
#include "gfx/rect.h"
namespace speech_input {
SpeechInputBubbleController::SpeechInputBubbleController(Delegate* delegate)
: delegate_(delegate),
- current_bubble_caller_id_(0) {
+ current_bubble_caller_id_(0),
+ registrar_(new NotificationRegistrar) {
}
SpeechInputBubbleController::~SpeechInputBubbleController() {
@@ -43,6 +47,8 @@
return;
bubbles_[caller_id] = bubble;
+
+ UpdateTabContentsSubscription(caller_id, BUBBLE_ADDED);
}
void SpeechInputBubbleController::CloseBubble(int caller_id) {
@@ -70,6 +76,60 @@
ProcessRequestInUiThread(caller_id, REQUEST_SET_MESSAGE, text, 0);
}
+void SpeechInputBubbleController::UpdateTabContentsSubscription(
+ int caller_id, ManageSubscriptionAction action) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ // If there are any other bubbles existing for the same TabContents, we would
+ // have subscribed to tab close notifications on their behalf and we need to
+ // stay registered. So we don't change the subscription in such cases.
+ TabContents* tab_contents = bubbles_[caller_id]->tab_contents();
+ for (BubbleCallerIdMap::iterator iter = bubbles_.begin();
+ iter != bubbles_.end(); ++iter) {
+ if (iter->second->tab_contents() == tab_contents &&
+ iter->first != caller_id) {
+ // At least one other bubble exists for the same TabContents. So don't
+ // make any change to the subscription.
+ return;
+ }
+ }
+
+ if (action == BUBBLE_ADDED) {
+ registrar_->Add(this, NotificationType::TAB_CONTENTS_DESTROYED,
+ Source<TabContents>(tab_contents));
+ } else {
+ registrar_->Remove(this, NotificationType::TAB_CONTENTS_DESTROYED,
+ Source<TabContents>(tab_contents));
+ }
+}
+
+void SpeechInputBubbleController::Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::TAB_CONTENTS_DESTROYED) {
+ // Cancel all bubbles and active recognition sessions for this tab.
+ TabContents* tab_contents = Source<TabContents>(source).ptr();
+ BubbleCallerIdMap::iterator iter = bubbles_.begin();
+ while (iter != bubbles_.end()) {
+ if (iter->second->tab_contents() == tab_contents) {
+ BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
+ NewRunnableMethod(
+ this,
+ &SpeechInputBubbleController::InvokeDelegateButtonClicked,
+ iter->first, SpeechInputBubble::BUTTON_CANCEL));
+ CloseBubble(iter->first);
+ // We expect to have a very small number of items in this map so
+ // redo-ing from start is ok.
+ iter = bubbles_.begin();
+ } else {
+ ++iter;
+ }
+ }
+ } else {
+ NOTREACHED() << "Unknown notification";
+ }
+}
+
void SpeechInputBubbleController::ProcessRequestInUiThread(
int caller_id, RequestType type, const string16& text, float volume) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
@@ -109,6 +169,7 @@
case REQUEST_CLOSE:
if (current_bubble_caller_id_ == caller_id)
current_bubble_caller_id_ = 0;
+ UpdateTabContentsSubscription(caller_id, BUBBLE_REMOVED);
delete bubble;
bubbles_.erase(caller_id);
break;
diff --git a/chrome/browser/speech/speech_input_bubble_controller.h b/chrome/browser/speech/speech_input_bubble_controller.h
index 0a20333..04c92b5 100644
--- a/chrome/browser/speech/speech_input_bubble_controller.h
+++ b/chrome/browser/speech/speech_input_bubble_controller.h
@@ -11,10 +11,12 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/speech/speech_input_bubble.h"
+#include "chrome/common/notification_observer.h"
namespace gfx {
class Rect;
}
+class NotificationRegistrar;
namespace speech_input {
@@ -25,7 +27,8 @@
// that bubble are reported to the delegate.
class SpeechInputBubbleController
: public base::RefCountedThreadSafe<SpeechInputBubbleController>,
- public SpeechInputBubbleDelegate {
+ public SpeechInputBubbleDelegate,
+ public NotificationObserver {
public:
// All methods of this delegate are called in the IO thread.
class Delegate {
@@ -73,6 +76,11 @@
virtual void InfoBubbleButtonClicked(SpeechInputBubble::Button button);
virtual void InfoBubbleFocusChanged();
+ // NotificationObserver implementation.
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
private:
// The various calls received by this object and handled in the UI thread.
enum RequestType {
@@ -83,6 +91,11 @@
REQUEST_CLOSE,
};
+ enum ManageSubscriptionAction {
+ BUBBLE_ADDED,
+ BUBBLE_REMOVED
+ };
+
void InvokeDelegateButtonClicked(int caller_id,
SpeechInputBubble::Button button);
void InvokeDelegateFocusChanged(int caller_id);
@@ -91,6 +104,14 @@
const string16& text,
float volume);
+ // Called whenever a bubble was added to or removed from the list. If the
+ // bubble was being added, this method registers for close notifications with
+ // the TabContents if this was the first bubble for the tab. Similarly if the
+ // bubble was being removed, this method unregisters from TabContents if this
+ // was the last bubble associated with that tab.
+ void UpdateTabContentsSubscription(int caller_id,
+ ManageSubscriptionAction action);
+
// Only accessed in the IO thread.
Delegate* delegate_;
@@ -102,7 +123,10 @@
// Map of caller-ids to bubble objects. The bubbles are weak pointers owned by
// this object and get destroyed by |CloseBubble|.
- std::map<int, SpeechInputBubble*> bubbles_;
+ typedef std::map<int, SpeechInputBubble*> BubbleCallerIdMap;
+ BubbleCallerIdMap bubbles_;
+
+ scoped_ptr<NotificationRegistrar> registrar_;
};
// This typedef is to workaround the issue with certain versions of
diff --git a/chrome/browser/speech/speech_input_bubble_controller_unittest.cc b/chrome/browser/speech/speech_input_bubble_controller_unittest.cc
index 2ed1f1b..e0ca5ba 100644
--- a/chrome/browser/speech/speech_input_bubble_controller_unittest.cc
+++ b/chrome/browser/speech/speech_input_bubble_controller_unittest.cc
@@ -5,6 +5,8 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/speech/speech_input_bubble_controller.h"
+#include "chrome/test/browser_with_test_window_test.h"
+#include "chrome/test/testing_profile.h"
#include "gfx/rect.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -22,7 +24,10 @@
BUBBLE_TEST_CLICK_TRY_AGAIN,
};
- MockSpeechInputBubble(TabContents*, Delegate* delegate, const gfx::Rect&) {
+ MockSpeechInputBubble(TabContents* tab_contents,
+ Delegate* delegate,
+ const gfx::Rect&)
+ : SpeechInputBubbleBase(tab_contents) {
VLOG(1) << "MockSpeechInputBubble created";
MessageLoop::current()->PostTask(
FROM_HERE, NewRunnableFunction(&InvokeDelegate, delegate));
@@ -62,12 +67,11 @@
// The test fixture.
class SpeechInputBubbleControllerTest
: public SpeechInputBubbleControllerDelegate,
- public testing::Test {
+ public BrowserWithTestWindowTest {
public:
SpeechInputBubbleControllerTest()
- : io_loop_(MessageLoop::TYPE_IO),
- ui_thread_(BrowserThread::UI), // constructs a new thread and loop
- io_thread_(BrowserThread::IO, &io_loop_), // resuses main thread loop
+ : BrowserWithTestWindowTest(),
+ io_thread_(BrowserThread::IO), // constructs a new thread and loop
cancel_clicked_(false),
try_again_clicked_(false),
focus_changed_(false),
@@ -91,26 +95,28 @@
} else if (button == SpeechInputBubble::BUTTON_TRY_AGAIN) {
try_again_clicked_ = true;
}
- MessageLoop::current()->Quit();
+ message_loop()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
}
virtual void InfoBubbleFocusChanged(int caller_id) {
VLOG(1) << "Received InfoBubbleFocusChanged";
EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO));
focus_changed_ = true;
- MessageLoop::current()->Quit();
+ message_loop()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
}
// testing::Test methods.
virtual void SetUp() {
+ BrowserWithTestWindowTest::SetUp();
SpeechInputBubble::set_factory(
&SpeechInputBubbleControllerTest::CreateBubble);
- ui_thread_.Start();
+ io_thread_.Start();
}
virtual void TearDown() {
SpeechInputBubble::set_factory(NULL);
- ui_thread_.Stop();
+ io_thread_.Stop();
+ BrowserWithTestWindowTest::TearDown();
}
static void ActivateBubble() {
@@ -132,14 +138,19 @@
// active.
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableFunction(&ActivateBubble));
+
+ // The |tab_contents| parameter would be NULL since the dummy caller id
+ // passed to CreateBubble would not have matched any active tab. So get a
+ // real TabContents pointer from the test fixture and pass that, because
+ // the bubble controller registers for tab close notifications which need
+ // a valid TabContents.
+ tab_contents = test_fixture_->browser()->GetSelectedTabContents();
return new MockSpeechInputBubble(tab_contents, delegate, element_rect);
}
protected:
// The main thread of the test is marked as the IO thread and we create a new
// one for the UI thread.
- MessageLoop io_loop_;
- BrowserThread ui_thread_;
BrowserThread io_thread_;
bool cancel_clicked_;
bool try_again_clicked_;
diff --git a/chrome/browser/speech/speech_input_bubble_gtk.cc b/chrome/browser/speech/speech_input_bubble_gtk.cc
index 2b159bf..eb8b906 100644
--- a/chrome/browser/speech/speech_input_bubble_gtk.cc
+++ b/chrome/browser/speech/speech_input_bubble_gtk.cc
@@ -54,7 +54,6 @@
Delegate* delegate_;
InfoBubbleGtk* info_bubble_;
- TabContents* tab_contents_;
gfx::Rect element_rect_;
bool did_invoke_close_;
@@ -68,9 +67,9 @@
SpeechInputBubbleGtk::SpeechInputBubbleGtk(TabContents* tab_contents,
Delegate* delegate,
const gfx::Rect& element_rect)
- : delegate_(delegate),
+ : SpeechInputBubbleBase(tab_contents),
+ delegate_(delegate),
info_bubble_(NULL),
- tab_contents_(tab_contents),
element_rect_(element_rect),
did_invoke_close_(false),
label_(NULL),
@@ -145,10 +144,10 @@
gtk_container_add(GTK_CONTAINER(content), vbox);
GtkThemeProvider* theme_provider = GtkThemeProvider::GetFrom(
- tab_contents_->profile());
+ tab_contents()->profile());
gfx::Rect rect(element_rect_.x() + kBubbleTargetOffsetX,
element_rect_.y() + element_rect_.height(), 1, 1);
- info_bubble_ = InfoBubbleGtk::Show(tab_contents_->GetNativeView(),
+ info_bubble_ = InfoBubbleGtk::Show(tab_contents()->GetNativeView(),
&rect,
content,
InfoBubbleGtk::ARROW_LOCATION_TOP_LEFT,
diff --git a/chrome/browser/speech/speech_input_bubble_mac.mm b/chrome/browser/speech/speech_input_bubble_mac.mm
index d4a54f2..912370e 100644
--- a/chrome/browser/speech/speech_input_bubble_mac.mm
+++ b/chrome/browser/speech/speech_input_bubble_mac.mm
@@ -30,7 +30,6 @@
private:
scoped_nsobject<SpeechInputWindowController> window_;
- TabContents* tab_contents_;
Delegate* delegate_;
gfx::Rect element_rect_;
};
@@ -38,7 +37,7 @@
SpeechInputBubbleImpl::SpeechInputBubbleImpl(TabContents* tab_contents,
Delegate* delegate,
const gfx::Rect& element_rect)
- : tab_contents_(tab_contents),
+ : SpeechInputBubbleBase(tab_contents),
delegate_(delegate),
element_rect_(element_rect) {
}
@@ -62,7 +61,7 @@
// Find the screen coordinates for the given tab and position the bubble's
// arrow anchor point inside that to point at the bottom-left of the html
// input element rect.
- gfx::NativeView view = tab_contents_->view()->GetNativeView();
+ gfx::NativeView view = tab_contents()->view()->GetNativeView();
NSRect tab_bounds = [view bounds];
NSPoint anchor = NSMakePoint(
tab_bounds.origin.x + element_rect_.x() + kBubbleTargetOffsetX,
@@ -72,7 +71,7 @@
anchor = [[view window] convertBaseToScreen:anchor];
window_.reset([[SpeechInputWindowController alloc]
- initWithParentWindow:tab_contents_->view()->GetTopLevelNativeWindow()
+ initWithParentWindow:tab_contents()->view()->GetTopLevelNativeWindow()
delegate:delegate_
anchoredAt:anchor]);
diff --git a/chrome/browser/speech/speech_input_bubble_views.cc b/chrome/browser/speech/speech_input_bubble_views.cc
index 83ccad0..2140ef4 100644
--- a/chrome/browser/speech/speech_input_bubble_views.cc
+++ b/chrome/browser/speech/speech_input_bubble_views.cc
@@ -13,10 +13,6 @@
#include "chrome/browser/tab_contents/tab_contents_view.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/views/info_bubble.h"
-#include "chrome/common/notification_observer.h"
-#include "chrome/common/notification_registrar.h"
-#include "chrome/common/notification_source.h"
-#include "chrome/common/notification_type.h"
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -66,7 +62,7 @@
const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont);
heading_ = new views::Label(
- l10n_util::GetString(IDS_SPEECH_INPUT_BUBBLE_HEADING));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)));
heading_->SetFont(font);
heading_->SetHorizontalAlignment(views::Label::ALIGN_CENTER);
AddChildView(heading_);
@@ -83,12 +79,14 @@
icon_->SetHorizontalAlignment(views::ImageView::CENTER);
AddChildView(icon_);
- cancel_ = new views::NativeButton(this, l10n_util::GetString(IDS_CANCEL));
+ cancel_ = new views::NativeButton(
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL)));
AddChildView(cancel_);
try_again_ = new views::NativeButton(
this,
- l10n_util::GetString(IDS_SPEECH_INPUT_TRY_AGAIN));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_TRY_AGAIN)));
AddChildView(try_again_);
}
@@ -103,11 +101,13 @@
if (mode == SpeechInputBubbleBase::DISPLAY_MODE_MESSAGE) {
message_->SetText(UTF16ToWideHack(message_text));
} else if (mode == SpeechInputBubbleBase::DISPLAY_MODE_RECORDING) {
- heading_->SetText(l10n_util::GetString(IDS_SPEECH_INPUT_BUBBLE_HEADING));
+ heading_->SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)));
icon_->SetImage(*ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_SPEECH_INPUT_MIC_EMPTY));
} else {
- heading_->SetText(l10n_util::GetString(IDS_SPEECH_INPUT_BUBBLE_WORKING));
+ heading_->SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_WORKING)));
}
}
@@ -196,8 +196,7 @@
// Implementation of SpeechInputBubble.
class SpeechInputBubbleImpl
: public SpeechInputBubbleBase,
- public InfoBubbleDelegate,
- public NotificationObserver {
+ public InfoBubbleDelegate {
public:
SpeechInputBubbleImpl(TabContents* tab_contents,
Delegate* delegate,
@@ -216,11 +215,6 @@
// |element_rect| is the html element's bounds in page coordinates.
gfx::Rect GetInfoBubbleTarget(const gfx::Rect& element_rect);
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
// InfoBubbleDelegate
virtual void InfoBubbleClosing(InfoBubble* info_bubble,
bool closed_by_escape);
@@ -230,9 +224,7 @@
private:
Delegate* delegate_;
InfoBubble* info_bubble_;
- TabContents* tab_contents_;
ContentView* bubble_content_;
- NotificationRegistrar registrar_;
gfx::Rect element_rect_;
// Set to true if the object is being destroyed normally instead of the
@@ -245,9 +237,9 @@
SpeechInputBubbleImpl::SpeechInputBubbleImpl(TabContents* tab_contents,
Delegate* delegate,
const gfx::Rect& element_rect)
- : delegate_(delegate),
+ : SpeechInputBubbleBase(tab_contents),
+ delegate_(delegate),
info_bubble_(NULL),
- tab_contents_(tab_contents),
bubble_content_(NULL),
element_rect_(element_rect),
did_invoke_close_(false) {
@@ -261,26 +253,14 @@
gfx::Rect SpeechInputBubbleImpl::GetInfoBubbleTarget(
const gfx::Rect& element_rect) {
gfx::Rect container_rect;
- tab_contents_->GetContainerBounds(&container_rect);
+ tab_contents()->GetContainerBounds(&container_rect);
return gfx::Rect(
container_rect.x() + element_rect.x() + kBubbleTargetOffsetX,
container_rect.y() + element_rect.y() + element_rect.height(), 1, 1);
}
-void SpeechInputBubbleImpl::Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details) {
- if (type == NotificationType::TAB_CONTENTS_DESTROYED) {
- delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_CANCEL);
- } else {
- NOTREACHED() << "Unknown notification";
- }
-}
-
void SpeechInputBubbleImpl::InfoBubbleClosing(InfoBubble* info_bubble,
bool closed_by_escape) {
- registrar_.Remove(this, NotificationType::TAB_CONTENTS_DESTROYED,
- Source<TabContents>(tab_contents_));
info_bubble_ = NULL;
bubble_content_ = NULL;
if (!did_invoke_close_)
@@ -303,7 +283,7 @@
UpdateLayout();
views::Widget* parent = views::Widget::GetWidgetFromNativeWindow(
- tab_contents_->view()->GetTopLevelNativeWindow());
+ tab_contents()->view()->GetTopLevelNativeWindow());
info_bubble_ = InfoBubble::Show(parent,
GetInfoBubbleTarget(element_rect_),
BubbleBorder::TOP_LEFT, bubble_content_,
@@ -315,9 +295,6 @@
// to end so the caller can manage this object's life cycle like a normal
// stack based or member variable object.
info_bubble_->set_fade_away_on_close(false);
-
- registrar_.Add(this, NotificationType::TAB_CONTENTS_DESTROYED,
- Source<TabContents>(tab_contents_));
}
void SpeechInputBubbleImpl::Hide() {
diff --git a/chrome/browser/speech/speech_input_dispatcher_host.cc b/chrome/browser/speech/speech_input_dispatcher_host.cc
index f1abebf..50b9aec 100644
--- a/chrome/browser/speech/speech_input_dispatcher_host.cc
+++ b/chrome/browser/speech/speech_input_dispatcher_host.cc
@@ -121,17 +121,29 @@
bool SpeechInputDispatcherHost::OnMessageReceived(
const IPC::Message& message, bool* message_was_ok) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- bool handled = true;
- IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, message, *message_was_ok)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition,
- OnStartRecognition)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_CancelRecognition,
- OnCancelRecognition)
- IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StopRecording,
- OnStopRecording)
- IPC_MESSAGE_UNHANDLED(handled = false)
- IPC_END_MESSAGE_MAP()
- return handled;
+
+ uint32 message_type = message.type();
+ if (message_type == ViewHostMsg_SpeechInput_StartRecognition::ID ||
+ message_type == ViewHostMsg_SpeechInput_CancelRecognition::ID ||
+ message_type == ViewHostMsg_SpeechInput_StopRecording::ID) {
+ if (!SpeechInputManager::IsFeatureEnabled()) {
+ *message_was_ok = false;
+ return true;
+ }
+
+ IPC_BEGIN_MESSAGE_MAP_EX(SpeechInputDispatcherHost, message,
+ *message_was_ok)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StartRecognition,
+ OnStartRecognition)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_CancelRecognition,
+ OnCancelRecognition)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_SpeechInput_StopRecording,
+ OnStopRecording)
+ IPC_END_MESSAGE_MAP()
+ return true;
+ }
+
+ return false;
}
void SpeechInputDispatcherHost::OnStartRecognition(
diff --git a/chrome/browser/speech/speech_input_manager.cc b/chrome/browser/speech/speech_input_manager.cc
index b370da4..25f0550 100644
--- a/chrome/browser/speech/speech_input_manager.cc
+++ b/chrome/browser/speech/speech_input_manager.cc
@@ -8,16 +8,20 @@
#include <string>
#include "app/l10n_util.h"
+#include "base/command_line.h"
+#include "base/lazy_instance.h"
#include "base/lock.h"
#include "base/ref_counted.h"
-#include "base/lazy_instance.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/speech/speech_input_bubble_controller.h"
#include "chrome/browser/speech/speech_recognizer.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_util.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "grit/generated_resources.h"
#include "media/audio/audio_manager.h"
@@ -135,7 +139,6 @@
// Starts/restarts recognition for an existing request.
void StartRecognitionForRequest(int caller_id);
- SpeechInputManagerDelegate* delegate_;
typedef std::map<int, SpeechInputRequest> SpeechRecognizerMap;
SpeechRecognizerMap requests_;
int recording_caller_id_;
@@ -150,6 +153,26 @@
return g_speech_input_manager_impl.Pointer();
}
+bool SpeechInputManager::IsFeatureEnabled() {
+ bool enabled = true;
+ const CommandLine& command_line = *CommandLine::ForCurrentProcess();
+
+ if (command_line.HasSwitch(switches::kDisableSpeechInput)) {
+ enabled = false;
+#if defined(GOOGLE_CHROME_BUILD)
+ } else if (!command_line.HasSwitch(switches::kEnableSpeechInput)) {
+ // We need to evaluate whether IO is OK here. http://crbug.com/63335.
+ base::ThreadRestrictions::ScopedAllowIO allow_io;
+ // Official Chrome builds have speech input enabled by default only in the
+ // dev channel.
+ std::string channel = platform_util::GetVersionStringModifier();
+ enabled = (channel == "dev");
+#endif
+ }
+
+ return enabled;
+}
+
SpeechInputManagerImpl::SpeechInputManagerImpl()
: recording_caller_id_(0),
bubble_controller_(new SpeechInputBubbleController(
diff --git a/chrome/browser/speech/speech_input_manager.h b/chrome/browser/speech/speech_input_manager.h
index be9779f..ffeaba0 100644
--- a/chrome/browser/speech/speech_input_manager.h
+++ b/chrome/browser/speech/speech_input_manager.h
@@ -32,6 +32,10 @@
virtual ~Delegate() {}
};
+ // Whether the speech input feature is enabled, based on the browser channel
+ // information and command line flags.
+ static bool IsFeatureEnabled();
+
// Factory method to access the singleton. We have this method here instead of
// using Singleton<> directly in the calling code to aid tests in injection
// mocks.
diff --git a/chrome/browser/speech/speech_recognition_request.h b/chrome/browser/speech/speech_recognition_request.h
index d6e9566..c12fc4d 100644
--- a/chrome/browser/speech/speech_recognition_request.h
+++ b/chrome/browser/speech/speech_recognition_request.h
@@ -1,9 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
#ifndef CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_
#define CHROME_BROWSER_SPEECH_SPEECH_RECOGNITION_REQUEST_H_
+#pragma once
#include <string>
#include "base/basictypes.h"
@@ -55,7 +56,7 @@
// URLFetcher::Delegate methods.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/speech/speech_recognizer.cc b/chrome/browser/speech/speech_recognizer.cc
index 3140d46..277393c 100644
--- a/chrome/browser/speech/speech_recognizer.cc
+++ b/chrome/browser/speech/speech_recognizer.cc
@@ -10,7 +10,7 @@
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/net/url_request_context_getter.h"
-#include "third_party/speex/include/speex/speex.h"
+#include "third_party/speex/speex.h"
using media::AudioInputController;
using std::list;
diff --git a/chrome/browser/spellcheck_host.cc b/chrome/browser/spellcheck_host.cc
index 638c83f..7a5ffa6 100644
--- a/chrome/browser/spellcheck_host.cc
+++ b/chrome/browser/spellcheck_host.cc
@@ -11,7 +11,7 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "base/string_split.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/profiles/profile.h"
@@ -255,7 +255,7 @@
void SpellCheckHost::OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data) {
diff --git a/chrome/browser/spellcheck_host.h b/chrome/browser/spellcheck_host.h
index aad254a..1f09b35 100644
--- a/chrome/browser/spellcheck_host.h
+++ b/chrome/browser/spellcheck_host.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -89,7 +89,7 @@
// spellcheck dictionary; saves the dictionary to |data_|.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/spellchecker_mac.mm b/chrome/browser/spellchecker_mac.mm
index 91d6f3e..ead554f 100644
--- a/chrome/browser/spellchecker_mac.mm
+++ b/chrome/browser/spellchecker_mac.mm
@@ -118,7 +118,10 @@
void UpdateSpellingPanelWithMisspelledWord(const string16& word) {
NSString * word_to_display = base::SysUTF16ToNSString(word);
[[NSSpellChecker sharedSpellChecker]
- updateSpellingPanelWithMisspelledWord:word_to_display];
+ performSelectorOnMainThread:
+ @selector(updateSpellingPanelWithMisspelledWord:)
+ withObject:word_to_display
+ waitUntilDone:YES];
}
void Init() {
diff --git a/chrome/browser/ssl/ssl_blocking_page.cc b/chrome/browser/ssl/ssl_blocking_page.cc
index b2bf6a1..ebec519 100644
--- a/chrome/browser/ssl/ssl_blocking_page.cc
+++ b/chrome/browser/ssl/ssl_blocking_page.cc
@@ -68,8 +68,8 @@
// Let's build the html error page.
DictionaryValue strings;
SSLErrorInfo error_info = delegate_->GetSSLErrorInfo(handler_);
- strings.SetString("headLine", WideToUTF16Hack(error_info.title()));
- strings.SetString("description", WideToUTF16Hack(error_info.details()));
+ strings.SetString("headLine", error_info.title());
+ strings.SetString("description", error_info.details());
strings.SetString("moreInfoTitle",
l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE));
@@ -158,14 +158,14 @@
// static
void SSLBlockingPage::SetExtraInfo(
DictionaryValue* strings,
- const std::vector<std::wstring>& extra_info) {
+ const std::vector<string16>& extra_info) {
DCHECK(extra_info.size() < 5); // We allow 5 paragraphs max.
const char* keys[5] = {
"moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5"
};
int i;
for (i = 0; i < static_cast<int>(extra_info.size()); i++) {
- strings->SetString(keys[i], WideToUTF16Hack(extra_info[i]));
+ strings->SetString(keys[i], extra_info[i]);
}
for (; i < 5; i++) {
strings->SetString(keys[i], "");
diff --git a/chrome/browser/ssl/ssl_blocking_page.h b/chrome/browser/ssl/ssl_blocking_page.h
index 0e76152..9b6584d 100644
--- a/chrome/browser/ssl/ssl_blocking_page.h
+++ b/chrome/browser/ssl/ssl_blocking_page.h
@@ -7,7 +7,9 @@
#pragma once
#include <string>
+#include <vector>
+#include "base/string16.h"
#include "chrome/browser/ssl/ssl_error_info.h"
#include "chrome/browser/tab_contents/interstitial_page.h"
@@ -53,7 +55,7 @@
// ssl_error.html files.
// Note: there can be up to 5 strings in |extra_info|.
static void SetExtraInfo(DictionaryValue* strings,
- const std::vector<std::wstring>& extra_info);
+ const std::vector<string16>& extra_info);
protected:
// InterstitialPage implementation.
diff --git a/chrome/browser/ssl/ssl_browser_tests.cc b/chrome/browser/ssl/ssl_browser_tests.cc
index 3919fc3..0e6b44a 100644
--- a/chrome/browser/ssl/ssl_browser_tests.cc
+++ b/chrome/browser/ssl/ssl_browser_tests.cc
@@ -239,7 +239,8 @@
}
// Visits a page with https error and proceed:
-IN_PROC_BROWSER_TEST_F(SSLUITest, TestHTTPSExpiredCertAndProceed) {
+// Disabled, http://crbug.com/68448.
+IN_PROC_BROWSER_TEST_F(SSLUITest, DISABLED_TestHTTPSExpiredCertAndProceed) {
ASSERT_TRUE(https_server_expired_.Start());
ui_test_utils::NavigateToURL(browser(),
diff --git a/chrome/browser/ssl/ssl_error_info.cc b/chrome/browser/ssl/ssl_error_info.cc
index b10e212..6769d88 100644
--- a/chrome/browser/ssl/ssl_error_info.cc
+++ b/chrome/browser/ssl/ssl_error_info.cc
@@ -15,10 +15,10 @@
#include "net/base/net_errors.h"
#include "net/base/ssl_info.h"
-SSLErrorInfo::SSLErrorInfo(const std::wstring& title,
- const std::wstring& details,
- const std::wstring& short_description,
- const std::vector<std::wstring>& extra_info)
+SSLErrorInfo::SSLErrorInfo(const string16& title,
+ const string16& details,
+ const string16& short_description,
+ const std::vector<string16>& extra_info)
: title_(title),
details_(details),
short_description_(short_description),
@@ -29,11 +29,12 @@
SSLErrorInfo SSLErrorInfo::CreateError(ErrorType error_type,
net::X509Certificate* cert,
const GURL& request_url) {
- std::wstring title, details, short_description;
- std::vector<std::wstring> extra_info;
+ string16 title, details, short_description;
+ std::vector<string16> extra_info;
switch (error_type) {
case CERT_COMMON_NAME_INVALID: {
- title = l10n_util::GetString(IDS_CERT_ERROR_COMMON_NAME_INVALID_TITLE);
+ title =
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_COMMON_NAME_INVALID_TITLE);
// If the certificate contains multiple DNS names, we choose the most
// representative one -- either the DNS name that's also in the subject
// field, or the first one. If this heuristic turns out to be
@@ -51,135 +52,138 @@
if (i == dns_names.size())
i = 0;
details =
- l10n_util::GetStringF(IDS_CERT_ERROR_COMMON_NAME_INVALID_DETAILS,
- UTF8ToWide(request_url.host()),
- UTF8ToWide(dns_names[i]),
- UTF8ToWide(request_url.host()));
- short_description =
- l10n_util::GetString(IDS_CERT_ERROR_COMMON_NAME_INVALID_DESCRIPTION);
+ l10n_util::GetStringFUTF16(IDS_CERT_ERROR_COMMON_NAME_INVALID_DETAILS,
+ UTF8ToUTF16(request_url.host()),
+ UTF8ToUTF16(dns_names[i]),
+ UTF8ToUTF16(request_url.host()));
+ short_description = l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_COMMON_NAME_INVALID_DESCRIPTION);
extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_1));
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_1));
extra_info.push_back(
- l10n_util::GetStringF(
+ l10n_util::GetStringFUTF16(
IDS_CERT_ERROR_COMMON_NAME_INVALID_EXTRA_INFO_2,
- UTF8ToWide(cert->subject().common_name),
- UTF8ToWide(request_url.host())));
+ UTF8ToUTF16(cert->subject().common_name),
+ UTF8ToUTF16(request_url.host())));
break;
}
case CERT_DATE_INVALID:
extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_1));
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_1));
if (cert->HasExpired()) {
- title = l10n_util::GetString(IDS_CERT_ERROR_EXPIRED_TITLE);
- details = l10n_util::GetStringF(IDS_CERT_ERROR_EXPIRED_DETAILS,
- UTF8ToWide(request_url.host()),
- UTF8ToWide(request_url.host()));
+ title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXPIRED_TITLE);
+ details = l10n_util::GetStringFUTF16(IDS_CERT_ERROR_EXPIRED_DETAILS,
+ UTF8ToUTF16(request_url.host()),
+ UTF8ToUTF16(request_url.host()));
short_description =
- l10n_util::GetString(IDS_CERT_ERROR_EXPIRED_DESCRIPTION);
- extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_EXPIRED_DETAILS_EXTRA_INFO_2));
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXPIRED_DESCRIPTION);
+ extra_info.push_back(l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_EXPIRED_DETAILS_EXTRA_INFO_2));
} else {
// Then it must be not yet valid. We don't check that it is not yet
// valid as there is still a very unlikely chance that the cert might
// have become valid since the error occurred.
- title = l10n_util::GetString(IDS_CERT_ERROR_NOT_YET_VALID_TITLE);
- details = l10n_util::GetStringF(IDS_CERT_ERROR_NOT_YET_VALID_DETAILS,
- UTF8ToWide(request_url.host()),
- UTF8ToWide(request_url.host()));
+ title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_NOT_YET_VALID_TITLE);
+ details = l10n_util::GetStringFUTF16(
+ IDS_CERT_ERROR_NOT_YET_VALID_DETAILS,
+ UTF8ToUTF16(request_url.host()),
+ UTF8ToUTF16(request_url.host()));
short_description =
- l10n_util::GetString(IDS_CERT_ERROR_NOT_YET_VALID_DESCRIPTION);
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_NOT_YET_VALID_DESCRIPTION);
extra_info.push_back(
- l10n_util::GetString(
+ l10n_util::GetStringUTF16(
IDS_CERT_ERROR_NOT_YET_VALID_DETAILS_EXTRA_INFO_2));
}
break;
case CERT_AUTHORITY_INVALID:
- title = l10n_util::GetString(IDS_CERT_ERROR_AUTHORITY_INVALID_TITLE);
- details = l10n_util::GetStringF(IDS_CERT_ERROR_AUTHORITY_INVALID_DETAILS,
- UTF8ToWide(request_url.host()));
- short_description =
- l10n_util::GetString(IDS_CERT_ERROR_AUTHORITY_INVALID_DESCRIPTION);
+ title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_AUTHORITY_INVALID_TITLE);
+ details = l10n_util::GetStringFUTF16(
+ IDS_CERT_ERROR_AUTHORITY_INVALID_DETAILS,
+ UTF8ToUTF16(request_url.host()));
+ short_description = l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_AUTHORITY_INVALID_DESCRIPTION);
extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_1));
- extra_info.push_back(
- l10n_util::GetStringF(IDS_CERT_ERROR_AUTHORITY_INVALID_EXTRA_INFO_2,
- UTF8ToWide(request_url.host()),
- UTF8ToWide(request_url.host())));
- extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_AUTHORITY_INVALID_EXTRA_INFO_3));
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_1));
+ extra_info.push_back(l10n_util::GetStringFUTF16(
+ IDS_CERT_ERROR_AUTHORITY_INVALID_EXTRA_INFO_2,
+ UTF8ToUTF16(request_url.host()),
+ UTF8ToUTF16(request_url.host())));
+ extra_info.push_back(l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_AUTHORITY_INVALID_EXTRA_INFO_3));
break;
case CERT_CONTAINS_ERRORS:
- title = l10n_util::GetString(IDS_CERT_ERROR_CONTAINS_ERRORS_TITLE);
- details = l10n_util::GetStringF(IDS_CERT_ERROR_CONTAINS_ERRORS_DETAILS,
- UTF8ToWide(request_url.host()));
+ title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_CONTAINS_ERRORS_TITLE);
+ details = l10n_util::GetStringFUTF16(
+ IDS_CERT_ERROR_CONTAINS_ERRORS_DETAILS,
+ UTF8ToUTF16(request_url.host()));
short_description =
- l10n_util::GetString(IDS_CERT_ERROR_CONTAINS_ERRORS_DESCRIPTION);
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_CONTAINS_ERRORS_DESCRIPTION);
extra_info.push_back(
- l10n_util::GetStringF(IDS_CERT_ERROR_EXTRA_INFO_1,
- UTF8ToWide(request_url.host())));
- extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_CONTAINS_ERRORS_EXTRA_INFO_2));
+ l10n_util::GetStringFUTF16(IDS_CERT_ERROR_EXTRA_INFO_1,
+ UTF8ToUTF16(request_url.host())));
+ extra_info.push_back(l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_CONTAINS_ERRORS_EXTRA_INFO_2));
break;
case CERT_NO_REVOCATION_MECHANISM:
- title =
- l10n_util::GetString(IDS_CERT_ERROR_NO_REVOCATION_MECHANISM_TITLE);
- details =
- l10n_util::GetString(IDS_CERT_ERROR_NO_REVOCATION_MECHANISM_DETAILS);
- short_description = l10n_util::GetString(
+ title = l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_NO_REVOCATION_MECHANISM_TITLE);
+ details = l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_NO_REVOCATION_MECHANISM_DETAILS);
+ short_description = l10n_util::GetStringUTF16(
IDS_CERT_ERROR_NO_REVOCATION_MECHANISM_DESCRIPTION);
break;
case CERT_UNABLE_TO_CHECK_REVOCATION:
- title =
- l10n_util::GetString(IDS_CERT_ERROR_UNABLE_TO_CHECK_REVOCATION_TITLE);
- details = l10n_util::GetString(
+ title = l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_UNABLE_TO_CHECK_REVOCATION_TITLE);
+ details = l10n_util::GetStringUTF16(
IDS_CERT_ERROR_UNABLE_TO_CHECK_REVOCATION_DETAILS);
- short_description = l10n_util::GetString(
+ short_description = l10n_util::GetStringUTF16(
IDS_CERT_ERROR_UNABLE_TO_CHECK_REVOCATION_DESCRIPTION);
break;
case CERT_REVOKED:
- title = l10n_util::GetString(IDS_CERT_ERROR_REVOKED_CERT_TITLE);
- details = l10n_util::GetStringF(IDS_CERT_ERROR_REVOKED_CERT_DETAILS,
- UTF8ToWide(request_url.host()));
+ title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_REVOKED_CERT_TITLE);
+ details = l10n_util::GetStringFUTF16(IDS_CERT_ERROR_REVOKED_CERT_DETAILS,
+ UTF8ToUTF16(request_url.host()));
short_description =
- l10n_util::GetString(IDS_CERT_ERROR_REVOKED_CERT_DESCRIPTION);
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_REVOKED_CERT_DESCRIPTION);
extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_1));
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_1));
extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_REVOKED_CERT_EXTRA_INFO_2));
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_REVOKED_CERT_EXTRA_INFO_2));
break;
case CERT_INVALID:
- title = l10n_util::GetString(IDS_CERT_ERROR_INVALID_CERT_TITLE);
- details = l10n_util::GetString(IDS_CERT_ERROR_INVALID_CERT_DETAILS);
+ title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_INVALID_CERT_TITLE);
+ details = l10n_util::GetStringUTF16(IDS_CERT_ERROR_INVALID_CERT_DETAILS);
short_description =
- l10n_util::GetString(IDS_CERT_ERROR_INVALID_CERT_DESCRIPTION);
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_INVALID_CERT_DESCRIPTION);
break;
case CERT_WEAK_SIGNATURE_ALGORITHM:
- title =
- l10n_util::GetString(IDS_CERT_ERROR_WEAK_SIGNATURE_ALGORITHM_TITLE);
- details = l10n_util::GetStringF(
+ title = l10n_util::GetStringUTF16(
+ IDS_CERT_ERROR_WEAK_SIGNATURE_ALGORITHM_TITLE);
+ details = l10n_util::GetStringFUTF16(
IDS_CERT_ERROR_WEAK_SIGNATURE_ALGORITHM_DETAILS,
- UTF8ToWide(request_url.host()));
- short_description = l10n_util::GetString(
+ UTF8ToUTF16(request_url.host()));
+ short_description = l10n_util::GetStringUTF16(
IDS_CERT_ERROR_WEAK_SIGNATURE_ALGORITHM_DESCRIPTION);
extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_EXTRA_INFO_1));
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_1));
extra_info.push_back(
- l10n_util::GetString(
+ l10n_util::GetStringUTF16(
IDS_CERT_ERROR_WEAK_SIGNATURE_ALGORITHM_EXTRA_INFO_2));
break;
case CERT_NOT_IN_DNS:
- title = l10n_util::GetString(IDS_CERT_ERROR_NOT_IN_DNS_TITLE);
- details = l10n_util::GetString(IDS_CERT_ERROR_NOT_IN_DNS_DETAILS);
- short_description = l10n_util::GetString(
+ title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_NOT_IN_DNS_TITLE);
+ details = l10n_util::GetStringUTF16(IDS_CERT_ERROR_NOT_IN_DNS_DETAILS);
+ short_description = l10n_util::GetStringUTF16(
IDS_CERT_ERROR_NOT_IN_DNS_DESCRIPTION);
extra_info.push_back(
- l10n_util::GetString(IDS_CERT_ERROR_NOT_IN_DNS_EXTRA_INFO));
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_NOT_IN_DNS_EXTRA_INFO));
break;
case UNKNOWN:
- title = l10n_util::GetString(IDS_CERT_ERROR_UNKNOWN_ERROR_TITLE);
- details = l10n_util::GetString(IDS_CERT_ERROR_UNKNOWN_ERROR_DETAILS);
+ title = l10n_util::GetStringUTF16(IDS_CERT_ERROR_UNKNOWN_ERROR_TITLE);
+ details = l10n_util::GetStringUTF16(IDS_CERT_ERROR_UNKNOWN_ERROR_DETAILS);
short_description =
- l10n_util::GetString(IDS_CERT_ERROR_UNKNOWN_ERROR_DESCRIPTION);
+ l10n_util::GetStringUTF16(IDS_CERT_ERROR_UNKNOWN_ERROR_DESCRIPTION);
break;
default:
NOTREACHED();
diff --git a/chrome/browser/ssl/ssl_error_info.h b/chrome/browser/ssl/ssl_error_info.h
index 225ccf6..ca87a0b 100644
--- a/chrome/browser/ssl/ssl_error_info.h
+++ b/chrome/browser/ssl/ssl_error_info.h
@@ -9,6 +9,7 @@
#include <string>
#include <vector>
+#include "base/string16.h"
#include "net/base/x509_certificate.h"
class GURL;
@@ -51,32 +52,32 @@
std::vector<SSLErrorInfo>* errors);
// A title describing the error, usually to be used with the details below.
- const std::wstring& title() const { return title_; }
+ const string16& title() const { return title_; }
// A description of the error.
- const std::wstring& details() const { return details_; }
+ const string16& details() const { return details_; }
// A short message describing the error (1 line).
- const std::wstring& short_description() const { return short_description_; }
+ const string16& short_description() const { return short_description_; }
// A lengthy explanation of what the error is. Each entry in the returned
// vector is a paragraph.
- const std::vector<std::wstring>& extra_information() const {
+ const std::vector<string16>& extra_information() const {
return extra_information_;
}
private:
- SSLErrorInfo(const std::wstring& title,
- const std::wstring& details,
- const std::wstring& short_description,
- const std::vector<std::wstring>& extra_info);
+ SSLErrorInfo(const string16& title,
+ const string16& details,
+ const string16& short_description,
+ const std::vector<string16>& extra_info);
- std::wstring title_;
- std::wstring details_;
- std::wstring short_description_;
+ string16 title_;
+ string16 details_;
+ string16 short_description_;
// Extra-informations contains paragraphs of text explaining in details what
// the error is and what the risks are.
- std::vector<std::wstring> extra_information_;
+ std::vector<string16> extra_information_;
};
#endif // CHROME_BROWSER_SSL_SSL_ERROR_INFO_H_
diff --git a/chrome/browser/ssl/ssl_host_state.h b/chrome/browser/ssl/ssl_host_state.h
index 43880f3..a23a239 100644
--- a/chrome/browser/ssl/ssl_host_state.h
+++ b/chrome/browser/ssl/ssl_host_state.h
@@ -11,7 +11,7 @@
#include <set>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
+#include "base/threading/non_thread_safe.h"
#include "googleurl/src/gurl.h"
#include "net/base/x509_certificate.h"
@@ -23,7 +23,7 @@
// from the SSLManager because this state is shared across many navigation
// controllers.
-class SSLHostState : public NonThreadSafe {
+class SSLHostState : public base::NonThreadSafe {
public:
SSLHostState();
~SSLHostState();
diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc
index f874cc0..7c9cd8f 100644
--- a/chrome/browser/ssl/ssl_manager.cc
+++ b/chrome/browser/ssl/ssl_manager.cc
@@ -11,12 +11,15 @@
#include "chrome/browser/net/url_request_tracking.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/renderer_host/resource_request_details.h"
+#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
+#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "chrome/browser/ssl/ssl_cert_error_handler.h"
#include "chrome/browser/ssl/ssl_policy.h"
#include "chrome/browser/ssl/ssl_request_info.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/provisional_load_details.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "grit/generated_resources.h"
@@ -95,17 +98,18 @@
}
// static
-std::wstring SSLManager::GetEVCertName(const net::X509Certificate& cert) {
+string16 SSLManager::GetEVCertName(const net::X509Certificate& cert) {
// EV are required to have an organization name and country.
if (cert.subject().organization_names.empty() ||
cert.subject().country_name.empty()) {
NOTREACHED();
- return std::wstring();
+ return string16();
}
- return l10n_util::GetStringF(IDS_SECURE_CONNECTION_EV,
- UTF8ToWide(cert.subject().organization_names[0]),
- UTF8ToWide(cert.subject().country_name));
+ return l10n_util::GetStringFUTF16(
+ IDS_SECURE_CONNECTION_EV,
+ UTF8ToUTF16(cert.subject().organization_names[0]),
+ UTF8ToUTF16(cert.subject().country_name));
}
SSLManager::SSLManager(NavigationController* controller)
@@ -118,9 +122,9 @@
registrar_.Add(this, NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR,
Source<NavigationController>(controller_));
registrar_.Add(this, NotificationType::RESOURCE_RESPONSE_STARTED,
- Source<NavigationController>(controller_));
+ Source<RenderViewHostDelegate>(controller_->tab_contents()));
registrar_.Add(this, NotificationType::RESOURCE_RECEIVED_REDIRECT,
- Source<NavigationController>(controller_));
+ Source<RenderViewHostDelegate>(controller_->tab_contents()));
registrar_.Add(this, NotificationType::LOAD_FROM_MEMORY_CACHE,
Source<NavigationController>(controller_));
registrar_.Add(this, NotificationType::SSL_INTERNAL_STATE_CHANGED,
@@ -204,8 +208,6 @@
}
void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) {
- DCHECK(details);
-
// Simulate loading this resource through the usual path.
// Note that we specify SUB_RESOURCE as the resource type as WebCore only
// caches sub-resources.
@@ -225,8 +227,6 @@
}
void SSLManager::DidStartResourceResponse(ResourceRequestDetails* details) {
- DCHECK(details);
-
scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo(
details->url(),
details->resource_type(),
diff --git a/chrome/browser/ssl/ssl_manager.h b/chrome/browser/ssl/ssl_manager.h
index 0c61596..c488c35 100644
--- a/chrome/browser/ssl/ssl_manager.h
+++ b/chrome/browser/ssl/ssl_manager.h
@@ -10,6 +10,7 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
+#include "base/string16.h"
#include "chrome/browser/ssl/ssl_policy_backend.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -66,7 +67,7 @@
int* connection_status);
// Returns "<organization_name> [<country>]".
- static std::wstring GetEVCertName(const net::X509Certificate& cert);
+ static string16 GetEVCertName(const net::X509Certificate& cert);
// Construct an SSLManager for the specified tab.
// If |delegate| is NULL, SSLPolicy::GetDefaultPolicy() is used.
diff --git a/chrome/browser/sync/abstract_profile_sync_service_test.h b/chrome/browser/sync/abstract_profile_sync_service_test.h
index 57b3791..b5fc1c2 100644
--- a/chrome/browser/sync/abstract_profile_sync_service_test.h
+++ b/chrome/browser/sync/abstract_profile_sync_service_test.h
@@ -15,6 +15,7 @@
#include "chrome/browser/net/gaia/token_service.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/autofill_model_associator.h"
+#include "chrome/browser/sync/glue/autofill_profile_model_associator.h"
#include "chrome/browser/sync/glue/password_model_associator.h"
#include "chrome/browser/sync/glue/preference_model_associator.h"
#include "chrome/browser/sync/glue/session_model_associator.h"
@@ -65,6 +66,9 @@
case syncable::AUTOFILL:
tag_name = browser_sync::kAutofillTag;
break;
+ case syncable::AUTOFILL_PROFILE:
+ tag_name = browser_sync::kAutofillProfileTag;
+ break;
case syncable::PREFERENCES:
tag_name = browser_sync::kPreferencesTag;
break;
diff --git a/chrome/browser/sync/engine/read_node_mock.h b/chrome/browser/sync/engine/read_node_mock.h
index f13eddd..564f01d 100644
--- a/chrome/browser/sync/engine/read_node_mock.h
+++ b/chrome/browser/sync/engine/read_node_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,8 +13,9 @@
class ReadNodeMock : public sync_api::ReadNode {
public:
- ReadNodeMock() { }
+ ReadNodeMock() {}
virtual ~ReadNodeMock() {}
+
MOCK_METHOD2(InitByClientTagLookup,
bool(syncable::ModelType model_type, const std::string& tag));
MOCK_CONST_METHOD0(GetAutofillProfileSpecifics,
@@ -25,5 +26,6 @@
MOCK_CONST_METHOD0(GetSuccessorId, int64());
MOCK_METHOD1(InitByIdLookup, bool(int64 id));
};
+
#endif // CHROME_BROWSER_SYNC_ENGINE_READ_NODE_MOCK_H_
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index 112878d..206125b 100644
--- a/chrome/browser/sync/engine/syncapi.cc
+++ b/chrome/browser/sync/engine/syncapi.cc
@@ -14,7 +14,6 @@
#include "base/lock.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
#include "base/sha1.h"
#include "base/string_util.h"
@@ -217,6 +216,10 @@
return GetEntry()->Get(syncable::META_HANDLE);
}
+int64 BaseNode::GetModificationTime() const {
+ return GetEntry()->Get(syncable::MTIME);
+}
+
bool BaseNode::GetIsFolder() const {
return GetEntry()->Get(syncable::IS_DIR);
}
diff --git a/chrome/browser/sync/engine/syncapi.h b/chrome/browser/sync/engine/syncapi.h
index e2503cb..d86ed71 100644
--- a/chrome/browser/sync/engine/syncapi.h
+++ b/chrome/browser/sync/engine/syncapi.h
@@ -153,6 +153,9 @@
// different ID value.
virtual int64 GetId() const;
+ // Returns the modification time of the object (in TimeTicks internal format).
+ int64 GetModificationTime() const;
+
// Nodes are hierarchically arranged into a single-rooted tree.
// InitByRootLookup on ReadNode allows access to the root. GetParentId is
// how you find a node's parent.
diff --git a/chrome/browser/sync/engine/syncer_thread.cc b/chrome/browser/sync/engine/syncer_thread.cc
index 501577d..3c0cd06 100644
--- a/chrome/browser/sync/engine/syncer_thread.cc
+++ b/chrome/browser/sync/engine/syncer_thread.cc
@@ -59,7 +59,7 @@
int milliseconds_from_now,
NudgeSource source,
const syncable::ModelTypeBitSet& model_types) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (vault_.syncer_ == NULL) {
return;
}
@@ -70,7 +70,7 @@
void SyncerThread::NudgeSyncer(
int milliseconds_from_now,
NudgeSource source) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (vault_.syncer_ == NULL) {
return;
}
@@ -107,7 +107,7 @@
// and false otherwise.
bool SyncerThread::Start() {
{
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (thread_.IsRunning()) {
return true;
}
@@ -141,7 +141,7 @@
void SyncerThread::RequestSyncerExitAndSetThreadStopConditions() {
{
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
// If the thread has been started, then we either already have or are about
// to enter ThreadMainLoop so we have to proceed with shutdown and wait for
// it to finish. If the thread has not been started --and we now own the
@@ -170,7 +170,7 @@
}
bool SyncerThread::RequestPause() {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
if (vault_.pause_requested_ || vault_.paused_)
return false;
@@ -195,7 +195,7 @@
}
bool SyncerThread::RequestResume() {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
// Only valid to request a resume when we are already paused or we
// have a pause pending.
if (!(vault_.paused_ || vault_.pause_requested_))
@@ -530,7 +530,7 @@
}
void SyncerThread::ThreadMain() {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
// Signal Start() to let it know we've made it safely onto the message loop,
// and unblock it's caller.
thread_main_started_.Signal();
@@ -637,7 +637,7 @@
}
void SyncerThread::CreateSyncer(const std::string& dirname) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
VLOG(1) << "Creating syncer up for: " << dirname;
// The underlying database structure is ready, and we should create
// the syncer.
@@ -655,7 +655,7 @@
// server.
static inline void CheckConnected(bool* connected,
HttpResponse::ServerConnectionCode code,
- ConditionVariable* condvar) {
+ base::ConditionVariable* condvar) {
if (*connected) {
// Note, be careful when adding cases here because if the SyncerThread
// thinks there is no valid connection as determined by this method, it
@@ -686,7 +686,7 @@
void SyncerThread::HandleServerConnectionEvent(
const ServerConnectionEvent& event) {
if (ServerConnectionEvent::STATUS_CHANGED == event.what_happened) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
CheckConnected(&vault_.connected_, event.connection_code,
&vault_field_changed_);
}
@@ -771,7 +771,7 @@
}
void SyncerThread::SetNotificationsEnabled(bool notifications_enabled) {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
session_context_->set_notifications_enabled(notifications_enabled);
}
diff --git a/chrome/browser/sync/engine/syncer_thread.h b/chrome/browser/sync/engine/syncer_thread.h
index 6681225..22531d8 100644
--- a/chrome/browser/sync/engine/syncer_thread.h
+++ b/chrome/browser/sync/engine/syncer_thread.h
@@ -14,21 +14,22 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/condition_variable.h"
#include "base/gtest_prod_util.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/threading/thread.h"
#include "base/time.h"
-#include "base/waitable_event.h"
-#if defined(OS_LINUX)
-#include "chrome/browser/sync/engine/idle_query_linux.h"
-#endif
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/sync/engine/syncer_types.h"
#include "chrome/browser/sync/sessions/sync_session.h"
#include "chrome/browser/sync/syncable/model_type.h"
#include "chrome/common/deprecated/event_sys-inl.h"
+#if defined(OS_LINUX)
+#include "chrome/browser/sync/engine/idle_query_linux.h"
+#endif
+
class EventListenerHookup;
namespace browser_sync {
@@ -213,10 +214,10 @@
// Gets signaled whenever a thread outside of the syncer thread changes a
// protected field in the vault_.
- ConditionVariable vault_field_changed_;
+ base::ConditionVariable vault_field_changed_;
// Used to lock everything in |vault_|.
- Lock lock_;
+ base::Lock lock_;
private:
// Threshold multipler for how long before user should be considered idle.
diff --git a/chrome/browser/sync/engine/syncer_thread_unittest.cc b/chrome/browser/sync/engine/syncer_thread_unittest.cc
index 887bcc1..df0733b 100644
--- a/chrome/browser/sync/engine/syncer_thread_unittest.cc
+++ b/chrome/browser/sync/engine/syncer_thread_unittest.cc
@@ -8,7 +8,7 @@
#include "base/lock.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/sync/engine/model_safe_worker.h"
#include "chrome/browser/sync/engine/syncer_thread.h"
#include "chrome/browser/sync/engine/syncer_types.h"
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller.h b/chrome/browser/sync/glue/autofill_data_type_controller.h
index d73edf2..2daedb4 100644
--- a/chrome/browser/sync/glue/autofill_data_type_controller.h
+++ b/chrome/browser/sync/glue/autofill_data_type_controller.h
@@ -10,7 +10,7 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/autofill/personal_data_manager.h"
#include "chrome/browser/sync/profile_sync_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
index 6ff8af6..127b591 100644
--- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
@@ -8,7 +8,7 @@
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/autofill/personal_data_manager.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/sync/glue/autofill_data_type_controller.h"
diff --git a/chrome/browser/sync/glue/autofill_model_associator.cc b/chrome/browser/sync/glue/autofill_model_associator.cc
index f1340df..289d5fb 100644
--- a/chrome/browser/sync/glue/autofill_model_associator.cc
+++ b/chrome/browser/sync/glue/autofill_model_associator.cc
@@ -237,8 +237,7 @@
bool autofill_profile_not_migrated = HasNotMigratedYet(write_trans);
- if (MigrationLoggingEnabled() &&
- autofill_profile_not_migrated) {
+ if (VLOG_IS_ON(1) && autofill_profile_not_migrated) {
VLOG(1) << "[AUTOFILL MIGRATION]"
<< "Printing profiles from web db";
@@ -251,7 +250,7 @@
}
}
- if (MigrationLoggingEnabled() && autofill_profile_not_migrated) {
+ if (autofill_profile_not_migrated) {
VLOG(1) << "[AUTOFILL MIGRATION]"
<< "Iterating over sync db";
}
@@ -271,11 +270,9 @@
} else if (autofill.has_profile()) {
// Ignore autofill profiles if we are not upgrading.
if (autofill_profile_not_migrated) {
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION] Looking for "
- << autofill.profile().name_first()
- << autofill.profile().name_last();
- }
+ VLOG(1) << "[AUTOFILL MIGRATION] Looking for "
+ << autofill.profile().name_first()
+ << autofill.profile().name_last();
AddNativeProfileIfNeeded(
autofill.profile(),
bundle,
@@ -355,19 +352,15 @@
profile, all_profiles_from_db);
if (profile_in_web_db != NULL) {
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << "Node found in web db. So associating";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << "Node found in web db. So associating";
int64 sync_id = node.GetId();
std::string guid = profile_in_web_db->guid();
Associate(&guid, sync_id);
return;
} else { // Create a new node.
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << "Node not found in web db so creating and associating";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << "Node not found in web db so creating and associating";
std::string guid = guid::GenerateGUID();
Associate(&guid, node.GetId());
AutoFillProfile* p = new AutoFillProfile(guid);
@@ -555,11 +548,9 @@
}
if (autofill_migration_state == syncable::INSUFFICIENT_INFO_TO_DETERMINE) {
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << "current autofill migration state is insufficient info to"
- << "determine.";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << "current autofill migration state is insufficient info to"
+ << "determine.";
sync_api::ReadNode autofill_profile_root_node(trans);
if (!autofill_profile_root_node.InitByTagLookup(
browser_sync::kAutofillProfileTag) ||
@@ -568,29 +559,21 @@
sync_service()->backend()->SetAutofillMigrationState(
syncable::NOT_MIGRATED);
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << "Current autofill migration state is NOT Migrated because"
- << "legacy autofill root node is present whereas new "
- << "Autofill profile root node is absent.";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << "Current autofill migration state is NOT Migrated because"
+ << "legacy autofill root node is present whereas new "
+ << "Autofill profile root node is absent.";
return true;
}
sync_service()->backend()->SetAutofillMigrationState(syncable::MIGRATED);
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << "Current autofill migration state is migrated.";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << "Current autofill migration state is migrated.";
}
return false;
}
-bool AutofillModelAssociator::MigrationLoggingEnabled() {
- // [TODO] enable logging via a command line flag.
- return false;
-}
} // namespace browser_sync
diff --git a/chrome/browser/sync/glue/autofill_model_associator.h b/chrome/browser/sync/glue/autofill_model_associator.h
index 3f1104e..553580f 100644
--- a/chrome/browser/sync/glue/autofill_model_associator.h
+++ b/chrome/browser/sync/glue/autofill_model_associator.h
@@ -173,8 +173,6 @@
// user requested an abort.
bool IsAbortPending();
- bool MigrationLoggingEnabled();
-
ProfileSyncService* sync_service_;
WebDatabase* web_database_;
PersonalDataManager* personal_data_;
diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.cc b/chrome/browser/sync/glue/autofill_profile_model_associator.cc
index b2d2e2c..c517e2c 100644
--- a/chrome/browser/sync/glue/autofill_profile_model_associator.cc
+++ b/chrome/browser/sync/glue/autofill_profile_model_associator.cc
@@ -46,7 +46,7 @@
std::vector<AutoFillProfile*>* new_profiles,
std::vector<std::string>* profiles_to_delete) {
- if (MigrationLoggingEnabled()) {
+ if (VLOG_IS_ON(1)) {
VLOG(1) << "[AUTOFILL MIGRATION]"
<< "Printing profiles from web db";
@@ -60,10 +60,9 @@
}
}
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << "Looking for the above data in sync db..";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << "Looking for the above data in sync db..";
+
// Alias the all_profiles_from_db so we fit in 80 characters
const std::vector<AutoFillProfile*>& profiles(all_profiles_from_db);
for (std::vector<AutoFillProfile*>::const_iterator ix = profiles.begin();
@@ -72,15 +71,18 @@
std::string guid((*ix)->guid());
ReadNode node(write_trans);
- if (node.InitByClientTagLookup(syncable::AUTOFILL_PROFILE, guid)) {
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << " Found in sync db: "
- << (*ix)->GetFieldText(AutoFillType(NAME_FIRST))
- << (*ix)->GetFieldText(AutoFillType(NAME_LAST))
- << (*ix)->guid()
- << " so associating";
- }
+ if (node.InitByClientTagLookup(syncable::AUTOFILL_PROFILE, guid) &&
+ // The following check is to ensure the given sync node is not already
+ // associated with another profile. That could happen if the user has
+ // the same profile duplicated.
+ current_profiles->find(guid) == current_profiles->end()) {
+
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << " Found in sync db: "
+ << (*ix)->GetFieldText(AutoFillType(NAME_FIRST))
+ << (*ix)->GetFieldText(AutoFillType(NAME_LAST))
+ << (*ix)->guid()
+ << " so associating with node id " << node.GetId();
const sync_pb::AutofillProfileSpecifics& autofill(
node.GetAutofillProfileSpecifics());
if (OverwriteProfileWithServerData(*ix, autofill)) {
@@ -138,11 +140,9 @@
return false;
}
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << " Now associating to the new autofill profile model associator"
- << " root node";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << " Now associating to the new autofill profile model associator"
+ << " root node";
DataBundle bundle;
{
// The write transaction lock is held inside this block.
@@ -251,7 +251,8 @@
int64 AutofillProfileModelAssociator::FindSyncNodeWithProfile(
sync_api::WriteTransaction* trans,
const sync_api::BaseNode& autofill_root,
- const AutoFillProfile& profile_from_db) {
+ const AutoFillProfile& profile_from_db,
+ std::set<std::string>* current_profiles) {
int64 sync_child_id = autofill_root.GetFirstChildId();
while (sync_child_id != sync_api::kInvalidId) {
ReadNode read_node(trans);
@@ -263,9 +264,14 @@
}
const sync_pb::AutofillProfileSpecifics& autofill_specifics(
read_node.GetAutofillProfileSpecifics());
- OverwriteProfileWithServerData(&p, autofill_specifics);
- if (p.Compare(profile_from_db) == 0) {
- return sync_child_id;
+
+ // This find should be fast as the set uses tree.
+ if (current_profiles->find(autofill_specifics.guid())
+ == current_profiles->end()) {
+ OverwriteProfileWithServerData(&p, autofill_specifics);
+ if (p.Compare(profile_from_db) == 0) {
+ return sync_child_id;
+ }
}
sync_child_id = read_node.GetSuccessorId();
}
@@ -280,7 +286,10 @@
std::set<std::string>* current_profiles,
std::vector<std::string>* profiles_to_delete) {
- int64 sync_node_id = FindSyncNodeWithProfile(trans, autofill_root, profile);
+ int64 sync_node_id = FindSyncNodeWithProfile(trans,
+ autofill_root,
+ profile,
+ current_profiles);
if (sync_node_id != sync_api::kInvalidId) {
// In case of duplicates throw away the local profile and apply the
// server profile.(The only difference between the 2 profiles are the guids)
@@ -298,14 +307,13 @@
std::string guid = autofill_specifics.guid();
Associate(&guid, sync_node_id);
current_profiles->insert(autofill_specifics.guid());
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << "Found in sync db but with a different guid: "
- << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_FIRST)))
- << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST)))
- << "New guid " << autofill_specifics.guid()
- << " so associating";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << "Found in sync db but with a different guid: "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_FIRST)))
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST)))
+ << "New guid " << autofill_specifics.guid() << " sync node id "
+ << sync_node_id << " so associating. Profile to be deleted "
+ << profile.guid();
} else {
sync_api::WriteNode node(trans);
if (!node.InitUniqueByCreation(
@@ -314,16 +322,17 @@
return false;
}
node.SetTitle(UTF8ToWide(profile.guid()));
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION]"
- << "NOT Found in sync db "
- << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_FIRST)))
- << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST)))
- << profile.guid()
- << " so creating a new sync node.";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION]"
+ << "NOT Found in sync db "
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_FIRST)))
+ << UTF16ToUTF8(profile.GetFieldText(AutoFillType(NAME_LAST)))
+ << profile.guid()
+ << " so creating a new sync node. Sync node id "
+ << node.GetId();
AutofillProfileChangeProcessor::WriteAutofillProfile(profile, &node);
current_profiles->insert(profile.guid());
+ std::string guid = profile.guid();
+ Associate(&guid, node.GetId());
number_of_profiles_created_++;
}
@@ -335,11 +344,9 @@
const sync_api::ReadNode& autofill_root,
DataBundle* bundle) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
+ VLOG(1) << "[AUTOFILL MIGRATION] "
+ << " Iterating over sync nodes of autofill profile root node";
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION] "
- << " Iterating over sync nodes of autofill profile root node";
- }
int64 sync_child_id = autofill_root.GetFirstChildId();
while (sync_child_id != sync_api::kInvalidId) {
ReadNode sync_child(write_trans);
@@ -363,14 +370,15 @@
const sync_api::ReadNode& node) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION] "
- << "Trying to lookup "
- << profile.name_first()
- << " "
- << profile.name_last()
- << " in the web db";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION] "
+ << "Trying to lookup "
+ << profile.name_first()
+ << " "
+ << profile.name_last()
+ << "sync node id " << node.GetId()
+ << " Guid " << profile.guid()
+ << " in the web db";
+
if (bundle->current_profiles.find(profile.guid()) ==
bundle->current_profiles.end()) {
std::string guid(profile.guid());
@@ -378,15 +386,11 @@
AutoFillProfile* p = new AutoFillProfile(profile.guid());
OverwriteProfileWithServerData(p, profile);
bundle->new_profiles.push_back(p);
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION] "
- << " Did not find one so creating it on web db";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION] "
+ << " Did not find one so creating it on web db";
} else {
- if (MigrationLoggingEnabled()) {
- VLOG(1) << "[AUTOFILL MIGRATION] "
- << " Found it on web db. Moving on ";
- }
+ VLOG(1) << "[AUTOFILL MIGRATION] "
+ << " Found it on web db. Moving on ";
}
}
@@ -469,10 +473,5 @@
return abort_association_pending_;
}
-bool AutofillProfileModelAssociator::MigrationLoggingEnabled() {
- // TODO(lipalani) enable logging via a command line flag.
- return false;
-}
-
} // namespace browser_sync
diff --git a/chrome/browser/sync/glue/autofill_profile_model_associator.h b/chrome/browser/sync/glue/autofill_profile_model_associator.h
index f636b63..e2abdaf 100644
--- a/chrome/browser/sync/glue/autofill_profile_model_associator.h
+++ b/chrome/browser/sync/glue/autofill_profile_model_associator.h
@@ -161,9 +161,8 @@
int64 FindSyncNodeWithProfile(sync_api::WriteTransaction* trans,
const sync_api::BaseNode& autofill_root,
- const AutoFillProfile& profile);
-
- bool MigrationLoggingEnabled();
+ const AutoFillProfile& profile,
+ std::set<std::string>* current_profiles);
ProfileSyncService* sync_service_;
WebDatabase* web_database_;
diff --git a/chrome/browser/sync/glue/change_processor_mock.cc b/chrome/browser/sync/glue/change_processor_mock.cc
new file mode 100644
index 0000000..faea86b
--- /dev/null
+++ b/chrome/browser/sync/glue/change_processor_mock.cc
@@ -0,0 +1,13 @@
+// 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 "chrome/browser/sync/glue/change_processor_mock.h"
+
+namespace browser_sync {
+
+ChangeProcessorMock::ChangeProcessorMock() : ChangeProcessor(NULL) {}
+
+ChangeProcessorMock::~ChangeProcessorMock() {}
+
+} // namespace browser_sync
diff --git a/chrome/browser/sync/glue/change_processor_mock.h b/chrome/browser/sync/glue/change_processor_mock.h
index e138937..d74e40e 100644
--- a/chrome/browser/sync/glue/change_processor_mock.h
+++ b/chrome/browser/sync/glue/change_processor_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -17,7 +17,8 @@
class ChangeProcessorMock : public ChangeProcessor {
public:
- ChangeProcessorMock() : ChangeProcessor(NULL) {}
+ ChangeProcessorMock();
+ virtual ~ChangeProcessorMock();
MOCK_METHOD3(ApplyChangesFromSyncModel,
void(const sync_api::BaseTransaction* trans,
const sync_api::SyncManager::ChangeRecord* changes,
diff --git a/chrome/browser/sync/glue/data_type_controller_mock.cc b/chrome/browser/sync/glue/data_type_controller_mock.cc
new file mode 100644
index 0000000..7909b86
--- /dev/null
+++ b/chrome/browser/sync/glue/data_type_controller_mock.cc
@@ -0,0 +1,13 @@
+// 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 "chrome/browser/sync/glue/data_type_controller_mock.h"
+
+namespace browser_sync {
+
+DataTypeControllerMock::DataTypeControllerMock() {}
+
+DataTypeControllerMock::~DataTypeControllerMock() {}
+
+} // namespace browser_sync
diff --git a/chrome/browser/sync/glue/data_type_controller_mock.h b/chrome/browser/sync/glue/data_type_controller_mock.h
index 09ec652..83d0b6b 100644
--- a/chrome/browser/sync/glue/data_type_controller_mock.h
+++ b/chrome/browser/sync/glue/data_type_controller_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,6 +13,9 @@
class DataTypeControllerMock : public DataTypeController {
public:
+ DataTypeControllerMock();
+ virtual ~DataTypeControllerMock();
+
MOCK_METHOD1(Start, void(StartCallback* start_callback));
MOCK_METHOD0(Stop, void());
MOCK_METHOD0(enabled, bool());
diff --git a/chrome/browser/sync/glue/data_type_manager_mock.cc b/chrome/browser/sync/glue/data_type_manager_mock.cc
new file mode 100644
index 0000000..9cc445e
--- /dev/null
+++ b/chrome/browser/sync/glue/data_type_manager_mock.cc
@@ -0,0 +1,24 @@
+// 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 "chrome/browser/sync/glue/data_type_manager_mock.h"
+
+namespace browser_sync {
+
+DataTypeManagerMock::DataTypeManagerMock()
+ : result_(OK) {
+ // By default, calling Configure will send a SYNC_CONFIGURE_START
+ // and SYNC_CONFIGURE_DONE notification with a DataTypeManager::OK
+ // detail.
+ ON_CALL(*this, Configure(testing::_)).
+ WillByDefault(testing::DoAll(
+ NotifyFromDataTypeManager(this,
+ NotificationType::SYNC_CONFIGURE_START),
+ NotifyFromDataTypeManagerWithResult
+ (this, NotificationType::SYNC_CONFIGURE_DONE, &result_)));
+}
+
+DataTypeManagerMock::~DataTypeManagerMock() {}
+
+} // namespace browser_sync
diff --git a/chrome/browser/sync/glue/data_type_manager_mock.h b/chrome/browser/sync/glue/data_type_manager_mock.h
index 2a1705a..05a3665 100644
--- a/chrome/browser/sync/glue/data_type_manager_mock.h
+++ b/chrome/browser/sync/glue/data_type_manager_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -30,17 +30,8 @@
class DataTypeManagerMock : public DataTypeManager {
public:
- DataTypeManagerMock() : result_(OK) {
- // By default, calling Configure will send a SYNC_CONFIGURE_START
- // and SYNC_CONFIGURE_DONE notification with a DataTypeManager::OK
- // detail.
- ON_CALL(*this, Configure(testing::_)).
- WillByDefault(testing::DoAll(
- NotifyFromDataTypeManager(this,
- NotificationType::SYNC_CONFIGURE_START),
- NotifyFromDataTypeManagerWithResult
- (this, NotificationType::SYNC_CONFIGURE_DONE, &result_)));
- }
+ DataTypeManagerMock();
+ virtual ~DataTypeManagerMock();
MOCK_METHOD1(Configure, void(const TypeSet&));
MOCK_METHOD0(Stop, void());
diff --git a/chrome/browser/sync/glue/database_model_worker.cc b/chrome/browser/sync/glue/database_model_worker.cc
index b09c6c6..91bba5b 100644
--- a/chrome/browser/sync/glue/database_model_worker.cc
+++ b/chrome/browser/sync/glue/database_model_worker.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/sync/glue/database_model_worker.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/browser_thread.h"
using base::WaitableEvent;
diff --git a/chrome/browser/sync/glue/database_model_worker_unittest.cc b/chrome/browser/sync/glue/database_model_worker_unittest.cc
index 8d399b1..7f60cea 100644
--- a/chrome/browser/sync/glue/database_model_worker_unittest.cc
+++ b/chrome/browser/sync/glue/database_model_worker_unittest.cc
@@ -5,7 +5,7 @@
#include "base/callback.h"
#include "base/message_loop.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/timer.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/sync/glue/database_model_worker.h"
diff --git a/chrome/browser/sync/glue/foreign_session_tracker.cc b/chrome/browser/sync/glue/foreign_session_tracker.cc
new file mode 100644
index 0000000..6db5c9c
--- /dev/null
+++ b/chrome/browser/sync/glue/foreign_session_tracker.cc
@@ -0,0 +1,143 @@
+// 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.
+
+#include "chrome/browser/sync/glue/foreign_session_tracker.h"
+#include "chrome/browser/sync/glue/session_model_associator.h"
+
+namespace browser_sync {
+
+
+ForeignSessionTracker::ForeignSessionTracker() {
+}
+
+ForeignSessionTracker::~ForeignSessionTracker() {
+ clear();
+}
+
+bool ForeignSessionTracker::LookupAllForeignSessions(
+ std::vector<const ForeignSession*>* sessions) {
+ DCHECK(sessions);
+ // Fill vector of sessions from our foreign session map.
+ for (ForeignSessionMap::const_iterator i =
+ foreign_session_map_.begin(); i != foreign_session_map_.end(); ++i) {
+ // Only include sessions with open tabs.
+ ForeignSession* foreign_session = i->second;
+ if (foreign_session->windows.size() > 0 &&
+ !SessionModelAssociator::SessionWindowHasNoTabsToSync(
+ *foreign_session->windows[0])) {
+ sessions->push_back(foreign_session);
+ }
+ }
+
+ if (sessions->size() > 0)
+ return true;
+ else
+ return false;
+}
+
+bool ForeignSessionTracker::LookupSessionWindows(
+ const std::string& foreign_session_tag,
+ std::vector<SessionWindow*>* windows) {
+ DCHECK(windows);
+ ForeignSessionMap::iterator iter = foreign_session_map_.find(
+ foreign_session_tag);
+ if (iter == foreign_session_map_.end())
+ return false;
+ *windows = iter->second->windows;
+ return true;
+}
+
+bool ForeignSessionTracker::LookupSessionTab(
+ const std::string& tag,
+ SessionID::id_type tab_id,
+ const SessionTab** tab) {
+ DCHECK(tab);
+ if (foreign_tab_map_.find(tag) == foreign_tab_map_.end()) {
+ // We have no record of this session.
+ *tab = NULL;
+ return false;
+ }
+ if (foreign_tab_map_[tag]->find(tab_id) == foreign_tab_map_[tag]->end()) {
+ // We have no record of this tab.
+ *tab = NULL;
+ return false;
+ }
+ *tab = (*foreign_tab_map_[tag])[tab_id];
+ return true;
+}
+
+ForeignSession* ForeignSessionTracker::GetForeignSession(
+ const std::string& foreign_session_tag) {
+ scoped_ptr<ForeignSession> foreign_session;
+ if (foreign_session_map_.find(foreign_session_tag) !=
+ foreign_session_map_.end()) {
+ foreign_session.reset(foreign_session_map_[foreign_session_tag]);
+ } else {
+ foreign_session.reset(new ForeignSession);
+ foreign_session->foreign_session_tag = foreign_session_tag;
+ foreign_session_map_[foreign_session_tag] = foreign_session.get();
+ }
+ DCHECK(foreign_session.get());
+ return foreign_session.release();
+}
+
+bool ForeignSessionTracker::DeleteForeignSession(
+ const std::string& foreign_session_tag) {
+ ForeignSessionMap::iterator iter =
+ foreign_session_map_.find(foreign_session_tag);
+ if (iter != foreign_session_map_.end()) {
+ delete iter->second; // Delete the ForeignSession object.
+ foreign_session_map_.erase(iter);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+SessionTab* ForeignSessionTracker::GetSessionTab(
+ const std::string& foreign_session_tag,
+ SessionID::id_type tab_id,
+ bool has_window) {
+ if (foreign_tab_map_.find(foreign_session_tag) == foreign_tab_map_.end())
+ foreign_tab_map_[foreign_session_tag] = new IDToSessionTabMap;
+ scoped_ptr<SessionTab> tab;
+ IDToSessionTabMap::iterator iter =
+ foreign_tab_map_[foreign_session_tag]->find(tab_id);
+ if (iter != foreign_tab_map_[foreign_session_tag]->end()) {
+ tab.reset(iter->second);
+ if (has_window) // This tab is linked to a window, so it's not an orphan.
+ unmapped_tabs_.erase(tab.get());
+ VLOG(1) << "Associating " << foreign_session_tag << "'s seen tab " <<
+ tab_id << " at " << tab.get();
+ } else {
+ tab.reset(new SessionTab());
+ (*foreign_tab_map_[foreign_session_tag])[tab_id] = tab.get();
+ if (!has_window) // This tab is not linked to a window, it's an orphan.
+ unmapped_tabs_.insert(tab.get());
+ VLOG(1) << "Associating " << foreign_session_tag << "'s new tab " <<
+ tab_id << " at " << tab.get();
+ }
+ DCHECK(tab.get());
+ return tab.release();
+}
+
+void ForeignSessionTracker::clear() {
+ // Delete ForeignSession objects (which also deletes all their windows/tabs).
+ STLDeleteContainerPairSecondPointers(foreign_session_map_.begin(),
+ foreign_session_map_.end());
+ foreign_session_map_.clear();
+
+ // Delete IDToSessTab maps. Does not delete the SessionTab objects, because
+ // they should already be referenced through foreign_session_map_.
+ STLDeleteContainerPairSecondPointers(foreign_tab_map_.begin(),
+ foreign_tab_map_.end());
+ foreign_tab_map_.clear();
+
+ // Go through and delete any tabs we had allocated but had not yet placed into
+ // a ForeignSessionobject.
+ STLDeleteContainerPointers(unmapped_tabs_.begin(), unmapped_tabs_.end());
+ unmapped_tabs_.clear();
+}
+
+} // namespace browser_sync
diff --git a/chrome/browser/sync/glue/foreign_session_tracker.h b/chrome/browser/sync/glue/foreign_session_tracker.h
new file mode 100644
index 0000000..dd99455
--- /dev/null
+++ b/chrome/browser/sync/glue/foreign_session_tracker.h
@@ -0,0 +1,111 @@
+// 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.
+
+#ifndef CHROME_BROWSER_SYNC_GLUE_FOREIGN_SESSION_TRACKER_H_
+#define CHROME_BROWSER_SYNC_GLUE_FOREIGN_SESSION_TRACKER_H_
+#pragma once
+
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+#include "base/basictypes.h"
+#include "base/scoped_vector.h"
+#include "chrome/browser/sessions/session_id.h"
+#include "chrome/browser/sessions/session_types.h"
+
+namespace browser_sync {
+
+// Class to manage foreign sessions. The tracker will own all ForeignSession
+// and SessionTab objects it creates, and deletes them appropriately on
+// destruction.
+class ForeignSessionTracker {
+ public:
+ ForeignSessionTracker();
+ ~ForeignSessionTracker();
+
+ // Fill a preallocated vector with all foreign sessions we're tracking.
+ // Returns true if we had foreign sessions to fill it with, false otherwise.
+ bool LookupAllForeignSessions(std::vector<const ForeignSession*>* sessions);
+
+ // Attempts to look up the session windows associatd with the foreign session
+ // given by |foreign_session_tag|.
+ // If lookup succeeds:
+ // - Fills windows with the SessionWindow pointers, returns true.
+ // Else
+ // - Returns false.
+ bool LookupSessionWindows(const std::string& foreign_session_tag,
+ std::vector<SessionWindow*>* windows);
+
+ // Attempts to look up the foreign tab associated with the given tag and tab
+ // id.
+ // If lookup succeeds:
+ // - Sets tab to point to the SessionTab, and returns true.
+ // Else
+ // - Returns false, tab is set to NULL.
+ bool LookupSessionTab(const std::string& foreign_session_tag,
+ SessionID::id_type tab_id,
+ const SessionTab** tab);
+
+ // Returns a pointer to the ForeignSession object associated with
+ // foreign_session_tag. If none exists, creates one and returns its pointer.
+ ForeignSession* GetForeignSession(const std::string& foreign_session_tag);
+
+ // Deletes the foreign session associated with |foreign_session_tag| if it
+ // exists.
+ // Returns true if the session existed and was deleted, false otherwise.
+ bool DeleteForeignSession(const std::string& foreign_session_tag);
+
+ // Returns a pointer to the SessionTab object associated with |tab_id| for
+ // the session specified with |foreign_session_tag|. If none exists, creates
+ // one and returns its pointer.
+ // |has_window| determines if newly created tabs are added to the pool of
+ // orphaned tabs (thos which can't be reached by traversing foreign sessions).
+ SessionTab* GetSessionTab(const std::string& foreign_session_tag,
+ SessionID::id_type tab_id,
+ bool has_window);
+
+ // Free the memory for all dynamically allocated objects and clear the
+ // tracking structures.
+ void clear();
+
+ inline bool empty() {
+ return foreign_tab_map_.empty() && foreign_session_map_.empty();
+ }
+
+ inline size_t num_foreign_sessions() {
+ return foreign_session_map_.size();
+ }
+
+ inline size_t num_foreign_tabs(const std::string& foreign_session_tag) {
+ if (foreign_tab_map_.find(foreign_session_tag) != foreign_tab_map_.end()) {
+ return foreign_tab_map_[foreign_session_tag]->size();
+ } else {
+ return 0;
+ }
+ }
+ private:
+ // Datatypes for accessing foreign tab data.
+ typedef std::map<SessionID::id_type, SessionTab*> IDToSessionTabMap;
+ typedef std::map<std::string, IDToSessionTabMap*> ForeignTabMap;
+ typedef std::map<std::string, ForeignSession*> ForeignSessionMap;
+
+ // Per foreign client mapping of their tab id's to their SessionTab objects.
+ ForeignTabMap foreign_tab_map_;
+
+ // Map of foreign sessions, accessed by the foreign client id.
+ ForeignSessionMap foreign_session_map_;
+
+ // The set of foreign tabs that we have seen, and created SessionTab objects
+ // for, but have not yet mapped to ForeignSessions. These are temporarily
+ // orphaned tabs, and won't be deleted if we delete foreign_session_map_.
+ std::set<SessionTab*> unmapped_tabs_;
+
+ DISALLOW_COPY_AND_ASSIGN(ForeignSessionTracker);
+};
+
+} // namespace browser_sync
+
+#endif // CHROME_BROWSER_SYNC_GLUE_FOREIGN_SESSION_TRACKER_H_
diff --git a/chrome/browser/sync/glue/history_model_worker.cc b/chrome/browser/sync/glue/history_model_worker.cc
index 9b0ea50..e880476 100644
--- a/chrome/browser/sync/glue/history_model_worker.cc
+++ b/chrome/browser/sync/glue/history_model_worker.cc
@@ -7,7 +7,7 @@
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/task.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/history/history.h"
using base::WaitableEvent;
diff --git a/chrome/browser/sync/glue/http_bridge.cc b/chrome/browser/sync/glue/http_bridge.cc
index 8dc2b6f..2ec5a1b 100644
--- a/chrome/browser/sync/glue/http_bridge.cc
+++ b/chrome/browser/sync/glue/http_bridge.cc
@@ -193,6 +193,7 @@
url_poster_->set_request_context(context_getter_for_request_);
url_poster_->set_upload_data(content_type_, request_content_);
url_poster_->set_extra_request_headers(extra_headers_);
+ url_poster_->set_load_flags(net::LOAD_DO_NOT_SEND_COOKIES);
url_poster_->Start();
}
diff --git a/chrome/browser/sync/glue/http_bridge.h b/chrome/browser/sync/glue/http_bridge.h
index 530c215..5fb2419 100644
--- a/chrome/browser/sync/glue/http_bridge.h
+++ b/chrome/browser/sync/glue/http_bridge.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,7 +9,7 @@
#include <string>
#include "base/ref_counted.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/common/net/url_fetcher.h"
#include "chrome/common/net/url_request_context_getter.h"
@@ -41,13 +41,13 @@
// 2) avoids ifdefs for now
// 3) not sure we want to strictly follow settings for cookie policy,
// accept lang/charset, since changing these could break syncing.
- class RequestContext : public URLRequestContext {
+ class RequestContext : public net::URLRequestContext {
public:
// |baseline_context| is used to obtain the accept-language,
// accept-charsets, and proxy service information for bridged requests.
// Typically |baseline_context| should be the URLRequestContext of the
// currently active profile.
- explicit RequestContext(URLRequestContext* baseline_context);
+ explicit RequestContext(net::URLRequestContext* baseline_context);
// Set the user agent for requests using this context. The default is
// the browser's UA string.
@@ -57,11 +57,7 @@
// If the user agent is set explicitly return that, otherwise call the
// base class method to return default value.
return user_agent_.empty() ?
- URLRequestContext::GetUserAgent(url) : user_agent_;
- }
-
- virtual bool AllowSendingCookies(const net::URLRequest* request) const {
- return false;
+ net::URLRequestContext::GetUserAgent(url) : user_agent_;
}
private:
@@ -69,7 +65,7 @@
~RequestContext();
std::string user_agent_;
- URLRequestContext* baseline_context_;
+ net::URLRequestContext* baseline_context_;
DISALLOW_COPY_AND_ASSIGN(RequestContext);
};
@@ -84,7 +80,7 @@
bool is_user_agent_set() const { return !user_agent_.empty(); }
// URLRequestContextGetter implementation.
- virtual URLRequestContext* GetURLRequestContext();
+ virtual net::URLRequestContext* GetURLRequestContext();
virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const;
private:
@@ -121,8 +117,9 @@
const std::string& name) const;
// URLFetcher::Delegate implementation.
- virtual void OnURLFetchComplete(const URLFetcher* source, const GURL& url,
- const URLRequestStatus& status,
+ virtual void OnURLFetchComplete(const URLFetcher* source,
+ const GURL& url,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/sync/glue/http_bridge_unittest.cc b/chrome/browser/sync/glue/http_bridge_unittest.cc
index 57fca13..f9aa32c 100644
--- a/chrome/browser/sync/glue/http_bridge_unittest.cc
+++ b/chrome/browser/sync/glue/http_bridge_unittest.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/message_loop_proxy.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/sync/glue/http_bridge.h"
#include "chrome/common/net/test_url_fetcher_factory.h"
diff --git a/chrome/browser/sync/glue/password_model_worker.cc b/chrome/browser/sync/glue/password_model_worker.cc
index c06f33f..6132a03 100644
--- a/chrome/browser/sync/glue/password_model_worker.cc
+++ b/chrome/browser/sync/glue/password_model_worker.cc
@@ -7,7 +7,7 @@
#include "base/callback.h"
#include "base/ref_counted.h"
#include "base/task.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/password_manager/password_store.h"
using base::WaitableEvent;
diff --git a/chrome/browser/sync/glue/session_change_processor.cc b/chrome/browser/sync/glue/session_change_processor.cc
index ca0b166..8823af0 100644
--- a/chrome/browser/sync/glue/session_change_processor.cc
+++ b/chrome/browser/sync/glue/session_change_processor.cc
@@ -10,9 +10,10 @@
#include "base/logging.h"
#include "base/scoped_vector.h"
-#include "chrome/browser/browser_thread.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/session_model_associator.h"
+#include "chrome/browser/tab_contents/navigation_controller.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_source.h"
@@ -40,18 +41,95 @@
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(running());
DCHECK(profile_);
+
+ // Track which windows and/or tabs are modified.
+ std::vector<TabContents*> modified_tabs;
+ bool windows_changed = false;
switch (type.value) {
- case NotificationType::SESSION_SERVICE_SAVED: {
- std::string tag = session_model_associator_->GetCurrentMachineTag();
- DCHECK_EQ(Source<Profile>(source).ptr(), profile_);
- session_model_associator_->UpdateSyncModelDataFromClient();
+ case NotificationType::BROWSER_OPENED: {
+ Browser* browser = Source<Browser>(source).ptr();
+ if (browser->profile() != profile_) {
+ return;
+ }
+
+ windows_changed = true;
+ break;
+ }
+
+ case NotificationType::TAB_PARENTED: {
+ NavigationController* controller =
+ Source<NavigationController>(source).ptr();
+ if (controller->profile() != profile_) {
+ return;
+ }
+ windows_changed = true;
+ modified_tabs.push_back(controller->tab_contents());
+ break;
+ }
+
+ case NotificationType::TAB_CLOSED: {
+ NavigationController* controller =
+ Source<NavigationController>(source).ptr();
+ if (controller->profile() != profile_) {
+ return;
+ }
+ windows_changed = true;
+ modified_tabs.push_back(controller->tab_contents());
+ break;
+ }
+
+ case NotificationType::NAV_LIST_PRUNED: {
+ NavigationController* controller =
+ Source<NavigationController>(source).ptr();
+ if (controller->profile() != profile_) {
+ return;
+ }
+ modified_tabs.push_back(controller->tab_contents());
+ break;
+ }
+
+ case NotificationType::NAV_ENTRY_CHANGED: {
+ NavigationController* controller =
+ Source<NavigationController>(source).ptr();
+ if (controller->profile() != profile_) {
+ return;
+ }
+ modified_tabs.push_back(controller->tab_contents());
+ break;
+ }
+
+ case NotificationType::NAV_ENTRY_COMMITTED: {
+ NavigationController* controller =
+ Source<NavigationController>(source).ptr();
+ if (controller->profile() != profile_) {
+ return;
+ }
+ modified_tabs.push_back(controller->tab_contents());
+ break;
+ }
+
+ case NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED: {
+ TabContents* tab_contents = Source<TabContents>(source).ptr();
+ DCHECK(tab_contents);
+ if (tab_contents->profile() != profile_) {
+ return;
+ }
+ if (tab_contents->extension_app()) {
+ modified_tabs.push_back(tab_contents);
+ }
break;
}
default:
- LOG(DFATAL) << "Received unexpected notification of type "
+ LOG(ERROR) << "Received unexpected notification of type "
<< type.value;
break;
}
+
+ // Associate windows first to ensure tabs have homes.
+ if (windows_changed)
+ session_model_associator_->ReassociateWindows(false);
+ if (!modified_tabs.empty())
+ session_model_associator_->ReassociateTabs(modified_tabs);
}
void SessionChangeProcessor::ApplyChangesFromSyncModel(
@@ -65,10 +143,50 @@
StopObserving();
- // This currently ignores the tracked changes and rebuilds the sessions from
- // all the session sync nodes.
- // TODO(zea): Make use of |changes| to adjust only modified sessions.
- session_model_associator_->UpdateFromSyncModel(trans);
+ sync_api::ReadNode root(trans);
+ if (!root.InitByTagLookup(kSessionsTag)) {
+ error_handler()->OnUnrecoverableError(FROM_HERE,
+ "Sessions root node lookup failed.");
+ return;
+ }
+
+ for (int i = 0; i < change_count; ++i) {
+ const sync_api::SyncManager::ChangeRecord& change = changes[i];
+ sync_api::SyncManager::ChangeRecord::Action action(change.action);
+ if (sync_api::SyncManager::ChangeRecord::ACTION_DELETE == action) {
+ // Deletions should only be for a foreign client itself, and hence affect
+ // the header node, never a tab node.
+ sync_api::ReadNode node(trans);
+ if (!node.InitByIdLookup(change.id)) {
+ error_handler()->OnUnrecoverableError(FROM_HERE,
+ "Session node lookup failed.");
+ return;
+ }
+ DCHECK_EQ(node.GetModelType(), syncable::SESSIONS);
+ const sync_pb::SessionSpecifics& specifics = node.GetSessionSpecifics();
+ session_model_associator_->DisassociateForeignSession(
+ specifics.session_tag());
+ continue;
+ }
+
+ // Handle an update or add.
+ sync_api::ReadNode sync_node(trans);
+ if (!sync_node.InitByIdLookup(change.id)) {
+ error_handler()->OnUnrecoverableError(FROM_HERE,
+ "Session node lookup failed.");
+ return;
+ }
+
+ // Check that the changed node is a child of the session folder.
+ DCHECK(root.GetId() == sync_node.GetParentId());
+ DCHECK(syncable::SESSIONS == sync_node.GetModelType());
+
+ const sync_pb::SessionSpecifics& specifics(
+ sync_node.GetSessionSpecifics());
+ const int64 mtime = sync_node.GetModificationTime();
+ // Model associator handles foreign session update and add the same.
+ session_model_associator_->AssociateForeignSpecifics(specifics, mtime);
+ }
// Notify foreign session handlers that there are new sessions.
NotificationService::current()->Notify(
@@ -96,9 +214,21 @@
void SessionChangeProcessor::StartObserving() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(profile_);
- notification_registrar_.Add(
- this, NotificationType::SESSION_SERVICE_SAVED,
- Source<Profile>(profile_));
+ notification_registrar_.Add(this, NotificationType::TAB_PARENTED,
+ NotificationService::AllSources());
+ notification_registrar_.Add(this, NotificationType::TAB_CLOSED,
+ NotificationService::AllSources());
+ notification_registrar_.Add(this, NotificationType::NAV_LIST_PRUNED,
+ NotificationService::AllSources());
+ notification_registrar_.Add(this, NotificationType::NAV_ENTRY_CHANGED,
+ NotificationService::AllSources());
+ notification_registrar_.Add(this, NotificationType::NAV_ENTRY_COMMITTED,
+ NotificationService::AllSources());
+ notification_registrar_.Add(this, NotificationType::BROWSER_OPENED,
+ NotificationService::AllSources());
+ notification_registrar_.Add(this,
+ NotificationType::TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED,
+ NotificationService::AllSources());
}
void SessionChangeProcessor::StopObserving() {
diff --git a/chrome/browser/sync/glue/session_model_associator.cc b/chrome/browser/sync/glue/session_model_associator.cc
index 5ec89be..8c8cb6d 100644
--- a/chrome/browser/sync/glue/session_model_associator.cc
+++ b/chrome/browser/sync/glue/session_model_associator.cc
@@ -4,15 +4,19 @@
#include "chrome/browser/sync/glue/session_model_associator.h"
+#include <algorithm>
#include <utility>
#include "base/logging.h"
-#include "base/string_util.h"
-#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser_list.h"
+#include "chrome/browser/browser_window.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/syncable/syncable.h"
+#include "chrome/browser/tab_contents/navigation_controller.h"
+#include "chrome/browser/tab_contents/navigation_entry.h"
+#include "chrome/browser/tabs/tab_strip_model.h"
+#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/url_constants.h"
@@ -20,15 +24,18 @@
namespace browser_sync {
namespace {
-
static const char kNoSessionsFolderError[] =
"Server did not create the top-level sessions node. We "
"might be running against an out-of-date server.";
+// The maximum number of navigations in each direction we care to sync.
+static const int max_sync_navigation_count = 6;
} // namespace
-SessionModelAssociator::SessionModelAssociator(
- ProfileSyncService* sync_service) : sync_service_(sync_service) {
+SessionModelAssociator::SessionModelAssociator(ProfileSyncService* sync_service)
+ : tab_pool_(sync_service),
+ local_session_syncid_(sync_api::kInvalidId),
+ sync_service_(sync_service) {
DCHECK(CalledOnValidThread());
DCHECK(sync_service_);
}
@@ -37,80 +44,10 @@
DCHECK(CalledOnValidThread());
}
-bool SessionModelAssociator::AssociateModels() {
- DCHECK(CalledOnValidThread());
-
- // Make sure we have a machine tag.
- if (current_machine_tag_.empty())
- InitializeCurrentMachineTag(); // Creates a syncable::BaseTransaction.
-
- {
- // Do an initial update from sync model (in case we just re-enabled and
- // already had data).
- sync_api::ReadTransaction trans(
- sync_service_->backend()->GetUserShareHandle());
- UpdateFromSyncModel(&trans);
- }
-
- // Check if anything has changed on the client side.
- UpdateSyncModelDataFromClient();
- return true;
-}
-
-bool SessionModelAssociator::ChromeModelHasUserCreatedNodes(
- bool* has_nodes) {
- DCHECK(CalledOnValidThread());
- CHECK(has_nodes);
- // This is wrong, but this function is unused, anyway.
- *has_nodes = true;
- return true;
-}
-
-bool SessionModelAssociator::DisassociateModels() {
- specifics_.clear();
-
- // There is no local model stored with which to disassociate, just notify
- // foreign session handlers.
- NotificationService::current()->Notify(
- NotificationType::FOREIGN_SESSION_DISABLED,
- NotificationService::AllSources(),
- NotificationService::NoDetails());
- return true;
-}
-
-const sync_pb::SessionSpecifics* SessionModelAssociator::
- GetChromeNodeFromSyncId(int64 sync_id) {
- sync_api::ReadTransaction trans(
- sync_service_->backend()->GetUserShareHandle());
- sync_api::ReadNode node(&trans);
- if (!node.InitByIdLookup(sync_id))
- return NULL;
- return new sync_pb::SessionSpecifics(node.GetSessionSpecifics());
-}
-
-bool SessionModelAssociator::GetSyncIdForTaggedNode(const std::string* tag,
- int64* sync_id) {
- sync_api::ReadTransaction trans(
- sync_service_->backend()->GetUserShareHandle());
- sync_api::ReadNode node(&trans);
- if (!node.InitByClientTagLookup(syncable::SESSIONS, *tag))
- return false;
- *sync_id = node.GetId();
- return true;
-}
-
-int64 SessionModelAssociator::GetSyncIdFromChromeId(const std::string& id) {
- sync_api::ReadTransaction trans(
- sync_service_->backend()->GetUserShareHandle());
- sync_api::ReadNode node(&trans);
- if (!node.InitByClientTagLookup(syncable::SESSIONS, id))
- return sync_api::kInvalidId;
- return node.GetId();
-}
-
bool SessionModelAssociator::InitSyncNodeFromChromeId(
const std::string& id,
sync_api::BaseNode* sync_node) {
+ NOTREACHED();
return false;
}
@@ -131,138 +68,212 @@
return true;
}
-std::string SessionModelAssociator::GetCurrentMachineTag() {
- DCHECK(!current_machine_tag_.empty());
- return current_machine_tag_;
+int64 SessionModelAssociator::GetSyncIdFromChromeId(const size_t& id) {
+ DCHECK(CalledOnValidThread());
+ return GetSyncIdFromSessionTag(TabIdToTag(GetCurrentMachineTag(), id));
}
-void SessionModelAssociator::UpdateSyncModelDataFromClient() {
+int64 SessionModelAssociator::GetSyncIdFromSessionTag(const std::string& tag) {
DCHECK(CalledOnValidThread());
- SessionService::SessionCallback* callback =
- NewCallback(this, &SessionModelAssociator::OnGotSession);
- // TODO(jerrica): Stop current race condition, possibly make new method in
- // session service, which only grabs the windows from memory.
- GetSessionService()->GetCurrentSession(&consumer_, callback);
+ sync_api::ReadTransaction trans(
+ sync_service_->backend()->GetUserShareHandle());
+ sync_api::ReadNode node(&trans);
+ if (!node.InitByClientTagLookup(syncable::SESSIONS, tag))
+ return sync_api::kInvalidId;
+ return node.GetId();
}
-
-// TODO(zea): Don't recreate sessions_ vector from scratch each time. This
-// will involve knowing which sessions have been changed (a different data
-// structure will probably be better too).
-bool SessionModelAssociator::UpdateFromSyncModel(
- const sync_api::BaseTransaction* trans) {
+void SessionModelAssociator::ReassociateWindows(bool reload_tabs) {
DCHECK(CalledOnValidThread());
+ sync_pb::SessionSpecifics specifics;
+ specifics.set_session_tag(GetCurrentMachineTag());
+ sync_pb::SessionHeader* header_s = specifics.mutable_header();
- // Rebuild specifics_ vector
- specifics_.clear();
- if (!QuerySyncModel(trans, specifics_)) {
- LOG(ERROR) << "SessionModelAssociator failed to updated from sync model";
- return false;
+ for (BrowserList::const_iterator i = BrowserList::begin();
+ i != BrowserList::end(); ++i) {
+ // Make sure the browser has tabs and a window. Browsers destructor
+ // removes itself from the BrowserList. When a browser is closed the
+ // destructor is not necessarily run immediately. This means its possible
+ // for us to get a handle to a browser that is about to be removed. If
+ // the tab count is 0 or the window is NULL, the browser is about to be
+ // deleted, so we ignore it.
+ if (ShouldSyncWindowType((*i)->type()) && (*i)->tab_count() &&
+ (*i)->window()) {
+ sync_pb::SessionWindow window_s;
+ SessionID::id_type window_id = (*i)->session_id().id();
+ VLOG(1) << "Reassociating window " << window_id << " with " <<
+ (*i)->tab_count() << " tabs.";
+ window_s.set_window_id(window_id);
+ window_s.set_selected_tab_index((*i)->selected_index());
+ if ((*i)->type() ==
+ Browser::TYPE_NORMAL) {
+ window_s.set_browser_type(
+ sync_pb::SessionWindow_BrowserType_TYPE_NORMAL);
+ } else {
+ window_s.set_browser_type(
+ sync_pb::SessionWindow_BrowserType_TYPE_POPUP);
+ }
+
+ // Store the order of tabs.
+ bool found_tabs = false;
+ for (int j = 0; j < (*i)->tab_count(); ++j) {
+ TabContents* tab = (*i)->GetTabContentsAt(j);
+ DCHECK(tab);
+ if (IsValidTab(*tab)) {
+ found_tabs = true;
+ window_s.add_tab(tab->controller().session_id().id());
+ if (reload_tabs) {
+ ReassociateTab(*tab);
+ }
+ }
+ }
+ // Only add a window if it contains valid tabs.
+ if (found_tabs) {
+ sync_pb::SessionWindow* header_window = header_s->add_window();
+ *header_window = window_s;
+ }
+ }
}
- return true;
+ sync_api::WriteTransaction trans(
+ sync_service_->backend()->GetUserShareHandle());
+ sync_api::WriteNode header_node(&trans);
+ if (!header_node.InitByIdLookup(local_session_syncid_)) {
+ LOG(ERROR) << "Failed to load local session header node.";
+ return;
+ }
+ header_node.SetSessionSpecifics(specifics);
}
-bool SessionModelAssociator::QuerySyncModel(
- const sync_api::BaseTransaction* trans,
- std::vector<const sync_pb::SessionSpecifics*>& specifics) {
- DCHECK(CalledOnValidThread());
- sync_api::ReadNode root(trans);
- if (!root.InitByTagLookup(kSessionsTag)) {
- LOG(ERROR) << kNoSessionsFolderError;
- return false;
- }
- sync_api::ReadNode current_machine(trans);
- int64 current_id = (current_machine.InitByClientTagLookup(syncable::SESSIONS,
- GetCurrentMachineTag())) ? current_machine.GetId() : sync_api::kInvalidId;
-
- // Iterate through the nodes and populate the session model.
- int64 id = root.GetFirstChildId();
- while (id != sync_api::kInvalidId) {
- sync_api::ReadNode sync_node(trans);
- if (!sync_node.InitByIdLookup(id)) {
- LOG(ERROR) << "Failed to fetch sync node for id " << id;
+// Static.
+bool SessionModelAssociator::ShouldSyncWindowType(const Browser::Type& type) {
+ switch (type) {
+ case Browser::TYPE_POPUP:
+ return true;
+ case Browser::TYPE_APP:
return false;
- }
- if (id != current_id) {
- specifics.insert(specifics.end(), &sync_node.GetSessionSpecifics());
- }
- id = sync_node.GetSuccessorId();
+ case Browser::TYPE_APP_POPUP:
+ return false;
+ case Browser::TYPE_DEVTOOLS:
+ return false;
+ case Browser::TYPE_APP_PANEL:
+ return false;
+ case Browser::TYPE_NORMAL:
+ default:
+ return true;
}
- return true;
}
-bool SessionModelAssociator::GetSessionData(
- std::vector<ForeignSession*>* sessions) {
+void SessionModelAssociator::ReassociateTabs(
+ const std::vector<TabContents*>& tabs) {
DCHECK(CalledOnValidThread());
+ for (std::vector<TabContents*>::const_iterator i = tabs.begin();
+ i != tabs.end();
+ ++i) {
+ ReassociateTab(**i);
+ }
+}
- // Build vector of sessions from specifics data
- for (std::vector<const sync_pb::SessionSpecifics*>::const_iterator i =
- specifics_.begin(); i != specifics_.end(); ++i) {
- // Only include sessions with open windows.
- if ((*i)->session_window_size() > 0)
- AppendForeignSessionFromSpecifics(*i, sessions);
+void SessionModelAssociator::ReassociateTab(const TabContents& tab) {
+ DCHECK(CalledOnValidThread());
+ if (!IsValidTab(tab))
+ return;
+
+ int64 sync_id;
+ SessionID::id_type id = tab.controller().session_id().id();
+ if (tab.is_being_destroyed()) {
+ // This tab is closing.
+ TabLinksMap::iterator tab_iter = tab_map_.find(id);
+ if (tab_iter == tab_map_.end()) {
+ // We aren't tracking this tab (for example, sync setting page).
+ return;
+ }
+ tab_pool_.FreeTabNode(tab_iter->second.sync_id());
+ tab_map_.erase(tab_iter);
+ return;
}
+ TabLinksMap::const_iterator tablink = tab_map_.find(id);
+ if (tablink == tab_map_.end()) {
+ // This is a new tab, get a sync node for it.
+ sync_id = tab_pool_.GetFreeTabNode();
+ } else {
+ // This tab is already associated with a sync node, reuse it.
+ sync_id = tablink->second.sync_id();
+ }
+ Associate(&tab, sync_id);
+}
+
+void SessionModelAssociator::Associate(const TabContents* tab, int64 sync_id) {
+ DCHECK(CalledOnValidThread());
+ SessionID::id_type session_id = tab->controller().session_id().id();
+
+ TabLinks t(sync_id, tab);
+ tab_map_[session_id] = t;
+
+ sync_api::WriteTransaction trans(
+ sync_service_->backend()->GetUserShareHandle());
+ WriteTabContentsToSyncModel(*tab, sync_id, &trans);
+}
+
+bool SessionModelAssociator::WriteTabContentsToSyncModel(
+ const TabContents& tab,
+ int64 sync_id,
+ sync_api::WriteTransaction* trans) {
+ DCHECK(CalledOnValidThread());
+ sync_api::WriteNode tab_node(trans);
+ if (!tab_node.InitByIdLookup(sync_id)) {
+ LOG(ERROR) << "Failed to look up tab node " << sync_id;
+ return false;
+ }
+
+ sync_pb::SessionSpecifics session_s;
+ session_s.set_session_tag(GetCurrentMachineTag());
+ sync_pb::SessionTab* tab_s = session_s.mutable_tab();
+
+ SessionID::id_type tab_id = tab.controller().session_id().id();
+ tab_s->set_tab_id(tab_id);
+ tab_s->set_window_id(tab.controller().window_id().id());
+ const int current_index = tab.controller().GetCurrentEntryIndex();
+ const int min_index = std::max(0,
+ current_index - max_sync_navigation_count);
+ const int max_index = std::min(current_index + max_sync_navigation_count,
+ tab.controller().entry_count());
+ const int pending_index = tab.controller().pending_entry_index();
+ Browser* browser = BrowserList::FindBrowserWithID(
+ tab.controller().window_id().id());
+ DCHECK(browser);
+ int index_in_window = browser->tabstrip_model()->GetWrapperIndex(&tab);
+ DCHECK(index_in_window != TabStripModel::kNoTab);
+ tab_s->set_pinned(browser->tabstrip_model()->IsTabPinned(index_in_window));
+ if (tab.extension_app())
+ tab_s->set_extension_app_id(tab.extension_app()->id());
+ for (int i = min_index; i < max_index; ++i) {
+ const NavigationEntry* entry = (i == pending_index) ?
+ tab.controller().pending_entry() : tab.controller().GetEntryAtIndex(i);
+ DCHECK(entry);
+ if (entry->virtual_url().is_valid()) {
+ if (i == max_index - 1) {
+ VLOG(1) << "Associating tab " << tab_id << " with sync id " << sync_id
+ << " and url " << entry->virtual_url().possibly_invalid_spec();
+ }
+ TabNavigation tab_nav;
+ tab_nav.SetFromNavigationEntry(*entry);
+ sync_pb::TabNavigation* nav_s = tab_s->add_navigation();
+ PopulateSessionSpecificsNavigation(&tab_nav, nav_s);
+ }
+ }
+ tab_s->set_current_navigation_index(current_index);
+
+ tab_node.SetSessionSpecifics(session_s);
return true;
}
-void SessionModelAssociator::AppendForeignSessionFromSpecifics(
- const sync_pb::SessionSpecifics* specifics,
- std::vector<ForeignSession*>* session) {
- ForeignSession* foreign_session = new ForeignSession();
- foreign_session->foreign_session_tag = specifics->session_tag();
- session->insert(session->end(), foreign_session);
- for (int i = 0; i < specifics->session_window_size(); i++) {
- const sync_pb::SessionWindow* window = &specifics->session_window(i);
- SessionWindow* session_window = new SessionWindow();
- PopulateSessionWindowFromSpecifics(session_window, window);
- foreign_session->windows.insert(
- foreign_session->windows.end(), session_window);
- }
-}
-
-// Fills the given vector with foreign session windows to restore.
-void SessionModelAssociator::AppendForeignSessionWithID(int64 id,
- std::vector<ForeignSession*>* session, sync_api::BaseTransaction* trans) {
- if (id == sync_api::kInvalidId)
- return;
- sync_api::ReadNode node(trans);
- if (!node.InitByIdLookup(id))
- return;
- const sync_pb::SessionSpecifics* ref = &node.GetSessionSpecifics();
- AppendForeignSessionFromSpecifics(ref, session);
-}
-
-SessionService* SessionModelAssociator::GetSessionService() {
- DCHECK(sync_service_);
- Profile* profile = sync_service_->profile();
- DCHECK(profile);
- SessionService* sessions_service = profile->GetSessionService();
- DCHECK(sessions_service);
- return sessions_service;
-}
-
-void SessionModelAssociator::InitializeCurrentMachineTag() {
- sync_api::WriteTransaction trans(sync_service_->backend()->
- GetUserShareHandle());
- syncable::Directory* dir =
- trans.GetWrappedWriteTrans()->directory();
-
- // TODO(zea): We need a better way of creating a machine tag. The directory
- // kernel's cache_guid changes every time syncing is turned on and off. This
- // will result in session's associated with stale machine tags persisting on
- // the server since that tag will not be reused. Eventually this should
- // become some string identifiable to the user. (Home, Work, Laptop, etc.)
- // See issue 59672
- current_machine_tag_ = "session_sync";
- current_machine_tag_.append(dir->cache_guid());
- VLOG(1) << "Creating machine tag: " << current_machine_tag_;
-}
-
-// See PopulateSessionSpecificsTab for use. May add functionality that includes
-// the state later.
+// Static
+// TODO(zea): perhaps sync state (scroll position, form entries, etc.) as well?
+// See http://crbug.com/67068.
void SessionModelAssociator::PopulateSessionSpecificsNavigation(
- const TabNavigation* navigation, sync_pb::TabNavigation* tab_navigation) {
+ const TabNavigation* navigation,
+ sync_pb::TabNavigation* tab_navigation) {
tab_navigation->set_index(navigation->index());
tab_navigation->set_virtual_url(navigation->virtual_url().spec());
tab_navigation->set_referrer(navigation->referrer().spec());
@@ -334,125 +345,280 @@
}
}
-// See PopulateSessionSpecificsWindow for use.
-void SessionModelAssociator::PopulateSessionSpecificsTab(
- const SessionTab* tab, sync_pb::SessionTab* session_tab) {
- session_tab->set_tab_visual_index(tab->tab_visual_index);
- session_tab->set_current_navigation_index(
- tab->current_navigation_index);
- session_tab->set_pinned(tab->pinned);
- session_tab->set_extension_app_id(tab->extension_app_id);
- for (std::vector<TabNavigation>::const_iterator i3 =
- tab->navigations.begin(); i3 != tab->navigations.end(); ++i3) {
- const TabNavigation navigation = *i3;
- sync_pb::TabNavigation* tab_navigation =
- session_tab->add_navigation();
- PopulateSessionSpecificsNavigation(&navigation, tab_navigation);
- }
+void SessionModelAssociator::Disassociate(int64 sync_id) {
+ DCHECK(CalledOnValidThread());
+ NOTIMPLEMENTED();
+ // TODO(zea): we will need this once we support deleting foreign sessions.
}
-// Called when populating session specifics to send to the sync model, called
-// when associating models, or updating the sync model.
-void SessionModelAssociator::PopulateSessionSpecificsWindow(
- const SessionWindow* window, sync_pb::SessionWindow* session_window) {
- session_window->set_selected_tab_index(window->selected_tab_index);
- if (window->type == 1) {
- session_window->set_browser_type(
- sync_pb::SessionWindow_BrowserType_TYPE_NORMAL);
- } else {
- session_window->set_browser_type(
- sync_pb::SessionWindow_BrowserType_TYPE_POPUP);
+bool SessionModelAssociator::AssociateModels() {
+ DCHECK(CalledOnValidThread());
+
+ // Ensure that we disassociated properly, otherwise memory might leak.
+ DCHECK(foreign_session_tracker_.empty());
+ DCHECK_EQ(0U, tab_pool_.capacity());
+
+ local_session_syncid_ = sync_api::kInvalidId;
+
+ // Read any available foreign sessions and load any session data we may have.
+ // If we don't have any local session data in the db, create a header node.
+ {
+ sync_api::WriteTransaction trans(
+ sync_service_->backend()->GetUserShareHandle());
+
+ sync_api::ReadNode root(&trans);
+ if (!root.InitByTagLookup(kSessionsTag)) {
+ LOG(ERROR) << kNoSessionsFolderError;
+ return false;
}
- for (std::vector<SessionTab*>::const_iterator i2 = window->tabs.begin();
- i2 != window->tabs.end(); ++i2) {
- const SessionTab* tab = *i2;
- if (tab->navigations.at(tab->current_navigation_index).virtual_url() ==
- GURL(chrome::kChromeUINewTabURL)) {
- continue;
+
+ // Make sure we have a machine tag.
+ if (current_machine_tag_.empty())
+ InitializeCurrentMachineTag(&trans);
+
+ UpdateAssociationsFromSyncModel(root, &trans);
+
+ if (local_session_syncid_ == sync_api::kInvalidId) {
+ // The sync db didn't have a header node for us, we need to create one.
+ sync_api::WriteNode write_node(&trans);
+ if (!write_node.InitUniqueByCreation(syncable::SESSIONS, root,
+ current_machine_tag_)) {
+ LOG(ERROR) << "Failed to create sessions header sync node.";
+ return false;
}
- sync_pb::SessionTab* session_tab = session_window->add_session_tab();
- PopulateSessionSpecificsTab(tab, session_tab);
+ write_node.SetTitle(UTF8ToWide(current_machine_tag_));
+ local_session_syncid_ = write_node.GetId();
}
-}
-
-bool SessionModelAssociator::WindowHasNoTabsToSync(
- const SessionWindow* window) {
- int num_populated = 0;
- for (std::vector<SessionTab*>::const_iterator i = window->tabs.begin();
- i != window->tabs.end(); ++i) {
- const SessionTab* tab = *i;
- if (tab->navigations.at(tab->current_navigation_index).virtual_url() ==
- GURL(chrome::kChromeUINewTabURL)) {
- continue;
- }
- num_populated++;
}
- if (num_populated == 0)
- return true;
- return false;
+
+ // Check if anything has changed on the client side.
+ UpdateSyncModelDataFromClient();
+
+ VLOG(1) << "Session models associated.";
+
+ return true;
}
-void SessionModelAssociator::OnGotSession(int handle,
- std::vector<SessionWindow*>* windows) {
- sync_pb::SessionSpecifics specifics;
- // Set the tag, then iterate through the vector of windows, extracting the
- // window data, along with the tabs data and tab navigation data to populate
- // the session specifics.
- specifics.set_session_tag(GetCurrentMachineTag());
- FillSpecificsFromSessions(windows, &specifics);
- bool has_nodes = false;
- if (!SyncModelHasUserCreatedNodes(&has_nodes))
- return;
- if (specifics.session_window_size() == 0 && has_nodes)
- return;
- sync_api::WriteTransaction trans(
- sync_service_->backend()->GetUserShareHandle());
- sync_api::ReadNode root(&trans);
- if (!root.InitByTagLookup(kSessionsTag)) {
- LOG(ERROR) << kNoSessionsFolderError;
- return;
- }
- UpdateSyncModel(&specifics, &trans, &root);
+bool SessionModelAssociator::DisassociateModels() {
+ DCHECK(CalledOnValidThread());
+ foreign_session_tracker_.clear();
+ tab_map_.clear();
+ tab_pool_.clear();
+ local_session_syncid_ = sync_api::kInvalidId;
+
+ // There is no local model stored with which to disassociate, just notify
+ // foreign session handlers.
+ NotificationService::current()->Notify(
+ NotificationType::FOREIGN_SESSION_DISABLED,
+ NotificationService::AllSources(),
+ NotificationService::NoDetails());
+ return true;
}
-void SessionModelAssociator::FillSpecificsFromSessions(
- std::vector<SessionWindow*>* windows,
- sync_pb::SessionSpecifics* session) {
- for (std::vector<SessionWindow*>::const_iterator i = windows->begin();
- i != windows->end(); ++i) {
- const SessionWindow* window = *i;
- if (WindowHasNoTabsToSync(window)) {
- continue;
+void SessionModelAssociator::InitializeCurrentMachineTag(
+ sync_api::WriteTransaction* trans) {
+ DCHECK(CalledOnValidThread());
+ syncable::Directory* dir = trans->GetWrappedWriteTrans()->directory();
+
+ // TODO(zea): We need a better way of creating a machine tag. The directory
+ // kernel's cache_guid changes every time syncing is turned on and off. This
+ // will result in session's associated with stale machine tags persisting on
+ // the server since that tag will not be reused. Eventually this should
+ // become some string identifiable to the user. (Home, Work, Laptop, etc.)
+ // See issue at http://crbug.com/59672
+ current_machine_tag_ = "session_sync";
+ current_machine_tag_.append(dir->cache_guid());
+ VLOG(1) << "Creating machine tag: " << current_machine_tag_;
+ tab_pool_.set_machine_tag(current_machine_tag_);
+}
+
+bool SessionModelAssociator::UpdateAssociationsFromSyncModel(
+ const sync_api::ReadNode& root,
+ const sync_api::BaseTransaction* trans) {
+ DCHECK(CalledOnValidThread());
+
+ // Iterate through the nodes and associate any foreign sessions.
+ int64 id = root.GetFirstChildId();
+ while (id != sync_api::kInvalidId) {
+ sync_api::ReadNode sync_node(trans);
+ if (!sync_node.InitByIdLookup(id)) {
+ LOG(ERROR) << "Failed to fetch sync node for id " << id;
+ return false;
}
- sync_pb::SessionWindow* session_window = session->add_session_window();
- PopulateSessionSpecificsWindow(window, session_window);
+
+ const sync_pb::SessionSpecifics& specifics =
+ sync_node.GetSessionSpecifics();
+ const int64 modification_time = sync_node.GetModificationTime();
+ if (specifics.session_tag() != GetCurrentMachineTag()) {
+ if (!AssociateForeignSpecifics(specifics, modification_time)) {
+ return false;
+ }
+ } else if (id != local_session_syncid_) {
+ // This is previously stored local session information.
+ if (specifics.has_header()) {
+ DCHECK_EQ(sync_api::kInvalidId, local_session_syncid_);
+
+ // This is our previous header node, reuse it.
+ local_session_syncid_ = id;
+ } else {
+ DCHECK(specifics.has_tab());
+
+ // This is a tab node. We want to track these to reuse them in our free
+ // tab node pool. They will be overwritten eventually, so need to do
+ // anything else.
+ tab_pool_.AddTabNode(id);
+ }
+ }
+
+ id = sync_node.GetSuccessorId();
+ }
+
+ // After updating from sync model all tabid's should be free.
+ DCHECK(tab_pool_.full());
+
+ return true;
+}
+
+bool SessionModelAssociator::AssociateForeignSpecifics(
+ const sync_pb::SessionSpecifics& specifics,
+ const int64 modification_time) {
+ DCHECK(CalledOnValidThread());
+ std::string foreign_session_tag = specifics.session_tag();
+ DCHECK(foreign_session_tag != GetCurrentMachineTag() ||
+ sync_service_->cros_user() == "test user"); // For tests.
+
+ if (specifics.has_header()) {
+ // Read in the header data for this foreign session.
+ // Header data contains window information and ordered tab id's for each
+ // window.
+
+ // Load (or create) the ForeignSession object for this client.
+ ForeignSession* foreign_session =
+ foreign_session_tracker_.GetForeignSession(foreign_session_tag);
+
+ const sync_pb::SessionHeader& header = specifics.header();
+ foreign_session->windows.reserve(header.window_size());
+ VLOG(1) << "Associating " << foreign_session_tag << " with " <<
+ header.window_size() << " windows.";
+ size_t i;
+ for (i = 0; i < static_cast<size_t>(header.window_size()); ++i) {
+ if (i >= foreign_session->windows.size()) {
+ // This a new window, create it.
+ foreign_session->windows.push_back(new SessionWindow());
+ }
+ const sync_pb::SessionWindow& window_s = header.window(i);
+ PopulateSessionWindowFromSpecifics(foreign_session_tag,
+ window_s,
+ modification_time,
+ foreign_session->windows[i],
+ &foreign_session_tracker_);
+ }
+ // Remove any remaining windows (in case windows were closed)
+ for (; i < foreign_session->windows.size(); ++i) {
+ delete foreign_session->windows[i];
+ }
+ foreign_session->windows.resize(header.window_size());
+ } else if (specifics.has_tab()) {
+ const sync_pb::SessionTab& tab_s = specifics.tab();
+ SessionID::id_type tab_id = tab_s.tab_id();
+ SessionTab* tab =
+ foreign_session_tracker_.GetSessionTab(foreign_session_tag,
+ tab_id,
+ false);
+ PopulateSessionTabFromSpecifics(tab_s, modification_time, tab);
+ } else {
+ NOTREACHED();
+ return false;
+ }
+
+ return true;
+}
+
+void SessionModelAssociator::DisassociateForeignSession(
+ const std::string& foreign_session_tag) {
+ DCHECK(CalledOnValidThread());
+ foreign_session_tracker_.DeleteForeignSession(foreign_session_tag);
+}
+
+// Static
+void SessionModelAssociator::PopulateSessionWindowFromSpecifics(
+ std::string foreign_session_tag,
+ const sync_pb::SessionWindow& specifics,
+ int64 mtime,
+ SessionWindow* session_window,
+ ForeignSessionTracker* tracker) {
+ if (specifics.has_window_id())
+ session_window->window_id.set_id(specifics.window_id());
+ if (specifics.has_selected_tab_index())
+ session_window->selected_tab_index = specifics.selected_tab_index();
+ if (specifics.has_browser_type()) {
+ if (specifics.browser_type() ==
+ sync_pb::SessionWindow_BrowserType_TYPE_NORMAL) {
+ session_window->type = 1;
+ } else {
+ session_window->type = 2;
+ }
+ }
+ session_window->timestamp = base::Time::FromInternalValue(mtime);
+ session_window->tabs.resize(specifics.tab_size());
+ for (int i = 0; i < specifics.tab_size(); i++) {
+ SessionID::id_type tab_id = specifics.tab(i);
+ session_window->tabs[i] =
+ tracker->GetSessionTab(foreign_session_tag, tab_id, true);
}
}
+// Static
+void SessionModelAssociator::PopulateSessionTabFromSpecifics(
+ const sync_pb::SessionTab& specifics,
+ const int64 mtime,
+ SessionTab* tab) {
+ if (specifics.has_tab_id())
+ tab->tab_id.set_id(specifics.tab_id());
+ if (specifics.has_window_id())
+ tab->window_id.set_id(specifics.window_id());
+ if (specifics.has_tab_visual_index())
+ tab->tab_visual_index = specifics.tab_visual_index();
+ if (specifics.has_current_navigation_index())
+ tab->current_navigation_index = specifics.current_navigation_index();
+ if (specifics.has_pinned())
+ tab->pinned = specifics.pinned();
+ if (specifics.has_extension_app_id())
+ tab->extension_app_id = specifics.extension_app_id();
+ tab->timestamp = base::Time::FromInternalValue(mtime);
+ tab->navigations.clear(); // In case we are reusing a previous SessionTab.
+ for (int i = 0; i < specifics.navigation_size(); i++) {
+ AppendSessionTabNavigation(specifics.navigation(i), &tab->navigations);
+ }
+}
+
+// Static
void SessionModelAssociator::AppendSessionTabNavigation(
- std::vector<TabNavigation>* navigations,
- const sync_pb::TabNavigation* navigation) {
+ const sync_pb::TabNavigation& specifics,
+ std::vector<TabNavigation>* navigations) {
int index = 0;
GURL virtual_url;
GURL referrer;
string16 title;
std::string state;
PageTransition::Type transition(PageTransition::LINK);
- if (navigation->has_index())
- index = navigation->index();
- if (navigation->has_virtual_url()) {
- GURL gurl(navigation->virtual_url());
+ if (specifics.has_index())
+ index = specifics.index();
+ if (specifics.has_virtual_url()) {
+ GURL gurl(specifics.virtual_url());
virtual_url = gurl;
}
- if (navigation->has_referrer()) {
- GURL gurl(navigation->referrer());
+ if (specifics.has_referrer()) {
+ GURL gurl(specifics.referrer());
referrer = gurl;
}
- if (navigation->has_title())
- title = UTF8ToUTF16(navigation->title());
- if (navigation->has_page_transition() ||
- navigation->has_navigation_qualifier()) {
- switch (navigation->page_transition()) {
+ if (specifics.has_title())
+ title = UTF8ToUTF16(specifics.title());
+ if (specifics.has_state())
+ state = specifics.state();
+ if (specifics.has_page_transition() ||
+ specifics.has_navigation_qualifier()) {
+ switch (specifics.page_transition()) {
case sync_pb::TabNavigation_PageTransition_LINK:
transition = PageTransition::LINK;
break;
@@ -493,7 +659,7 @@
transition = PageTransition::CHAIN_END;
break;
default:
- switch (navigation->navigation_qualifier()) {
+ switch (specifics.navigation_qualifier()) {
case sync_pb::
TabNavigation_PageTransitionQualifier_CLIENT_REDIRECT:
transition = PageTransition::CLIENT_REDIRECT;
@@ -512,67 +678,291 @@
navigations->insert(navigations->end(), tab_navigation);
}
-void SessionModelAssociator::PopulateSessionTabFromSpecifics(
- SessionTab* session_tab,
- const sync_pb::SessionTab* tab, SessionID id) {
- session_tab->window_id = id;
- SessionID tabID;
- session_tab->tab_id = tabID;
- if (tab->has_tab_visual_index())
- session_tab->tab_visual_index = tab->tab_visual_index();
- if (tab->has_current_navigation_index()) {
- session_tab->current_navigation_index =
- tab->current_navigation_index();
- }
- if (tab->has_pinned())
- session_tab->pinned = tab->pinned();
- if (tab->has_extension_app_id())
- session_tab->extension_app_id = tab->extension_app_id();
- for (int i3 = 0; i3 < tab->navigation_size(); i3++) {
- const sync_pb::TabNavigation* navigation = &tab->navigation(i3);
- AppendSessionTabNavigation(&session_tab->navigations, navigation);
+void SessionModelAssociator::UpdateSyncModelDataFromClient() {
+ DCHECK(CalledOnValidThread());
+ // TODO(zea): the logic for determining if we want to sync and the loading of
+ // the previous session should go here. We can probably reuse the code for
+ // loading the current session from the old session implementation.
+ // SessionService::SessionCallback* callback =
+ // NewCallback(this, &SessionModelAssociator::OnGotSession);
+ // GetSessionService()->GetCurrentSession(&consumer_, callback);
+
+ // Associate all open windows and their tabs.
+ ReassociateWindows(true);
+}
+
+SessionModelAssociator::TabNodePool::TabNodePool(
+ ProfileSyncService* sync_service)
+ : tab_pool_fp_(-1),
+ sync_service_(sync_service) {
+}
+
+void SessionModelAssociator::TabNodePool::AddTabNode(int64 sync_id) {
+ tab_syncid_pool_.resize(tab_syncid_pool_.size() + 1);
+ tab_syncid_pool_[static_cast<size_t>(++tab_pool_fp_)] = sync_id;
+}
+
+int64 SessionModelAssociator::TabNodePool::GetFreeTabNode() {
+ DCHECK_GT(machine_tag_.length(), 0U);
+ if (tab_pool_fp_ == -1) {
+ // Tab pool has no free nodes, allocate new one.
+ sync_api::WriteTransaction trans(
+ sync_service_->backend()->GetUserShareHandle());
+ sync_api::ReadNode root(&trans);
+ if (!root.InitByTagLookup(kSessionsTag)) {
+ LOG(ERROR) << kNoSessionsFolderError;
+ return 0;
+ }
+ size_t tab_node_id = tab_syncid_pool_.size();
+ std::string tab_node_tag = TabIdToTag(machine_tag_, tab_node_id);
+ sync_api::WriteNode tab_node(&trans);
+ if (!tab_node.InitUniqueByCreation(syncable::SESSIONS, root,
+ tab_node_tag)) {
+ LOG(ERROR) << "Could not create new node!";
+ return -1;
+ }
+ tab_node.SetTitle(UTF8ToWide(tab_node_tag));
+
+ // Grow the pool by 1 since we created a new node. We don't actually need
+ // to put the node's id in the pool now, since the pool is still empty.
+ // The id will be added when that tab is closed and the node is freed.
+ tab_syncid_pool_.resize(tab_node_id + 1);
+ VLOG(1) << "Adding sync node " << tab_node.GetId() << " to tab syncid pool";
+ return tab_node.GetId();
+ } else {
+ // There are nodes available, grab next free and decrement free pointer.
+ return tab_syncid_pool_[static_cast<size_t>(tab_pool_fp_--)];
}
}
-void SessionModelAssociator::PopulateSessionWindowFromSpecifics(
- SessionWindow* session_window, const sync_pb::SessionWindow* window) {
- SessionID id;
- session_window->window_id = id;
- if (window->has_selected_tab_index())
- session_window->selected_tab_index = window->selected_tab_index();
- if (window->has_browser_type()) {
- if (window->browser_type() ==
- sync_pb::SessionWindow_BrowserType_TYPE_NORMAL) {
- session_window->type = 1;
- } else {
- session_window->type = 2;
+void SessionModelAssociator::TabNodePool::FreeTabNode(int64 sync_id) {
+ // Pool size should always match # of free tab nodes.
+ DCHECK_LT(tab_pool_fp_, static_cast<int64>(tab_syncid_pool_.size()));
+ tab_syncid_pool_[static_cast<size_t>(++tab_pool_fp_)] = sync_id;
+}
+
+bool SessionModelAssociator::GetAllForeignSessions(
+ std::vector<const ForeignSession*>* sessions) {
+ DCHECK(CalledOnValidThread());
+ return foreign_session_tracker_.LookupAllForeignSessions(sessions);
+}
+
+bool SessionModelAssociator::GetForeignSession(
+ const std::string& tag,
+ std::vector<SessionWindow*>* windows) {
+ DCHECK(CalledOnValidThread());
+ return foreign_session_tracker_.LookupSessionWindows(tag, windows);
+}
+
+bool SessionModelAssociator::GetForeignTab(
+ const std::string& tag,
+ const SessionID::id_type tab_id,
+ const SessionTab** tab) {
+ DCHECK(CalledOnValidThread());
+ return foreign_session_tracker_.LookupSessionTab(tag, tab_id, tab);
+}
+
+// Static
+bool SessionModelAssociator::SessionWindowHasNoTabsToSync(
+ const SessionWindow& window) {
+ int num_populated = 0;
+ for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin();
+ i != window.tabs.end(); ++i) {
+ const SessionTab* tab = *i;
+ if (IsValidSessionTab(*tab))
+ num_populated++;
+ }
+ if (num_populated == 0)
+ return true;
+ return false;
+}
+
+// Valid local tab?
+bool SessionModelAssociator::IsValidTab(const TabContents& tab) {
+ DCHECK(CalledOnValidThread());
+ if ((tab.profile() == sync_service_->profile() ||
+ sync_service_->profile() == NULL)) {
+ const NavigationEntry* entry = tab.controller().GetActiveEntry();
+ if (!entry)
+ return false;
+ if (entry->virtual_url().is_valid() &&
+ (entry->virtual_url() != GURL(chrome::kChromeUINewTabURL) ||
+ tab.controller().entry_count() > 1)) {
+ return true;
}
}
- for (int i = 0; i < window->session_tab_size(); i++) {
- const sync_pb::SessionTab& tab = window->session_tab(i);
- SessionTab* session_tab = new SessionTab();
- PopulateSessionTabFromSpecifics(session_tab, &tab, id);
- session_window->tabs.insert(session_window->tabs.end(), session_tab);
+ return false;
+}
+
+// Static
+bool SessionModelAssociator::IsValidSessionTab(const SessionTab& tab) {
+ if (tab.navigations.empty())
+ return false;
+ int selected_index = tab.current_navigation_index;
+ selected_index = std::max(
+ 0,
+ std::min(selected_index,
+ static_cast<int>(tab.navigations.size() - 1)));
+ if (selected_index == 0 &&
+ tab.navigations.size() == 1 &&
+ tab.navigations.at(selected_index).virtual_url() ==
+ GURL(chrome::kChromeUINewTabURL)) {
+ // This is a new tab with no further history, skip.
+ return false;
+ }
+ return true;
+}
+
+// ==========================================================================
+// The following methods are not currently used but will likely become useful
+// if we choose to sync the previous browser session.
+
+SessionService* SessionModelAssociator::GetSessionService() {
+ DCHECK(CalledOnValidThread());
+ DCHECK(sync_service_);
+ Profile* profile = sync_service_->profile();
+ DCHECK(profile);
+ SessionService* sessions_service = profile->GetSessionService();
+ DCHECK(sessions_service);
+ return sessions_service;
+}
+
+void SessionModelAssociator::OnGotSession(
+ int handle,
+ std::vector<SessionWindow*>* windows) {
+ DCHECK(CalledOnValidThread());
+ DCHECK(local_session_syncid_);
+
+ sync_pb::SessionSpecifics specifics;
+ specifics.set_session_tag(GetCurrentMachineTag());
+ sync_pb::SessionHeader* header_s = specifics.mutable_header();
+ PopulateSessionSpecificsHeader(*windows, header_s);
+
+ sync_api::WriteTransaction trans(
+ sync_service_->backend()->GetUserShareHandle());
+ sync_api::ReadNode root(&trans);
+ if (!root.InitByTagLookup(kSessionsTag)) {
+ LOG(ERROR) << kNoSessionsFolderError;
+ return;
+ }
+
+ sync_api::WriteNode header_node(&trans);
+ if (!header_node.InitByIdLookup(local_session_syncid_)) {
+ LOG(ERROR) << "Failed to load local session header node.";
+ return;
+ }
+
+ header_node.SetSessionSpecifics(specifics);
+}
+
+void SessionModelAssociator::PopulateSessionSpecificsHeader(
+ const std::vector<SessionWindow*>& windows,
+ sync_pb::SessionHeader* header_s) {
+ DCHECK(CalledOnValidThread());
+
+ // Iterate through the vector of windows, extracting the window data, along
+ // with the tab data to populate the session specifics.
+ for (size_t i = 0; i < windows.size(); ++i) {
+ if (SessionWindowHasNoTabsToSync(*(windows[i])))
+ continue;
+ sync_pb::SessionWindow* window_s = header_s->add_window();
+ PopulateSessionSpecificsWindow(*(windows[i]), window_s);
+ if (!SyncLocalWindowToSyncModel(*(windows[i])))
+ return;
}
}
-bool SessionModelAssociator::UpdateSyncModel(
- sync_pb::SessionSpecifics* session_data,
- sync_api::WriteTransaction* trans,
- const sync_api::ReadNode* root) {
- const std::string id = session_data->session_tag();
- sync_api::WriteNode write_node(trans);
- if (!write_node.InitByClientTagLookup(syncable::SESSIONS, id)) {
- sync_api::WriteNode create_node(trans);
- if (!create_node.InitUniqueByCreation(syncable::SESSIONS, *root, id)) {
- LOG(ERROR) << "Could not create node for session " << id;
+// Called when populating session specifics to send to the sync model, called
+// when associating models, or updating the sync model.
+void SessionModelAssociator::PopulateSessionSpecificsWindow(
+ const SessionWindow& window,
+ sync_pb::SessionWindow* session_window) {
+ DCHECK(CalledOnValidThread());
+ session_window->set_window_id(window.window_id.id());
+ session_window->set_selected_tab_index(window.selected_tab_index);
+ if (window.type == Browser::TYPE_NORMAL) {
+ session_window->set_browser_type(
+ sync_pb::SessionWindow_BrowserType_TYPE_NORMAL);
+ } else if (window.type == Browser::TYPE_POPUP) {
+ session_window->set_browser_type(
+ sync_pb::SessionWindow_BrowserType_TYPE_POPUP);
+ } else {
+ // ignore
+ LOG(WARNING) << "Session Sync unable to handle windows of type" <<
+ window.type;
+ return;
+ }
+ for (std::vector<SessionTab*>::const_iterator i = window.tabs.begin();
+ i != window.tabs.end(); ++i) {
+ const SessionTab* tab = *i;
+ if (!IsValidSessionTab(*tab))
+ continue;
+ session_window->add_tab(tab->tab_id.id());
+ }
+}
+
+bool SessionModelAssociator::SyncLocalWindowToSyncModel(
+ const SessionWindow& window) {
+ DCHECK(CalledOnValidThread());
+ DCHECK(tab_map_.empty());
+ for (size_t i = 0; i < window.tabs.size(); ++i) {
+ SessionTab* tab = window.tabs[i];
+ int64 id = tab_pool_.GetFreeTabNode();
+ if (id == -1) {
+ LOG(ERROR) << "Failed to find/generate free sync node for tab.";
return false;
}
- create_node.SetSessionSpecifics(*session_data);
- return true;
+
+ sync_api::WriteTransaction trans(
+ sync_service_->backend()->GetUserShareHandle());
+ if (!WriteSessionTabToSyncModel(*tab, id, &trans)) {
+ return false;
+ }
+
+ TabLinks t(id, tab);
+ tab_map_[tab->tab_id.id()] = t;
}
- write_node.SetSessionSpecifics(*session_data);
return true;
}
+bool SessionModelAssociator::WriteSessionTabToSyncModel(
+ const SessionTab& tab,
+ const int64 sync_id,
+ sync_api::WriteTransaction* trans) {
+ DCHECK(CalledOnValidThread());
+ sync_api::WriteNode tab_node(trans);
+ if (!tab_node.InitByIdLookup(sync_id)) {
+ LOG(ERROR) << "Failed to look up tab node " << sync_id;
+ return false;
+ }
+
+ sync_pb::SessionSpecifics specifics;
+ specifics.set_session_tag(GetCurrentMachineTag());
+ sync_pb::SessionTab* tab_s = specifics.mutable_tab();
+ PopulateSessionSpecificsTab(tab, tab_s);
+ tab_node.SetSessionSpecifics(specifics);
+ return true;
+}
+
+// See PopulateSessionSpecificsWindow for use.
+void SessionModelAssociator::PopulateSessionSpecificsTab(
+ const SessionTab& tab,
+ sync_pb::SessionTab* session_tab) {
+ DCHECK(CalledOnValidThread());
+ session_tab->set_tab_id(tab.tab_id.id());
+ session_tab->set_window_id(tab.window_id.id());
+ session_tab->set_tab_visual_index(tab.tab_visual_index);
+ session_tab->set_current_navigation_index(
+ tab.current_navigation_index);
+ session_tab->set_pinned(tab.pinned);
+ session_tab->set_extension_app_id(tab.extension_app_id);
+ for (std::vector<TabNavigation>::const_iterator i =
+ tab.navigations.begin(); i != tab.navigations.end(); ++i) {
+ const TabNavigation navigation = *i;
+ sync_pb::TabNavigation* tab_navigation =
+ session_tab->add_navigation();
+ PopulateSessionSpecificsNavigation(&navigation, tab_navigation);
+ }
+}
+
} // namespace browser_sync
diff --git a/chrome/browser/sync/glue/session_model_associator.h b/chrome/browser/sync/glue/session_model_associator.h
index 502af18..cff376f 100644
--- a/chrome/browser/sync/glue/session_model_associator.h
+++ b/chrome/browser/sync/glue/session_model_associator.h
@@ -6,6 +6,7 @@
#define CHROME_BROWSER_SYNC_GLUE_SESSION_MODEL_ASSOCIATOR_H_
#pragma once
+#include <map>
#include <string>
#include <vector>
@@ -13,12 +14,19 @@
#include "base/gtest_prod_util.h"
#include "base/observer_list.h"
#include "base/scoped_vector.h"
+#include "base/string_util.h"
+#include "base/threading/non_thread_safe.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser_window.h"
+#include "chrome/browser/sessions/session_id.h"
#include "chrome/browser/sessions/session_service.h"
#include "chrome/browser/sessions/session_types.h"
#include "chrome/browser/sync/engine/syncapi.h"
+#include "chrome/browser/sync/glue/foreign_session_tracker.h"
#include "chrome/browser/sync/glue/model_associator.h"
#include "chrome/browser/sync/protocol/session_specifics.pb.h"
#include "chrome/browser/sync/syncable/model_type.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_registrar.h"
class Profile;
@@ -40,59 +48,76 @@
// Contains all logic for associating the Chrome sessions model and
// the sync sessions model.
-// In the case of sessions, our local model is nothing but a buffer (specifics_)
-// that gets overwritten everytime there is an update. From it, we build a new
-// foreign session windows list each time |GetSessionData| is called by the
-// ForeignSessionHandler.
-class SessionModelAssociator : public PerDataTypeAssociatorInterface<
- sync_pb::SessionSpecifics, std::string>, public NonThreadSafe {
+class SessionModelAssociator
+ : public PerDataTypeAssociatorInterface<TabContents, size_t>,
+ public base::NonThreadSafe {
public:
-
// Does not take ownership of sync_service.
explicit SessionModelAssociator(ProfileSyncService* sync_service);
virtual ~SessionModelAssociator();
+ // The has_nodes out parameter is set to true if the sync model has
+ // nodes other than the permanent tagged nodes. The method may
+ // return false if an error occurred.
+ virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes);
+
// AssociatorInterface and PerDataTypeAssociator Interface implementation.
virtual void AbortAssociation() {
- // No implementation needed, this associator runs on the main
- // thread.
+ // No implementation needed, this associator runs on the main thread.
}
- // Dummy method, we do everything all-at-once in UpdateFromSyncModel.
- virtual void Associate(const sync_pb::SessionSpecifics* specifics,
- int64 sync_id) {
- }
-
- // Updates the sync model with the local client data. (calls
- // UpdateFromSyncModel)
- virtual bool AssociateModels();
-
- // The has_nodes out parameter is set to true if the chrome model
- // has user-created nodes. The method may return false if an error
- // occurred.
- virtual bool ChromeModelHasUserCreatedNodes(bool* has_nodes);
-
- // Dummy method, we do everything all-at-once in UpdateFromSyncModel.
- virtual void Disassociate(int64 sync_id) {
- }
-
- // Clear specifics_ buffer and notify foreign session handlers.
- virtual bool DisassociateModels();
-
- // Returns the chrome session specifics for the given sync id.
- // Returns NULL if no specifics are found for the given sync id.
- virtual const sync_pb::SessionSpecifics* GetChromeNodeFromSyncId(
- int64 sync_id);
-
- // Returns whether a node with the given permanent tag was found and update
- // |sync_id| with that node's id.
- virtual bool GetSyncIdForTaggedNode(const std::string* tag, int64* sync_id);
-
// Returns sync id for the given chrome model id.
// Returns sync_api::kInvalidId if the sync node is not found for the given
// chrome id.
- virtual int64 GetSyncIdFromChromeId(const std::string& id);
+ virtual int64 GetSyncIdFromChromeId(const size_t& id);
+ // Returns sync id for the given session tag.
+ // Returns sync_api::kInvalidId if the sync node is not found for the given
+ // tag
+ virtual int64 GetSyncIdFromSessionTag(const std::string& tag);
+
+ // Not used.
+ virtual const TabContents* GetChromeNodeFromSyncId(int64 sync_id) {
+ NOTREACHED();
+ return NULL;
+ }
+
+ // Not used.
+ bool InitSyncNodeFromChromeId(const size_t& id,
+ sync_api::BaseNode* sync_node) {
+ NOTREACHED();
+ return false;
+ }
+
+ // Resync local window information. Updates the local sessions header node
+ // with the status of open windows and the order of tabs they contain. Should
+ // only be called for changes that affect a window, not a change within a
+ // single tab.
+ //
+ // If |reload_tabs| is true, will also resync all tabs (same as calling
+ // ReassociateTabs with a vector of all tabs).
+ void ReassociateWindows(bool reload_tabs);
+
+ // Loads and reassociates the local tabs referenced in |tabs|.
+ void ReassociateTabs(const std::vector<TabContents*>& tabs);
+
+ // Reassociates a single tab with the sync model. Will check if the tab
+ // already is associated with a sync node and allocate one if necessary.
+ void ReassociateTab(const TabContents& tab);
+
+ // Associate a local tab and it's sync node. Will overwrite the contents of
+ // the sync node with new specifics built from the tab.
+ virtual void Associate(const TabContents* tab, int64 sync_id);
+
+ // Looks up the specified sync node, and marks that tab as closed, then marks
+ // the node as free and deletes association.
+ virtual void Disassociate(int64 sync_id);
+
+ // Load any foreign session info stored in sync db and update the sync db
+ // with local client data. Processes/reuses any sync nodes owned by this
+ // client and creates any further sync nodes needed to store local header and
+ // tab info.
+ virtual bool AssociateModels();
// Initializes the given sync node from the given chrome node id.
// Returns false if no sync node was found for the given chrome node id or
@@ -100,46 +125,53 @@
virtual bool InitSyncNodeFromChromeId(const std::string& id,
sync_api::BaseNode* sync_node);
- // The has_nodes out parameter is set to true if the sync model has
- // nodes other than the permanent tagged nodes. The method may
- // return false if an error occurred.
- virtual bool SyncModelHasUserCreatedNodes(bool* has_nodes);
+ // Clear local sync data buffers. Does not delete sync nodes to avoid
+ // tombstones. TODO(zea): way to eventually delete orphaned nodes.
+ virtual bool DisassociateModels();
// Returns the tag used to uniquely identify this machine's session in the
// sync model.
- std::string GetCurrentMachineTag();
+ inline const std::string& GetCurrentMachineTag() {
+ DCHECK(!current_machine_tag_.empty());
+ return current_machine_tag_;
+ }
- // Updates the server data based upon the current client session. If no node
- // corresponding to this machine exists in the sync model, one is created.
- void UpdateSyncModelDataFromClient();
+ // Load and associate window and tab data for a foreign session
+ bool AssociateForeignSpecifics(const sync_pb::SessionSpecifics& specifics,
+ int64 modification_time);
- // Pulls the current sync model from the sync database and returns true upon
- // update of the client model. Called by SessionChangeProcessor.
- // Note that the specifics_ vector is reset and built from scratch each time.
- bool UpdateFromSyncModel(const sync_api::BaseTransaction* trans);
+ // Removes a foreign session from our internal bookkeeping.
+ void DisassociateForeignSession(const std::string& foreign_session_tag);
- // Helper for UpdateFromSyncModel. Appends sync data to a vector of specifics.
- bool QuerySyncModel(const sync_api::BaseTransaction* trans,
- std::vector<const sync_pb::SessionSpecifics*>& specifics);
+ // Builds a list of all foreign sessions.
+ // Caller does NOT own ForeignSession objects.
+ bool GetAllForeignSessions(std::vector<const ForeignSession*>* sessions);
- // Builds sessions from buffered specifics data
- bool GetSessionData(std::vector<ForeignSession*>* sessions);
+ // Loads all windows for foreign session with session tag |tag|.
+ // Caller does NOT own ForeignSession objects.
+ bool GetForeignSession(const std::string& tag,
+ std::vector<SessionWindow*>* windows);
- // Helper method to generate session specifics from session windows.
- void FillSpecificsFromSessions(std::vector<SessionWindow*>* windows,
- sync_pb::SessionSpecifics* session);
+ // Looks up the foreign tab identified by |tab_id| and belonging to foreign
+ // session |tag|.
+ // Caller does NOT own the SessionTab object.
+ bool GetForeignTab(const std::string& tag,
+ const SessionID::id_type tab_id,
+ const SessionTab** tab);
- // Helper method for converting session specifics to windows.
- void AppendForeignSessionFromSpecifics(
- const sync_pb::SessionSpecifics* specifics,
- std::vector<ForeignSession*>* session);
+ // Specifies whether the window has tabs to sync. The new tab page does not
+ // count. If no tabs to sync, it returns true, otherwise false;
+ static bool SessionWindowHasNoTabsToSync(const SessionWindow& window);
- // Fills the given empty vector with foreign session windows to restore.
- // If the vector is returned empty, then the session data could not be
- // converted back into windows.
- void AppendForeignSessionWithID(int64 id,
- std::vector<ForeignSession*>* session,
- sync_api::BaseTransaction* trans);
+ // Control which local tabs we're interested in syncing.
+ // Ensures the profile matches sync's profile and that the tab has at least
+ // one navigation entry and is not an empty tab.
+ bool IsValidTab(const TabContents& tab);
+
+ // Control which foreign tabs we're interested in displaying.
+ // Checks that the tab has navigations and is not a new tab.
+ // Note: a new tab page with back/forward history is valid.
+ static bool IsValidSessionTab(const SessionTab& tab);
// Returns the syncable model type.
static syncable::ModelType model_type() { return syncable::SESSIONS; }
@@ -147,60 +179,225 @@
private:
FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceSessionTest, WriteSessionToNode);
FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceSessionTest,
+ WriteFilledSessionToNode);
+ FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceSessionTest,
WriteForeignSessionToNode);
+ FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceSessionTest, TabNodePoolEmpty);
+ FRIEND_TEST_ALL_PREFIXES(ProfileSyncServiceSessionTest, TabNodePoolNonEmpty);
+ FRIEND_TEST_ALL_PREFIXES(SessionModelAssociatorTest, PopulateSessionWindow);
+ FRIEND_TEST_ALL_PREFIXES(SessionModelAssociatorTest, PopulateSessionTab);
+
+ // Keep all the links to local tab data in one place.
+ class TabLinks {
+ public:
+ // To support usage as second value in maps we need default and copy
+ // constructors.
+ TabLinks()
+ : sync_id_(0),
+ session_tab_(NULL),
+ tab_(NULL) {}
+
+ // We only ever have either a SessionTab (for foreign tabs), or a
+ // TabContents (for local tabs).
+ TabLinks(int64 sync_id, const TabContents* tab)
+ : sync_id_(sync_id),
+ session_tab_(NULL) {
+ tab_ = const_cast<TabContents*>(tab);
+ }
+ TabLinks(int64 sync_id, const SessionTab* session_tab)
+ : sync_id_(sync_id),
+ tab_(NULL) {
+ session_tab_ = const_cast<SessionTab*>(session_tab);
+ }
+
+ inline int64 sync_id() const { return sync_id_; }
+ inline const SessionTab* session_tab() const { return session_tab_; }
+ inline const TabContents* tab() const { return tab_; }
+ private:
+ int64 sync_id_;
+ SessionTab* session_tab_;
+ TabContents* tab_;
+ };
+
+ // A pool for managing free/used tab sync nodes. Performs lazy creation
+ // of sync nodes when necessary.
+ class TabNodePool {
+ public:
+ explicit TabNodePool(ProfileSyncService* sync_service);
+
+ // Add a previously allocated tab sync node to our pool. Increases the size
+ // of tab_syncid_pool_ by one and marks the new tab node as free.
+ // Note: this should only be called when we discover tab sync nodes from
+ // previous sessions, not for freeing tab nodes we created through
+ // GetFreeTabNode (use FreeTabNode below for that).
+ void AddTabNode(int64 sync_id);
+
+ // Returns the sync_id for the next free tab node. If none are available,
+ // creates a new tab node.
+ // Note: We make use of the following "id's"
+ // - a sync_id: an int64 used in |sync_api::InitByIdLookup|
+ // - a tab_id: created by session service, unique to this client
+ // - a tab_node_id: the id for a particular sync tab node. This is used
+ // to generate the sync tab node tag through:
+ // tab_tag = StringPrintf("%s_%ui", local_session_tag, tab_node_id);
+ // tab_node_id and sync_id are both unique to a particular sync node. The
+ // difference is that tab_node_id is controlled by the model associator and
+ // is used when creating a new sync node, which returns the sync_id, created
+ // by the sync db.
+ int64 GetFreeTabNode();
+
+ // Return a tab node to our free pool.
+ // Note: the difference between FreeTabNode and AddTabNode is that
+ // FreeTabNode does not modify the size of |tab_syncid_pool_|, while
+ // AddTabNode increases it by one. In the case of FreeTabNode, the size of
+ // the |tab_syncid_pool_| should always be equal to the amount of tab nodes
+ // associated with this machine.
+ void FreeTabNode(int64 sync_id);
+
+ // Clear tab pool.
+ inline void clear() { tab_syncid_pool_.clear(); }
+
+ // Return the number of tab nodes this client currently has allocated
+ // (including both free and used nodes)
+ inline size_t capacity() const { return tab_syncid_pool_.size(); }
+
+ // Return empty status (all tab nodes are in use).
+ inline bool empty() const { return tab_pool_fp_ == -1; }
+
+ // Return full status (no tab nodes are in use).
+ inline bool full() {
+ return tab_pool_fp_ == static_cast<int64>(tab_syncid_pool_.size())-1;
+ }
+
+ inline void set_machine_tag(const std::string& machine_tag) {
+ machine_tag_ = machine_tag;
+ }
+ private:
+ // Pool of all available syncid's for tab's we have created.
+ std::vector<int64> tab_syncid_pool_;
+
+ // Free pointer for tab pool. Only those node id's, up to and including the
+ // one indexed by the free pointer, are valid and free. The rest of the
+ // |tab_syncid_pool_| is invalid because the nodes are in use.
+ // To get the next free node, use tab_syncid_pool_[tab_pool_fp_--].
+ int64 tab_pool_fp_;
+
+ // The machiine tag associated with this tab pool. Used in the title of new
+ // sync nodes.
+ std::string machine_tag_;
+
+ // Our sync service profile (for making changes to the sync db)
+ ProfileSyncService* sync_service_;
+
+ DISALLOW_COPY_AND_ASSIGN(TabNodePool);
+ };
+
+ // Datatypes for accessing local tab data.
+ typedef std::map<SessionID::id_type, TabLinks> TabLinksMap;
+
+ // Delete all foreign session/window/tab objects allocated dynamically.
+ // This is comprised of ForeignSession*, IDToSessionTabMap*, and any orphaned
+ // SessionTab*'s.
+ void DeleteForeignSessions();
+
+ // Determine if a window is of a type we're interested in syncing.
+ static bool ShouldSyncWindowType(const Browser::Type& type);
+
+ // Build a sync tag from tab_node_id.
+ static inline std::string TabIdToTag(
+ const std::string machine_tag,
+ size_t tab_node_id) {
+ return StringPrintf("%s %lu",
+ machine_tag.c_str(), static_cast<unsigned long>(tab_node_id));
+ }
+
+ // Initializes the tag corresponding to this machine.
+ void InitializeCurrentMachineTag(sync_api::WriteTransaction* trans);
+
+ // Updates the server data based upon the current client session. If no node
+ // corresponding to this machine exists in the sync model, one is created.
+ void UpdateSyncModelDataFromClient();
+
+ // Pulls the current sync model from the sync database and returns true upon
+ // update of the client model. Will associate any foreign sessions as well as
+ // keep track of any local tab nodes, adding them to our free tab node pool.
+ bool UpdateAssociationsFromSyncModel(const sync_api::ReadNode& root,
+ const sync_api::BaseTransaction* trans);
+
+ // Fills a tab sync node with data from a TabContents object.
+ // (from a local navigation event)
+ bool WriteTabContentsToSyncModel(const TabContents& tab,
+ const int64 sync_id,
+ sync_api::WriteTransaction* trans);
+
+ // Used to populate a session window from the session specifics window
+ // provided. Tracks any foreign session data created through |tracker|.
+ static void PopulateSessionWindowFromSpecifics(
+ std::string foreign_session_tag,
+ const sync_pb::SessionWindow& window,
+ const int64 mtime,
+ SessionWindow* session_window,
+ ForeignSessionTracker* tracker);
+
+ // Used to populate a session tab from the session specifics tab provided.
+ static void PopulateSessionTabFromSpecifics(const sync_pb::SessionTab& tab,
+ const int64 mtime,
+ SessionTab* session_tab);
+
+ // Used to populate a session tab from the session specifics tab provided.
+ static void AppendSessionTabNavigation(
+ const sync_pb::TabNavigation& navigation,
+ std::vector<TabNavigation>* navigations);
+
+ // Populates the navigation portion of the session specifics.
+ static void PopulateSessionSpecificsNavigation(
+ const TabNavigation* navigation,
+ sync_pb::TabNavigation* tab_navigation);
// Returns the session service from |sync_service_|.
SessionService* GetSessionService();
- // Initializes the tag corresponding to this machine.
- // Note: creates a syncable::BaseTransaction.
- void InitializeCurrentMachineTag();
-
- // Populates the navigation portion of the session specifics.
- void PopulateSessionSpecificsNavigation(const TabNavigation* navigation,
- sync_pb::TabNavigation* tab_navigation);
-
- // Populates the tab portion of the session specifics.
- void PopulateSessionSpecificsTab(const SessionTab* tab,
- sync_pb::SessionTab* session_tab);
-
- // Populates the window portion of the session specifics.
- void PopulateSessionSpecificsWindow(const SessionWindow* window,
- sync_pb::SessionWindow* session_window);
-
- // Specifies whether the window has tabs to sync. The new tab page does not
- // count. If no tabs to sync, it returns true, otherwise false;
- bool WindowHasNoTabsToSync(const SessionWindow* window);
-
// Internal method used in the callback to obtain the current session.
// We don't own |windows|.
void OnGotSession(int handle, std::vector<SessionWindow*>* windows);
- // Used to populate a session tab from the session specifics tab provided.
- void AppendSessionTabNavigation(std::vector<TabNavigation>* navigations,
- const sync_pb::TabNavigation* navigation);
+ // Populate a session specifics header from a list of SessionWindows
+ void PopulateSessionSpecificsHeader(
+ const std::vector<SessionWindow*>& windows,
+ sync_pb::SessionHeader* header_s);
- // Used to populate a session tab from the session specifics tab provided.
- void PopulateSessionTabFromSpecifics(SessionTab* session_tab,
- const sync_pb::SessionTab* tab, SessionID id);
+ // Populates the window portion of the session specifics.
+ void PopulateSessionSpecificsWindow(const SessionWindow& window,
+ sync_pb::SessionWindow* session_window);
- // Used to populate a session window from the session specifics window
- // provided.
- void PopulateSessionWindowFromSpecifics(SessionWindow* session_window,
- const sync_pb::SessionWindow* window);
+ // Syncs all the tabs in |window| with the local sync db. Will allocate tab
+ // nodes if needed.
+ bool SyncLocalWindowToSyncModel(const SessionWindow& window);
- // Updates the current session on the server. Creates a node for this machine
- // if there is not one already.
- bool UpdateSyncModel(sync_pb::SessionSpecifics* session_data,
- sync_api::WriteTransaction* trans,
- const sync_api::ReadNode* root);
- // Stores the machine tag.
+ // Fills a tab sync node with data from a SessionTab object.
+ // (from ReadCurrentSessions)
+ bool WriteSessionTabToSyncModel(const SessionTab& tab,
+ const int64 sync_id,
+ sync_api::WriteTransaction* trans);
+
+ // Populates the tab portion of the session specifics.
+ void PopulateSessionSpecificsTab(const SessionTab& tab,
+ sync_pb::SessionTab* session_tab);
+
+ // Local client name.
std::string current_machine_tag_;
- // Stores the current set of foreign session specifics.
- // Used by ForeignSessionHandler through |GetSessionData|.
- // Built by |QuerySyncModel| via |UpdateFromSyncModel|.
- std::vector<const sync_pb::SessionSpecifics*> specifics_;
+ // Pool of all used/available sync nodes associated with tabs.
+ TabNodePool tab_pool_;
+
+ // SyncID for the sync node containing all the window information for this
+ // client.
+ int64 local_session_syncid_;
+
+ // Mapping of current open (local) tabs to their sync identifiers.
+ TabLinksMap tab_map_;
+
+ ForeignSessionTracker foreign_session_tracker_;
// Weak pointer.
ProfileSyncService* sync_service_;
diff --git a/chrome/browser/sync/glue/session_model_associator_unittest.cc b/chrome/browser/sync/glue/session_model_associator_unittest.cc
new file mode 100644
index 0000000..77f3866
--- /dev/null
+++ b/chrome/browser/sync/glue/session_model_associator_unittest.cc
@@ -0,0 +1,163 @@
+// 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.
+
+#include <string>
+#include <vector>
+
+#include "base/scoped_ptr.h"
+#include "base/values.h"
+#include "chrome/browser/sessions/session_types.h"
+#include "chrome/browser/sync/glue/session_model_associator.h"
+#include "chrome/common/page_transition_types.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/test/testing_profile.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+using browser_sync::SessionModelAssociator;
+using browser_sync::ForeignSessionTracker;
+namespace browser_sync {
+
+typedef testing::Test SessionModelAssociatorTest;
+
+TEST_F(SessionModelAssociatorTest, SessionWindowHasNoTabsToSync) {
+ SessionWindow win;
+ ASSERT_TRUE(SessionModelAssociator::SessionWindowHasNoTabsToSync(win));
+ scoped_ptr<SessionTab> tab(new SessionTab());
+ win.tabs.push_back(tab.release());
+ ASSERT_TRUE(SessionModelAssociator::SessionWindowHasNoTabsToSync(win));
+ TabNavigation nav(0, GURL("about:bubba"), GURL("about:referrer"),
+ string16(ASCIIToUTF16("title")),
+ std::string("state"), 0U);
+ win.tabs[0]->navigations.push_back(nav);
+ ASSERT_FALSE(SessionModelAssociator::SessionWindowHasNoTabsToSync(win));
+}
+
+TEST_F(SessionModelAssociatorTest, IsValidSessionTab) {
+ SessionTab tab;
+ ASSERT_FALSE(SessionModelAssociator::IsValidSessionTab(tab));
+ TabNavigation nav(0, GURL(chrome::kChromeUINewTabURL),
+ GURL("about:referrer"),
+ string16(ASCIIToUTF16("title")),
+ std::string("state"), 0U);
+ tab.navigations.push_back(nav);
+ // NewTab does not count as valid if it's the only navigation.
+ ASSERT_FALSE(SessionModelAssociator::IsValidSessionTab(tab));
+ TabNavigation nav2(0, GURL("about:bubba"),
+ GURL("about:referrer"),
+ string16(ASCIIToUTF16("title")),
+ std::string("state"), 0U);
+ tab.navigations.push_back(nav2);
+ // Once there's another navigation, the tab is valid.
+ ASSERT_TRUE(SessionModelAssociator::IsValidSessionTab(tab));
+}
+
+TEST_F(SessionModelAssociatorTest, PopulateSessionWindow) {
+ sync_pb::SessionWindow window_s;
+ window_s.add_tab(0);
+ window_s.set_browser_type(sync_pb::SessionWindow_BrowserType_TYPE_NORMAL);
+ window_s.set_selected_tab_index(1);
+
+ std::string tag = "tag";
+ ForeignSessionTracker tracker;
+ ForeignSession* session = tracker.GetForeignSession(tag);
+ SessionWindow* win = new SessionWindow();
+ session->windows.push_back(win);
+ SessionModelAssociator::PopulateSessionWindowFromSpecifics(
+ tag, window_s, 0, win, &tracker);
+ ASSERT_EQ(1U, win->tabs.size());
+ ASSERT_EQ(1, win->selected_tab_index);
+ ASSERT_EQ(1, win->type);
+ ASSERT_EQ(1U, tracker.num_foreign_sessions());
+ ASSERT_EQ(1U, tracker.num_foreign_tabs(std::string("tag")));
+
+ // We do this so that when the destructor for the tracker is called, it will
+ // be able to delete the session, window, and tab. We can't delete these
+ // ourselves, otherwise we would run into double free errors when the
+ // destructor was invoked (the true argument tells the tracker the tab
+ // is now associated with a window).
+ ASSERT_TRUE(tracker.GetSessionTab(tag, 0, true));
+}
+
+TEST_F(SessionModelAssociatorTest, PopulateSessionTab) {
+ sync_pb::SessionTab tab_s;
+ tab_s.set_tab_visual_index(13);
+ tab_s.set_current_navigation_index(3);
+ tab_s.set_pinned(true);
+ tab_s.set_extension_app_id("app_id");
+ sync_pb::TabNavigation* navigation = tab_s.add_navigation();
+ navigation->set_index(12);
+ navigation->set_virtual_url("http://foo/1");
+ navigation->set_referrer("referrer");
+ navigation->set_title("title");
+ navigation->set_page_transition(sync_pb::TabNavigation_PageTransition_TYPED);
+
+ SessionTab tab;
+ SessionModelAssociator::PopulateSessionTabFromSpecifics(tab_s, 0, &tab);
+ ASSERT_EQ(13, tab.tab_visual_index);
+ ASSERT_EQ(3, tab.current_navigation_index);
+ ASSERT_TRUE(tab.pinned);
+ ASSERT_EQ("app_id", tab.extension_app_id);
+ ASSERT_EQ(12, tab.navigations[0].index());
+ ASSERT_EQ(GURL("referrer"), tab.navigations[0].referrer());
+ ASSERT_EQ(string16(ASCIIToUTF16("title")), tab.navigations[0].title());
+ ASSERT_EQ(PageTransition::TYPED, tab.navigations[0].transition());
+ ASSERT_EQ(GURL("http://foo/1"), tab.navigations[0].virtual_url());
+}
+
+TEST_F(SessionModelAssociatorTest, ForeignSessionTracker) {
+ const std::string tag1 = "tag";
+ const std::string tag2 = "tag2";
+ const std::string tag3 = "tag3";
+ ForeignSessionTracker tracker;
+ ASSERT_TRUE(tracker.empty());
+ ASSERT_EQ(0U, tracker.num_foreign_sessions());
+ ASSERT_EQ(0U, tracker.num_foreign_tabs(tag1));
+ SessionTab* tab = tracker.GetSessionTab(tag1, 0, false);
+ ASSERT_EQ(1U, tracker.num_foreign_tabs(tag1));
+ ASSERT_EQ(0U, tracker.num_foreign_sessions());
+ SessionTab* tab2 = tracker.GetSessionTab(tag1, 0, false);
+ ASSERT_EQ(1U, tracker.num_foreign_tabs(tag1));
+ ASSERT_EQ(0U, tracker.num_foreign_sessions());
+ ASSERT_EQ(tab, tab2);
+ tab2 = tracker.GetSessionTab(tag2, 0, false);
+ ASSERT_EQ(1U, tracker.num_foreign_tabs(tag1));
+ ASSERT_EQ(1U, tracker.num_foreign_tabs(tag2));
+ ASSERT_EQ(0U, tracker.num_foreign_sessions());
+
+ ASSERT_FALSE(tracker.DeleteForeignSession(tag1));
+ ASSERT_FALSE(tracker.DeleteForeignSession(tag3));
+
+ ForeignSession* session = tracker.GetForeignSession(tag1);
+ ForeignSession* session2 = tracker.GetForeignSession(tag2);
+ ForeignSession* session3 = tracker.GetForeignSession(tag3);
+ ASSERT_EQ(3U, tracker.num_foreign_sessions());
+
+ ASSERT_TRUE(session);
+ ASSERT_TRUE(session2);
+ ASSERT_TRUE(session3);
+ ASSERT_NE(session, session2);
+ ASSERT_NE(session2, session3);
+ ASSERT_TRUE(tracker.DeleteForeignSession(tag3));
+ ASSERT_EQ(2U, tracker.num_foreign_sessions());
+
+ const SessionTab *tab_ptr;
+ ASSERT_TRUE(tracker.LookupSessionTab(tag1, 0, &tab_ptr));
+ ASSERT_EQ(tab_ptr, tab);
+
+ std::vector<SessionWindow*> windows;
+ ASSERT_TRUE(tracker.LookupSessionWindows(tag1, &windows));
+ ASSERT_EQ(0U, windows.size());
+
+ // The sessions don't have valid windows, lookup should not succeed.
+ std::vector<const ForeignSession*> sessions;
+ ASSERT_FALSE(tracker.LookupAllForeignSessions(&sessions));
+
+ tracker.clear();
+ ASSERT_EQ(0U, tracker.num_foreign_tabs(tag1));
+ ASSERT_EQ(0U, tracker.num_foreign_tabs(tag2));
+ ASSERT_EQ(0U, tracker.num_foreign_sessions());
+}
+
+} // namespace browser_sync
+
diff --git a/chrome/browser/sync/glue/sync_backend_host.h b/chrome/browser/sync/glue/sync_backend_host.h
index fdfc7b4..3543a4f 100644
--- a/chrome/browser/sync/glue/sync_backend_host.h
+++ b/chrome/browser/sync/glue/sync_backend_host.h
@@ -14,7 +14,7 @@
#include "base/lock.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/timer.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/sync/engine/syncapi.h"
diff --git a/chrome/browser/sync/glue/sync_backend_host_mock.cc b/chrome/browser/sync/glue/sync_backend_host_mock.cc
new file mode 100644
index 0000000..fe488ad
--- /dev/null
+++ b/chrome/browser/sync/glue/sync_backend_host_mock.cc
@@ -0,0 +1,26 @@
+// 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 "chrome/browser/sync/glue/sync_backend_host_mock.h"
+
+namespace browser_sync {
+
+SyncBackendHostMock::SyncBackendHostMock() {
+ // By default, the RequestPause and RequestResume methods will
+ // send the confirmation notification and return true.
+ ON_CALL(*this, RequestPause()).
+ WillByDefault(testing::DoAll(Notify(NotificationType::SYNC_PAUSED),
+ testing::Return(true)));
+ ON_CALL(*this, RequestResume()).
+ WillByDefault(testing::DoAll(Notify(NotificationType::SYNC_RESUMED),
+ testing::Return(true)));
+
+ // By default, invoke the ready callback.
+ ON_CALL(*this, ConfigureDataTypes(testing::_, testing::_)).
+ WillByDefault(InvokeTask());
+}
+
+SyncBackendHostMock::~SyncBackendHostMock() {}
+
+} // namespace browser_sync
diff --git a/chrome/browser/sync/glue/sync_backend_host_mock.h b/chrome/browser/sync/glue/sync_backend_host_mock.h
index 4035f97..e133a57 100644
--- a/chrome/browser/sync/glue/sync_backend_host_mock.h
+++ b/chrome/browser/sync/glue/sync_backend_host_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -23,20 +23,8 @@
class SyncBackendHostMock : public SyncBackendHost {
public:
- SyncBackendHostMock() {
- // By default, the RequestPause and RequestResume methods will
- // send the confirmation notification and return true.
- ON_CALL(*this, RequestPause()).
- WillByDefault(testing::DoAll(Notify(NotificationType::SYNC_PAUSED),
- testing::Return(true)));
- ON_CALL(*this, RequestResume()).
- WillByDefault(testing::DoAll(Notify(NotificationType::SYNC_RESUMED),
- testing::Return(true)));
-
- // By default, invoke the ready callback.
- ON_CALL(*this, ConfigureDataTypes(testing::_, testing::_)).
- WillByDefault(InvokeTask());
- }
+ SyncBackendHostMock();
+ virtual ~SyncBackendHostMock();
MOCK_METHOD2(ConfigureDataTypes,
void(const std::set<syncable::ModelType>&, CancelableTask*));
diff --git a/chrome/browser/sync/glue/ui_model_worker.cc b/chrome/browser/sync/glue/ui_model_worker.cc
index 24622ae..38f4a98 100644
--- a/chrome/browser/sync/glue/ui_model_worker.cc
+++ b/chrome/browser/sync/glue/ui_model_worker.cc
@@ -6,7 +6,7 @@
#include "base/message_loop.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
namespace browser_sync {
@@ -32,7 +32,7 @@
// We lock only to avoid PostTask'ing a NULL pending_work_ (because it
// could get Run() in Stop() and call OnTaskCompleted before we post).
// The task is owned by the message loop as per usual.
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
DCHECK(!pending_work_);
pending_work_ = new CallDoWorkAndSignalTask(work, &work_done, this);
ui_loop_->PostTask(FROM_HERE, pending_work_);
@@ -54,7 +54,7 @@
}
void UIModelWorker::OnSyncerShutdownComplete() {
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
// The SyncerThread has terminated and we are no longer needed by syncapi.
// The UI loop initiated shutdown and is (or will be) waiting in Stop().
// We could either be WORKING or RUNNING_MANUAL_SHUTDOWN_PUMP, depending
@@ -69,7 +69,7 @@
void UIModelWorker::Stop() {
DCHECK_EQ(MessageLoop::current(), ui_loop_);
- AutoLock lock(lock_);
+ base::AutoLock lock(lock_);
DCHECK_EQ(state_, WORKING);
// We're on our own now, the beloved UI MessageLoop is no longer running.
diff --git a/chrome/browser/sync/glue/ui_model_worker.h b/chrome/browser/sync/glue/ui_model_worker.h
index f3a988b..503d8cb 100644
--- a/chrome/browser/sync/glue/ui_model_worker.h
+++ b/chrome/browser/sync/glue/ui_model_worker.h
@@ -7,8 +7,8 @@
#pragma once
#include "base/callback.h"
-#include "base/condition_variable.h"
-#include "base/lock.h"
+#include "base/synchronization/lock.h"
+#include "base/synchronization/condition_variable.h"
#include "base/task.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/engine/model_safe_worker.h"
@@ -119,14 +119,14 @@
// barrier permits instructions to be reordered by compiler optimizations.
// Possible or not, that route makes for very fragile code due to existence
// of theoretical races.
- Lock lock_;
+ base::Lock lock_;
// Used as a barrier at shutdown to ensure the SyncerThread terminates before
// we allow the UI thread to return from Stop(). This gets signalled whenever
// one of two events occur: a new pending_work_ task was scheduled, or the
// SyncerThread has terminated. We only care about (1) when we are in Stop(),
// because we have to manually Run() the task.
- ConditionVariable syncapi_event_;
+ base::ConditionVariable syncapi_event_;
DISALLOW_COPY_AND_ASSIGN(UIModelWorker);
};
diff --git a/chrome/browser/sync/glue/ui_model_worker_unittest.cc b/chrome/browser/sync/glue/ui_model_worker_unittest.cc
index e71a254..a2a1dde 100644
--- a/chrome/browser/sync/glue/ui_model_worker_unittest.cc
+++ b/chrome/browser/sync/glue/ui_model_worker_unittest.cc
@@ -5,8 +5,8 @@
#include "base/callback.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/ui_model_worker.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/browser/sync/notifier/cache_invalidation_packet_handler.h b/chrome/browser/sync/notifier/cache_invalidation_packet_handler.h
index ac2d0c4..a879836 100644
--- a/chrome/browser/sync/notifier/cache_invalidation_packet_handler.h
+++ b/chrome/browser/sync/notifier/cache_invalidation_packet_handler.h
@@ -13,8 +13,8 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
-#include "base/non_thread_safe.h"
#include "base/scoped_callback_factory.h"
+#include "base/threading/non_thread_safe.h"
#include "base/weak_ptr.h"
namespace invalidation {
@@ -52,7 +52,7 @@
void HandleInboundPacket(const std::string& packet);
- NonThreadSafe non_thread_safe_;
+ base::NonThreadSafe non_thread_safe_;
base::ScopedCallbackFactory<CacheInvalidationPacketHandler>
scoped_callback_factory_;
diff --git a/chrome/browser/sync/notifier/chrome_invalidation_client.h b/chrome/browser/sync/notifier/chrome_invalidation_client.h
index e408085..99af02c 100644
--- a/chrome/browser/sync/notifier/chrome_invalidation_client.h
+++ b/chrome/browser/sync/notifier/chrome_invalidation_client.h
@@ -12,9 +12,9 @@
#include <string>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
#include "base/scoped_callback_factory.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "base/weak_ptr.h"
#include "chrome/browser/sync/notifier/chrome_system_resources.h"
#include "chrome/browser/sync/notifier/state_writer.h"
@@ -99,7 +99,7 @@
void HandleOutboundPacket(
invalidation::NetworkEndpoint* const& network_endpoint);
- NonThreadSafe non_thread_safe_;
+ base::NonThreadSafe non_thread_safe_;
ChromeSystemResources chrome_system_resources_;
base::ScopedCallbackFactory<ChromeInvalidationClient>
scoped_callback_factory_;
diff --git a/chrome/browser/sync/notifier/chrome_system_resources.h b/chrome/browser/sync/notifier/chrome_system_resources.h
index b6e6256..06b8001 100644
--- a/chrome/browser/sync/notifier/chrome_system_resources.h
+++ b/chrome/browser/sync/notifier/chrome_system_resources.h
@@ -14,9 +14,9 @@
#include <string>
#include "base/message_loop.h"
-#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/browser/sync/notifier/state_writer.h"
#include "google/cacheinvalidation/invalidation-client.h"
@@ -52,7 +52,7 @@
invalidation::StorageCallback* callback);
private:
- NonThreadSafe non_thread_safe_;
+ base::NonThreadSafe non_thread_safe_;
scoped_ptr<ScopedRunnableMethodFactory<ChromeSystemResources> >
scoped_runnable_method_factory_;
// Holds all posted tasks that have not yet been run.
diff --git a/chrome/browser/sync/notifier/registration_manager.h b/chrome/browser/sync/notifier/registration_manager.h
index 1b1a534..2694373 100644
--- a/chrome/browser/sync/notifier/registration_manager.h
+++ b/chrome/browser/sync/notifier/registration_manager.h
@@ -12,7 +12,7 @@
#include <map>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/browser/sync/syncable/model_type.h"
#include "google/cacheinvalidation/invalidation-client.h"
@@ -54,7 +54,7 @@
void OnRegister(const invalidation::RegistrationUpdateResult& result);
- NonThreadSafe non_thread_safe_;
+ base::NonThreadSafe non_thread_safe_;
// Weak pointer.
invalidation::InvalidationClient* invalidation_client_;
RegistrationStatusMap registration_status_;
diff --git a/chrome/browser/sync/profile_sync_factory_mock.cc b/chrome/browser/sync/profile_sync_factory_mock.cc
index 68fc045..2d92100 100644
--- a/chrome/browser/sync/profile_sync_factory_mock.cc
+++ b/chrome/browser/sync/profile_sync_factory_mock.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,6 +11,8 @@
using testing::_;
using testing::InvokeWithoutArgs;
+ProfileSyncFactoryMock::ProfileSyncFactoryMock() {}
+
ProfileSyncFactoryMock::ProfileSyncFactoryMock(
AssociatorInterface* bookmark_model_associator,
ChangeProcessor* bookmark_change_processor)
@@ -23,6 +25,8 @@
&ProfileSyncFactoryMock::MakeBookmarkSyncComponents));
}
+ProfileSyncFactoryMock::~ProfileSyncFactoryMock() {}
+
ProfileSyncFactory::SyncComponents
ProfileSyncFactoryMock::MakeBookmarkSyncComponents() {
return SyncComponents(bookmark_model_associator_.release(),
diff --git a/chrome/browser/sync/profile_sync_factory_mock.h b/chrome/browser/sync/profile_sync_factory_mock.h
index f5210a0..a1d1a15 100644
--- a/chrome/browser/sync/profile_sync_factory_mock.h
+++ b/chrome/browser/sync/profile_sync_factory_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -18,10 +18,11 @@
class ProfileSyncFactoryMock : public ProfileSyncFactory {
public:
- ProfileSyncFactoryMock() {}
+ ProfileSyncFactoryMock();
ProfileSyncFactoryMock(
browser_sync::AssociatorInterface* bookmark_model_associator,
browser_sync::ChangeProcessor* bookmark_change_processor);
+ virtual ~ProfileSyncFactoryMock();
MOCK_METHOD1(CreateProfileSyncService,
ProfileSyncService*(const std::string&));
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index a3da689..852ed4b 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -19,6 +19,7 @@
#include "base/string_util.h"
#include "base/task.h"
#include "base/utf_string_conversions.h"
+#include "chrome/browser/browser_signin.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -31,6 +32,7 @@
#include "chrome/browser/sync/glue/session_data_type_controller.h"
#include "chrome/browser/sync/profile_sync_factory.h"
#include "chrome/browser/sync/signin_manager.h"
+#include "chrome/browser/sync/sync_ui_util.h"
#include "chrome/browser/sync/token_migrator.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/net/gaia/gaia_constants.h"
@@ -39,6 +41,7 @@
#include "chrome/common/notification_type.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/time_format.h"
+#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "jingle/notifier/communicator/const_communicator.h"
#include "net/base/cookie_monster.h"
@@ -716,11 +719,7 @@
}
wizard_.SetParent(parent_window);
- // This method will also be called if a passphrase is needed.
- if (observed_passphrase_required_)
- wizard_.Step(SyncSetupWizard::ENTER_PASSPHRASE);
- else
- wizard_.Step(SyncSetupWizard::GAIA_LOGIN);
+ wizard_.Step(SyncSetupWizard::GAIA_LOGIN);
FOR_EACH_OBSERVER(Observer, observers_, OnStateChanged());
}
@@ -734,6 +733,31 @@
wizard_.Step(SyncSetupWizard::CONFIGURE);
}
+void ProfileSyncService::PromptForExistingPassphrase(
+ gfx::NativeWindow parent_window) {
+ if (WizardIsVisible()) {
+ wizard_.Focus();
+ return;
+ }
+ wizard_.SetParent(parent_window);
+ wizard_.Step(SyncSetupWizard::ENTER_PASSPHRASE);
+}
+
+void ProfileSyncService::ShowPassphraseMigration(
+ gfx::NativeWindow parent_window) {
+ wizard_.SetParent(parent_window);
+ wizard_.Step(SyncSetupWizard::PASSPHRASE_MIGRATION);
+}
+
+void ProfileSyncService::SigninForPassphrase(TabContents* container) {
+ string16 prefilled_username = GetAuthenticatedUsername();
+ string16 login_message = sync_ui_util::GetLoginMessageForEncryption();
+ profile_->GetBrowserSignin()->RequestSignin(container,
+ prefilled_username,
+ login_message,
+ this);
+}
+
SyncBackendHost::StatusSummary ProfileSyncService::QuerySyncStatusSummary() {
if (backend_.get() && backend_initialized_)
return backend_->GetStatusSummary();
@@ -1138,6 +1162,27 @@
}
}
+// This is the delegate callback from BrowserSigin.
+void ProfileSyncService::OnLoginSuccess() {
+ // The reason for the browser signin was a non-explicit passphrase
+ // required signal. If this is the first time through the passphrase
+ // process, we want to show the migration UI and offer an explicit
+ // passphrase. Otherwise, we're done because the implicit is enough.
+
+ if (passphrase_required_for_decryption_) {
+ // NOT first time (decrypting something encrypted elsewhere).
+ // Do nothing.
+ } else {
+ ShowPassphraseMigration(NULL);
+ }
+}
+
+// This is the delegate callback from BrowserSigin.
+void ProfileSyncService::OnLoginFailure(const GoogleServiceAuthError& error) {
+ // Do nothing. The UI will already reflect the fact that the
+ // user is not signed in.
+}
+
void ProfileSyncService::AddObserver(Observer* observer) {
observers_.AddObserver(observer);
}
diff --git a/chrome/browser/sync/profile_sync_service.h b/chrome/browser/sync/profile_sync_service.h
index 19583b6..62a8e07 100644
--- a/chrome/browser/sync/profile_sync_service.h
+++ b/chrome/browser/sync/profile_sync_service.h
@@ -15,6 +15,7 @@
#include "base/string16.h"
#include "base/time.h"
#include "base/timer.h"
+#include "chrome/browser/browser_signin.h"
#include "chrome/browser/prefs/pref_member.h"
#include "chrome/browser/sync/engine/syncapi.h"
#include "chrome/browser/sync/glue/data_type_controller.h"
@@ -37,6 +38,7 @@
class NotificationType;
class Profile;
class ProfileSyncFactory;
+class TabContents;
class TokenMigrator;
// ProfileSyncService is the layer between browser subsystems like bookmarks,
@@ -83,6 +85,7 @@
//
class ProfileSyncService : public browser_sync::SyncFrontend,
public browser_sync::UnrecoverableErrorHandler,
+ public BrowserSignin::SigninDelegate,
public NotificationObserver {
public:
typedef ProfileSyncServiceObserver Observer;
@@ -223,6 +226,9 @@
}
virtual void ShowLoginDialog(gfx::NativeWindow parent_window);
void ShowConfigure(gfx::NativeWindow parent_window);
+ void PromptForExistingPassphrase(gfx::NativeWindow parent_window);
+ void SigninForPassphrase(TabContents* container);
+ void ShowPassphraseMigration(gfx::NativeWindow parent_window);
// Pretty-printed strings for a given StatusSummary.
static std::string BuildSyncStatusSummaryText(
@@ -230,6 +236,10 @@
// Returns true if the SyncBackendHost has told us it's ready to accept
// changes.
+ // [REMARK] - it is safe to call this function only from the ui thread.
+ // because the variable is not thread safe and should only be accessed from
+ // single thread. If we want multiple threads to access this(and there is
+ // currently no need to do so) we need to protect this with a lock.
// TODO(timsteele): What happens if the bookmark model is loaded, a change
// takes place, and the backend isn't initialized yet?
bool sync_initialized() const { return backend_initialized_; }
@@ -315,6 +325,10 @@
const NotificationSource& source,
const NotificationDetails& details);
+ // BrowserSignin::SigninDelegate interface.
+ virtual void OnLoginSuccess();
+ virtual void OnLoginFailure(const GoogleServiceAuthError& error);
+
// Changes which data types we're going to be syncing to |preferred_types|.
// If it is running, the DataTypeManager will be instructed to reconfigure
// the sync backend so that exactly these datatypes are actively synced. See
diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
index a7b929a..025c573 100644
--- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc
@@ -16,7 +16,7 @@
#include "base/task.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/autofill/autofill_common_test.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/sync/abstract_profile_sync_service_test.h"
@@ -28,10 +28,15 @@
#include "chrome/browser/sync/glue/autofill_data_type_controller.h"
#include "chrome/browser/sync/glue/autofill_model_associator.h"
#include "chrome/browser/sync/glue/autofill_model_associator2.h"
+#include "chrome/browser/sync/glue/autofill_profile_change_processor.h"
+#include "chrome/browser/sync/glue/autofill_profile_data_type_controller.h"
+#include "chrome/browser/sync/glue/autofill_profile_model_associator.h"
+#include "chrome/browser/sync/glue/data_type_controller.h"
#include "chrome/browser/sync/profile_sync_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_test_util.h"
#include "chrome/browser/sync/protocol/autofill_specifics.pb.h"
+#include "chrome/browser/sync/syncable/autofill_migration.h"
#include "chrome/browser/sync/syncable/syncable.h"
#include "chrome/browser/sync/syncable/model_type.h"
#include "chrome/browser/sync/test_profile_sync_service.h"
@@ -47,9 +52,15 @@
using base::Time;
using base::WaitableEvent;
+using browser_sync::AutofillChangeProcessor;
using browser_sync::AutofillChangeProcessor2;
using browser_sync::AutofillDataTypeController;
+using browser_sync::AutofillModelAssociator;
using browser_sync::AutofillModelAssociator2;
+using browser_sync::AutofillProfileChangeProcessor;
+using browser_sync::AutofillProfileDataTypeController;
+using browser_sync::AutofillProfileModelAssociator;
+using browser_sync::DataTypeController;
using browser_sync::GROUP_DB;
using browser_sync::kAutofillTag;
using browser_sync::SyncBackendHostForProfileSyncTest;
@@ -99,9 +110,26 @@
MOCK_METHOD1(AddAutoFillProfile,
bool(const AutoFillProfile&)); // NOLINT
MOCK_METHOD1(RemoveAutoFillProfile,
- bool(int)); // NOLINT
+ bool(const string&)); // NOLINT
};
+class ProfileSyncServiceAutofillTest;
+
+template<class AutoFillProfile>
+syncable::ModelType GetModelType() {
+ return syncable::UNSPECIFIED;
+}
+
+template<>
+syncable::ModelType GetModelType<AutofillEntry>() {
+ return syncable::AUTOFILL;
+}
+
+template<>
+syncable::ModelType GetModelType<AutoFillProfile>() {
+ return syncable::AUTOFILL_PROFILE;
+}
+
class WebDataServiceFake : public WebDataService {
public:
explicit WebDataServiceFake(WebDatabase* web_database)
@@ -118,6 +146,86 @@
WebDatabase* web_database_;
};
+ACTION_P4(MakeAutofillSyncComponents, service, wd, pdm, dtc) {
+ EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
+ if (!BrowserThread::CurrentlyOn(BrowserThread::DB))
+ return ProfileSyncFactory::SyncComponents(NULL, NULL);
+ AutofillModelAssociator* model_associator =
+ new AutofillModelAssociator(service, wd, pdm);
+ AutofillChangeProcessor* change_processor =
+ new AutofillChangeProcessor(model_associator, wd, pdm, dtc);
+ return ProfileSyncFactory::SyncComponents(model_associator,
+ change_processor);
+}
+
+ACTION_P4(MakeAutofillProfileSyncComponents, service, wd, pdm, dtc) {
+ EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
+ if (!BrowserThread::CurrentlyOn(BrowserThread::DB))
+ return ProfileSyncFactory::SyncComponents(NULL, NULL);
+ AutofillProfileModelAssociator* model_associator =
+ new AutofillProfileModelAssociator(service, wd, pdm);
+ AutofillProfileChangeProcessor* change_processor =
+ new AutofillProfileChangeProcessor(model_associator, wd, pdm, dtc);
+ return ProfileSyncFactory::SyncComponents(model_associator,
+ change_processor);
+}
+
+class AbstractAutofillFactory {
+ public:
+ virtual AutofillDataTypeController* CreateDataTypeController(
+ ProfileSyncFactory *factory,
+ ProfileMock* profile,
+ ProfileSyncService* service) = 0;
+ virtual void SetExpectation(ProfileSyncFactoryMock* factory,
+ ProfileSyncService* service,
+ WebDatabase* wd,
+ PersonalDataManager* pdm,
+ DataTypeController* dtc) = 0;
+ virtual ~AbstractAutofillFactory() {}
+};
+
+class AutofillEntryFactory : public AbstractAutofillFactory {
+ public:
+ browser_sync::AutofillDataTypeController* CreateDataTypeController(
+ ProfileSyncFactory *factory,
+ ProfileMock* profile,
+ ProfileSyncService* service) {
+ return new AutofillDataTypeController(factory,
+ profile,
+ service);
+ }
+
+ void SetExpectation(ProfileSyncFactoryMock* factory,
+ ProfileSyncService* service,
+ WebDatabase* wd,
+ PersonalDataManager* pdm,
+ DataTypeController* dtc) {
+ EXPECT_CALL(*factory, CreateAutofillSyncComponents(_,_,_,_)).
+ WillOnce(MakeAutofillSyncComponents(service, wd, pdm, dtc));
+ }
+};
+
+class AutofillProfileFactory : public AbstractAutofillFactory {
+ public:
+ browser_sync::AutofillDataTypeController* CreateDataTypeController(
+ ProfileSyncFactory *factory,
+ ProfileMock* profile,
+ ProfileSyncService* service) {
+ return new AutofillProfileDataTypeController(factory,
+ profile,
+ service);
+ }
+
+ void SetExpectation(ProfileSyncFactoryMock* factory,
+ ProfileSyncService* service,
+ WebDatabase* wd,
+ PersonalDataManager* pdm,
+ DataTypeController* dtc) {
+ EXPECT_CALL(*factory, CreateAutofillProfileSyncComponents(_,_,_,_)).
+ WillOnce(MakeAutofillProfileSyncComponents(service, wd, pdm, dtc));
+ }
+};
+
class PersonalDataManagerMock: public PersonalDataManager {
public:
MOCK_CONST_METHOD0(IsDataLoaded, bool());
@@ -125,24 +233,26 @@
MOCK_METHOD0(LoadCreditCards, void());
MOCK_METHOD0(Refresh, void());
};
-
-ACTION_P4(MakeAutofillSyncComponents, service, wd, pdm, dtc) {
- EXPECT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
- if (!BrowserThread::CurrentlyOn(BrowserThread::DB))
- return ProfileSyncFactory::SyncComponents(NULL, NULL);
- AutofillModelAssociator2* model_associator =
- new AutofillModelAssociator2(service, wd, pdm);
- AutofillChangeProcessor2* change_processor =
- new AutofillChangeProcessor2(model_associator, wd, pdm, dtc);
- return ProfileSyncFactory::SyncComponents(model_associator,
- change_processor);
-}
+template <class T> class AddAutofillTask;
class ProfileSyncServiceAutofillTest : public AbstractProfileSyncServiceTest {
protected:
ProfileSyncServiceAutofillTest() : db_thread_(BrowserThread::DB) {
}
+ AutofillProfileFactory profile_factory_;
+ AutofillEntryFactory entry_factory_;
+
+ AbstractAutofillFactory* GetFactory(syncable::ModelType type) {
+ if (type == syncable::AUTOFILL) {
+ return &entry_factory_;
+ } else if (type == syncable::AUTOFILL_PROFILE) {
+ return &profile_factory_;
+ } else {
+ NOTREACHED();
+ return NULL;
+ }
+ }
virtual void SetUp() {
web_data_service_ = new WebDataServiceFake(&web_database_);
personal_data_manager_ = new PersonalDataManagerMock();
@@ -162,48 +272,49 @@
MessageLoop::current()->RunAllPending();
}
- void StartSyncService(Task* task, bool will_fail_association) {
- if (!service_.get()) {
- service_.reset(
- new TestProfileSyncService(&factory_, &profile_, "test_user", false,
- task));
- AutofillDataTypeController* data_type_controller =
- new AutofillDataTypeController(&factory_,
- &profile_,
- service_.get());
+ void StartSyncService(Task* task,
+ bool will_fail_association,
+ syncable::ModelType type) {
+ AbstractAutofillFactory* factory = GetFactory(type);
+ service_.reset(
+ new TestProfileSyncService(&factory_, &profile_, "test_user", false,
+ task));
+ AutofillDataTypeController* data_type_controller =
+ factory->CreateDataTypeController(&factory_,
+ &profile_,
+ service_.get());
+ SyncBackendHostForProfileSyncTest::
+ SetDefaultExpectationsForWorkerCreation(&profile_);
- SyncBackendHostForProfileSyncTest::
- SetDefaultExpectationsForWorkerCreation(&profile_);
+ factory->SetExpectation(&factory_,
+ service_.get(),
+ &web_database_,
+ personal_data_manager_.get(),
+ data_type_controller);
- EXPECT_CALL(factory_, CreateAutofillSyncComponents(_, _, _, _)).
- WillOnce(MakeAutofillSyncComponents(service_.get(),
- &web_database_,
- personal_data_manager_.get(),
- data_type_controller));
- EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).
- WillOnce(ReturnNewDataTypeManager());
+ EXPECT_CALL(factory_, CreateDataTypeManager(_, _)).
+ WillOnce(ReturnNewDataTypeManager());
- EXPECT_CALL(profile_, GetWebDataService(_)).
- WillOnce(Return(web_data_service_.get()));
+ EXPECT_CALL(profile_, GetWebDataService(_)).
+ WillOnce(Return(web_data_service_.get()));
- EXPECT_CALL(profile_, GetPersonalDataManager()).
- WillRepeatedly(Return(personal_data_manager_.get()));
+ EXPECT_CALL(profile_, GetPersonalDataManager()).
+ WillRepeatedly(Return(personal_data_manager_.get()));
- EXPECT_CALL(*personal_data_manager_, IsDataLoaded()).
- WillRepeatedly(Return(true));
+ EXPECT_CALL(*personal_data_manager_, IsDataLoaded()).
+ WillRepeatedly(Return(true));
- // We need tokens to get the tests going
- token_service_.IssueAuthTokenForTest(
- GaiaConstants::kSyncService, "token");
+ // We need tokens to get the tests going
+ token_service_.IssueAuthTokenForTest(
+ GaiaConstants::kSyncService, "token");
- EXPECT_CALL(profile_, GetTokenService()).
- WillRepeatedly(Return(&token_service_));
+ EXPECT_CALL(profile_, GetTokenService()).
+ WillRepeatedly(Return(&token_service_));
- service_->set_num_expected_resumes(will_fail_association ? 0 : 1);
- service_->RegisterDataTypeController(data_type_controller);
- service_->Initialize();
- MessageLoop::current()->Run();
- }
+ service_->set_num_expected_resumes(will_fail_association ? 0 : 1);
+ service_->RegisterDataTypeController(data_type_controller);
+ service_->Initialize();
+ MessageLoop::current()->Run();
}
bool AddAutofillSyncNode(const AutofillEntry& entry) {
@@ -214,30 +325,27 @@
return false;
sync_api::WriteNode node(&trans);
- std::string tag = AutofillModelAssociator2::KeyToTag(entry.key().name(),
+ std::string tag = AutofillModelAssociator::KeyToTag(entry.key().name(),
entry.key().value());
if (!node.InitUniqueByCreation(syncable::AUTOFILL, autofill_root, tag))
return false;
- AutofillChangeProcessor2::WriteAutofillEntry(entry, &node);
+ AutofillChangeProcessor::WriteAutofillEntry(entry, &node);
return true;
}
- bool AddAutofillProfileSyncNode(const AutoFillProfile& profile) {
+ bool AddAutofillSyncNode(const AutoFillProfile& profile) {
sync_api::WriteTransaction trans(
service_->backend()->GetUserShareHandle());
sync_api::ReadNode autofill_root(&trans);
- if (!autofill_root.InitByTagLookup(browser_sync::kAutofillTag))
+ if (!autofill_root.InitByTagLookup(browser_sync::kAutofillProfileTag))
return false;
sync_api::WriteNode node(&trans);
- std::string tag = browser_sync::AutofillModelAssociator2::ProfileLabelToTag(
- profile.Label());
- if (!node.InitUniqueByCreation(syncable::AUTOFILL, autofill_root, tag))
+ std::string tag = profile.guid();
+ if (!node.InitUniqueByCreation(syncable::AUTOFILL_PROFILE,
+ autofill_root, tag))
return false;
- AutofillChangeProcessor2::WriteAutofillProfile(profile, &node);
- sync_pb::AutofillSpecifics s(node.GetAutofillSpecifics());
- s.mutable_profile()->set_label(UTF16ToUTF8(profile.Label()));
- node.SetAutofillSpecifics(s);
+ AutofillProfileChangeProcessor::WriteAutofillProfile(profile, &node);
return true;
}
@@ -268,8 +376,8 @@
entries->push_back(AutofillEntry(key, timestamps));
} else if (autofill.has_profile()) {
AutoFillProfile p;
- p.set_label(UTF8ToUTF16(autofill.profile().label()));
- AutofillModelAssociator2::OverwriteProfileWithServerData(&p,
+ p.set_guid(autofill.profile().guid());
+ AutofillProfileModelAssociator::OverwriteProfileWithServerData(&p,
autofill.profile());
profiles->push_back(p);
}
@@ -278,6 +386,31 @@
return true;
}
+ bool GetAutofillProfilesFromSyncDBUnderProfileNode(
+ std::vector<AutoFillProfile>* profiles) {
+ sync_api::ReadTransaction trans(service_->backend()->GetUserShareHandle());
+ sync_api::ReadNode autofill_root(&trans);
+ if (!autofill_root.InitByTagLookup(browser_sync::kAutofillProfileTag))
+ return false;
+
+ int64 child_id = autofill_root.GetFirstChildId();
+ while (child_id != sync_api::kInvalidId) {
+ sync_api::ReadNode child_node(&trans);
+ if (!child_node.InitByIdLookup(child_id))
+ return false;
+
+ const sync_pb::AutofillProfileSpecifics& autofill(
+ child_node.GetAutofillProfileSpecifics());
+ AutoFillProfile p;
+ p.set_guid(autofill.guid());
+ AutofillProfileModelAssociator::OverwriteProfileWithServerData(&p,
+ autofill);
+ profiles->push_back(p);
+ child_id = child_node.GetSuccessorId();
+ }
+ return true;
+ }
+
void SetIdleChangeProcessorExpectations() {
EXPECT_CALL(web_database_, RemoveFormElement(_, _)).Times(0);
EXPECT_CALL(web_database_, GetAutofillTimestamps(_, _, _)).Times(0);
@@ -303,7 +436,8 @@
return MakeAutofillEntry(name, value, timestamp, -1);
}
- friend class AddAutofillEntriesTask;
+ friend class AddAutofillTask<AutofillEntry>;
+ friend class AddAutofillTask<AutoFillProfile>;
friend class FakeServerUpdater;
BrowserThread db_thread_;
@@ -315,34 +449,28 @@
scoped_refptr<PersonalDataManagerMock> personal_data_manager_;
};
-class AddAutofillEntriesTask : public Task {
+template <class T>
+class AddAutofillTask : public Task {
public:
- AddAutofillEntriesTask(ProfileSyncServiceAutofillTest* test,
- const std::vector<AutofillEntry>& entries,
- const std::vector<AutoFillProfile>& profiles)
- : test_(test), entries_(entries), profiles_(profiles), success_(false) {
+ AddAutofillTask(ProfileSyncServiceAutofillTest* test,
+ const std::vector<T>& entries)
+ : test_(test), entries_(entries), success_(false) {
}
virtual void Run() {
- if (!test_->CreateRoot(syncable::AUTOFILL))
+ if (!test_->CreateRoot(GetModelType<T>()))
return;
for (size_t i = 0; i < entries_.size(); ++i) {
if (!test_->AddAutofillSyncNode(entries_[i]))
return;
}
- for (size_t i = 0; i < profiles_.size(); ++i) {
- if (!test_->AddAutofillProfileSyncNode(profiles_[i]))
- return;
- }
success_ = true;
}
-
bool success() { return success_; }
private:
ProfileSyncServiceAutofillTest* test_;
- const std::vector<AutofillEntry>& entries_;
- const std::vector<AutoFillProfile>& profiles_;
+ const std::vector<T>& entries_;
bool success_;
};
@@ -392,7 +520,7 @@
ASSERT_TRUE(dir.good());
// Create autofill protobuf
- std::string tag = AutofillModelAssociator2::KeyToTag(entry_.key().name(),
+ std::string tag = AutofillModelAssociator::KeyToTag(entry_.key().name(),
entry_.key().value());
sync_pb::AutofillSpecifics new_autofill;
new_autofill.set_name(UTF16ToUTF8(entry_.key().name()));
@@ -485,7 +613,7 @@
// waiting for the PersonalDataManager.
TEST_F(ProfileSyncServiceAutofillTest, FailModelAssociation) {
// Don't create the root autofill node so startup fails.
- StartSyncService(NULL, true);
+ StartSyncService(NULL, true, syncable::AUTOFILL);
EXPECT_TRUE(service_->unrecoverable_error_detected());
}
@@ -495,7 +623,7 @@
SetIdleChangeProcessorExpectations();
CreateRootTask task(this, syncable::AUTOFILL);
EXPECT_CALL(*personal_data_manager_, Refresh());
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
std::vector<AutofillEntry> sync_entries;
std::vector<AutoFillProfile> sync_profiles;
@@ -513,7 +641,7 @@
SetIdleChangeProcessorExpectations();
CreateRootTask task(this, syncable::AUTOFILL);
EXPECT_CALL(*personal_data_manager_, Refresh());
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
std::vector<AutofillEntry> sync_entries;
std::vector<AutoFillProfile> sync_profiles;
@@ -523,18 +651,15 @@
EXPECT_EQ(0U, sync_profiles.size());
}
-TEST_F(ProfileSyncServiceAutofillTest, HasMixedNativeEmptySync) {
- std::vector<AutofillEntry> entries;
- entries.push_back(MakeAutofillEntry("foo", "bar", 1));
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).
- WillOnce(DoAll(SetArgumentPointee<0>(entries), Return(true)));
+TEST_F(ProfileSyncServiceAutofillTest, HasProfileEmptySync) {
std::vector<AutoFillProfile*> profiles;
std::vector<AutoFillProfile> expected_profiles;
// Owned by GetAutoFillProfiles caller.
AutoFillProfile* profile0 = new AutoFillProfile;
- autofill_test::SetProfileInfo(profile0,
- "Billing", "Marion", "Mitchell", "Morrison",
+ autofill_test::SetProfileInfoWithGuid(profile0,
+ "{54B3F9AA-335E-4f71-A27D-719C41564230}", "Billing",
+ "Mitchell", "Morrison",
"johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
"91601", "US", "12345678910", "01987654321");
profiles.push_back(profile0);
@@ -543,88 +668,15 @@
WillOnce(DoAll(SetArgumentPointee<0>(profiles), Return(true)));
EXPECT_CALL(*personal_data_manager_, Refresh());
SetIdleChangeProcessorExpectations();
- CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
+ CreateRootTask task(this, syncable::AUTOFILL_PROFILE);
+ StartSyncService(&task, false, syncable::AUTOFILL_PROFILE);
ASSERT_TRUE(task.success());
- std::vector<AutofillEntry> sync_entries;
std::vector<AutoFillProfile> sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
- ASSERT_EQ(1U, entries.size());
- EXPECT_TRUE(entries[0] == sync_entries[0]);
+ ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode(&sync_profiles));
EXPECT_EQ(1U, sync_profiles.size());
EXPECT_EQ(0, expected_profiles[0].Compare(sync_profiles[0]));
}
-bool ProfilesMatchExceptLabelImpl(AutoFillProfile p1, AutoFillProfile p2) {
- const AutoFillFieldType types[] = { NAME_FIRST,
- NAME_MIDDLE,
- NAME_LAST,
- EMAIL_ADDRESS,
- COMPANY_NAME,
- ADDRESS_HOME_LINE1,
- ADDRESS_HOME_LINE2,
- ADDRESS_HOME_CITY,
- ADDRESS_HOME_STATE,
- ADDRESS_HOME_ZIP,
- ADDRESS_HOME_COUNTRY,
- PHONE_HOME_NUMBER,
- PHONE_FAX_NUMBER };
- if (p1.Label() == p2.Label())
- return false;
-
- for (size_t index = 0; index < arraysize(types); ++index) {
- if (p1.GetFieldText(AutoFillType(types[index])) !=
- p2.GetFieldText(AutoFillType(types[index])))
- return false;
- }
- return true;
-}
-
-MATCHER_P(ProfileMatchesExceptLabel, profile, "") {
- return ProfilesMatchExceptLabelImpl(arg, profile);
-}
-
-TEST_F(ProfileSyncServiceAutofillTest, HasDuplicateProfileLabelsEmptySync) {
- std::vector<AutoFillProfile> expected_profiles;
- std::vector<AutoFillProfile*> profiles;
- AutoFillProfile* profile0 = new AutoFillProfile;
- autofill_test::SetProfileInfo(profile0,
- "Billing", "Marion", "Mitchell", "Morrison",
- "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
- "91601", "US", "12345678910", "01987654321");
- AutoFillProfile* profile1 = new AutoFillProfile;
- autofill_test::SetProfileInfo(profile1,
- "Billing", "Same", "Label", "Morrison",
- "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
- "91601", "US", "12345678910", "01987654321");
- profiles.push_back(profile0);
- profiles.push_back(profile1);
- expected_profiles.push_back(*profile0);
- expected_profiles.push_back(*profile1);
- AutoFillProfile relabelled_profile;
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).WillOnce(Return(true));
- EXPECT_CALL(*personal_data_manager_, Refresh());
- EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).
- WillOnce(DoAll(SetArgumentPointee<0>(profiles), Return(true)));
- EXPECT_CALL(web_database_, UpdateAutoFillProfile(
- ProfileMatchesExceptLabel(expected_profiles[1]))).
- WillOnce(DoAll(SaveArg<0>(&relabelled_profile), Return(true)));
-
- SetIdleChangeProcessorExpectations();
- CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
- ASSERT_TRUE(task.success());
- std::vector<AutofillEntry> sync_entries;
- std::vector<AutoFillProfile> sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&sync_entries, &sync_profiles));
- EXPECT_EQ(0U, sync_entries.size());
- EXPECT_EQ(2U, sync_profiles.size());
- EXPECT_EQ(0, expected_profiles[0].Compare(sync_profiles[1]));
- EXPECT_TRUE(ProfilesMatchExceptLabelImpl(expected_profiles[1],
- sync_profiles[0]));
- EXPECT_EQ(sync_profiles[0].Label(), relabelled_profile.Label());
-}
-
TEST_F(ProfileSyncServiceAutofillTest, HasNativeWithDuplicatesEmptySync) {
// There is buggy autofill code that allows duplicate name/value
// pairs to exist in the database with separate pair_ids.
@@ -638,7 +690,7 @@
SetIdleChangeProcessorExpectations();
CreateRootTask task(this, syncable::AUTOFILL);
EXPECT_CALL(*personal_data_manager_, Refresh());
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
std::vector<AutofillEntry> sync_entries;
std::vector<AutoFillProfile> sync_profiles;
@@ -649,46 +701,25 @@
TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncNoMerge) {
AutofillEntry native_entry(MakeAutofillEntry("native", "entry", 1));
AutofillEntry sync_entry(MakeAutofillEntry("sync", "entry", 2));
- AutoFillProfile sync_profile;
- autofill_test::SetProfileInfo(&sync_profile,
- "Billing", "Marion", "Mitchell", "Morrison",
- "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
- "91601", "US", "12345678910", "01987654321");
-
- AutoFillProfile* native_profile = new AutoFillProfile;
- autofill_test::SetProfileInfo(native_profile,
- "Work", "Josephine", "Alicia", "Saenz",
- "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
- "32801", "US", "19482937549", "13502849239");
std::vector<AutofillEntry> native_entries;
native_entries.push_back(native_entry);
- std::vector<AutoFillProfile*> native_profiles;
- native_profiles.push_back(native_profile);
-
- std::vector<AutoFillProfile> expected_profiles;
- expected_profiles.push_back(*native_profile);
- expected_profiles.push_back(sync_profile);
EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).
WillOnce(DoAll(SetArgumentPointee<0>(native_entries), Return(true)));
- EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).
- WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true)));
+
+ EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true));
+
std::vector<AutofillEntry> sync_entries;
sync_entries.push_back(sync_entry);
- std::vector<AutoFillProfile> sync_profiles;
- sync_profiles.push_back(sync_profile);
- AddAutofillEntriesTask task(this, sync_entries, sync_profiles);
- AutoFillProfile to_be_added(sync_profile);
+ AddAutofillTask<AutofillEntry> task(this, sync_entries);
+
EXPECT_CALL(web_database_, UpdateAutofillEntries(ElementsAre(sync_entry))).
WillOnce(Return(true));
- // TODO(dhollowa): Duplicate removal when contents match but GUIDs don't.
- // http://crbug.com/58813
- EXPECT_CALL(web_database_, AddAutoFillProfile(_)).
- WillOnce(Return(true));
+
EXPECT_CALL(*personal_data_manager_, Refresh());
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
std::set<AutofillEntry> expected_entries;
@@ -703,9 +734,6 @@
new_sync_entries.end());
EXPECT_TRUE(expected_entries == new_sync_entries_set);
- EXPECT_EQ(2U, new_sync_profiles.size());
- EXPECT_EQ(0, expected_profiles[0].Compare(new_sync_profiles[0]));
- EXPECT_EQ(0, expected_profiles[1].Compare(new_sync_profiles[1]));
}
TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeEntry) {
@@ -720,14 +748,13 @@
EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true));
std::vector<AutofillEntry> sync_entries;
- std::vector<AutoFillProfile> sync_profiles;
sync_entries.push_back(sync_entry);
- AddAutofillEntriesTask task(this, sync_entries, sync_profiles);
+ AddAutofillTask<AutofillEntry> task(this, sync_entries);
EXPECT_CALL(web_database_, UpdateAutofillEntries(ElementsAre(merged_entry))).
WillOnce(Return(true));
EXPECT_CALL(*personal_data_manager_, Refresh());
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
std::vector<AutofillEntry> new_sync_entries;
@@ -740,51 +767,89 @@
TEST_F(ProfileSyncServiceAutofillTest, HasNativeHasSyncMergeProfile) {
AutoFillProfile sync_profile;
- autofill_test::SetProfileInfo(&sync_profile,
- "Billing", "Marion", "Mitchell", "Morrison",
+ autofill_test::SetProfileInfoWithGuid(&sync_profile,
+ "{23355099-1170-4b71-8ED4-144470CC9EBE}", "Billing",
+ "Mitchell", "Morrison",
"johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
"91601", "US", "12345678910", "01987654321");
AutoFillProfile* native_profile = new AutoFillProfile;
- autofill_test::SetProfileInfo(native_profile,
- "Billing", "Josephine", "Alicia", "Saenz",
+ autofill_test::SetProfileInfoWithGuid(native_profile,
+ "{23355099-1170-4b71-8ED4-144470CC9EBE}", "Billing", "Alicia", "Saenz",
"joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
"32801", "US", "19482937549", "13502849239");
std::vector<AutoFillProfile*> native_profiles;
native_profiles.push_back(native_profile);
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(Return(true));
EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).
WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true)));
- std::vector<AutofillEntry> sync_entries;
std::vector<AutoFillProfile> sync_profiles;
sync_profiles.push_back(sync_profile);
- AddAutofillEntriesTask task(this, sync_entries, sync_profiles);
+ AddAutofillTask<AutoFillProfile> task(this, sync_profiles);
- // TODO(dhollowa): Duplicate removal when contents match but GUIDs don't.
- // http://crbug.com/58813
EXPECT_CALL(web_database_, UpdateAutoFillProfile(_)).
WillOnce(Return(true));
EXPECT_CALL(*personal_data_manager_, Refresh());
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL_PROFILE);
ASSERT_TRUE(task.success());
- std::vector<AutofillEntry> new_sync_entries;
std::vector<AutoFillProfile> new_sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries,
- &new_sync_profiles));
+ ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode(
+ &new_sync_profiles));
ASSERT_EQ(1U, new_sync_profiles.size());
EXPECT_EQ(0, sync_profile.Compare(new_sync_profiles[0]));
}
+TEST_F(ProfileSyncServiceAutofillTest, MergeProfileWithDifferentGuid) {
+ AutoFillProfile sync_profile;
+
+ autofill_test::SetProfileInfoWithGuid(&sync_profile,
+ "{23355099-1170-4b71-8ED4-144470CC9EBE}", "Billing",
+ "Mitchell", "Morrison",
+ "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
+ "91601", "US", "12345678910", "01987654321");
+
+ string native_guid = "{EDC609ED-7EEE-4f27-B00C-423242A9C44B}";
+ AutoFillProfile* native_profile = new AutoFillProfile;
+ autofill_test::SetProfileInfoWithGuid(native_profile,
+ native_guid.c_str(), "Billing",
+ "Mitchell", "Morrison",
+ "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
+ "91601", "US", "12345678910", "01987654321");
+
+ std::vector<AutoFillProfile*> native_profiles;
+ native_profiles.push_back(native_profile);
+ EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).
+ WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true)));
+
+ std::vector<AutoFillProfile> sync_profiles;
+ sync_profiles.push_back(sync_profile);
+ AddAutofillTask<AutoFillProfile> task(this, sync_profiles);
+
+ EXPECT_CALL(web_database_, AddAutoFillProfile(_)).
+ WillOnce(Return(true));
+ EXPECT_CALL(web_database_, RemoveAutoFillProfile(native_guid)).
+ WillOnce(Return(true));
+ EXPECT_CALL(*personal_data_manager_, Refresh());
+ StartSyncService(&task, false, syncable::AUTOFILL_PROFILE);
+ ASSERT_TRUE(task.success());
+
+ std::vector<AutoFillProfile> new_sync_profiles;
+ ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode(
+ &new_sync_profiles));
+ ASSERT_EQ(1U, new_sync_profiles.size());
+ EXPECT_EQ(0, sync_profile.Compare(new_sync_profiles[0]));
+ EXPECT_EQ(sync_profile.guid(), new_sync_profiles[0].guid());
+}
+
TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddEntry) {
EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).WillOnce(Return(true));
EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true));
EXPECT_CALL(*personal_data_manager_, Refresh());
SetIdleChangeProcessorExpectations();
CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
AutofillEntry added_entry(MakeAutofillEntry("added", "entry", 1));
@@ -809,89 +874,33 @@
}
TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) {
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).WillOnce(Return(true));
EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true));
EXPECT_CALL(*personal_data_manager_, Refresh());
SetIdleChangeProcessorExpectations();
- CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
+ CreateRootTask task(this, syncable::AUTOFILL_PROFILE);
+ StartSyncService(&task, false, syncable::AUTOFILL_PROFILE);
ASSERT_TRUE(task.success());
AutoFillProfile added_profile;
- autofill_test::SetProfileInfo(&added_profile,
- "Billing", "Josephine", "Alicia", "Saenz",
+ autofill_test::SetProfileInfoWithGuid(&added_profile,
+ "{D6ADA912-D374-4c0a-917D-F5C8EBE43011}", "Josephine", "Alicia", "Saenz",
"joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
"32801", "US", "19482937549", "13502849239");
- AutofillProfileChange change(AutofillProfileChange::ADD,
- added_profile.Label(), &added_profile, string16());
+ AutofillProfileChangeGUID change(AutofillProfileChangeGUID::ADD,
+ added_profile.guid(), &added_profile);
scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_));
- notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED,
+ notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED_GUID,
Source<WebDataService>(web_data_service_.get()),
- Details<AutofillProfileChange>(&change));
+ Details<AutofillProfileChangeGUID>(&change));
- std::vector<AutofillEntry> new_sync_entries;
std::vector<AutoFillProfile> new_sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries,
- &new_sync_profiles));
+ ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode(
+ &new_sync_profiles));
ASSERT_EQ(1U, new_sync_profiles.size());
EXPECT_EQ(0, added_profile.Compare(new_sync_profiles[0]));
}
-TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfileConflict) {
- AutoFillProfile sync_profile;
- autofill_test::SetProfileInfo(&sync_profile,
- "Billing", "Marion", "Mitchell", "Morrison",
- "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
- "91601", "US", "12345678910", "01987654321");
-
- std::vector<AutofillEntry> sync_entries;
- std::vector<AutoFillProfile> sync_profiles;
- sync_profiles.push_back(sync_profile);
- AddAutofillEntriesTask task(this, sync_entries, sync_profiles);
-
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)).WillOnce(Return(true));
- EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true));
- // TODO(dhollowa): Duplicate removal when contents match but GUIDs don't.
- // http://crbug.com/58813
- EXPECT_CALL(web_database_, AddAutoFillProfile(_)).
- WillOnce(Return(true));
- EXPECT_CALL(*personal_data_manager_, Refresh());
- SetIdleChangeProcessorExpectations();
- StartSyncService(&task, false);
- ASSERT_TRUE(task.success());
-
- AutoFillProfile added_profile;
- autofill_test::SetProfileInfo(&added_profile,
- "Billing", "Josephine", "Alicia", "Saenz",
- "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
- "32801", "US", "19482937549", "13502849239");
-
- AutofillProfileChange change(AutofillProfileChange::ADD,
- added_profile.Label(), &added_profile, string16());
-
- AutoFillProfile relabelled_profile;
- EXPECT_CALL(web_database_, UpdateAutoFillProfile(
- ProfileMatchesExceptLabel(added_profile))).
- WillOnce(DoAll(SaveArg<0>(&relabelled_profile), Return(true)));
- EXPECT_CALL(*personal_data_manager_, Refresh());
-
- scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_));
- notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED,
- Source<WebDataService>(web_data_service_.get()),
- Details<AutofillProfileChange>(&change));
-
- std::vector<AutofillEntry> new_sync_entries;
- std::vector<AutoFillProfile> new_sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries,
- &new_sync_profiles));
- ASSERT_EQ(2U, new_sync_profiles.size());
- EXPECT_EQ(0, sync_profile.Compare(new_sync_profiles[1]));
- EXPECT_TRUE(ProfilesMatchExceptLabelImpl(added_profile,
- new_sync_profiles[0]));
- EXPECT_EQ(new_sync_profiles[0].Label(), relabelled_profile.Label());
-}
-
TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateEntry) {
AutofillEntry original_entry(MakeAutofillEntry("my", "entry", 1));
std::vector<AutofillEntry> original_entries;
@@ -902,7 +911,7 @@
EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true));
EXPECT_CALL(*personal_data_manager_, Refresh());
CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
AutofillEntry updated_entry(MakeAutofillEntry("my", "entry", 1, 2));
@@ -928,147 +937,6 @@
}
-TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfile) {
- AutoFillProfile* native_profile = new AutoFillProfile;
- autofill_test::SetProfileInfo(native_profile,
- "Billing", "Josephine", "Alicia", "Saenz",
- "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
- "32801", "US", "19482937549", "13502849239");
- std::vector<AutoFillProfile*> native_profiles;
- native_profiles.push_back(native_profile);
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(Return(true));
- EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).
- WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true)));
- EXPECT_CALL(*personal_data_manager_, Refresh());
- CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
- ASSERT_TRUE(task.success());
-
- AutoFillProfile update_profile;
- autofill_test::SetProfileInfo(&update_profile,
- "Billing", "Changin'", "Mah", "Namez",
- "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
- "32801", "US", "19482937549", "13502849239");
-
- AutofillProfileChange change(AutofillProfileChange::UPDATE,
- update_profile.Label(), &update_profile,
- ASCIIToUTF16("Billing"));
- scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_));
- notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED,
- Source<WebDataService>(web_data_service_.get()),
- Details<AutofillProfileChange>(&change));
-
- std::vector<AutofillEntry> new_sync_entries;
- std::vector<AutoFillProfile> new_sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries,
- &new_sync_profiles));
- ASSERT_EQ(1U, new_sync_profiles.size());
- EXPECT_EQ(0, update_profile.Compare(new_sync_profiles[0]));
-}
-
-TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfileRelabel) {
- AutoFillProfile* native_profile = new AutoFillProfile;
- autofill_test::SetProfileInfo(native_profile,
- "Billing", "Josephine", "Alicia", "Saenz",
- "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
- "32801", "US", "19482937549", "13502849239");
- std::vector<AutoFillProfile*> native_profiles;
- native_profiles.push_back(native_profile);
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(Return(true));
- EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).
- WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true)));
- EXPECT_CALL(*personal_data_manager_, Refresh());
- CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
- ASSERT_TRUE(task.success());
-
- AutoFillProfile update_profile;
- autofill_test::SetProfileInfo(&update_profile,
- "TRYIN 2 FOOL U", "Josephine", "Alicia", "Saenz",
- "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
- "32801", "US", "19482937549", "13502849239");
-
- AutofillProfileChange change(AutofillProfileChange::UPDATE,
- update_profile.Label(), &update_profile,
- ASCIIToUTF16("Billing"));
- scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_));
- notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED,
- Source<WebDataService>(web_data_service_.get()),
- Details<AutofillProfileChange>(&change));
-
- std::vector<AutofillEntry> new_sync_entries;
- std::vector<AutoFillProfile> new_sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries,
- &new_sync_profiles));
- ASSERT_EQ(1U, new_sync_profiles.size());
- EXPECT_EQ(0, update_profile.Compare(new_sync_profiles[0]));
-}
-
-TEST_F(ProfileSyncServiceAutofillTest,
- ProcessUserChangeUpdateProfileRelabelConflict) {
- std::vector<AutoFillProfile*> native_profiles;
- native_profiles.push_back(new AutoFillProfile);
- native_profiles.push_back(new AutoFillProfile);
- autofill_test::SetProfileInfo(native_profiles[0],
- "Billing", "Josephine", "Alicia", "Saenz",
- "joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
- "32801", "US", "19482937549", "13502849239");
- autofill_test::SetProfileInfo(native_profiles[1],
- "ExistingLabel", "Marion", "Mitchell", "Morrison",
- "johnwayne@me.xyz", "Fox", "123 Zoo St.", "unit 5", "Hollywood", "CA",
- "91601", "US", "12345678910", "01987654321");
- AutoFillProfile marion(*native_profiles[1]);
- AutoFillProfile josephine(*native_profiles[0]);
-
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(Return(true));
- EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).
- WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true)));
- EXPECT_CALL(*personal_data_manager_, Refresh());
- CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
- ASSERT_TRUE(task.success());
- MessageLoop::current()->RunAllPending();
- Mock::VerifyAndClearExpectations(&web_database_);
- native_profiles.clear(); // Contents freed.
-
- // Update josephine twice with marion's label. The second time ought to be
- // idempotent, settling on the same name and not triggering a sync upload.
- for (int pass = 0; pass < 2; ++pass) {
- AutoFillProfile josephine_update(josephine);
- // TODO(dhollowa): Replace with |AutoFillProfile::set_guid|.
- // http://crbug.com/58813
- josephine_update.set_label(ASCIIToUTF16("ExistingLabel"));
-
- AutoFillProfile relabelled_profile;
- EXPECT_CALL(web_database_, UpdateAutoFillProfile(
- ProfileMatchesExceptLabel(josephine_update))).
- WillOnce(DoAll(SaveArg<0>(&relabelled_profile), Return(true)));
- EXPECT_CALL(*personal_data_manager_, Refresh());
-
- AutofillProfileChange change(AutofillProfileChange::UPDATE,
- josephine_update.Label(), &josephine_update,
- josephine.Label());
- scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_));
- notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED,
- Source<WebDataService>(web_data_service_.get()),
- Details<AutofillProfileChange>(&change));
- MessageLoop::current()->RunAllPending(); // Run the Refresh task.
- Mock::VerifyAndClearExpectations(&web_database_);
-
- std::vector<AutofillEntry> new_sync_entries;
- std::vector<AutoFillProfile> new_sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries,
- &new_sync_profiles));
- ASSERT_EQ(2U, new_sync_profiles.size());
- EXPECT_EQ(0, marion.Compare(new_sync_profiles[1]));
- EXPECT_TRUE(ProfilesMatchExceptLabelImpl(josephine_update,
- new_sync_profiles[0]));
- EXPECT_EQ(ASCIIToUTF16("ExistingLabel2"), new_sync_profiles[0].Label());
- EXPECT_EQ(ASCIIToUTF16("ExistingLabel2"), relabelled_profile.Label());
- josephine = relabelled_profile;
- }
-}
-
TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveEntry) {
AutofillEntry original_entry(MakeAutofillEntry("my", "entry", 1));
std::vector<AutofillEntry> original_entries;
@@ -1079,7 +947,7 @@
EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true));
EXPECT_CALL(*personal_data_manager_, Refresh());
CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
AutofillChangeList changes;
@@ -1099,42 +967,39 @@
TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) {
AutoFillProfile sync_profile;
- autofill_test::SetProfileInfo(&sync_profile,
- "Billing", "Josephine", "Alicia", "Saenz",
+ autofill_test::SetProfileInfoWithGuid(&sync_profile,
+ "{3BA5FA1B-1EC4-4bb3-9B57-EC92BE3C1A09}", "Josephine", "Alicia", "Saenz",
"joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
"32801", "US", "19482937549", "13502849239");
AutoFillProfile* native_profile = new AutoFillProfile;
- autofill_test::SetProfileInfo(native_profile,
- "Billing", "Josephine", "Alicia", "Saenz",
+ autofill_test::SetProfileInfoWithGuid(native_profile,
+ "{3BA5FA1B-1EC4-4bb3-9B57-EC92BE3C1A09}", "Josephine", "Alicia", "Saenz",
"joewayne@me.xyz", "Fox", "1212 Center.", "Bld. 5", "Orlando", "FL",
"32801", "US", "19482937549", "13502849239");
std::vector<AutoFillProfile*> native_profiles;
native_profiles.push_back(native_profile);
- EXPECT_CALL(web_database_, GetAllAutofillEntries(_)). WillOnce(Return(true));
EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).
WillOnce(DoAll(SetArgumentPointee<0>(native_profiles), Return(true)));
- std::vector<AutofillEntry> sync_entries;
std::vector<AutoFillProfile> sync_profiles;
sync_profiles.push_back(sync_profile);
- AddAutofillEntriesTask task(this, sync_entries, sync_profiles);
+ AddAutofillTask<AutoFillProfile> task(this, sync_profiles);
EXPECT_CALL(*personal_data_manager_, Refresh());
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL_PROFILE);
ASSERT_TRUE(task.success());
- AutofillProfileChange change(AutofillProfileChange::REMOVE,
- sync_profile.Label(), NULL, string16());
+ AutofillProfileChangeGUID change(AutofillProfileChangeGUID::REMOVE,
+ sync_profile.guid(), NULL);
scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_));
- notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED,
+ notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED_GUID,
Source<WebDataService>(web_data_service_.get()),
- Details<AutofillProfileChange>(&change));
+ Details<AutofillProfileChangeGUID>(&change));
- std::vector<AutofillEntry> new_sync_entries;
std::vector<AutoFillProfile> new_sync_profiles;
- ASSERT_TRUE(GetAutofillEntriesFromSyncDB(&new_sync_entries,
- &new_sync_profiles));
- ASSERT_EQ(0U, new_sync_entries.size());
+ ASSERT_TRUE(GetAutofillProfilesFromSyncDBUnderProfileNode(
+ &new_sync_profiles));
+ ASSERT_EQ(0U, new_sync_profiles.size());
}
TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeError) {
@@ -1142,7 +1007,7 @@
EXPECT_CALL(web_database_, GetAutoFillProfiles(_)).WillOnce(Return(true));
EXPECT_CALL(*personal_data_manager_, Refresh());
CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
// Inject an evil entry into the sync db to conflict with the same
@@ -1179,7 +1044,7 @@
WillRepeatedly(Return(true));
EXPECT_CALL(*personal_data_manager_, Refresh()).Times(3);
CreateRootTask task(this, syncable::AUTOFILL);
- StartSyncService(&task, false);
+ StartSyncService(&task, false, syncable::AUTOFILL);
ASSERT_TRUE(task.success());
// (true, false) means we have to reset after |Signal|, init to unsignaled.
diff --git a/chrome/browser/sync/profile_sync_service_harness.cc b/chrome/browser/sync/profile_sync_service_harness.cc
index d275147..14fba6e 100644
--- a/chrome/browser/sync/profile_sync_service_harness.cc
+++ b/chrome/browser/sync/profile_sync_service_harness.cc
@@ -2,12 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "chrome/browser/sync/profile_sync_service_harness.h"
+
+#include <algorithm>
+#include <vector>
+
#include "base/message_loop.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/net/gaia/token_service.h"
#include "chrome/browser/sync/glue/sync_backend_host.h"
-#include "chrome/browser/sync/profile_sync_service_harness.h"
#include "chrome/browser/sync/sessions/session_state.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/net/gaia/gaia_constants.h"
@@ -90,8 +94,7 @@
: wait_state_(INITIAL_WAIT_STATE),
profile_(profile),
service_(NULL),
- last_timestamp_(0),
- min_timestamp_needed_(kMinTimestampNeededNone),
+ timestamp_match_partner_(NULL),
username_(username),
password_(password),
id_(id) {
@@ -263,11 +266,14 @@
}
case WAITING_FOR_UPDATES: {
LogClientInfo("WAITING_FOR_UPDATES");
- if (!IsSynced() || GetUpdatedTimestamp() < min_timestamp_needed_) {
- // The client is not yet fully synced. Continue waiting until the client
- // is at the required minimum timestamp.
+ DCHECK(timestamp_match_partner_);
+ if (!MatchesOtherClient(timestamp_match_partner_)) {
+ // The client is not yet fully synced; keep waiting until we converge.
break;
}
+ timestamp_match_partner_->service()->RemoveObserver(this);
+ timestamp_match_partner_ = NULL;
+
SignalStateCompleteWithNextState(FULLY_SYNCED);
break;
}
@@ -353,7 +359,7 @@
LogClientInfo("AwaitMutualSyncCycleCompletion");
if (!AwaitSyncCycleCompletion("Sync cycle completion on active client."))
return false;
- return partner->WaitUntilTimestampIsAtLeast(last_timestamp_,
+ return partner->WaitUntilTimestampMatches(this,
"Sync cycle completion on passive client.");
}
@@ -367,7 +373,7 @@
partners.begin(); it != partners.end(); ++it) {
if ((this != *it) && ((*it)->wait_state_ != SYNC_DISABLED)) {
return_value = return_value &&
- (*it)->WaitUntilTimestampIsAtLeast(last_timestamp_,
+ (*it)->WaitUntilTimestampMatches(this,
"Sync cycle completion on partner client.");
}
}
@@ -388,20 +394,21 @@
return return_value;
}
-bool ProfileSyncServiceHarness::WaitUntilTimestampIsAtLeast(
- int64 timestamp, const std::string& reason) {
- LogClientInfo("WaitUntilTimestampIsAtLeast");
+bool ProfileSyncServiceHarness::WaitUntilTimestampMatches(
+ ProfileSyncServiceHarness* partner, const std::string& reason) {
+ LogClientInfo("WaitUntilTimestampMatches");
if (wait_state_ == SYNC_DISABLED) {
LOG(ERROR) << "Sync disabled for Client " << id_ << ".";
return false;
}
- min_timestamp_needed_ = timestamp;
- if (GetUpdatedTimestamp() < min_timestamp_needed_) {
- wait_state_ = WAITING_FOR_UPDATES;
- return AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason);
- } else {
+ DCHECK(!timestamp_match_partner_);
+ if (MatchesOtherClient(partner))
return true;
- }
+
+ timestamp_match_partner_ = partner;
+ partner->service()->AddObserver(this);
+ wait_state_ = WAITING_FOR_UPDATES;
+ return AwaitStatusChangeWithTimeout(kLiveSyncOperationTimeoutMs, reason);
}
bool ProfileSyncServiceHarness::AwaitStatusChangeWithTimeout(
@@ -424,8 +431,13 @@
timeout_milliseconds);
loop->Run();
loop->SetNestableTasksAllowed(did_allow_nestable_tasks);
- LogClientInfo("AwaitStatusChangeWithTimeout succeeded");
- return timeout_signal->Abort();
+ if (timeout_signal->Abort()) {
+ LogClientInfo("AwaitStatusChangeWithTimeout succeeded");
+ return true;
+ } else {
+ LogClientInfo("AwaitStatusChangeWithTimeout timed out");
+ return false;
+ }
}
ProfileSyncService::Status ProfileSyncServiceHarness::GetStatus() {
@@ -449,6 +461,27 @@
snap->unsynced_count == 0);
}
+bool ProfileSyncServiceHarness::MatchesOtherClient(
+ ProfileSyncServiceHarness* partner) {
+ if (!IsSynced())
+ return false;
+
+ // Only look for a match if we have at least one enabled datatype in
+ // common with the partner client.
+ syncable::ModelTypeSet types, other_types, intersection_types;
+ service()->GetPreferredDataTypes(&types);
+ partner->service()->GetPreferredDataTypes(&other_types);
+ std::set_intersection(types.begin(), types.end(), other_types.begin(),
+ other_types.end(),
+ inserter(intersection_types,
+ intersection_types.begin()));
+ if (intersection_types.empty()) {
+ return true;
+ }
+ return partner->IsSynced() &&
+ partner->GetUpdatedTimestamp() == GetUpdatedTimestamp();
+}
+
const SyncSessionSnapshot*
ProfileSyncServiceHarness::GetLastSessionSnapshot() const {
DCHECK(service_ != NULL) << "Sync service has not yet been set up.";
@@ -539,9 +572,7 @@
int64 ProfileSyncServiceHarness::GetUpdatedTimestamp() {
const SyncSessionSnapshot* snap = GetLastSessionSnapshot();
DCHECK(snap != NULL) << "GetUpdatedTimestamp(): Sync snapshot is NULL.";
- DCHECK_LE(last_timestamp_, snap->max_local_timestamp);
- last_timestamp_ = snap->max_local_timestamp;
- return last_timestamp_;
+ return snap->max_local_timestamp;
}
void ProfileSyncServiceHarness::LogClientInfo(std::string message) {
diff --git a/chrome/browser/sync/profile_sync_service_harness.h b/chrome/browser/sync/profile_sync_service_harness.h
index e3047af..064afe1 100644
--- a/chrome/browser/sync/profile_sync_service_harness.h
+++ b/chrome/browser/sync/profile_sync_service_harness.h
@@ -59,8 +59,9 @@
bool AwaitSyncCycleCompletion(const std::string& reason);
// Blocks the caller until this harness has observed that the sync engine
- // has "synced" up to at least the specified local timestamp.
- bool WaitUntilTimestampIsAtLeast(int64 timestamp, const std::string& reason);
+ // has downloaded all the changes seen by the |partner| harness's client.
+ bool WaitUntilTimestampMatches(
+ ProfileSyncServiceHarness* partner, const std::string& reason);
// Calling this acts as a barrier and blocks the caller until |this| and
// |partner| have both completed a sync cycle. When calling this method,
@@ -72,10 +73,9 @@
bool AwaitMutualSyncCycleCompletion(ProfileSyncServiceHarness* partner);
// Blocks the caller until |this| completes its ongoing sync cycle and every
- // other client in |partners| has a timestamp that is greater than or equal to
- // the timestamp of |this|. Note: Use this method when exactly one client
- // makes local change(s), and more than one client is waiting to receive those
- // changes.
+ // other client in |partners| have achieved identical download progresses.
+ // Note: Use this method when exactly one client makes local change(s),
+ // and more than one client is waiting to receive those changes.
bool AwaitGroupSyncCycleCompletion(
std::vector<ProfileSyncServiceHarness*>& partners);
@@ -168,11 +168,14 @@
// Returns true if the sync client has no unsynced items.
bool IsSynced();
+ // Returns true if this client has downloaded all the items that the
+ // other client has.
+ bool MatchesOtherClient(ProfileSyncServiceHarness* partner);
+
// Logs message with relevant info about client's sync state (if available).
void LogClientInfo(std::string message);
- // Updates |last_timestamp_| with the timestamp of the current sync session.
- // Returns the new value of |last_timestamp_|.
+ // Gets the current progress indicator of the current sync session.
int64 GetUpdatedTimestamp();
WaitState wait_state_;
@@ -180,15 +183,9 @@
Profile* profile_;
ProfileSyncService* service_;
- // This value tracks the max sync timestamp (e.g. synced-to revision) inside
- // the sync engine. It gets updated when a sync cycle ends and the session
- // snapshot implies syncing is "done".
- int64 last_timestamp_;
-
- // The minimum value of the 'max_local_timestamp' member of a
- // SyncSessionSnapshot we need to wait to observe in OnStateChanged when told
- // to WaitUntilTimestampIsAtLeast(...).
- int64 min_timestamp_needed_;
+ // The harness of the client whose update progress marker we're expecting
+ // eventually match.
+ ProfileSyncServiceHarness* timestamp_match_partner_;
// Credentials used for GAIA authentication.
std::string username_;
diff --git a/chrome/browser/sync/profile_sync_service_mock.cc b/chrome/browser/sync/profile_sync_service_mock.cc
new file mode 100644
index 0000000..8bfdb10
--- /dev/null
+++ b/chrome/browser/sync/profile_sync_service_mock.cc
@@ -0,0 +1,9 @@
+// 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 "chrome/browser/sync/profile_sync_service_mock.h"
+
+ProfileSyncServiceMock::ProfileSyncServiceMock() {}
+
+ProfileSyncServiceMock::~ProfileSyncServiceMock() {}
diff --git a/chrome/browser/sync/profile_sync_service_mock.h b/chrome/browser/sync/profile_sync_service_mock.h
index a338631..32bff66 100644
--- a/chrome/browser/sync/profile_sync_service_mock.h
+++ b/chrome/browser/sync/profile_sync_service_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -17,8 +17,8 @@
class ProfileSyncServiceMock : public ProfileSyncService {
public:
- ProfileSyncServiceMock() {}
- virtual ~ProfileSyncServiceMock() {}
+ ProfileSyncServiceMock();
+ virtual ~ProfileSyncServiceMock();
MOCK_METHOD0(DisableForUser, void());
MOCK_METHOD0(OnBackendInitialized, void());
diff --git a/chrome/browser/sync/profile_sync_service_session_unittest.cc b/chrome/browser/sync/profile_sync_service_session_unittest.cc
index 6242f0e..7f90cd6 100644
--- a/chrome/browser/sync/profile_sync_service_session_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_session_unittest.cc
@@ -170,16 +170,9 @@
bool has_nodes;
ASSERT_TRUE(model_associator_->SyncModelHasUserCreatedNodes(&has_nodes));
ASSERT_TRUE(has_nodes);
- ASSERT_TRUE(model_associator_->ChromeModelHasUserCreatedNodes(&has_nodes));
- ASSERT_TRUE(has_nodes);
std::string machine_tag = model_associator_->GetCurrentMachineTag();
- int64 sync_id;
- ASSERT_TRUE(model_associator_->GetSyncIdForTaggedNode(&machine_tag,
- &sync_id));
- ASSERT_EQ(model_associator_->GetSyncIdFromChromeId(machine_tag), sync_id);
- scoped_ptr<const sync_pb::SessionSpecifics> sync_specifics(
- model_associator_->GetChromeNodeFromSyncId(sync_id));
- ASSERT_TRUE(sync_specifics != NULL);
+ int64 sync_id = model_associator_->GetSyncIdFromSessionTag(machine_tag);
+ ASSERT_NE(sync_api::kInvalidId, sync_id);
// Check that we can get the correct session specifics back from the node.
sync_api::ReadTransaction trans(sync_service_->
@@ -188,8 +181,10 @@
ASSERT_TRUE(node.InitByClientTagLookup(syncable::SESSIONS,
machine_tag));
const sync_pb::SessionSpecifics& specifics(node.GetSessionSpecifics());
- ASSERT_EQ(sync_specifics->session_tag(), specifics.session_tag());
ASSERT_EQ(machine_tag, specifics.session_tag());
+ ASSERT_TRUE(specifics.has_header());
+ const sync_pb::SessionHeader& header_s = specifics.header();
+ ASSERT_EQ(0, header_s.window_size());
}
// Test that we can fill this machine's session, write it to a node,
@@ -208,51 +203,35 @@
AddTab(browser(), GURL("http://bar/1"));
NavigateAndCommitActiveTab(GURL("http://bar/2"));
- // Report a saved session, thus causing the ChangeProcessor to write to a
- // node.
- NotificationService::current()->Notify(
- NotificationType::SESSION_SERVICE_SAVED,
- Source<Profile>(profile()),
- NotificationService::NoDetails());
+ ASSERT_TRUE(model_associator_->SyncModelHasUserCreatedNodes(&has_nodes));
+ ASSERT_TRUE(has_nodes);
std::string machine_tag = model_associator_->GetCurrentMachineTag();
- int64 sync_id;
- ASSERT_TRUE(model_associator_->GetSyncIdForTaggedNode(&machine_tag,
- &sync_id));
- ASSERT_EQ(model_associator_->GetSyncIdFromChromeId(machine_tag), sync_id);
- scoped_ptr<const sync_pb::SessionSpecifics> sync_specifics(
- model_associator_->GetChromeNodeFromSyncId(sync_id));
- ASSERT_TRUE(sync_specifics != NULL);
+ int64 sync_id = model_associator_->GetSyncIdFromSessionTag(machine_tag);
+ ASSERT_NE(sync_api::kInvalidId, sync_id);
// Check that this machine's data is not included in the foreign windows.
- ScopedVector<ForeignSession> foreign_sessions;
- model_associator_->GetSessionData(&foreign_sessions.get());
+ std::vector<const ForeignSession*> foreign_sessions;
+ model_associator_->GetAllForeignSessions(&foreign_sessions);
ASSERT_EQ(foreign_sessions.size(), 0U);
- // Get the windows for this machine from the node and check that they were
+ // Get the tabs for this machine from the node and check that they were
// filled.
- sync_api::ReadTransaction trans(sync_service_->
- backend()->GetUserShareHandle());
- sync_api::ReadNode node(&trans);
- ASSERT_TRUE(node.InitByClientTagLookup(syncable::SESSIONS,
- machine_tag));
- model_associator_->AppendForeignSessionWithID(sync_id,
- &foreign_sessions.get(), &trans);
- ASSERT_EQ(foreign_sessions.size(), 1U);
- ASSERT_EQ(1U, foreign_sessions[0]->windows.size());
- ASSERT_EQ(2U, foreign_sessions[0]->windows[0]->tabs.size());
- ASSERT_EQ(2U, foreign_sessions[0]->windows[0]->tabs[0]->navigations.size());
- ASSERT_EQ(GURL("http://bar/1"),
- foreign_sessions[0]->windows[0]->tabs[0]->navigations[0].virtual_url());
- ASSERT_EQ(GURL("http://bar/2"),
- foreign_sessions[0]->windows[0]->tabs[0]->navigations[1].virtual_url());
- ASSERT_EQ(2U, foreign_sessions[0]->windows[0]->tabs[1]->navigations.size());
- ASSERT_EQ(GURL("http://foo/1"),
- foreign_sessions[0]->windows[0]->tabs[1]->navigations[0].virtual_url());
- ASSERT_EQ(GURL("http://foo/2"),
- foreign_sessions[0]->windows[0]->tabs[1]->navigations[1].virtual_url());
- const sync_pb::SessionSpecifics& specifics(node.GetSessionSpecifics());
- ASSERT_EQ(sync_specifics->session_tag(), specifics.session_tag());
- ASSERT_EQ(machine_tag, specifics.session_tag());
+ SessionModelAssociator::TabLinksMap tab_map = model_associator_->tab_map_;
+ ASSERT_EQ(2U, tab_map.size());
+ // Tabs are ordered by sessionid in tab_map, so should be able to traverse
+ // the tree based on order of tabs created
+ SessionModelAssociator::TabLinksMap::iterator iter = tab_map.begin();
+ ASSERT_EQ(2, iter->second.tab()->controller().entry_count());
+ ASSERT_EQ(GURL("http://foo/1"), iter->second.tab()->controller().
+ GetEntryAtIndex(0)->virtual_url());
+ ASSERT_EQ(GURL("http://foo/2"), iter->second.tab()->controller().
+ GetEntryAtIndex(1)->virtual_url());
+ iter++;
+ ASSERT_EQ(2, iter->second.tab()->controller().entry_count());
+ ASSERT_EQ(GURL("http://bar/1"), iter->second.tab()->controller().
+ GetEntryAtIndex(0)->virtual_url());
+ ASSERT_EQ(GURL("http://bar/2"), iter->second.tab()->controller().
+ GetEntryAtIndex(1)->virtual_url());
}
// Test that we fail on a failed model association.
@@ -273,13 +252,18 @@
ASSERT_TRUE(has_nodes);
// Fill an instance of session specifics with a foreign session's data.
- sync_pb::SessionSpecifics specifics;
+ sync_pb::SessionSpecifics meta_specifics;
std::string machine_tag = "session_sync123";
- specifics.set_session_tag(machine_tag);
- sync_pb::SessionWindow* window = specifics.add_session_window();
- window->set_selected_tab_index(1);
- window->set_browser_type(sync_pb::SessionWindow_BrowserType_TYPE_NORMAL);
- sync_pb::SessionTab* tab = window->add_session_tab();
+ meta_specifics.set_session_tag(machine_tag);
+ sync_pb::SessionHeader* header_s = meta_specifics.mutable_header();
+ sync_pb::SessionWindow* window_s = header_s->add_window();
+ window_s->add_tab(0);
+ window_s->set_browser_type(sync_pb::SessionWindow_BrowserType_TYPE_NORMAL);
+ window_s->set_selected_tab_index(1);
+
+ sync_pb::SessionSpecifics tab_specifics;
+ tab_specifics.set_session_tag(machine_tag);
+ sync_pb::SessionTab* tab = tab_specifics.mutable_tab();
tab->set_tab_visual_index(13);
tab->set_current_navigation_index(3);
tab->set_pinned(true);
@@ -293,25 +277,15 @@
// Update the server with the session specifics.
{
- sync_api::WriteTransaction trans(sync_service_->
- backend()->GetUserShareHandle());
- sync_api::ReadNode root(&trans);
- ASSERT_TRUE(root.InitByTagLookup(kSessionsTag));
- model_associator_->UpdateSyncModel(&specifics, &trans, &root);
- model_associator_->UpdateFromSyncModel(&trans);
+ model_associator_->AssociateForeignSpecifics(meta_specifics, 0);
+ model_associator_->AssociateForeignSpecifics(tab_specifics, 0);
}
- // Check that the foreign session was written to a node and retrieve the data.
- int64 sync_id;
- ASSERT_TRUE(model_associator_->GetSyncIdForTaggedNode(&machine_tag,
- &sync_id));
- ASSERT_EQ(model_associator_->GetSyncIdFromChromeId(machine_tag), sync_id);
- scoped_ptr<const sync_pb::SessionSpecifics> sync_specifics(
- model_associator_->GetChromeNodeFromSyncId(sync_id));
- ASSERT_TRUE(sync_specifics != NULL);
- ScopedVector<ForeignSession> foreign_sessions;
- model_associator_->GetSessionData(&foreign_sessions.get());
+ // Check that the foreign session was associated and retrieve the data.
+ std::vector<const ForeignSession*> foreign_sessions;
+ model_associator_->GetAllForeignSessions(&foreign_sessions);
ASSERT_EQ(1U, foreign_sessions.size());
+ ASSERT_EQ(machine_tag, foreign_sessions[0]->foreign_session_tag);
ASSERT_EQ(1U, foreign_sessions[0]->windows.size());
ASSERT_EQ(1U, foreign_sessions[0]->windows[0]->tabs.size());
ASSERT_EQ(1U, foreign_sessions[0]->windows[0]->tabs[0]->navigations.size());
@@ -334,14 +308,6 @@
foreign_sessions[0]->windows[0]->tabs[0]->navigations[0].transition());
ASSERT_EQ(GURL("http://foo/1"),
foreign_sessions[0]->windows[0]->tabs[0]->navigations[0].virtual_url());
- sync_api::WriteTransaction trans(sync_service_->
- backend()->GetUserShareHandle());
- sync_api::ReadNode node(&trans);
- ASSERT_TRUE(node.InitByClientTagLookup(syncable::SESSIONS,
- machine_tag));
- const sync_pb::SessionSpecifics& specifics_(node.GetSessionSpecifics());
- ASSERT_EQ(sync_specifics->session_tag(), specifics_.session_tag());
- ASSERT_EQ(machine_tag, specifics_.session_tag());
}
// Test the DataTypeController on update.
@@ -349,7 +315,7 @@
CreateRootTask task(this);
ASSERT_TRUE(StartSyncService(&task, false));
ASSERT_TRUE(task.success());
- int64 node_id = model_associator_->GetSyncIdFromChromeId(
+ int64 node_id = model_associator_->GetSyncIdFromSessionTag(
model_associator_->GetCurrentMachineTag());
scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
record->action = SyncManager::ChangeRecord::ACTION_UPDATE;
@@ -368,7 +334,7 @@
ASSERT_TRUE(StartSyncService(&task, false));
ASSERT_TRUE(task.success());
- int64 node_id = model_associator_->GetSyncIdFromChromeId(
+ int64 node_id = model_associator_->GetSyncIdFromSessionTag(
model_associator_->GetCurrentMachineTag());
scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
record->action = SyncManager::ChangeRecord::ACTION_ADD;
@@ -387,7 +353,7 @@
ASSERT_TRUE(StartSyncService(&task, false));
ASSERT_TRUE(task.success());
- int64 node_id = model_associator_->GetSyncIdFromChromeId(
+ int64 node_id = model_associator_->GetSyncIdFromSessionTag(
model_associator_->GetCurrentMachineTag());
scoped_ptr<SyncManager::ChangeRecord> record(new SyncManager::ChangeRecord);
record->action = SyncManager::ChangeRecord::ACTION_DELETE;
@@ -399,6 +365,64 @@
}
ASSERT_TRUE(notified_of_update_);
}
+// Test the TabNodePool when it starts off empty.
+TEST_F(ProfileSyncServiceSessionTest, TabNodePoolEmpty) {
+ CreateRootTask task(this);
+ ASSERT_TRUE(StartSyncService(&task, false));
+ ASSERT_TRUE(task.success());
+
+ std::vector<int64> node_ids;
+ ASSERT_EQ(0U, model_associator_->tab_pool_.capacity());
+ ASSERT_TRUE(model_associator_->tab_pool_.empty());
+ ASSERT_TRUE(model_associator_->tab_pool_.full());
+ const size_t num_ids = 10;
+ for (size_t i = 0; i < num_ids; ++i) {
+ int64 id = model_associator_->tab_pool_.GetFreeTabNode();
+ ASSERT_GT(id, -1);
+ node_ids.push_back(id);
+ }
+ ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity());
+ ASSERT_TRUE(model_associator_->tab_pool_.empty());
+ ASSERT_FALSE(model_associator_->tab_pool_.full());
+ for (size_t i = 0; i < num_ids; ++i) {
+ model_associator_->tab_pool_.FreeTabNode(node_ids[i]);
+ }
+ ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity());
+ ASSERT_FALSE(model_associator_->tab_pool_.empty());
+ ASSERT_TRUE(model_associator_->tab_pool_.full());
+}
+
+// Test the TabNodePool when it starts off with nodes
+TEST_F(ProfileSyncServiceSessionTest, TabNodePoolNonEmpty) {
+ CreateRootTask task(this);
+ ASSERT_TRUE(StartSyncService(&task, false));
+ ASSERT_TRUE(task.success());
+
+ const size_t num_starting_nodes = 3;
+ for (size_t i = 0; i < num_starting_nodes; ++i) {
+ model_associator_->tab_pool_.AddTabNode(i);
+ }
+
+ std::vector<int64> node_ids;
+ ASSERT_EQ(num_starting_nodes, model_associator_->tab_pool_.capacity());
+ ASSERT_FALSE(model_associator_->tab_pool_.empty());
+ ASSERT_TRUE(model_associator_->tab_pool_.full());
+ const size_t num_ids = 10;
+ for (size_t i = 0; i < num_ids; ++i) {
+ int64 id = model_associator_->tab_pool_.GetFreeTabNode();
+ ASSERT_GT(id, -1);
+ node_ids.push_back(id);
+ }
+ ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity());
+ ASSERT_TRUE(model_associator_->tab_pool_.empty());
+ ASSERT_FALSE(model_associator_->tab_pool_.full());
+ for (size_t i = 0; i < num_ids; ++i) {
+ model_associator_->tab_pool_.FreeTabNode(node_ids[i]);
+ }
+ ASSERT_EQ(num_ids, model_associator_->tab_pool_.capacity());
+ ASSERT_FALSE(model_associator_->tab_pool_.empty());
+ ASSERT_TRUE(model_associator_->tab_pool_.full());
+}
} // namespace browser_sync
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
index 17795c6..98b70c0 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -8,7 +8,7 @@
#include "base/ref_counted.h"
#include "base/string16.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/history/history_notifications.h"
diff --git a/chrome/browser/sync/profile_sync_test_util.h b/chrome/browser/sync/profile_sync_test_util.h
index f6e66ac..4e28efa 100644
--- a/chrome/browser/sync/profile_sync_test_util.h
+++ b/chrome/browser/sync/profile_sync_test_util.h
@@ -13,8 +13,8 @@
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/webdata/web_database.h"
diff --git a/chrome/browser/sync/protocol/session_specifics.proto b/chrome/browser/sync/protocol/session_specifics.proto
index 050687d..5b00b35 100644
--- a/chrome/browser/sync/protocol/session_specifics.proto
+++ b/chrome/browser/sync/protocol/session_specifics.proto
@@ -13,14 +13,20 @@
import "sync.proto";
-// Properties of session sync objects.
message SessionSpecifics {
- // Unique id for the session.
+ // Unique id for the client.
optional string session_tag = 1;
+ optional SessionHeader header = 2;
+ optional SessionTab tab = 3;
+}
+// Properties of session sync objects.
+message SessionHeader {
// Each session is composed of windows.
- repeated SessionWindow session_window = 2;
+ repeated SessionWindow window = 2;
}
message SessionWindow {
+ // Unique (to the owner) id for this window.
+ optional int32 window_id = 1;
// Index of the selected tab in tabs; -1 if no tab is selected.
optional int32 selected_tab_index = 2 [default = -1];
// Type of the browser. Currently we only store browsers of type
@@ -30,22 +36,26 @@
TYPE_POPUP = 2;
}
optional BrowserType browser_type = 3 [default = TYPE_NORMAL];
- // The tabs that compose a window.
- repeated SessionTab session_tab= 4;
+ // The tabs that compose a window (correspond to tab id's).
+ repeated int32 tab = 4;
}
message SessionTab {
+ // Unique (to the owner) id for this tab.
+ optional int32 tab_id = 1;
+ // The unique id for the window this tab belongs to.
+ optional int32 window_id = 2;
// Visual index of the tab within its window. There may be gaps in these
// values.
- optional int32 tab_visual_index = 2 [default = -1];
+ optional int32 tab_visual_index = 3 [default = -1];
// Identifies the index of the current navigation in navigations. For
// example, if this is 2 it means the current navigation is navigations[2].
- optional int32 current_navigation_index = 3 [default = -1];
+ optional int32 current_navigation_index = 4 [default = -1];
// True if the tab is pinned.
- optional bool pinned = 4 [default = false];
+ optional bool pinned = 5 [default = false];
// If non-empty, this tab is an app tab and this is the id of the extension.
- optional string extension_app_id = 5;
+ optional string extension_app_id = 6;
// Tabs are navigated, and the navigation data is here.
- repeated TabNavigation navigation = 6;
+ repeated TabNavigation navigation = 7;
}
message TabNavigation {
// The index in the NavigationController. If this is -1, it means this
diff --git a/chrome/browser/sync/resources/configure.html b/chrome/browser/sync/resources/configure.html
index 90a3491..b087169 100644
--- a/chrome/browser/sync/resources/configure.html
+++ b/chrome/browser/sync/resources/configure.html
@@ -83,13 +83,11 @@
}
#sync-encryption-instructions {
- margin-bottom: 10px;
- line-height: 1.8em;
+ margin-bottom: 5px;
}
#sync-passphrase-warning {
- font-style: italic;
- line-height: 1.8em;
+ margin-bottom: 5px;
}
#encryption-tab-contents > .sync_item_show {
@@ -145,6 +143,26 @@
margin-right: 10px;
margin-bottom: 10px;
}
+.sync-section {
+ background: #EEE;
+ margin: 5px 0px;
+ padding: 6px;
+}
+
+#explicit-message {
+ margin-bottom: 5px;
+}
+
+#change-passphrase {
+ margin: 10px 0;
+ background: #EEE;
+ padding: 8px;
+}
+
+#clear-data-button {
+ margin-top: 10px;
+}
+
html[dir='rtl'] .sync-footer {
text-align: left;
left: 0px;
@@ -254,9 +272,9 @@
args.syncApps;
document.getElementById("appsItem").className = "sync-item-show";
} else {
- document.getElementById("appsItem").className = "sync-item-hide";
- }
-
+ document.getElementById("appsItem").className = "sync-item-hide";
+ }
+
setCheckboxesToKeepEverythingSynced(args.keepEverythingSynced);
if (args.sessionsRegistered) {
document.getElementById("sessionsCheckbox").checked = args.syncSessions;
@@ -267,13 +285,18 @@
}
function setEncryptionCheckboxes(args) {
- document.getElementById("usePassphraseCheckbox").checked =
- args["usePassphrase"];
-
- // The passphrase, once set, cannot be unset.
if (args["usePassphrase"]) {
- document.getElementById("usePassphraseCheckbox").disabled = true;
+ document.getElementById("explicit-option").checked = true;
+
+ // The passphrase, once set, cannot be unset, but we show a reset link.
+ document.getElementById("explicit-option").disabled = true;
+ document.getElementById("google-option").disabled = true;
+ document.getElementById("change-passphrase").style.display = "block";
+ } else {
+ document.getElementById("google-option").checked = true;
+ document.getElementById("change-passphrase").style.display = "none";
}
+ switchToMode("");
}
function setErrorState(args) {
@@ -298,6 +321,8 @@
}
}
+
+
// Returns true if at least one data type is enabled and no data types are
// checked. (If all data type checkboxes are disabled, it's because "keep
// everything synced" is checked.)
@@ -328,6 +353,10 @@
}
var f = document.getElementById("chooseDataTypesForm");
+ if (!checkPassphraseMatch()) {
+ return false;
+ }
+
var syncAll = f.keepEverythingSyncedRadio.checked;
// These values need to be kept in sync with where they are read in
// SyncSetupFlow::GetDataTypeChoiceData().
@@ -342,7 +371,8 @@
"syncTypedUrls": syncAll || f.typedUrlsCheckbox.checked,
"syncApps": syncAll || f.appsCheckbox.checked,
"syncSessions": syncAll || f.sessionsCheckbox.checked,
- "usePassphrase": document.getElementById("usePassphraseCheckbox").checked
+ "usePassphrase": (getRadioCheckedValue() == 'explicit'),
+ "passphrase": f.passphrase.value
});
chrome.send("Configure", [result]);
}
@@ -354,15 +384,73 @@
document.getElementById(currentTab + "-tab-contents").className =
"sync-config-tab-contents-inactive";
}
-
+
document.getElementById(newTab + "-tab").className =
"sync-config-tab-active";
document.getElementById(newTab + "-tab-contents").className =
"sync-config-tab-contents-active";
-
+
currentTab = newTab;
}
+ function switchToMode(mode) {
+ document.getElementById("section-explicit").style.display = "none";
+ document.getElementById("section-google").style.display = "none";
+
+ if (mode == "google") {
+ document.getElementById("section-google").style.display = "block";
+ } else if (mode =="explicit") {
+ document.getElementById("section-explicit").style.display = "block";
+ }
+ }
+
+ function getRadioCheckedValue() {
+ var f = document.getElementById("chooseDataTypesForm");
+ for (var i = 0; i < f.option.length; ++i) {
+ if (f.option[i].checked) {
+ return f.option[i].value;
+ }
+ }
+ return undefined;
+ }
+
+ function onRadioChange() {
+ switchToMode(getRadioCheckedValue());
+ }
+
+ function checkPassphraseMatch() {
+ var emptyError = document.getElementById("emptyerror");
+ var mismatchError = document.getElementById("mismatcherror");
+ emptyError.style.display = "none";
+ mismatchError.style.display = "none";
+
+ if (getRadioCheckedValue() != "explicit") {
+ return true;
+ }
+ var f = document.getElementById("chooseDataTypesForm");
+ if (f.passphrase.value.length == 0) {
+ emptyError.style.display = "block";
+ return false;
+ }
+ if (f.confirmpassphrase.value.length > 0 &&
+ f.confirmpassphrase.value != f.passphrase.value) {
+ mismatchError.style.display = "block";
+ return false;
+ }
+ return true;
+ }
+
+ function sendValuesAndClose() {
+ var result = JSON.stringify({"option": getRadioCheckedValue(),
+ "passphrase": f.passphrase.value});
+ chrome.send("FirstPassphrase", [result]);
+ }
+
+ function goToDashboard() {
+ chrome.send("GoToDashboard", [""]);
+ chrome.send("DialogClose", [""]);
+ }
+
</script>
</head>
<body i18n-values=".style.fontFamily:fontfamily"
@@ -381,9 +469,9 @@
</div>
<div id="data-type-tab-contents" class="sync-config-tab-contents-inactive">
- <div class="sync-header"
+ <div class="sync-header"
i18n-content="choosedatatypesheader"></div>
- <div class="sync-choose_data_types_instructions"
+ <div class="sync-choose_data_types_instructions"
i18n-content="choosedatatypesinstructions"></div>
<div class="sync-select-customization">
<div class="sync-choice_radio">
@@ -395,7 +483,7 @@
</label>
</div>
<div id="chooseDataTypes" class="sync-choice_radio">
- <input id="chooseDataTypesRadio" type="radio" name="syncChooseDataTypes"
+ <input id="chooseDataTypesRadio" type="radio" name="syncChooseDataTypes"
onclick="setCheckboxesToKeepEverythingSynced(false)">
<label for="chooseDataTypesRadio" i18n-content="choosedatatypes" ></label>
<div id="chooseDataTypesBody">
@@ -403,49 +491,49 @@
<!-- Apps -->
<div class="sync-item-show" id="appsItem">
<input id="appsCheckbox" name="dataTypeCheckbox" type="checkbox">
- <label id="appsCheckboxLabel" name="dataTypeLabel"
+ <label id="appsCheckboxLabel" name="dataTypeLabel"
for="appsCheckbox" i18n-content="apps"
i18n-values="title:apps"></label>
</div>
<!-- Autofill -->
<div class="sync-item-show" id="autofillItem">
<input id="autofillCheckbox" name="dataTypeCheckbox" type="checkbox">
- <label id="autofillCheckboxLabel" name="dataTypeLabel"
+ <label id="autofillCheckboxLabel" name="dataTypeLabel"
for="autofillCheckbox" i18n-content="autofill"
i18n-values="title:autofill"></label>
</div>
<!-- Bookmarks -->
<div class="sync-item-show" id="bookmarksItem">
<input id="bookmarksCheckbox" name="dataTypeCheckbox" type="checkbox">
- <label id="bookmarksCheckboxLabel" name="dataTypeLabel"
+ <label id="bookmarksCheckboxLabel" name="dataTypeLabel"
for="bookmarksCheckbox" i18n-content="bookmarks"
i18n-values="title:bookmarks"></label>
</div>
<!-- Extensions -->
<div class="sync-item-show" id="extensionsItem">
<input id="extensionsCheckbox" name="dataTypeCheckbox" type="checkbox">
- <label id="extensionsCheckboxLabel" name="dataTypeLabel"
+ <label id="extensionsCheckboxLabel" name="dataTypeLabel"
for="extensionsCheckbox" i18n-content="extensions"
i18n-values="title:extensions"></label>
</div>
<!-- Omnibox -->
<div class="sync-item-show" id="omniboxItem">
<input id="typedUrlsCheckbox" name="dataTypeCheckbox" type="checkbox">
- <label id="typedUrlsCheckboxLabel" name="dataTypeLabel"
+ <label id="typedUrlsCheckboxLabel" name="dataTypeLabel"
for="typedUrlsCheckbox" i18n-content="typedurls"
i18n-values="title:typedurls"></label>
</div>
<!-- Passwords -->
<div class="sync-item-show" id="passwordsItem">
<input id="passwordsCheckbox" name="dataTypeCheckbox" type="checkbox">
- <label id="passwordsCheckboxLabel" name="dataTypeLabel"
+ <label id="passwordsCheckboxLabel" name="dataTypeLabel"
for="passwordsCheckbox" i18n-content="passwords"
i18n-values="title:passwords"></label>
</div>
<!-- Preferences -->
<div class="sync-item-show" id="preferencesItem">
<input id="preferencesCheckbox" name="dataTypeCheckbox" type="checkbox">
- <label id="preferencesCheckboxLabel" name="dataTypeLabel"
+ <label id="preferencesCheckboxLabel" name="dataTypeLabel"
for="preferencesCheckbox" i18n-content="preferences"
i18n-values="title:preferences"></label>
</div>
@@ -458,7 +546,7 @@
<!-- Sessions -->
<div class="sync-item-show" id="sessionsItem">
<input id="sessionsCheckbox" name="dataTypeCheckbox" type="checkbox">
- <label id="sessionsCheckboxLabel" name="dataTypeLabel"
+ <label id="sessionsCheckboxLabel" name="dataTypeLabel"
for="sessionsCheckbox" i18n-content="foreignsessions"
il8n-values="title:sessions"></label>
</div>
@@ -475,21 +563,58 @@
</div>
<div id="encryption-tab-contents" class="sync-config-tab-contents-inactive">
- <div id="sync-encryption-instructions"
+ <div id="sync-encryption-instructions"
i18n-content="encryptionInstructions"></div>
-
- <div class="sync-item-show" id="usePassphrase">
- <input id="usePassphraseCheckbox" name="usePassphraseCheckbox"
- type="checkbox" />
- <label id="usePassphraseLabel" name="usePassphraseLabel"
- for="usePassphraseCheckbox" i18n-content="usePassphraseLabel">
- </label>
+
+ <div>
+ <input id="google-option" name="option" type="radio"
+ value="google" onchange="onRadioChange();">
+ <span i18n-content="googleOption"></span>
+ </input>
</div>
-
- <div id="sync-passphrase-warning" i18n-content="passphraseWarning">
+ <div>
+ <input id="explicit-option" name="option" type="radio"
+ value="explicit" onchange="onRadioChange();">
+ <span i18n-content="explicitOption"></span>
+ </input>
+ </div>
+
+ <div class="sync-section" id="section-google">
+ <div i18n-content="sectionGoogleMessage"></div>
+ </div>
+ <div class="sync-section" id="section-explicit">
+ <div i18n-content="sectionExplicitMessage" id="explicit-message"></div>
+ <div>
+ <div i18n-content="passphraseLabel" id="passphraseLabel"></div>
+ <input id="passphrase" name="passphrase" label="passphraseLabel"
+ type="password" onkeyup="checkPassphraseMatch();"
+ onchange="checkPassphraseMatch();"/>
+ </div>
+ <div>
+ <div i18n-content="confirmLabel" id="confirmPassphraseLabel">
+ </div>
+ <input id="confirmpassphrase" name="confirmpassphrase" type="password"
+ label="confirmPassphraseLabel"
+ onkeyup="checkPassphraseMatch();"
+ onchange="checkPassphraseMatch();" />
+ </div>
+ <div class="error" style="display:none"
+ id="emptyerror" i18n-content="emptyErrorMessage"></div>
+ <div class="error" style="display:none"
+ id="mismatcherror" i18n-content="mismatchErrorMessage"></div>
+ </div>
+
+ <div id="change-passphrase">
+ <div id="sync-passphrase-warning" i18n-content="passphraseWarning">
+ </div>
+ <div id="sync-reset-confirmation" i18n-content="cleardataconfirmation"
+ style="display: none;">
+ </div>
+ <a id="clear-data-link" i18n-content="cleardatalink" href="#"
+ onclick='goToDashboard(); return false;'></a>
</div>
</div>
-
+
<div class="sync-footer">
<input id="okButton" type="submit" i18n-values="value:ok" />
<input id="cancelButton" type="button" i18n-values="value:cancel"
diff --git a/chrome/browser/sync/resources/encryption_login.html b/chrome/browser/sync/resources/encryption_login.html
new file mode 100644
index 0000000..7883cca
--- /dev/null
+++ b/chrome/browser/sync/resources/encryption_login.html
@@ -0,0 +1,6 @@
+<!-- This is intentionally an HTML fragment to be embedded
+ in the browser sign in HTML -->
+<div id="login_message">
+<h1>$1</h1>
+<p>$2</p>
+</div>
diff --git a/chrome/browser/sync/resources/firstpassphrase.html b/chrome/browser/sync/resources/firstpassphrase.html
new file mode 100644
index 0000000..4f82ef9
--- /dev/null
+++ b/chrome/browser/sync/resources/firstpassphrase.html
@@ -0,0 +1,204 @@
+<html i18n-values="dir:textdirection;">
+<head>
+<title></title>
+<style type="text/css">
+body {
+ line-height: 1.5em;
+ background: #FFFFFF;
+ font-size: 11pt;
+}
+html[os='mac'] body {
+ line-height: 1.5em;
+ background: #FFFFFF;
+}
+form {
+ -webkit-user-select: none;
+}
+.error {
+ color: red;
+ font-size: 10pt;
+ }
+.sync-header {
+ font-size: 1.2em;
+ font-weight: bold;
+ margin-bottom: 10px;
+}
+.sync-instructions {
+ margin-top: 10px;
+ margin-bottom: 10px;
+}
+.sync-footer {
+ position: fixed;
+ right: 0px;
+ bottom: 0px;
+ margin-right: 10px;
+ margin-bottom: 10px;
+}
+.sync-section {
+ background: #EEE;
+ margin: 5px;
+ padding: 10px;
+}
+html[dir='rtl'] .sync-footer {
+ text-align: left;
+ left: 0px;
+ bottom: 0px;
+ margin-left: 20px;
+}
+input[type='button'],
+input[type='submit'] {
+ min-width: 87px;
+ min-height: 26px;
+}
+html[os='mac'] input[type='button'],
+html[os='mac'] input[type='submit'] {
+ font-size: 12pt;
+}
+
+#passphrase {
+ margin-top: 5px;
+}
+
+#passphraseLabel,
+#confirmPassphraseLabel {
+ width: 145px;
+ float: left;
+ text-align: right;
+ margin-right: 4px;
+ padding-top: 3px;
+}
+
+</style>
+<script src="chrome://resources/js/cr.js"></script>
+<script>
+ var currentMode;
+
+ // Called once, when this html/js is loaded.
+ function setupDialog(args) {
+ // Allow platform specific rules
+ if (cr.isMac) {
+ document.documentElement.setAttribute('os', 'mac');
+ } else if (!cr.isWindows) {
+ document.documentElement.setAttribute('os', 'linux');
+ }
+
+ switchToMode("");
+ }
+
+ function switchToMode(mode) {
+ document.getElementById("section-explicit").style.display = "none";
+ document.getElementById("section-nothanks").style.display = "none";
+ document.getElementById("section-google").style.display = "none";
+
+ if (mode == "google") {
+ document.getElementById("section-google").style.display = "block";
+ } else if (mode =="explicit") {
+ document.getElementById("section-explicit").style.display = "block";
+ } else if (mode == "nothanks") {
+ document.getElementById("section-nothanks").style.display = "block";
+ }
+ }
+
+ function getRadioCheckedValue() {
+ var f = document.getElementById("form");
+ for (var i = 0; i < f.option.length; ++i) {
+ if (f.option[i].checked) {
+ return f.option[i].value;
+ }
+ }
+ return undefined;
+ }
+
+ function onRadioChange() {
+ switchToMode(getRadioCheckedValue());
+ }
+
+ function checkPassphraseMatch() {
+ var emptyError = document.getElementById("emptyerror");
+ var mismatchError = document.getElementById("mismatcherror");
+ emptyError.style.display = "none";
+ mismatchError.style.display = "none";
+
+ if (getRadioCheckedValue() != "explicit") {
+ return true;
+ }
+ var f = document.getElementById("form");
+ if (f.passphrase.value.length == 0) {
+ emptyError.style.display = "block";
+ return false;
+ }
+ if (f.confirmpassphrase.value.length > 0 &&
+ f.confirmpassphrase.value != f.passphrase.value) {
+ mismatchError.style.display = "block";
+ return false;
+ }
+ return true;
+ }
+
+ function sendValuesAndClose() {
+ var f = document.getElementById("form");
+ if (!checkPassphraseMatch()) {
+ return false;
+ }
+
+ var result = JSON.stringify({"option": getRadioCheckedValue(),
+ "passphrase": f.passphrase.value});
+ chrome.send("FirstPassphrase", [result]);
+ }
+</script>
+</head>
+<body i18n-values=".style.fontFamily:fontfamily" onload="setupDialog();">
+<form id="form" onSubmit="sendValuesAndClose(); return false;">
+ <div class="sync-header" id="title" i18n-content="title"></div>
+ <div class="sync-instructions" id="instructions"
+ i18n-content="instructions"></div>
+ <div>
+ <input name="option" type="radio" value="google" onchange="onRadioChange();">
+ <span i18n-content="googleOption"></span>
+ </input>
+ </div>
+ <div>
+ <input name="option" type="radio" value="explicit" onchange="onRadioChange();">
+ <span i18n-content="explicitOption"></span>
+ </input>
+ </div>
+ <div>
+ <input name="option" type="radio" value="nothanks" onchange="onRadioChange();">
+ <span i18n-content="nothanksOption"></span>
+ </input>
+ </div>
+
+ <div class="sync-section" id="section-google">
+ <div i18n-content="sectionGoogleMessage"></div>
+ </div>
+ <div class="sync-section" id="section-explicit">
+ <div i18n-content="sectionExplicitMessage"></div>
+ <div>
+ <div i18n-content="passphraseLabel" id="passphraseLabel"></div>
+ <input id="passphrase" name="passphrase" label="passphraseLabel"
+ type="password" onkeyup="checkPassphraseMatch();"
+ onchange="checkPassphraseMatch();"/>
+ </div>
+ <div>
+ <div i18n-content="confirmLabel" id="confirmPassphraseLabel">
+ </div>
+ <input id="confirmpassphrase" name="confirmpassphrase" type="password"
+ label="confirmPassphraseLabel"
+ onkeyup="checkPassphraseMatch();"
+ onchange="checkPassphraseMatch();" />
+ </div>
+ <div class="error" style="display:none"
+ id="emptyerror" i18n-content="emptyErrorMessage"></div>
+ <div class="error" style="display:none"
+ id="mismatcherror" i18n-content="mismatchErrorMessage"></div>
+ </div>
+ <div class="sync-section" id="section-nothanks">
+ <div i18n-content="sectionNothanksMessage"></div>
+ </div>
+
+ <div class="sync-footer">
+ <input id="okButton" type="submit" i18n-values="value:ok" />
+ </div>
+</form>
+</body>
+</html>
diff --git a/chrome/browser/sync/resources/setup_flow.html b/chrome/browser/sync/resources/setup_flow.html
index a3de363..495828f 100644
--- a/chrome/browser/sync/resources/setup_flow.html
+++ b/chrome/browser/sync/resources/setup_flow.html
@@ -3,7 +3,8 @@
<title></title>
<script type="text/javascript">
function hideAllPages() {
- var pages = ['login', 'configure', 'passphrase', 'settingup', 'done'];
+ var pages = ['login', 'configure', 'passphrase',
+ 'settingup', 'done', 'firstpassphrase'];
for (var i = 0; i < pages.length; ++i) {
document.getElementById(pages[i]).style.display = 'none';
document.getElementById(pages[i]).tabIndex = -1;
@@ -21,6 +22,7 @@
function showPassphrase() { showPage('passphrase'); }
function showSettingUp() { showPage('settingup'); }
function showSetupDone() { showPage('done'); }
+ function showFirstPassphrase() { showPage('firstpassphrase'); }
// Called once, when this html/js is loaded.
function showTheRightIframe() {
@@ -45,5 +47,8 @@
<iframe id="done" frameborder="0" width="100%" scrolling="no" height="100%"
src="chrome://syncresources/setupdone" style="display:none"
tabindex="-1"></iframe>
+ <iframe id="firstpassphrase" frameborder="0" width="100%" scrolling="no"
+ height="100%" src="chrome://syncresources/firstpassphrase"
+ style="display:none" tabindex="-1"></iframe>
</body>
</html>
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index a6dd5ec..adb06ea 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -44,6 +44,10 @@
NewCallback(this, &FlowHandler::HandleConfigure));
dom_ui_->RegisterMessageCallback("Passphrase",
NewCallback(this, &FlowHandler::HandlePassphraseEntry));
+ dom_ui_->RegisterMessageCallback("FirstPassphrase",
+ NewCallback(this, &FlowHandler::HandleFirstPassphrase));
+ dom_ui_->RegisterMessageCallback("GoToDashboard",
+ NewCallback(this, &FlowHandler::HandleGoToDashboard));
}
static bool GetAuthData(const std::string& json,
@@ -76,6 +80,18 @@
result->GetString("mode", mode);
}
+bool GetFirstPassphrase(const std::string& json,
+ std::string* option,
+ std::string* passphrase) {
+ scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
+ if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY))
+ return false;
+
+ DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get());
+ return result->GetString("option", option) &&
+ result->GetString("passphrase", passphrase);
+}
+
static bool GetConfiguration(const std::string& json,
SyncConfiguration* config) {
scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
@@ -145,6 +161,9 @@
// Encyption settings.
if (!result->GetBoolean("usePassphrase", &config->use_secondary_passphrase))
return false;
+ if (config->use_secondary_passphrase &&
+ !result->GetString("passphrase", &config->secondary_passphrase))
+ return false;
return true;
}
@@ -204,6 +223,28 @@
flow_->OnPassphraseEntry(passphrase, mode);
}
+void FlowHandler::HandleFirstPassphrase(const ListValue* args) {
+ std::string json(dom_ui_util::GetJsonResponseFromFirstArgumentInList(args));
+
+ if (json.empty())
+ return;
+
+ std::string option;
+ std::string passphrase;
+ if (!GetFirstPassphrase(json, &option, &passphrase)) {
+ // Page sent result which couldn't be parsed. Programming error.
+ NOTREACHED();
+ return;
+ }
+
+ DCHECK(flow_);
+ flow_->OnFirstPassphraseEntry(option, passphrase);
+}
+
+void FlowHandler::HandleGoToDashboard(const ListValue* args) {
+ flow_->OnGoToDashboard();
+}
+
// Called by SyncSetupFlow::Advance.
void FlowHandler::ShowGaiaLogin(const DictionaryValue& args) {
// Whenever you start a wizard, you pass in an arg so it starts on the right
@@ -258,6 +299,17 @@
ExecuteJavascriptInIFrame(kPassphraseIFrameXPath, script);
}
+void FlowHandler::ShowFirstPassphrase(const DictionaryValue& args) {
+ if (dom_ui_)
+ dom_ui_->CallJavascriptFunction(L"showFirstPassphrase");
+
+ std::string json;
+ base::JSONWriter::Write(&args, false, &json);
+ std::wstring script = std::wstring(L"setupDialog") +
+ L"(" + UTF8ToWide(json) + L");";
+ ExecuteJavascriptInIFrame(kPassphraseIFrameXPath, script);
+}
+
void FlowHandler::ShowSettingUp() {
if (dom_ui_)
dom_ui_->CallJavascriptFunction(L"showSettingUp");
@@ -306,7 +358,6 @@
login_start_time_(base::TimeTicks::Now()),
flow_handler_(new FlowHandler()),
owns_flow_handler_(true),
- configuration_pending_(false),
service_(service),
html_dialog_window_(NULL) {
flow_handler_->set_flow(this);
@@ -390,7 +441,8 @@
}
std::wstring SyncSetupFlow::GetDialogTitle() const {
- return l10n_util::GetString(IDS_SYNC_MY_BOOKMARKS_LABEL);
+ return UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_SYNC_MY_BOOKMARKS_LABEL));
}
bool SyncSetupFlow::IsDialogModal() const {
@@ -502,8 +554,6 @@
return current_state_ == SyncSetupWizard::GAIA_LOGIN;
case SyncSetupWizard::CONFIGURE:
return current_state_ == SyncSetupWizard::GAIA_SUCCESS;
- case SyncSetupWizard::CREATE_PASSPHRASE:
- return current_state_ == SyncSetupWizard::CONFIGURE;
case SyncSetupWizard::ENTER_PASSPHRASE:
return current_state_ == SyncSetupWizard::CONFIGURE ||
current_state_ == SyncSetupWizard::SETTING_UP;
@@ -511,8 +561,8 @@
return current_state_ == SyncSetupWizard::CONFIGURE;
case SyncSetupWizard::SETTING_UP:
return current_state_ == SyncSetupWizard::CONFIGURE ||
- current_state_ == SyncSetupWizard::CREATE_PASSPHRASE ||
- current_state_ == SyncSetupWizard::ENTER_PASSPHRASE;
+ current_state_ == SyncSetupWizard::ENTER_PASSPHRASE ||
+ current_state_ == SyncSetupWizard::PASSPHRASE_MIGRATION;
case SyncSetupWizard::FATAL_ERROR:
return true; // You can always hit the panic button.
case SyncSetupWizard::DONE_FIRST_TIME:
@@ -553,18 +603,18 @@
flow_handler_->ShowConfigure(args);
break;
}
- case SyncSetupWizard::CREATE_PASSPHRASE: {
- DictionaryValue args;
- args.SetString("mode", "new");
- flow_handler_->ShowPassphraseEntry(args);
- break;
- }
case SyncSetupWizard::ENTER_PASSPHRASE: {
DictionaryValue args;
SyncSetupFlow::GetArgsForEnterPassphrase(service_, &args);
flow_handler_->ShowPassphraseEntry(args);
break;
}
+ case SyncSetupWizard::PASSPHRASE_MIGRATION: {
+ DictionaryValue args;
+ args.SetString("iframeToShow", "firstpassphrase");
+ flow_handler_->ShowFirstPassphrase(args);
+ break;
+ }
case SyncSetupWizard::SETUP_ABORTED_BY_PENDING_CLEAR: {
DictionaryValue args;
SyncSetupFlow::GetArgsForConfigure(service_, &args);
@@ -629,6 +679,9 @@
SyncSetupFlow::GetArgsForConfigure(service, &args);
else if (start == SyncSetupWizard::ENTER_PASSPHRASE)
SyncSetupFlow::GetArgsForEnterPassphrase(service, &args);
+ else if (start == SyncSetupWizard::PASSPHRASE_MIGRATION)
+ args.SetString("iframeToShow", "firstpassphrase");
+
std::string json_args;
base::JSONWriter::Write(&args, false, &json_args);
@@ -663,56 +716,47 @@
}
void SyncSetupFlow::OnUserConfigured(const SyncConfiguration& configuration) {
- // Store the configuration in case we need more information.
- configuration_ = configuration;
- configuration_pending_ = true;
-
- // If the user is activating secondary passphrase for the first time,
- // we need to prompt them to enter one.
- if (configuration.use_secondary_passphrase &&
- !service_->IsUsingSecondaryPassphrase()) {
- // TODO(tim): If we could download the Nigori node first before any other
- // types, we could do that prior to showing the configure page so that we
- // could pre-populate the 'Use an encryption passphrase' checkbox.
- // http://crbug.com/60182
- Advance(SyncSetupWizard::CREATE_PASSPHRASE);
- return;
- }
-
- OnConfigurationComplete();
-}
-
-void SyncSetupFlow::OnConfigurationComplete() {
- if (!configuration_pending_)
- return;
-
// Go to the "loading..." screen."
Advance(SyncSetupWizard::SETTING_UP);
// If we are activating the passphrase, we need to have one supplied.
DCHECK(service_->IsUsingSecondaryPassphrase() ||
- !configuration_.use_secondary_passphrase ||
- configuration_.secondary_passphrase.length() > 0);
+ !configuration.use_secondary_passphrase ||
+ configuration.secondary_passphrase.length() > 0);
- if (configuration_.use_secondary_passphrase &&
+ if (configuration.use_secondary_passphrase &&
!service_->IsUsingSecondaryPassphrase()) {
- service_->SetPassphrase(configuration_.secondary_passphrase, true);
+ service_->SetPassphrase(configuration.secondary_passphrase, true);
}
- service_->OnUserChoseDatatypes(configuration_.sync_everything,
- configuration_.data_types);
-
- configuration_pending_ = false;
+ service_->OnUserChoseDatatypes(configuration.sync_everything,
+ configuration.data_types);
}
void SyncSetupFlow::OnPassphraseEntry(const std::string& passphrase,
const std::string& mode) {
- if (current_state_ == SyncSetupWizard::ENTER_PASSPHRASE) {
- service_->SetPassphrase(passphrase, mode == std::string("enter"));
- Advance(SyncSetupWizard::SETTING_UP);
- } else if (configuration_pending_) {
- DCHECK_EQ(SyncSetupWizard::CREATE_PASSPHRASE, current_state_);
- configuration_.secondary_passphrase = passphrase;
- OnConfigurationComplete();
+ Advance(SyncSetupWizard::SETTING_UP);
+ service_->SetPassphrase(passphrase, true);
+}
+
+void SyncSetupFlow::OnFirstPassphraseEntry(const std::string& option,
+ const std::string& passphrase) {
+ Advance(SyncSetupWizard::SETTING_UP);
+ if (option == "explicit") {
+ service_->SetPassphrase(passphrase, true);
+ } else if (option == "nothanks") {
+ // User opted out of encrypted sync, need to turn off encrypted
+ // data types.
+ syncable::ModelTypeSet registered_types;
+ service_->GetRegisteredDataTypes(®istered_types);
+ registered_types.erase(syncable::PASSWORDS);
+ service_->OnUserChoseDatatypes(false, registered_types);
+ } else if (option == "google") {
+ // Implicit passphrase already set up.
+ Advance(SyncSetupWizard::DONE);
}
}
+
+void SyncSetupFlow::OnGoToDashboard() {
+ BrowserList::GetLastActive()->OpenPrivacyDashboardTabAndActivate();
+}
diff --git a/chrome/browser/sync/sync_setup_flow.h b/chrome/browser/sync/sync_setup_flow.h
index 8bfc443..f6c0233 100644
--- a/chrome/browser/sync/sync_setup_flow.h
+++ b/chrome/browser/sync/sync_setup_flow.h
@@ -110,7 +110,10 @@
void OnPassphraseEntry(const std::string& passphrase,
const std::string& mode);
- void OnConfigurationComplete();
+ void OnFirstPassphraseEntry(const std::string& option,
+ const std::string& passphrase);
+
+ void OnGoToDashboard();
private:
FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, InitialStepLogin);
@@ -124,6 +127,7 @@
FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest,
DiscreteRunChooseDataTypesAbortedByPendingClear);
FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, EnterPassphraseRequired);
+ FRIEND_TEST_ALL_PREFIXES(SyncSetupWizardTest, PassphraseMigration);
// Use static Run method to get an instance.
SyncSetupFlow(SyncSetupWizard::State start_state,
@@ -149,11 +153,6 @@
FlowHandler* flow_handler_;
mutable bool owns_flow_handler_;
- // The current configuration, held pending until all the information has
- // been populated (possibly using multiple dialog states).
- SyncConfiguration configuration_;
- bool configuration_pending_;
-
// We need this to write the sentinel "setup completed" pref.
ProfileSyncService* service_;
@@ -198,6 +197,8 @@
void HandleSubmitAuth(const ListValue* args);
void HandleConfigure(const ListValue* args);
void HandlePassphraseEntry(const ListValue* args);
+ void HandleFirstPassphrase(const ListValue* args);
+ void HandleGoToDashboard(const ListValue* args);
// These functions control which part of the HTML is visible.
void ShowGaiaLogin(const DictionaryValue& args);
@@ -205,6 +206,7 @@
void ShowGaiaSuccessAndSettingUp();
void ShowConfigure(const DictionaryValue& args);
void ShowPassphraseEntry(const DictionaryValue& args);
+ void ShowFirstPassphrase(const DictionaryValue& args);
void ShowSettingUp();
void ShowSetupDone(const std::wstring& user);
void ShowFirstTimeDone(const std::wstring& user);
diff --git a/chrome/browser/sync/sync_setup_wizard.cc b/chrome/browser/sync/sync_setup_wizard.cc
index e80afe0..6e9d254 100644
--- a/chrome/browser/sync/sync_setup_wizard.cc
+++ b/chrome/browser/sync/sync_setup_wizard.cc
@@ -79,6 +79,7 @@
const char kSyncGaiaLoginPath[] = "gaialogin";
const char kSyncConfigurePath[] = "configure";
const char kSyncPassphrasePath[] = "passphrase";
+ const char kSyncFirstPassphrasePath[] = "firstpassphrase";
const char kSyncSettingUpPath[] = "settingup";
const char kSyncSetupDonePath[] = "setupdone";
@@ -149,23 +150,48 @@
GetStringFUTF16(IDS_SYNC_ENCRYPTION_INSTRUCTIONS,
GetStringUTF16(IDS_PRODUCT_NAME)));
AddString(dict, "encryptAllLabel", IDS_SYNC_ENCRYPT_ALL_LABEL);
- AddString(dict, "usePassphraseLabel", IDS_SYNC_PASSPHRASE_CHECKBOX_LABEL);
+
+ AddString(dict, "googleOption", IDS_SYNC_PASSPHRASE_OPT_GOOGLE);
+ AddString(dict, "explicitOption", IDS_SYNC_PASSPHRASE_OPT_EXPLICIT);
+ AddString(dict, "sectionGoogleMessage", IDS_SYNC_PASSPHRASE_MSG_GOOGLE);
+ AddString(dict, "sectionExplicitMessage", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT);
+ AddString(dict, "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL);
+ AddString(dict, "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL);
+ AddString(dict, "emptyErrorMessage", IDS_SYNC_EMPTY_PASSPHRASE_ERROR);
+ AddString(dict, "mismatchErrorMessage", IDS_SYNC_PASSPHRASE_MISMATCH_ERROR);
+
AddString(dict, "passphraseWarning", IDS_SYNC_PASSPHRASE_WARNING);
+ AddString(dict, "cleardata", IDS_SYNC_CLEAR_DATA_FOR_PASSPHRASE);
+ AddString(dict, "cleardatalink", IDS_SYNC_CLEAR_DATA_LINK);
// Stuff for the footer.
AddString(dict, "ok", IDS_OK);
AddString(dict, "cancel", IDS_CANCEL);
} else if (path_raw == kSyncPassphrasePath) {
html_resource_id = IDR_SYNC_PASSPHRASE_HTML;
- AddString(dict, "newPassphraseTitle", IDS_SYNC_NEW_PASSPHRASE_TITLE);
- AddString(dict, "newPassphraseBody", IDS_SYNC_NEW_PASSPHRASE_BODY);
AddString(dict, "enterPassphraseTitle", IDS_SYNC_ENTER_PASSPHRASE_TITLE);
AddString(dict, "enterPassphraseBody", IDS_SYNC_ENTER_PASSPHRASE_BODY);
- AddString(dict, "gaiaPassphraseTitle", IDS_SYNC_GAIA_PASSPHRASE_TITLE);
- AddString(dict, "gaiaPassphraseBody", IDS_SYNC_GAIA_PASSPHRASE_BODY);
AddString(dict, "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL);
AddString(dict, "ok", IDS_OK);
AddString(dict, "cancel", IDS_CANCEL);
+ } else if (path_raw == kSyncFirstPassphrasePath) {
+ html_resource_id = IDR_SYNC_FIRST_PASSPHRASE_HTML;
+ AddString(dict, "title", IDS_SYNC_FIRST_PASSPHRASE_TITLE);
+ dict->SetString("instructions",
+ GetStringFUTF16(IDS_SYNC_FIRST_PASSPHRASE_MESSAGE,
+ GetStringUTF16(IDS_PRODUCT_NAME)));
+ AddString(dict, "googleOption", IDS_SYNC_PASSPHRASE_OPT_GOOGLE);
+ AddString(dict, "explicitOption", IDS_SYNC_PASSPHRASE_OPT_EXPLICIT);
+ AddString(dict, "nothanksOption", IDS_SYNC_PASSPHRASE_OPT_CANCEL);
+ AddString(dict, "sectionGoogleMessage", IDS_SYNC_PASSPHRASE_MSG_GOOGLE);
+ AddString(dict, "sectionExplicitMessage", IDS_SYNC_PASSPHRASE_MSG_EXPLICIT);
+ AddString(dict, "sectionNothanksMessage", IDS_SYNC_PASSPHRASE_MSG_CANCEL);
+ AddString(dict, "passphraseLabel", IDS_SYNC_PASSPHRASE_LABEL);
+ AddString(dict, "confirmLabel", IDS_SYNC_CONFIRM_PASSPHRASE_LABEL);
+ AddString(dict, "emptyErrorMessage", IDS_SYNC_EMPTY_PASSPHRASE_ERROR);
+ AddString(dict, "mismatchErrorMessage", IDS_SYNC_PASSPHRASE_MISMATCH_ERROR);
+ AddString(dict, "ok", IDS_OK);
+ AddString(dict, "cancel", IDS_CANCEL);
} else if (path_raw == kSyncSettingUpPath) {
html_resource_id = IDR_SYNC_SETTING_UP_HTML;
@@ -279,9 +305,9 @@
State result = FATAL_ERROR;
if (start_state == GAIA_LOGIN) {
result = GAIA_SUCCESS;
- } else if (start_state == ENTER_PASSPHRASE) {
- result = DONE;
- } else if (start_state == CONFIGURE) {
+ } else if (start_state == ENTER_PASSPHRASE ||
+ start_state == CONFIGURE ||
+ start_state == PASSPHRASE_MIGRATION) {
result = DONE;
}
DCHECK_NE(FATAL_ERROR, result) <<
diff --git a/chrome/browser/sync/sync_setup_wizard.h b/chrome/browser/sync/sync_setup_wizard.h
index dad3fa9..76b6fae 100644
--- a/chrome/browser/sync/sync_setup_wizard.h
+++ b/chrome/browser/sync/sync_setup_wizard.h
@@ -29,10 +29,11 @@
// Encryption --
// Choose what to encrypt and whether to use a passphrase.
CONFIGURE,
- // Show the screen that lets you enter a new passphrase
- CREATE_PASSPHRASE,
// Show the screen that prompts for your passphrase
ENTER_PASSPHRASE,
+ // Show the passphrase "first time" screen for migrating users, where all
+ // is explained and they choose between google password/custom passphrase.
+ PASSPHRASE_MIGRATION,
// The panic switch. Something went terribly wrong during setup and we
// can't recover.
FATAL_ERROR,
diff --git a/chrome/browser/sync/sync_setup_wizard_unittest.cc b/chrome/browser/sync/sync_setup_wizard_unittest.cc
index 46a0d69..b0da0d7 100644
--- a/chrome/browser/sync/sync_setup_wizard_unittest.cc
+++ b/chrome/browser/sync/sync_setup_wizard_unittest.cc
@@ -312,6 +312,7 @@
TEST_F(SyncSetupWizardTest, ChooseDataTypesSetsPrefs) {
SKIP_TEST_ON_MACOSX();
wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
+ wizard_->Step(SyncSetupWizard::GAIA_SUCCESS);
wizard_->Step(SyncSetupWizard::CONFIGURE);
ListValue data_type_choices_value;
@@ -359,6 +360,22 @@
EXPECT_EQ("myPassphrase", service_->passphrase_);
}
+TEST_F(SyncSetupWizardTest, PassphraseMigration) {
+ SKIP_TEST_ON_MACOSX();
+ wizard_->Step(SyncSetupWizard::PASSPHRASE_MIGRATION);
+ ListValue value;
+ value.Append(new StringValue("{\"option\":\"explicit\","
+ "\"passphrase\":\"myPassphrase\"}"));
+ test_window_->flow()->flow_handler_->HandleFirstPassphrase(&value);
+ EXPECT_EQ("myPassphrase", service_->passphrase_);
+
+ ListValue value2;
+ value2.Append(new StringValue("{\"option\":\"nothanks\","
+ "\"passphrase\":\"myPassphrase\"}"));
+ test_window_->flow()->flow_handler_->HandleFirstPassphrase(&value2);
+ EXPECT_EQ(service_->chosen_data_types_.count(syncable::PASSWORDS), 0U);
+}
+
TEST_F(SyncSetupWizardTest, DialogCancelled) {
SKIP_TEST_ON_MACOSX();
wizard_->Step(SyncSetupWizard::GAIA_LOGIN);
diff --git a/chrome/browser/sync/sync_ui_util.cc b/chrome/browser/sync/sync_ui_util.cc
index 27fdb9a..d49ada1 100644
--- a/chrome/browser/sync/sync_ui_util.cc
+++ b/chrome/browser/sync/sync_ui_util.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/sync/sync_ui_util.h"
#include "app/l10n_util.h"
+#include "app/resource_bundle.h"
#include "base/i18n/number_formatting.h"
#include "base/i18n/time_formatting.h"
#include "base/string_util.h"
@@ -13,6 +14,7 @@
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/ui/options/options_window.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
+#include "grit/browser_resources.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -102,8 +104,28 @@
l10n_util::GetStringUTF16(IDS_SYNC_AUTHENTICATING_LABEL));
}
result_type = PRE_SYNCED;
- } else if (auth_error.state() != AuthError::NONE ||
- service->observed_passphrase_required()) {
+ } else if (service->observed_passphrase_required()) {
+ if (service->passphrase_required_for_decryption()) {
+ // NOT first machine.
+ // Show a link and present as an error ("needs attention").
+ if (status_label && link_label) {
+ status_label->assign(string16());
+ link_label->assign(
+ l10n_util::GetStringUTF16(IDS_SYNC_CONFIGURE_ENCRYPTION));
+ }
+ result_type = SYNC_ERROR;
+ } else {
+ // First machine. Show as a promotion.
+ if (status_label && link_label) {
+ status_label->assign(
+ l10n_util::GetStringFUTF16(IDS_SYNC_NTP_PASSWORD_PROMO,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+ link_label->assign(
+ l10n_util::GetStringUTF16(IDS_SYNC_NTP_PASSWORD_ENABLE));
+ }
+ result_type = SYNC_PROMO;
+ }
+ } else if (auth_error.state() != AuthError::NONE) {
if (status_label && link_label) {
GetStatusLabelsForAuthError(auth_error, service,
status_label, link_label);
@@ -156,6 +178,20 @@
} // namespace
+// Returns an HTML chunk for a login prompt related to encryption.
+string16 GetLoginMessageForEncryption() {
+ std::vector<std::string> subst;
+ const base::StringPiece html(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(
+ IDR_SYNC_ENCRYPTION_LOGIN_HTML));
+ subst.push_back(l10n_util::GetStringUTF8(IDS_SYNC_PLEASE_SIGN_IN));
+ subst.push_back(
+ l10n_util::GetStringFUTF8(IDS_SYNC_LOGIN_FOR_ENCRYPTION,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
+
+ return UTF8ToUTF16(ReplaceStringPlaceholders(html, subst, NULL));
+}
+
MessageType GetStatusLabels(ProfileSyncService* service,
string16* status_label,
string16* link_label) {
@@ -322,6 +358,12 @@
std::string location_str;
loc.Write(true, true, &location_str);
strings->SetString("unrecoverable_error_location", location_str);
+ } else if (!service->sync_initialized()) {
+ strings->SetString("summary", "Sync not yet initialized");
+ } else if (service->backend() == NULL) {
+ strings->SetString("summary",
+ "Unrecoverable error detected. Backend is null when it shouldnt be");
+ NOTREACHED();
} else {
browser_sync::ModelSafeRoutingInfo routes;
service->backend()->GetModelSafeRoutingInfo(&routes);
diff --git a/chrome/browser/sync/sync_ui_util.h b/chrome/browser/sync/sync_ui_util.h
index 8bcd85a..5a168c4 100644
--- a/chrome/browser/sync/sync_ui_util.h
+++ b/chrome/browser/sync/sync_ui_util.h
@@ -24,11 +24,15 @@
PRE_SYNCED, // User has not set up sync.
SYNCED, // We are synced and authenticated to a gmail account.
SYNC_ERROR, // A sync error (such as invalid credentials) has occurred.
+ SYNC_PROMO, // A situation has occurred which should be brought to the user's
+ // attention, but not as an error.
};
// TODO(akalin): audit the use of ProfileSyncService* service below,
// and use const ProfileSyncService& service where possible.
+string16 GetLoginMessageForEncryption();
+
// Create status and link labels for the current status labels and link text
// by querying |service|.
MessageType GetStatusLabels(ProfileSyncService* service,
@@ -60,4 +64,3 @@
int64 stat_value);
} // namespace sync_ui_util
#endif // CHROME_BROWSER_SYNC_SYNC_UI_UTIL_H_
-
diff --git a/chrome/browser/sync/syncable/syncable_unittest.cc b/chrome/browser/sync/syncable/syncable_unittest.cc
index 32a4cc3..6c887b2 100644
--- a/chrome/browser/sync/syncable/syncable_unittest.cc
+++ b/chrome/browser/sync/syncable/syncable_unittest.cc
@@ -23,10 +23,10 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
#include "base/scoped_ptr.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "chrome/browser/sync/engine/syncproto.h"
#include "chrome/browser/sync/protocol/bookmark_specifics.pb.h"
#include "chrome/browser/sync/syncable/directory_backing_store.h"
@@ -386,7 +386,7 @@
dir_->PurgeEntriesWithTypeIn(to_purge);
Directory::SaveChangesSnapshot snapshot1;
- AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
+ base::AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
dir_->TakeSnapshotForSaveChanges(&snapshot1);
EXPECT_TRUE(expected_purges == snapshot1.metahandles_to_purge);
@@ -415,7 +415,7 @@
// Fake SaveChanges() and make sure we got what we expected.
{
Directory::SaveChangesSnapshot snapshot;
- AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
+ base::AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
dir_->TakeSnapshotForSaveChanges(&snapshot);
// Make sure there's an entry for each new metahandle. Make sure all
// entries are marked dirty.
@@ -448,7 +448,7 @@
// Fake SaveChanges() and make sure we got what we expected.
{
Directory::SaveChangesSnapshot snapshot;
- AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
+ base::AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
dir_->TakeSnapshotForSaveChanges(&snapshot);
// Make sure there's an entry for each new metahandle. Make sure all
// entries are marked dirty.
@@ -588,7 +588,7 @@
// Fake SaveChanges() and make sure we got what we expected.
{
Directory::SaveChangesSnapshot snapshot;
- AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
+ base::AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
dir_->TakeSnapshotForSaveChanges(&snapshot);
// Make sure there are no dirty_metahandles.
EXPECT_EQ(0u, snapshot.dirty_metas.size());
@@ -614,7 +614,7 @@
// Fake SaveChanges() and make sure we got what we expected.
{
Directory::SaveChangesSnapshot snapshot;
- AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
+ base::AutoLock scoped_lock(dir_->kernel_->save_changes_mutex);
dir_->TakeSnapshotForSaveChanges(&snapshot);
// Make sure there's an entry for each changed metahandle. Make sure all
// entries are marked dirty.
@@ -1356,7 +1356,7 @@
ASSERT_TRUE(file_util::Delete(dm.GetSyncDataDatabasePath(), true));
}
-class ThreadOpenTestDelegate : public PlatformThread::Delegate {
+class ThreadOpenTestDelegate : public base::PlatformThread::Delegate {
public:
explicit ThreadOpenTestDelegate(DirectoryManager* dm)
: directory_manager_(dm) {}
@@ -1373,10 +1373,10 @@
TEST(SyncableDirectoryManager, ThreadOpenTest) {
DirectoryManager dm(FilePath(FILE_PATH_LITERAL(".")));
- PlatformThreadHandle thread_handle;
+ base::PlatformThreadHandle thread_handle;
ThreadOpenTestDelegate test_delegate(&dm);
- ASSERT_TRUE(PlatformThread::Create(0, &test_delegate, &thread_handle));
- PlatformThread::Join(thread_handle);
+ ASSERT_TRUE(base::PlatformThread::Create(0, &test_delegate, &thread_handle));
+ base::PlatformThread::Join(thread_handle);
{
ScopedDirLookup dir(&dm, "Open");
ASSERT_TRUE(dir.good());
@@ -1389,13 +1389,13 @@
struct Step {
Step() : condvar(&mutex), number(0) {}
- Lock mutex;
- ConditionVariable condvar;
+ base::Lock mutex;
+ base::ConditionVariable condvar;
int number;
int64 metahandle;
};
-class ThreadBugDelegate : public PlatformThread::Delegate {
+class ThreadBugDelegate : public base::PlatformThread::Delegate {
public:
// a role is 0 or 1, meaning this thread does the odd or event steps.
ThreadBugDelegate(int role, Step* step, DirectoryManager* dirman)
@@ -1409,7 +1409,7 @@
// PlatformThread::Delegate methods:
virtual void ThreadMain() {
const std::string dirname = "ThreadBug1";
- AutoLock scoped_lock(step_->mutex);
+ base::AutoLock scoped_lock(step_->mutex);
while (step_->number < 3) {
while (step_->number % 2 != role_) {
@@ -1457,14 +1457,16 @@
ThreadBugDelegate thread_delegate_1(0, &step, &dirman);
ThreadBugDelegate thread_delegate_2(1, &step, &dirman);
- PlatformThreadHandle thread_handle_1;
- PlatformThreadHandle thread_handle_2;
+ base::PlatformThreadHandle thread_handle_1;
+ base::PlatformThreadHandle thread_handle_2;
- ASSERT_TRUE(PlatformThread::Create(0, &thread_delegate_1, &thread_handle_1));
- ASSERT_TRUE(PlatformThread::Create(0, &thread_delegate_2, &thread_handle_2));
+ ASSERT_TRUE(
+ base::PlatformThread::Create(0, &thread_delegate_1, &thread_handle_1));
+ ASSERT_TRUE(
+ base::PlatformThread::Create(0, &thread_delegate_2, &thread_handle_2));
- PlatformThread::Join(thread_handle_1);
- PlatformThread::Join(thread_handle_2);
+ base::PlatformThread::Join(thread_handle_1);
+ base::PlatformThread::Join(thread_handle_2);
}
@@ -1480,7 +1482,7 @@
virtual void ThreadMain() {
const char test_bytes[] = "test data";
const std::string dirname = "DirectoryKernelStalenessBug";
- AutoLock scoped_lock(step_->mutex);
+ base::AutoLock scoped_lock(step_->mutex);
const Id jeff_id = TestIdFactory::FromNumber(100);
while (step_->number < 4) {
@@ -1552,17 +1554,19 @@
DirectoryKernelStalenessBugDelegate thread_delegate_1(0, &step, &dirman);
DirectoryKernelStalenessBugDelegate thread_delegate_2(1, &step, &dirman);
- PlatformThreadHandle thread_handle_1;
- PlatformThreadHandle thread_handle_2;
+ base::PlatformThreadHandle thread_handle_1;
+ base::PlatformThreadHandle thread_handle_2;
- ASSERT_TRUE(PlatformThread::Create(0, &thread_delegate_1, &thread_handle_1));
- ASSERT_TRUE(PlatformThread::Create(0, &thread_delegate_2, &thread_handle_2));
+ ASSERT_TRUE(
+ base::PlatformThread::Create(0, &thread_delegate_1, &thread_handle_1));
+ ASSERT_TRUE(
+ base::PlatformThread::Create(0, &thread_delegate_2, &thread_handle_2));
- PlatformThread::Join(thread_handle_1);
- PlatformThread::Join(thread_handle_2);
+ base::PlatformThread::Join(thread_handle_1);
+ base::PlatformThread::Join(thread_handle_2);
}
-class StressTransactionsDelegate : public PlatformThread::Delegate {
+class StressTransactionsDelegate : public base::PlatformThread::Delegate {
public:
StressTransactionsDelegate(DirectoryManager* dm,
const std::string& dirname,
@@ -1588,7 +1592,7 @@
if (rand_action < 4 && !path_name.empty()) {
ReadTransaction trans(dir, __FILE__, __LINE__);
CHECK(1 == CountEntriesWithName(&trans, trans.root_id(), path_name));
- PlatformThread::Sleep(rand() % 10);
+ base::PlatformThread::Sleep(rand() % 10);
} else {
std::string unique_name = StringPrintf("%d.%d", thread_number_,
entry_count++);
@@ -1596,7 +1600,7 @@
WriteTransaction trans(dir, UNITTEST, __FILE__, __LINE__);
MutableEntry e(&trans, CREATE, trans.root_id(), path_name);
CHECK(e.good());
- PlatformThread::Sleep(rand() % 20);
+ base::PlatformThread::Sleep(rand() % 20);
e.Put(IS_UNSYNCED, true);
if (e.Put(ID, TestIdFactory::FromNumber(rand())) &&
e.Get(ID).ServerKnows() && !e.Get(ID).IsRoot()) {
@@ -1616,18 +1620,18 @@
dirman.Open(dirname);
const int kThreadCount = 7;
- PlatformThreadHandle threads[kThreadCount];
+ base::PlatformThreadHandle threads[kThreadCount];
scoped_ptr<StressTransactionsDelegate> thread_delegates[kThreadCount];
for (int i = 0; i < kThreadCount; ++i) {
thread_delegates[i].reset(
new StressTransactionsDelegate(&dirman, dirname, i));
- ASSERT_TRUE(
- PlatformThread::Create(0, thread_delegates[i].get(), &threads[i]));
+ ASSERT_TRUE(base::PlatformThread::Create(
+ 0, thread_delegates[i].get(), &threads[i]));
}
for (int i = 0; i < kThreadCount; ++i) {
- PlatformThread::Join(threads[i]);
+ base::PlatformThread::Join(threads[i]);
}
dirman.Close(dirname);
diff --git a/chrome/browser/sync/test_profile_sync_service.h b/chrome/browser/sync/test_profile_sync_service.h
index f5da3d6..2615b24 100644
--- a/chrome/browser/sync/test_profile_sync_service.h
+++ b/chrome/browser/sync/test_profile_sync_service.h
@@ -112,6 +112,12 @@
}
}
+ virtual void ConfigureDataTypes(const syncable::ModelTypeSet& types,
+ CancelableTask* ready_task) {
+ SetAutofillMigrationState(syncable::MIGRATED);
+ SyncBackendHost::ConfigureDataTypes(types, ready_task);
+ }
+
virtual void HandleInitializationCompletedOnFrontendLoop() {
set_syncapi_initialized(); // Need to do this asap so task below works.
diff --git a/chrome/browser/sync/tools/sync_listen_notifications.cc b/chrome/browser/sync/tools/sync_listen_notifications.cc
index d15ded3..0f66c27 100644
--- a/chrome/browser/sync/tools/sync_listen_notifications.cc
+++ b/chrome/browser/sync/tools/sync_listen_notifications.cc
@@ -299,7 +299,6 @@
xmpp_client_settings.set_server(addr);
net::CertVerifier cert_verifier;
-
MessageLoopForIO message_loop;
// Connect and listen.
diff --git a/chrome/browser/sync/util/channel.h b/chrome/browser/sync/util/channel.h
index a21f6ea..88ddfc4 100644
--- a/chrome/browser/sync/util/channel.h
+++ b/chrome/browser/sync/util/channel.h
@@ -52,7 +52,7 @@
#include "base/lock.h"
#include "base/observer_list.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
namespace browser_sync {
@@ -106,7 +106,7 @@
void RemoveObserver(ChannelEventHandler<EventType>* observer) {
// This can be called in response to a notification, so we may already have
// locked this channel on this thread.
- bool need_lock = (locking_thread_ != PlatformThread::CurrentId());
+ bool need_lock = (locking_thread_ != base::PlatformThread::CurrentId());
if (need_lock)
event_handlers_mutex_.Acquire();
@@ -121,7 +121,7 @@
// This may result in an observer trying to remove itself, so keep track
// of the thread we're locked on.
- locking_thread_ = PlatformThread::CurrentId();
+ locking_thread_ = base::PlatformThread::CurrentId();
ChannelObserverList::Iterator it(event_handlers_);
EventHandler* obs;
@@ -136,7 +136,7 @@
private:
Lock event_handlers_mutex_;
- PlatformThreadId locking_thread_;
+ base::PlatformThreadId locking_thread_;
ObserverList<EventHandler> event_handlers_;
};
diff --git a/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc b/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
index d5f88d4..b85256e 100644
--- a/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
+++ b/chrome/browser/sync/util/extensions_activity_monitor_unittest.cc
@@ -6,7 +6,7 @@
#include "base/file_path.h"
#include "base/string_util.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "base/values.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/extensions/extension_bookmarks_module.h"
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index 8548c8d..263b67c 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -9,7 +9,7 @@
#include "base/compiler_specific.h"
#include "base/message_loop.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/tab_contents/navigation_entry.cc b/chrome/browser/tab_contents/navigation_entry.cc
index a14fc08..d5504ba 100644
--- a/chrome/browser/tab_contents/navigation_entry.cc
+++ b/chrome/browser/tab_contents/navigation_entry.cc
@@ -13,7 +13,6 @@
#include "chrome/browser/renderer_host/site_instance.h"
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "grit/app_resources.h"
#include "net/base/net_util.h"
@@ -78,7 +77,7 @@
}
const string16& NavigationEntry::GetTitleForDisplay(
- const NavigationController* navigation_controller) {
+ const std::string& languages) {
// Most pages have real titles. Don't even bother caching anything if this is
// the case.
if (!title_.empty())
@@ -90,12 +89,6 @@
return cached_display_title_;
// Use the virtual URL first if any, and fall back on using the real URL.
- std::string languages;
- if (navigation_controller) {
- languages = navigation_controller->profile()->GetPrefs()->
- GetString(prefs::kAcceptLanguages);
- }
-
string16 title;
std::wstring elided_title;
if (!virtual_url_.is_empty()) {
diff --git a/chrome/browser/tab_contents/navigation_entry.h b/chrome/browser/tab_contents/navigation_entry.h
index ca97e02..57d93c4 100644
--- a/chrome/browser/tab_contents/navigation_entry.h
+++ b/chrome/browser/tab_contents/navigation_entry.h
@@ -16,7 +16,6 @@
#include "googleurl/src/gurl.h"
#include "third_party/skia/include/core/SkBitmap.h"
-class NavigationController;
class SiteInstance;
////////////////////////////////////////////////////////////////////////////////
@@ -322,12 +321,10 @@
// Page-related helpers ------------------------------------------------------
// Returns the title to be displayed on the tab. This could be the title of
- // the page if it is available or the URL.
- //
- // The NavigationController corresponding to this entry must be given so we
- // can get the preferences so we can optionally format a URL for display. It
- // may be NULL if you don't need proper URL formatting (e.g. unit tests).
- const string16& GetTitleForDisplay(const NavigationController* controller);
+ // the page if it is available or the URL. |languages| is the list of
+ // accpeted languages (e.g., prefs::kAcceptLanguages) or empty if proper
+ // URL formatting isn't needed (e.g., unit tests).
+ const string16& GetTitleForDisplay(const std::string& languages);
// Returns true if the current tab is in view source mode. This will be false
// if there is no navigation.
diff --git a/chrome/browser/tab_contents/navigation_entry_unittest.cc b/chrome/browser/tab_contents/navigation_entry_unittest.cc
index e28cf1c..014817c 100644
--- a/chrome/browser/tab_contents/navigation_entry_unittest.cc
+++ b/chrome/browser/tab_contents/navigation_entry_unittest.cc
@@ -53,18 +53,18 @@
EXPECT_EQ(GURL(), entry1_.get()->url());
EXPECT_EQ(GURL(), entry1_.get()->virtual_url());
- EXPECT_TRUE(entry1_.get()->GetTitleForDisplay(NULL).empty());
+ EXPECT_TRUE(entry1_.get()->GetTitleForDisplay("").empty());
// Setting URL affects virtual_url and GetTitleForDisplay
entry1_.get()->set_url(GURL("http://www.google.com"));
EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->url());
EXPECT_EQ(GURL("http://www.google.com"), entry1_.get()->virtual_url());
EXPECT_EQ(ASCIIToUTF16("www.google.com"),
- entry1_.get()->GetTitleForDisplay(NULL));
+ entry1_.get()->GetTitleForDisplay(""));
// Title affects GetTitleForDisplay
entry1_.get()->set_title(ASCIIToUTF16("Google"));
- EXPECT_EQ(ASCIIToUTF16("Google"), entry1_.get()->GetTitleForDisplay(NULL));
+ EXPECT_EQ(ASCIIToUTF16("Google"), entry1_.get()->GetTitleForDisplay(""));
// Setting virtual_url doesn't affect URL
entry2_.get()->set_virtual_url(GURL("display:url"));
@@ -73,7 +73,7 @@
EXPECT_EQ(GURL("display:url"), entry2_.get()->virtual_url());
// Having a title set in constructor overrides virtual URL
- EXPECT_EQ(ASCIIToUTF16("title"), entry2_.get()->GetTitleForDisplay(NULL));
+ EXPECT_EQ(ASCIIToUTF16("title"), entry2_.get()->GetTitleForDisplay(""));
// User typed URL is independent of the others
EXPECT_EQ(GURL(), entry1_.get()->user_typed_url());
diff --git a/chrome/browser/tab_contents/render_view_context_menu.cc b/chrome/browser/tab_contents/render_view_context_menu.cc
index 2ee6d08..f35c0e0 100644
--- a/chrome/browser/tab_contents/render_view_context_menu.cc
+++ b/chrome/browser/tab_contents/render_view_context_menu.cc
@@ -1394,16 +1394,6 @@
if (active_entry->url().SchemeIs(chrome::kGearsScheme))
return false;
-#if defined NDEBUG
- bool debug_mode = false;
-#else
- bool debug_mode = true;
-#endif
- // Don't inspect new tab UI, etc.
- if (active_entry->url().SchemeIs(chrome::kChromeUIScheme) && !debug_mode &&
- active_entry->url().host() != chrome::kChromeUIDevToolsHost)
- return false;
-
// Don't inspect about:network, about:memory, etc.
// However, we do want to inspect about:blank, which is often
// used by ordinary web pages.
diff --git a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
index 491e7f6..568ae4c 100644
--- a/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
+++ b/chrome/browser/tab_contents/render_view_host_delegate_helper.cc
@@ -291,6 +291,8 @@
command_line.HasSwitch(switches::kEnableAccelerated2dCanvas);
web_prefs.accelerated_layers_enabled =
command_line.HasSwitch(switches::kEnableAcceleratedLayers);
+ web_prefs.accelerated_video_enabled =
+ !command_line.HasSwitch(switches::kDisableAcceleratedVideo);
web_prefs.memory_info_enabled =
command_line.HasSwitch(switches::kEnableMemoryInfo);
web_prefs.hyperlink_auditing_enabled =
diff --git a/chrome/browser/tab_contents/render_view_host_manager.cc b/chrome/browser/tab_contents/render_view_host_manager.cc
index bcc9a78..ed5628e 100644
--- a/chrome/browser/tab_contents/render_view_host_manager.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager.cc
@@ -298,6 +298,12 @@
// into the same process.
if (new_entry->url().SchemeIs(chrome::kExtensionScheme))
return true;
+ // When a tab is created, it starts as TYPE_NORMAL. If the new entry is a
+ // DOM UI page, it needs to be grouped with other DOM UI pages. This matches
+ // the logic when transitioning between DOM UI and normal pages.
+ Profile* profile = delegate_->GetControllerForRenderManager().profile();
+ if (DOMUIFactory::UseDOMUIForURL(profile, new_entry->url()))
+ return true;
return false;
}
diff --git a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
index d6a58a1..5325abe 100644
--- a/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
+++ b/chrome/browser/tab_contents/render_view_host_manager_unittest.cc
@@ -253,8 +253,6 @@
EXPECT_TRUE(host);
EXPECT_TRUE(host == manager.current_host());
EXPECT_FALSE(manager.pending_render_view_host());
- EXPECT_TRUE(manager.pending_dom_ui());
- EXPECT_FALSE(manager.dom_ui());
// It's important that the site instance get set on the DOM UI page as soon
// as the navigation starts, rather than lazily after it commits, so we don't
@@ -263,11 +261,13 @@
EXPECT_TRUE(host->site_instance()->has_site());
EXPECT_EQ(url, host->site_instance()->site());
- // Commit.
- manager.DidNavigateMainFrame(host);
-
+ // The DOM UI is committed immediately because the RenderViewHost has not been
+ // used yet. UpdateRendererStateForNavigate() took the short cut path.
EXPECT_FALSE(manager.pending_dom_ui());
EXPECT_TRUE(manager.dom_ui());
+
+ // Commit.
+ manager.DidNavigateMainFrame(host);
}
// Tests that chrome: URLs that are not DOM UI pages do not get grouped into
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 3dba1a8..698d691 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -10,6 +10,7 @@
#include "app/resource_bundle.h"
#include "base/auto_reset.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/stats_counters.h"
#include "base/string16.h"
#include "base/string_util.h"
#include "base/time.h"
@@ -21,6 +22,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
#include "chrome/browser/character_encoding.h"
+#include "chrome/browser/child_process_security_policy.h"
#include "chrome/browser/content_settings/content_settings_details.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/debugger/devtools_manager.h"
@@ -44,6 +46,7 @@
#include "chrome/browser/load_from_memory_cache_details.h"
#include "chrome/browser/load_notification_details.h"
#include "chrome/browser/metrics/metric_event_duration_details.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/modal_html_dialog_delegate.h"
#include "chrome/browser/omnibox_search_hint.h"
#include "chrome/browser/platform_util.h"
@@ -548,6 +551,36 @@
IDS_STATIC_ENCODING_LIST);
}
+bool TabContents::OnMessageReceived(const IPC::Message& message) {
+ bool handled = true;
+ bool message_is_ok = true;
+ IPC_BEGIN_MESSAGE_MAP_EX(TabContents, message, message_is_ok)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidStartProvisionalLoadForFrame,
+ OnDidStartProvisionalLoadForFrame)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidRedirectProvisionalLoad,
+ OnDidRedirectProvisionalLoad)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidFailProvisionalLoadWithError,
+ OnDidFailProvisionalLoadWithError)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidLoadResourceFromMemoryCache,
+ OnDidLoadResourceFromMemoryCache)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidDisplayInsecureContent,
+ OnDidDisplayInsecureContent)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidRunInsecureContent,
+ OnDidRunInsecureContent)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DocumentLoadedInFrame,
+ OnDocumentLoadedInFrame)
+ IPC_MESSAGE_HANDLER(ViewHostMsg_DidFinishLoad, OnDidFinishLoad)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP_EX()
+
+ if (!message_is_ok) {
+ UserMetrics::RecordAction(UserMetricsAction("BadMessageTerminate_RVD"));
+ GetRenderProcessHost()->ReceivedBadMessage();
+ }
+
+ return handled;
+}
+
// Returns true if contains content rendered by an extension.
bool TabContents::HostsExtension() const {
return GetURL().SchemeIs(chrome::kExtensionScheme);
@@ -618,9 +651,10 @@
// Transient entries take precedence. They are used for interstitial pages
// that are shown on top of existing pages.
NavigationEntry* entry = controller_.GetTransientEntry();
- if (entry)
- return entry->GetTitleForDisplay(&controller_);
-
+ if (entry) {
+ return entry->GetTitleForDisplay(profile()->GetPrefs()->
+ GetString(prefs::kAcceptLanguages));
+ }
DOMUI* our_dom_ui = render_manager_.pending_dom_ui() ?
render_manager_.pending_dom_ui() : render_manager_.dom_ui();
if (our_dom_ui) {
@@ -639,8 +673,10 @@
// keep the old page's title until the new load has committed and we get a new
// title.
entry = controller_.GetLastCommittedEntry();
- if (entry)
- return entry->GetTitleForDisplay(&controller_);
+ if (entry) {
+ return entry->GetTitleForDisplay(profile()->GetPrefs()->
+ GetString(prefs::kAcceptLanguages));
+ }
return EmptyString16();
}
@@ -719,40 +755,41 @@
return true;
}
-std::wstring TabContents::GetStatusText() const {
+string16 TabContents::GetStatusText() const {
if (!is_loading() || load_state_ == net::LOAD_STATE_IDLE)
- return std::wstring();
+ return string16();
switch (load_state_) {
case net::LOAD_STATE_WAITING_FOR_CACHE:
- return l10n_util::GetString(IDS_LOAD_STATE_WAITING_FOR_CACHE);
+ return l10n_util::GetStringUTF16(IDS_LOAD_STATE_WAITING_FOR_CACHE);
case net::LOAD_STATE_ESTABLISHING_PROXY_TUNNEL:
- return l10n_util::GetString(IDS_LOAD_STATE_ESTABLISHING_PROXY_TUNNEL);
+ return
+ l10n_util::GetStringUTF16(IDS_LOAD_STATE_ESTABLISHING_PROXY_TUNNEL);
case net::LOAD_STATE_RESOLVING_PROXY_FOR_URL:
- return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL);
+ return l10n_util::GetStringUTF16(IDS_LOAD_STATE_RESOLVING_PROXY_FOR_URL);
case net::LOAD_STATE_RESOLVING_HOST:
- return l10n_util::GetString(IDS_LOAD_STATE_RESOLVING_HOST);
+ return l10n_util::GetStringUTF16(IDS_LOAD_STATE_RESOLVING_HOST);
case net::LOAD_STATE_CONNECTING:
- return l10n_util::GetString(IDS_LOAD_STATE_CONNECTING);
+ return l10n_util::GetStringUTF16(IDS_LOAD_STATE_CONNECTING);
case net::LOAD_STATE_SSL_HANDSHAKE:
- return l10n_util::GetString(IDS_LOAD_STATE_SSL_HANDSHAKE);
+ return l10n_util::GetStringUTF16(IDS_LOAD_STATE_SSL_HANDSHAKE);
case net::LOAD_STATE_SENDING_REQUEST:
if (upload_size_)
- return l10n_util::GetStringF(
+ return l10n_util::GetStringFUTF16Int(
IDS_LOAD_STATE_SENDING_REQUEST_WITH_PROGRESS,
static_cast<int>((100 * upload_position_) / upload_size_));
else
- return l10n_util::GetString(IDS_LOAD_STATE_SENDING_REQUEST);
+ return l10n_util::GetStringUTF16(IDS_LOAD_STATE_SENDING_REQUEST);
case net::LOAD_STATE_WAITING_FOR_RESPONSE:
- return l10n_util::GetStringF(IDS_LOAD_STATE_WAITING_FOR_RESPONSE,
- load_state_host_);
+ return l10n_util::GetStringFUTF16(IDS_LOAD_STATE_WAITING_FOR_RESPONSE,
+ load_state_host_);
// Ignore net::LOAD_STATE_READING_RESPONSE and net::LOAD_STATE_IDLE
case net::LOAD_STATE_IDLE:
case net::LOAD_STATE_READING_RESPONSE:
break;
}
- return std::wstring();
+ return string16();
}
void TabContents::AddNavigationObserver(WebNavigationObserver* observer) {
@@ -1555,6 +1592,159 @@
delegate_->ViewSourceForTab(this, active_entry->url());
}
+void TabContents::OnDidStartProvisionalLoadForFrame(int64 frame_id,
+ bool is_main_frame,
+ const GURL& url) {
+ bool is_error_page = (url.spec() == chrome::kUnreachableWebDataURL);
+ GURL validated_url(url);
+ render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(),
+ GetRenderProcessHost()->id(), &validated_url);
+
+ ProvisionalLoadDetails details(
+ is_main_frame,
+ controller_.IsURLInPageNavigation(validated_url),
+ validated_url, std::string(), false, is_error_page, frame_id);
+ NotificationService::current()->Notify(
+ NotificationType::FRAME_PROVISIONAL_LOAD_START,
+ Source<NavigationController>(&controller_),
+ Details<ProvisionalLoadDetails>(&details));
+ if (is_main_frame) {
+ // If we're displaying a network error page do not reset the content
+ // settings delegate's cookies so the user has a chance to modify cookie
+ // settings.
+ if (!is_error_page)
+ content_settings_delegate_->ClearCookieSpecificContentSettings();
+ content_settings_delegate_->ClearGeolocationContentSettings();
+ }
+}
+
+void TabContents::OnDidRedirectProvisionalLoad(int32 page_id,
+ const GURL& source_url,
+ const GURL& target_url) {
+ NavigationEntry* entry;
+ if (page_id == -1)
+ entry = controller_.pending_entry();
+ else
+ entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id);
+ if (!entry || entry->url() != source_url)
+ return;
+ entry->set_url(target_url);
+}
+
+void TabContents::OnDidFailProvisionalLoadWithError(
+ int64 frame_id,
+ bool is_main_frame,
+ int error_code,
+ const GURL& url,
+ bool showing_repost_interstitial) {
+ VLOG(1) << "Failed Provisional Load: " << url.possibly_invalid_spec()
+ << ", error_code: " << error_code
+ << " is_main_frame: " << is_main_frame
+ << " showing_repost_interstitial: " << showing_repost_interstitial
+ << " frame_id: " << frame_id;
+ GURL validated_url(url);
+ render_view_host()->FilterURL(ChildProcessSecurityPolicy::GetInstance(),
+ GetRenderProcessHost()->id(), &validated_url);
+
+ if (net::ERR_ABORTED == error_code) {
+ // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials.
+ // This means that the interstitial won't be torn down properly, which is
+ // bad. But if we have an interstitial, go back to another tab type, and
+ // then load the same interstitial again, we could end up getting the first
+ // interstitial's "failed" message (as a result of the cancel) when we're on
+ // the second one.
+ //
+ // We can't tell this apart, so we think we're tearing down the current page
+ // which will cause a crash later one. There is also some code in
+ // RenderViewHostManager::RendererAbortedProvisionalLoad that is commented
+ // out because of this problem.
+ //
+ // http://code.google.com/p/chromium/issues/detail?id=2855
+ // Because this will not tear down the interstitial properly, if "back" is
+ // back to another tab type, the interstitial will still be somewhat alive
+ // in the previous tab type. If you navigate somewhere that activates the
+ // tab with the interstitial again, you'll see a flash before the new load
+ // commits of the interstitial page.
+ if (showing_interstitial_page()) {
+ LOG(WARNING) << "Discarding message during interstitial.";
+ return;
+ }
+
+ // This will discard our pending entry if we cancelled the load (e.g., if we
+ // decided to download the file instead of load it). Only discard the
+ // pending entry if the URLs match, otherwise the user initiated a navigate
+ // before the page loaded so that the discard would discard the wrong entry.
+ NavigationEntry* pending_entry = controller_.pending_entry();
+ if (pending_entry && pending_entry->url() == validated_url) {
+ controller_.DiscardNonCommittedEntries();
+ // Update the URL display.
+ NotifyNavigationStateChanged(TabContents::INVALIDATE_URL);
+ }
+
+ render_manager_.RendererAbortedProvisionalLoad(render_view_host());
+ }
+
+ // Send out a notification that we failed a provisional load with an error.
+ ProvisionalLoadDetails details(
+ is_main_frame, controller_.IsURLInPageNavigation(validated_url),
+ validated_url, std::string(), false, false, frame_id);
+ details.set_error_code(error_code);
+
+ NotificationService::current()->Notify(
+ NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR,
+ Source<NavigationController>(&controller_),
+ Details<ProvisionalLoadDetails>(&details));
+}
+
+void TabContents::OnDidLoadResourceFromMemoryCache(
+ const GURL& url,
+ const std::string& frame_origin,
+ const std::string& main_frame_origin,
+ const std::string& security_info) {
+ static base::StatsCounter cache("WebKit.CacheHit");
+ cache.Increment();
+
+ // Send out a notification that we loaded a resource from our memory cache.
+ int cert_id = 0, cert_status = 0, security_bits = -1, connection_status = 0;
+ SSLManager::DeserializeSecurityInfo(security_info,
+ &cert_id, &cert_status,
+ &security_bits,
+ &connection_status);
+ LoadFromMemoryCacheDetails details(url, frame_origin, main_frame_origin,
+ GetRenderProcessHost()->id(), cert_id,
+ cert_status);
+
+ NotificationService::current()->Notify(
+ NotificationType::LOAD_FROM_MEMORY_CACHE,
+ Source<NavigationController>(&controller_),
+ Details<LoadFromMemoryCacheDetails>(&details));
+}
+
+void TabContents::OnDidDisplayInsecureContent() {
+ displayed_insecure_content_ = true;
+ SSLManager::NotifySSLInternalStateChanged();
+}
+
+void TabContents::OnDidRunInsecureContent(
+ const std::string& security_origin) {
+ controller_.ssl_manager()->DidRunInsecureContent(security_origin);
+}
+
+void TabContents::OnDocumentLoadedInFrame(int64 frame_id) {
+ controller_.DocumentLoadedInFrame();
+ NotificationService::current()->Notify(
+ NotificationType::FRAME_DOM_CONTENT_LOADED,
+ Source<NavigationController>(&controller_),
+ Details<int64>(&frame_id));
+}
+
+void TabContents::OnDidFinishLoad(int64 frame_id) {
+ NotificationService::current()->Notify(
+ NotificationType::FRAME_DID_FINISH_LOAD,
+ Source<NavigationController>(&controller_),
+ Details<int64>(&frame_id));
+}
+
// Notifies the RenderWidgetHost instance about the fact that the page is
// loading, or done loading and calls the base implementation.
void TabContents::SetIsLoading(bool is_loading,
@@ -2189,148 +2379,6 @@
delegate()->OnInstantSupportDetermined(page_id, result);
}
-void TabContents::DidStartProvisionalLoadForFrame(
- RenderViewHost* render_view_host,
- int64 frame_id,
- bool is_main_frame,
- bool is_error_page,
- const GURL& url) {
- ProvisionalLoadDetails details(is_main_frame,
- controller_.IsURLInPageNavigation(url),
- url, std::string(), false,
- is_error_page, frame_id);
- NotificationService::current()->Notify(
- NotificationType::FRAME_PROVISIONAL_LOAD_START,
- Source<NavigationController>(&controller_),
- Details<ProvisionalLoadDetails>(&details));
- if (is_main_frame) {
- // If we're displaying a network error page do not reset the content
- // settings delegate's cookies so the user has a chance to modify cookie
- // settings.
- if (!is_error_page)
- content_settings_delegate_->ClearCookieSpecificContentSettings();
- content_settings_delegate_->ClearGeolocationContentSettings();
- }
-}
-
-void TabContents::DidStartReceivingResourceResponse(
- const ResourceRequestDetails& details) {
- NotificationService::current()->Notify(
- NotificationType::RESOURCE_RESPONSE_STARTED,
- Source<NavigationController>(&controller()),
- Details<const ResourceRequestDetails>(&details));
-}
-
-void TabContents::DidRedirectResource(
- const ResourceRedirectDetails& details) {
- NotificationService::current()->Notify(
- NotificationType::RESOURCE_RECEIVED_REDIRECT,
- Source<NavigationController>(&controller()),
- Details<const ResourceRequestDetails>(&details));
-}
-
-void TabContents::DidLoadResourceFromMemoryCache(
- const GURL& url,
- const std::string& frame_origin,
- const std::string& main_frame_origin,
- const std::string& security_info) {
- // Send out a notification that we loaded a resource from our memory cache.
- int cert_id = 0, cert_status = 0, security_bits = -1, connection_status = 0;
- SSLManager::DeserializeSecurityInfo(security_info,
- &cert_id, &cert_status,
- &security_bits,
- &connection_status);
- LoadFromMemoryCacheDetails details(url, frame_origin, main_frame_origin,
- GetRenderProcessHost()->id(), cert_id,
- cert_status);
-
- NotificationService::current()->Notify(
- NotificationType::LOAD_FROM_MEMORY_CACHE,
- Source<NavigationController>(&controller_),
- Details<LoadFromMemoryCacheDetails>(&details));
-}
-
-void TabContents::DidDisplayInsecureContent() {
- displayed_insecure_content_ = true;
- SSLManager::NotifySSLInternalStateChanged();
-}
-
-void TabContents::DidRunInsecureContent(const std::string& security_origin) {
- controller_.ssl_manager()->DidRunInsecureContent(security_origin);
-}
-
-void TabContents::DidFailProvisionalLoadWithError(
- RenderViewHost* render_view_host,
- int64 frame_id,
- bool is_main_frame,
- int error_code,
- const GURL& url,
- bool showing_repost_interstitial) {
- if (net::ERR_ABORTED == error_code) {
- // EVIL HACK ALERT! Ignore failed loads when we're showing interstitials.
- // This means that the interstitial won't be torn down properly, which is
- // bad. But if we have an interstitial, go back to another tab type, and
- // then load the same interstitial again, we could end up getting the first
- // interstitial's "failed" message (as a result of the cancel) when we're on
- // the second one.
- //
- // We can't tell this apart, so we think we're tearing down the current page
- // which will cause a crash later one. There is also some code in
- // RenderViewHostManager::RendererAbortedProvisionalLoad that is commented
- // out because of this problem.
- //
- // http://code.google.com/p/chromium/issues/detail?id=2855
- // Because this will not tear down the interstitial properly, if "back" is
- // back to another tab type, the interstitial will still be somewhat alive
- // in the previous tab type. If you navigate somewhere that activates the
- // tab with the interstitial again, you'll see a flash before the new load
- // commits of the interstitial page.
- if (showing_interstitial_page()) {
- LOG(WARNING) << "Discarding message during interstitial.";
- return;
- }
-
- // This will discard our pending entry if we cancelled the load (e.g., if we
- // decided to download the file instead of load it). Only discard the
- // pending entry if the URLs match, otherwise the user initiated a navigate
- // before the page loaded so that the discard would discard the wrong entry.
- NavigationEntry* pending_entry = controller_.pending_entry();
- if (pending_entry && pending_entry->url() == url) {
- controller_.DiscardNonCommittedEntries();
- // Update the URL display.
- NotifyNavigationStateChanged(TabContents::INVALIDATE_URL);
- }
-
- render_manager_.RendererAbortedProvisionalLoad(render_view_host);
- }
-
- // Send out a notification that we failed a provisional load with an error.
- ProvisionalLoadDetails details(is_main_frame,
- controller_.IsURLInPageNavigation(url),
- url, std::string(), false, false, frame_id);
- details.set_error_code(error_code);
-
- NotificationService::current()->Notify(
- NotificationType::FAIL_PROVISIONAL_LOAD_WITH_ERROR,
- Source<NavigationController>(&controller_),
- Details<ProvisionalLoadDetails>(&details));
-}
-
-void TabContents::DocumentLoadedInFrame(int64 frame_id) {
- controller_.DocumentLoadedInFrame();
- NotificationService::current()->Notify(
- NotificationType::FRAME_DOM_CONTENT_LOADED,
- Source<NavigationController>(&controller_),
- Details<int64>(&frame_id));
-}
-
-void TabContents::DidFinishLoad(int64 frame_id) {
- NotificationService::current()->Notify(
- NotificationType::FRAME_DID_FINISH_LOAD,
- Source<NavigationController>(&controller_),
- Details<int64>(&frame_id));
-}
-
void TabContents::OnContentSettingsAccessed(bool content_was_blocked) {
if (delegate_)
delegate_->OnContentSettingsChange(this);
@@ -2350,10 +2398,6 @@
return this;
}
-RenderViewHostDelegate::Resource* TabContents::GetResourceDelegate() {
- return this;
-}
-
RenderViewHostDelegate::ContentSettings*
TabContents::GetContentSettingsDelegate() {
return content_settings_delegate_.get();
@@ -2773,19 +2817,6 @@
Details<int>(&page_id));
}
-void TabContents::DidRedirectProvisionalLoad(int32 page_id,
- const GURL& source_url,
- const GURL& target_url) {
- NavigationEntry* entry;
- if (page_id == -1)
- entry = controller_.pending_entry();
- else
- entry = controller_.GetEntryWithPageID(GetSiteInstance(), page_id);
- if (!entry || entry->url() != source_url)
- return;
- entry->set_url(target_url);
-}
-
void TabContents::RequestOpenURL(const GURL& url, const GURL& referrer,
WindowOpenDisposition disposition) {
if (render_manager_.dom_ui()) {
@@ -3076,8 +3107,8 @@
std::wstring languages =
UTF8ToWide(profile()->GetPrefs()->GetString(prefs::kAcceptLanguages));
std::string host = url.host();
- load_state_host_ =
- net::IDNToUnicode(host.c_str(), host.size(), languages, NULL);
+ load_state_host_ = WideToUTF16Hack(
+ net::IDNToUnicode(host.c_str(), host.size(), languages, NULL));
if (load_state_ == net::LOAD_STATE_READING_RESPONSE)
SetNotWaitingForResponse();
if (is_loading())
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 500418c..150d101 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -48,6 +48,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/scoped_ptr.h"
+#include "base/string16.h"
#include "chrome/browser/dom_ui/dom_ui_factory.h"
#include "chrome/browser/download/save_package.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
@@ -72,6 +73,10 @@
#include "gfx/native_widget_types.h"
#include "net/base/load_states.h"
+#if defined(OS_WIN)
+#include "base/win/scoped_handle.h"
+#endif
+
namespace gfx {
class Rect;
}
@@ -84,10 +89,6 @@
class PrintViewManager;
}
-namespace IPC {
-class Message;
-}
-
namespace webkit_glue {
struct PasswordForm;
}
@@ -127,7 +128,6 @@
public NotificationObserver,
public RenderViewHostDelegate,
public RenderViewHostDelegate::BrowserIntegration,
- public RenderViewHostDelegate::Resource,
public RenderViewHostManager::Delegate,
public JavaScriptAppModalDialogDelegate,
public ImageLoadingTracker::Observer,
@@ -294,7 +294,7 @@
virtual bool ShouldDisplayFavIcon();
// Returns a human-readable description the tab's loading state.
- virtual std::wstring GetStatusText() const;
+ virtual string16 GetStatusText() const;
// Add and remove observers for page navigation notifications. Adding or
// removing multiple times has no effect. The order in which notifications
@@ -818,6 +818,27 @@
// Used to access RVH Delegates.
friend class PrerenderManager;
+ // Message handlers.
+ void OnDidStartProvisionalLoadForFrame(int64 frame_id,
+ bool main_frame,
+ const GURL& url);
+ void OnDidRedirectProvisionalLoad(int32 page_id,
+ const GURL& source_url,
+ const GURL& target_url);
+ void OnDidFailProvisionalLoadWithError(int64 frame_id,
+ bool main_frame,
+ int error_code,
+ const GURL& url,
+ bool showing_repost_interstitial);
+ void OnDidLoadResourceFromMemoryCache(const GURL& url,
+ const std::string& frame_origin,
+ const std::string& main_frame_origin,
+ const std::string& security_info);
+ void OnDidDisplayInsecureContent();
+ void OnDidRunInsecureContent(const std::string& security_origin);
+ void OnDocumentLoadedInFrame(int64 frame_id);
+ void OnDidFinishLoad(int64 frame_id);
+
// Changes the IsLoading state and notifies delegate as needed
// |details| is used to provide details on the load that just finished
// (but can be null if not applicable). Can be overridden.
@@ -953,43 +974,12 @@
const std::vector<std::string>& suggestions);
virtual void OnInstantSupportDetermined(int32 page_id, bool result);
- // RenderViewHostDelegate::Resource implementation.
- virtual void DidStartProvisionalLoadForFrame(RenderViewHost* render_view_host,
- int64 frame_id,
- bool is_main_frame,
- bool is_error_page,
- const GURL& url);
- virtual void DidStartReceivingResourceResponse(
- const ResourceRequestDetails& details);
- virtual void DidRedirectProvisionalLoad(int32 page_id,
- const GURL& source_url,
- const GURL& target_url);
- virtual void DidRedirectResource(
- const ResourceRedirectDetails& details);
- virtual void DidLoadResourceFromMemoryCache(
- const GURL& url,
- const std::string& frame_origin,
- const std::string& main_frame_origin,
- const std::string& security_info);
- virtual void DidDisplayInsecureContent();
- virtual void DidRunInsecureContent(const std::string& security_origin);
- virtual void DidFailProvisionalLoadWithError(
- RenderViewHost* render_view_host,
- int64 frame_id,
- bool is_main_frame,
- int error_code,
- const GURL& url,
- bool showing_repost_interstitial);
- virtual void DocumentLoadedInFrame(int64 frame_id);
- virtual void DidFinishLoad(int64 frame_id);
-
// RenderViewHostDelegate implementation.
virtual RenderViewHostDelegate::View* GetViewDelegate();
virtual RenderViewHostDelegate::RendererManagement*
GetRendererManagementDelegate();
virtual RenderViewHostDelegate::BrowserIntegration*
GetBrowserIntegrationDelegate();
- virtual RenderViewHostDelegate::Resource* GetResourceDelegate();
virtual RenderViewHostDelegate::ContentSettings* GetContentSettingsDelegate();
virtual RenderViewHostDelegate::Save* GetSaveDelegate();
virtual RenderViewHostDelegate::Printing* GetPrintingDelegate();
@@ -1001,6 +991,7 @@
virtual AutomationResourceRoutingDelegate*
GetAutomationResourceRoutingDelegate();
virtual TabContents* GetAsTabContents();
+ virtual bool OnMessageReceived(const IPC::Message& message);
virtual ViewType::Type GetRenderViewType() const;
virtual int GetBrowserWindowID() const;
virtual void RenderViewCreated(RenderViewHost* render_view_host);
@@ -1213,7 +1204,7 @@
// The current load state and the URL associated with it.
net::LoadState load_state_;
- std::wstring load_state_host_;
+ string16 load_state_host_;
// Upload progress, for displaying in the status bar.
// Set to zero when there is no significant upload happening.
uint64 upload_size_;
@@ -1327,7 +1318,7 @@
// Handle to an event that's set when the page is showing a message box (or
// equivalent constrained window). Plugin processes check this to know if
// they should pump messages then.
- ScopedHandle message_box_active_;
+ base::win::ScopedHandle message_box_active_;
#endif
// The time that the last javascript message was dismissed.
diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc
index 80c609b..1844f67 100644
--- a/chrome/browser/tab_contents/thumbnail_generator.cc
+++ b/chrome/browser/tab_contents/thumbnail_generator.cc
@@ -23,7 +23,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#endif
// Overview
@@ -205,7 +205,7 @@
// Duplicate the handle to the DIB here because the renderer process does not
// have permission. The duplicated handle is owned by the renderer process,
// which is responsible for closing it.
- TransportDIB::Handle renderer_dib_handle = win_util::GetSectionForProcess(
+ TransportDIB::Handle renderer_dib_handle = app::win::GetSectionForProcess(
thumbnail_dib->handle(),
renderer->process()->GetHandle(),
false);
diff --git a/chrome/browser/task_manager/task_manager.cc b/chrome/browser/task_manager/task_manager.cc
index 30209c7..ac58e03 100644
--- a/chrome/browser/task_manager/task_manager.cc
+++ b/chrome/browser/task_manager/task_manager.cc
@@ -12,7 +12,7 @@
#include "base/process_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
diff --git a/chrome/browser/task_manager/task_manager.h b/chrome/browser/task_manager/task_manager.h
index c0f757e..7117092 100644
--- a/chrome/browser/task_manager/task_manager.h
+++ b/chrome/browser/task_manager/task_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -300,7 +300,7 @@
virtual void OnJobAdded(net::URLRequestJob* job);
virtual void OnJobRemoved(net::URLRequestJob* job);
virtual void OnJobDone(net::URLRequestJob* job,
- const URLRequestStatus& status);
+ const net::URLRequestStatus& status);
virtual void OnJobRedirect(net::URLRequestJob* job,
const GURL& location,
int status_code);
diff --git a/chrome/browser/task_manager/task_manager_browsertest.cc b/chrome/browser/task_manager/task_manager_browsertest.cc
index b944869..b17132f 100644
--- a/chrome/browser/task_manager/task_manager_browsertest.cc
+++ b/chrome/browser/task_manager/task_manager_browsertest.cc
@@ -110,8 +110,8 @@
// Check that the third entry is a tab contents resource whose title starts
// starts with "Tab:".
ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL);
- string16 prefix = WideToUTF16Hack(l10n_util::GetStringF(
- IDS_TASK_MANAGER_TAB_PREFIX, L""));
+ string16 prefix = l10n_util::GetStringFUTF16(
+ IDS_TASK_MANAGER_TAB_PREFIX, string16());
ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true));
// Close the tab and verify that we notice.
@@ -193,8 +193,8 @@
ASSERT_EQ(TaskManager::Resource::EXTENSION, model()->GetResourceType(2));
ASSERT_TRUE(model()->GetResourceTabContents(2) == NULL);
ASSERT_TRUE(model()->GetResourceExtension(2) != NULL);
- string16 prefix = WideToUTF16Hack(l10n_util::GetStringF(
- IDS_TASK_MANAGER_EXTENSION_PREFIX, L""));
+ string16 prefix = l10n_util::GetStringFUTF16(
+ IDS_TASK_MANAGER_EXTENSION_PREFIX, string16());
ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true));
// Check that the fourth entry (page.html) is of type extension and has both
@@ -233,8 +233,8 @@
ASSERT_EQ(TaskManager::Resource::EXTENSION, model()->GetResourceType(2));
ASSERT_TRUE(model()->GetResourceTabContents(2) != NULL);
ASSERT_TRUE(model()->GetResourceExtension(2) != NULL);
- string16 prefix = WideToUTF16Hack(l10n_util::GetStringF(
- IDS_TASK_MANAGER_APP_PREFIX, L""));
+ string16 prefix = l10n_util::GetStringFUTF16(
+ IDS_TASK_MANAGER_APP_PREFIX, string16());
ASSERT_TRUE(StartsWith(model()->GetResourceTitle(2), prefix, true));
// Unload extension to avoid crash on Windows.
@@ -332,17 +332,20 @@
}
// Regression test for http://crbug.com/18693.
-// Crashy, http://crbug.com/42315.
+//
+// This test is crashy. See http://crbug.com/42315.
IN_PROC_BROWSER_TEST_F(TaskManagerBrowserTest, DISABLED_ReloadExtension) {
// Show the task manager. This populates the model, and helps with debugging
// (you see the task manager).
browser()->window()->ShowTaskManager();
+ LOG(INFO) << "loading extension";
ASSERT_TRUE(LoadExtension(
test_data_dir_.AppendASCII("common").AppendASCII("background_page")));
// Wait until we see the loaded extension in the task manager (the three
// resources are: the browser process, New Tab Page, and the extension).
+ LOG(INFO) << "waiting for resource change";
WaitForResourceChange(3);
EXPECT_TRUE(model()->GetResourceExtension(0) == NULL);
@@ -350,17 +353,23 @@
ASSERT_TRUE(model()->GetResourceExtension(2) != NULL);
const Extension* extension = model()->GetResourceExtension(2);
+ ASSERT_TRUE(extension != NULL);
// Reload the extension a few times and make sure our resource count
// doesn't increase.
+ LOG(INFO) << "First extension reload";
ReloadExtension(extension->id());
WaitForResourceChange(3);
extension = model()->GetResourceExtension(2);
+ ASSERT_TRUE(extension != NULL);
+ LOG(INFO) << "Second extension reload";
ReloadExtension(extension->id());
WaitForResourceChange(3);
extension = model()->GetResourceExtension(2);
+ ASSERT_TRUE(extension != NULL);
+ LOG(INFO) << "Third extension reload";
ReloadExtension(extension->id());
WaitForResourceChange(3);
}
diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc
index 40a23b2..ed8f848 100644
--- a/chrome/browser/task_manager/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager/task_manager_resource_providers.cc
@@ -14,7 +14,7 @@
#include "base/process_util.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/background_contents_service.h"
@@ -171,12 +171,11 @@
std::wstring TaskManagerTabContentsResource::GetTitle() const {
// Fall back on the URL if there's no title.
- std::wstring tab_title(UTF16ToWideHack(tab_contents_->GetTitle()));
+ string16 tab_title = tab_contents_->GetTitle();
if (tab_title.empty()) {
- tab_title = UTF8ToWide(tab_contents_->GetURL().spec());
+ tab_title = UTF8ToUTF16(tab_contents_->GetURL().spec());
// Force URL to be LTR.
- tab_title = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(
- WideToUTF16(tab_title)));
+ tab_title = base::i18n::GetDisplayStringInLTRDirectionality(tab_title);
} else {
// Since the tab_title will be concatenated with
// IDS_TASK_MANAGER_TAB_PREFIX, we need to explicitly set the tab_title to
@@ -196,7 +195,7 @@
extensions_service->IsInstalledApp(tab_contents_->GetURL()),
tab_contents_->HostsExtension(),
tab_contents_->profile()->IsOffTheRecord());
- return l10n_util::GetStringF(message_id, tab_title);
+ return UTF16ToWideHack(l10n_util::GetStringFUTF16(message_id, tab_title));
}
SkBitmap TaskManagerTabContentsResource::GetIcon() const {
@@ -415,15 +414,16 @@
}
std::wstring TaskManagerBackgroundContentsResource::GetTitle() const {
- std::wstring title = application_name_;
+ string16 title = WideToUTF16Hack(application_name_);
if (title.empty()) {
// No title (can't locate the parent app for some reason) so just display
// the URL (properly forced to be LTR).
- title = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(
- UTF8ToUTF16(background_contents_->GetURL().spec())));
+ title = base::i18n::GetDisplayStringInLTRDirectionality(
+ UTF8ToUTF16(background_contents_->GetURL().spec()));
}
- return l10n_util::GetStringF(IDS_TASK_MANAGER_BACKGROUND_PREFIX, title);
+ return UTF16ToWideHack(
+ l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_BACKGROUND_PREFIX, title));
}
@@ -881,12 +881,13 @@
}
process_handle_ = extension_host_->render_process_host()->GetHandle();
pid_ = base::GetProcId(process_handle_);
- std::wstring extension_name(UTF8ToWide(GetExtension()->name()));
+ string16 extension_name = UTF8ToUTF16(GetExtension()->name());
DCHECK(!extension_name.empty());
int message_id = GetMessagePrefixID(GetExtension()->is_app(), true,
extension_host_->profile()->IsOffTheRecord());
- title_ = l10n_util::GetStringF(message_id, extension_name);
+ title_ = UTF16ToWideHack(l10n_util::GetStringFUTF16(message_id,
+ extension_name));
}
TaskManagerExtensionProcessResource::~TaskManagerExtensionProcessResource() {
@@ -1263,7 +1264,8 @@
// TaskManagerResource methods:
std::wstring TaskManagerBrowserProcessResource::GetTitle() const {
if (title_.empty()) {
- title_ = l10n_util::GetString(IDS_TASK_MANAGER_WEB_BROWSER_CELL_TEXT);
+ title_ = UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_TASK_MANAGER_WEB_BROWSER_CELL_TEXT));
}
return title_;
}
diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
index 6333900..3ddc0cb 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -8,7 +8,7 @@
#include "app/resource_bundle.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/themes/browser_theme_provider.cc b/chrome/browser/themes/browser_theme_provider.cc
index 1f70532..bdd9bf1 100644
--- a/chrome/browser/themes/browser_theme_provider.cc
+++ b/chrome/browser/themes/browser_theme_provider.cc
@@ -20,7 +20,7 @@
#include "grit/theme_resources.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
+#include "app/win/hwnd_util.h"
#endif
// Strings used in alignment properties.
@@ -255,7 +255,7 @@
if (HasCustomImage(IDR_THEME_FRAME))
return false;
#if defined(OS_WIN)
- return win_util::ShouldUseVistaFrame();
+ return app::win::ShouldUseVistaFrame();
#else
return false;
#endif
diff --git a/chrome/browser/themes/browser_theme_provider.h b/chrome/browser/themes/browser_theme_provider.h
index cddd153..e400a1f 100644
--- a/chrome/browser/themes/browser_theme_provider.h
+++ b/chrome/browser/themes/browser_theme_provider.h
@@ -11,8 +11,8 @@
#include <string>
#include "app/theme_provider.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
namespace color_utils {
struct HSL;
@@ -32,7 +32,7 @@
extern "C" NSString* const kBrowserThemeDidChangeNotification;
#endif // __OBJC__
-class BrowserThemeProvider : public NonThreadSafe,
+class BrowserThemeProvider : public base::NonThreadSafe,
public ThemeProvider {
public:
// Public constants used in BrowserThemeProvider and its subclasses:
diff --git a/chrome/browser/translate/translate_manager.h b/chrome/browser/translate/translate_manager.h
index 48e1951..39d9df7 100644
--- a/chrome/browser/translate/translate_manager.h
+++ b/chrome/browser/translate/translate_manager.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -66,7 +66,7 @@
// URLFetcher::Delegate implementation:
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
diff --git a/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc b/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc
index a486abb..bdf7d42 100644
--- a/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc
+++ b/chrome/browser/ui/app_modal_dialogs/message_box_handler.cc
@@ -33,15 +33,15 @@
extension = extensions_service->GetExtensionByWebExtent(frame_url);
if (extension && (extension->location() == Extension::COMPONENT)) {
- return l10n_util::GetString(IDS_PRODUCT_NAME);
+ return UTF16ToWideHack(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
} else if (extension && !extension->name().empty()) {
return UTF8ToWide(extension->name());
}
}
if (!frame_url.has_host()) {
- return l10n_util::GetString(
+ return UTF16ToWideHack(l10n_util::GetStringUTF16(
is_alert ? IDS_JAVASCRIPT_ALERT_DEFAULT_TITLE
- : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE);
+ : IDS_JAVASCRIPT_MESSAGEBOX_DEFAULT_TITLE));
}
// TODO(brettw) it should be easier than this to do the correct language
@@ -78,11 +78,16 @@
void RunBeforeUnloadDialog(TabContents* tab_contents,
const std::wstring& message_text,
IPC::Message* reply_msg) {
- std::wstring full_message =
- message_text + L"\n\n" +
- l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER);
+ std::wstring full_message = message_text + L"\n\n" + UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_BEFOREUNLOAD_MESSAGEBOX_FOOTER));
AppModalDialogQueue::GetInstance()->AddDialog(new JavaScriptAppModalDialog(
- tab_contents, l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE),
- MessageBoxFlags::kIsJavascriptConfirm, message_text, std::wstring(),
- false, true, reply_msg));
+ tab_contents,
+ UTF16ToWideHack(
+ l10n_util::GetStringUTF16(IDS_BEFOREUNLOAD_MESSAGEBOX_TITLE)),
+ MessageBoxFlags::kIsJavascriptConfirm,
+ message_text,
+ std::wstring(),
+ false,
+ true,
+ reply_msg));
}
diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc
index 9d0353c..cdaf933 100644
--- a/chrome/browser/ui/browser.cc
+++ b/chrome/browser/ui/browser.cc
@@ -12,7 +12,6 @@
#include <algorithm>
#include <string>
-#include "app/animation.h"
#include "app/l10n_util.h"
#include "base/base_paths.h"
#include "base/command_line.h"
@@ -20,8 +19,8 @@
#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/string_util.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "gfx/point.h"
#include "chrome/app/chrome_command_ids.h"
@@ -108,15 +107,12 @@
#include "net/base/registry_controlled_domain.h"
#include "net/base/static_cookie_policy.h"
#include "net/url_request/url_request_context.h"
+#include "ui/base/animation/animation.h"
#include "webkit/glue/webkit_glue.h"
#include "webkit/glue/window_open_disposition.h"
-#if defined(ENABLE_REMOTING)
-#include "chrome/browser/remoting/remoting_setup_flow.h"
-#endif
-
#if defined(OS_WIN)
-#include "app/win_util.h"
+#include "app/win/shell.h"
#include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h"
#include "chrome/browser/browser_child_process_host.h"
#include "chrome/browser/download/save_package.h"
@@ -379,7 +375,7 @@
// Set the app user model id for this application to that of the application
// name. See http://crbug.com/7028.
- win_util::SetAppIdForWindow(
+ app::win::SetAppIdForWindow(
type_ & TYPE_APP ?
ShellIntegration::GetAppId(UTF8ToWide(app_name_), profile_->GetPath()) :
ShellIntegration::GetChromiumAppId(profile_->GetPath()),
@@ -1115,12 +1111,6 @@
command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS,
show_main_ui && profile_->IsSyncAccessible());
-#if defined(ENABLE_REMOTING)
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) {
- command_updater_.UpdateCommandEnabled(IDC_REMOTING_SETUP, show_main_ui);
- }
-#endif
-
command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_EDIT_SEARCH_ENGINES, show_main_ui);
command_updater_.UpdateCommandEnabled(IDC_VIEW_PASSWORDS, show_main_ui);
@@ -1800,8 +1790,8 @@
void Browser::OpenClearBrowsingDataDialog() {
UserMetrics::RecordAction(UserMetricsAction("ClearBrowsingData_ShowDlg"),
profile_);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
ShowOptionsTab(
chrome::kAdvancedOptionsSubPage + std::string(kHashMark) +
chrome::kClearBrowserDataSubPage);
@@ -1812,8 +1802,8 @@
void Browser::OpenOptionsDialog() {
UserMetrics::RecordAction(UserMetricsAction("ShowOptions"), profile_);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
ShowOptionsTab(chrome::kDefaultOptionsSubPage);
} else {
ShowOptionsWindow(OPTIONS_PAGE_DEFAULT, OPTIONS_GROUP_NONE, profile_);
@@ -1822,8 +1812,8 @@
void Browser::OpenKeywordEditor() {
UserMetrics::RecordAction(UserMetricsAction("EditSearchEngines"), profile_);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
ShowOptionsTab(chrome::kSearchEnginesSubPage);
} else {
window_->ShowSearchEnginesDialog();
@@ -1836,8 +1826,8 @@
void Browser::OpenImportSettingsDialog() {
UserMetrics::RecordAction(UserMetricsAction("Import_ShowDlg"), profile_);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
ShowOptionsTab(
chrome::kPersonalOptionsSubPage + std::string(kHashMark) +
chrome::kImportDataSubPage);
@@ -1851,12 +1841,6 @@
profile_, ProfileSyncService::START_FROM_WRENCH);
}
-#if defined(ENABLE_REMOTING)
-void Browser::OpenRemotingSetupDialog() {
- RemotingSetupFlow::OpenDialog(profile_);
-}
-#endif
-
void Browser::OpenAboutChromeDialog() {
UserMetrics::RecordAction(UserMetricsAction("AboutChrome"), profile_);
#if defined(OS_CHROMEOS)
@@ -1899,8 +1883,8 @@
}
void Browser::OpenSearchEngineOptionsDialog() {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
OpenKeywordEditor();
} else {
ShowOptionsWindow(OPTIONS_PAGE_GENERAL, OPTIONS_GROUP_DEFAULT_SEARCH,
@@ -1912,8 +1896,8 @@
void Browser::OpenSystemOptionsDialog() {
UserMetrics::RecordAction(UserMetricsAction("OpenSystemOptionsDialog"),
profile_);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
ShowOptionsTab(chrome::kSystemOptionsSubPage);
} else {
ShowOptionsWindow(OPTIONS_PAGE_SYSTEM, OPTIONS_GROUP_NONE,
@@ -1924,8 +1908,8 @@
void Browser::OpenInternetOptionsDialog() {
UserMetrics::RecordAction(UserMetricsAction("OpenInternetOptionsDialog"),
profile_);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
ShowOptionsTab(chrome::kInternetOptionsSubPage);
} else {
ShowOptionsWindow(OPTIONS_PAGE_INTERNET, OPTIONS_GROUP_DEFAULT_SEARCH,
@@ -1936,8 +1920,8 @@
void Browser::OpenLanguageOptionsDialog() {
UserMetrics::RecordAction(UserMetricsAction("OpenLanguageOptionsDialog"),
profile_);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
ShowOptionsTab(chrome::kLanguageOptionsSubPage);
} else {
chromeos::LanguageConfigView::Show(profile_, NULL);
@@ -2244,9 +2228,6 @@
case IDC_SHOW_DOWNLOADS: ShowDownloadsTab(); break;
case IDC_MANAGE_EXTENSIONS: ShowExtensionsTab(); break;
case IDC_SYNC_BOOKMARKS: OpenSyncMyBookmarksDialog(); break;
-#if defined(ENABLE_REMOTING)
- case IDC_REMOTING_SETUP: OpenRemotingSetupDialog(); break;
-#endif
case IDC_OPTIONS: OpenOptionsDialog(); break;
case IDC_EDIT_SEARCH_ENGINES: OpenKeywordEditor(); break;
case IDC_VIEW_PASSWORDS: OpenPasswordManager(); break;
@@ -2463,7 +2444,51 @@
TabContentsWrapper* contents = GetTabContentsWrapperAt(index);
CHECK(contents);
TabContentsWrapper* contents_dupe = contents->Clone();
- InsertContentsDupe(contents, contents_dupe);
+ TabContents* new_contents = contents_dupe->tab_contents();
+
+ bool pinned = false;
+ if (CanSupportWindowFeature(FEATURE_TABSTRIP)) {
+ // If this is a tabbed browser, just create a duplicate tab inside the same
+ // window next to the tab being duplicated.
+ int index = tab_handler_->GetTabStripModel()->
+ GetIndexOfTabContents(contents);
+ pinned = tab_handler_->GetTabStripModel()->IsTabPinned(index);
+ int add_types = TabStripModel::ADD_SELECTED |
+ TabStripModel::ADD_INHERIT_GROUP |
+ (pinned ? TabStripModel::ADD_PINNED : 0);
+ tab_handler_->GetTabStripModel()->InsertTabContentsAt(index + 1,
+ contents_dupe,
+ add_types);
+ } else {
+ Browser* browser = NULL;
+ if (type_ & TYPE_APP) {
+ CHECK((type_ & TYPE_POPUP) == 0);
+ CHECK(type_ != TYPE_APP_PANEL);
+ browser = Browser::CreateForApp(app_name_, gfx::Size(), profile_,
+ false);
+ } else if (type_ == TYPE_POPUP) {
+ browser = Browser::CreateForType(TYPE_POPUP, profile_);
+ }
+
+ // Preserve the size of the original window. The new window has already
+ // been given an offset by the OS, so we shouldn't copy the old bounds.
+ BrowserWindow* new_window = browser->window();
+ new_window->SetBounds(gfx::Rect(new_window->GetRestoredBounds().origin(),
+ window()->GetRestoredBounds().size()));
+
+ // We need to show the browser now. Otherwise ContainerWin assumes the
+ // TabContents is invisible and won't size it.
+ browser->window()->Show();
+
+ // The page transition below is only for the purpose of inserting the tab.
+ browser->AddTab(contents_dupe, PageTransition::LINK);
+ }
+
+ if (profile_->HasSessionService()) {
+ SessionService* session_service = profile_->GetSessionService();
+ if (session_service)
+ session_service->TabRestored(&new_contents->controller(), pinned);
+ }
}
void Browser::CloseFrameAfterDragSession() {
@@ -2620,8 +2645,7 @@
status_bubble->Hide();
// Show the loading state (if any).
- status_bubble->SetStatus(WideToUTF16Hack(
- GetSelectedTabContents()->GetStatusText()));
+ status_bubble->SetStatus(GetSelectedTabContents()->GetStatusText());
}
if (HasFindBarController()) {
@@ -2787,8 +2811,7 @@
if (source == selected_contents) {
UpdateReloadStopState(source->is_loading(), false);
if (GetStatusBubble()) {
- GetStatusBubble()->SetStatus(WideToUTF16(
- GetSelectedTabContents()->GetStatusText()));
+ GetStatusBubble()->SetStatus(GetSelectedTabContents()->GetStatusText());
}
if (!source->is_loading() &&
@@ -3037,7 +3060,7 @@
TabContents* current_tab = GetSelectedTabContents();
// We make this check for the case of minimized windows, unit tests, etc.
if (platform_util::IsVisible(current_tab->GetNativeView()) &&
- Animation::ShouldRenderRichAnimation()) {
+ ui::Animation::ShouldRenderRichAnimation()) {
DownloadStartedAnimation::Show(current_tab);
}
#endif
@@ -3089,8 +3112,8 @@
}
void Browser::ShowContentSettingsWindow(ContentSettingsType content_type) {
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabbedOptions)) {
+ if (!CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableTabbedOptions)) {
ShowOptionsTab(
chrome::kContentSettingsSubPage + std::string(kHashMark) +
ContentSettingsHandler::ContentSettingsTypeToGroupName(content_type));
@@ -3743,7 +3766,7 @@
// Updating the URL happens synchronously in ScheduleUIUpdate.
if (flags & TabContents::INVALIDATE_LOAD && GetStatusBubble())
- GetStatusBubble()->SetStatus(WideToUTF16(contents->GetStatusText()));
+ GetStatusBubble()->SetStatus(contents->GetStatusText());
if (flags & (TabContents::INVALIDATE_TAB |
TabContents::INVALIDATE_TITLE)) {
@@ -4120,17 +4143,23 @@
}
bool Browser::OpenInstant(WindowOpenDisposition disposition) {
- if (!instant() || !instant()->is_active() || !instant()->IsCurrent())
+ if (!instant() || !instant()->is_active() || !instant()->IsCurrent() ||
+ disposition == NEW_BACKGROUND_TAB) {
+ // NEW_BACKGROUND_TAB results in leaving the omnibox open, so we don't
+ // attempt to use the instant preview.
return false;
+ }
if (disposition == CURRENT_TAB) {
instant()->CommitCurrentPreview(INSTANT_COMMIT_PRESSED_ENTER);
return true;
}
- if (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB) {
- HideInstant();
+ if (disposition == NEW_FOREGROUND_TAB) {
TabContentsWrapper* preview_contents = instant()->ReleasePreviewContents(
INSTANT_COMMIT_PRESSED_ENTER);
+ // HideInstant is invoked after release so that InstantController is not
+ // active when HideInstant asks it for its state.
+ HideInstant();
preview_contents->controller().PruneAllButActive();
tab_handler_->GetTabStripModel()->AddTabContents(
preview_contents,
@@ -4177,39 +4206,21 @@
active_entry->set_virtual_url(url);
// Do not restore title, derive it from the url.
active_entry->set_title(string16());
- InsertContentsDupe(contents, view_source_contents);
-}
-void Browser::InsertContentsDupe(
- TabContentsWrapper* contents,
- TabContentsWrapper* contents_dupe) {
- CHECK(contents);
-
- TabContents* new_contents = contents_dupe->tab_contents();
- bool pinned = false;
+ // Now show view-source entry.
if (CanSupportWindowFeature(FEATURE_TABSTRIP)) {
// If this is a tabbed browser, just create a duplicate tab inside the same
// window next to the tab being duplicated.
int index = tab_handler_->GetTabStripModel()->
GetIndexOfTabContents(contents);
- pinned = tab_handler_->GetTabStripModel()->IsTabPinned(index);
int add_types = TabStripModel::ADD_SELECTED |
- TabStripModel::ADD_INHERIT_GROUP |
- (pinned ? TabStripModel::ADD_PINNED : 0);
+ TabStripModel::ADD_INHERIT_GROUP;
tab_handler_->GetTabStripModel()->InsertTabContentsAt(index + 1,
- contents_dupe,
+ view_source_contents,
add_types);
} else {
- Browser* browser = NULL;
- if (type_ & TYPE_APP) {
- CHECK((type_ & TYPE_POPUP) == 0);
- CHECK(type_ != TYPE_APP_PANEL);
- browser = Browser::CreateForApp(app_name_, gfx::Size(), profile_,
- false);
- } else if (type_ == TYPE_POPUP) {
- browser = Browser::CreateForType(TYPE_POPUP, profile_);
- }
+ Browser* browser = Browser::CreateForType(TYPE_NORMAL, profile_);
// Preserve the size of the original window. The new window has already
// been given an offset by the OS, so we shouldn't copy the old bounds.
@@ -4222,12 +4233,12 @@
browser->window()->Show();
// The page transition below is only for the purpose of inserting the tab.
- browser->AddTab(contents_dupe, PageTransition::LINK);
+ browser->AddTab(view_source_contents, PageTransition::LINK);
}
if (profile_->HasSessionService()) {
SessionService* session_service = profile_->GetSessionService();
if (session_service)
- session_service->TabRestored(&new_contents->controller(), pinned);
+ session_service->TabRestored(&view_source_contents->controller(), false);
}
}
diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h
index 00f558c..cc1686d 100644
--- a/chrome/browser/ui/browser.h
+++ b/chrome/browser/ui/browser.h
@@ -191,6 +191,7 @@
ToolbarModel* toolbar_model() { return &toolbar_model_; }
const SessionID& session_id() const { return session_id_; }
CommandUpdater* command_updater() { return &command_updater_; }
+ bool block_command_execution() const { return block_command_execution_; }
// Get the FindBarController for this browser, creating it if it does not
// yet exist.
@@ -996,12 +997,6 @@
// Opens view-source tab for given tab contents.
void ViewSource(TabContentsWrapper* tab);
- // Inserts contents dupe next to the original contents. This method is used
- // to insert duplicate tab and view source tab next to the original tab.
- void InsertContentsDupe(
- TabContentsWrapper* original_content,
- TabContentsWrapper* clone_content);
-
// Data members /////////////////////////////////////////////////////////////
NotificationRegistrar registrar_;
diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc
index 8835996..6977552 100644
--- a/chrome/browser/ui/browser_init.cc
+++ b/chrome/browser/ui/browser_init.cc
@@ -16,7 +16,7 @@
#include "base/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/automation/automation_provider.h"
#include "chrome/browser/automation/automation_provider_list.h"
@@ -72,10 +72,6 @@
#include "chrome/browser/ui/cocoa/keystone_infobar.h"
#endif
-#if defined(OS_WIN)
-#include "app/win_util.h"
-#endif
-
#if defined(TOOLKIT_GTK)
#include "chrome/browser/gtk/gtk_util.h"
#endif
diff --git a/chrome/browser/ui/browser_list.cc b/chrome/browser/ui/browser_list.cc
index dfdd576..ec5fef1 100644
--- a/chrome/browser/ui/browser_list.cc
+++ b/chrome/browser/ui/browser_list.cc
@@ -26,6 +26,7 @@
#include "chrome/browser/chromeos/boot_times_loader.h"
#include "chrome/browser/chromeos/cros/cros_library.h"
#include "chrome/browser/chromeos/cros/login_library.h"
+#include "chrome/browser/chromeos/wm_ipc.h"
#endif
namespace {
@@ -189,6 +190,7 @@
NotificationService::AllSources(),
NotificationService::NoDetails());
#if defined(OS_CHROMEOS)
+ chromeos::WmIpc::instance()->NotifyAboutSignout();
if (chromeos::CrosLibrary::Get()->EnsureLoaded()) {
chromeos::CrosLibrary::Get()->GetLoginLibrary()->StopSession("");
return;
diff --git a/chrome/browser/ui/browser_navigator_browsertest.cc b/chrome/browser/ui/browser_navigator_browsertest.cc
index 37bb0de..a5a2291 100644
--- a/chrome/browser/ui/browser_navigator_browsertest.cc
+++ b/chrome/browser/ui/browser_navigator_browsertest.cc
@@ -63,11 +63,6 @@
EXPECT_EQ(old_url, browser()->GetSelectedTabContents()->GetURL());
}
- // TODO(jhawkins): Remove once tabbed options are enabled by default.
- virtual void SetUpCommandLine(CommandLine* command_line) {
- command_line->AppendSwitch(switches::kEnableTabbedOptions);
- }
-
void Observe(NotificationType type, const NotificationSource& source,
const NotificationDetails& details) {
switch (type.value) {
@@ -509,8 +504,8 @@
}
// This test verifies that constructing params with disposition = SINGLETON_TAB
-// and |ignore_paths| = true opens a new tab navigated to the specified URL if no
-// previous tab with that URL (minus the path) exists.
+// and |ignore_paths| = true opens a new tab navigated to the specified URL if
+// no previous tab with that URL (minus the path) exists.
IN_PROC_BROWSER_TEST_F(BrowserNavigatorTest,
Disposition_SingletonTabNew_IgnorePath) {
GURL url("http://www.google.com/");
diff --git a/chrome/browser/ui/cocoa/about_ipc_controller.mm b/chrome/browser/ui/cocoa/about_ipc_controller.mm
index f7f7c31..89e0db7 100644
--- a/chrome/browser/ui/cocoa/about_ipc_controller.mm
+++ b/chrome/browser/ui/cocoa/about_ipc_controller.mm
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/time.h"
@@ -86,7 +86,7 @@
}
- (id)init {
- NSString* nibpath = [mac_util::MainAppBundle() pathForResource:@"AboutIPC"
+ NSString* nibpath = [base::mac::MainAppBundle() pathForResource:@"AboutIPC"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
// Default to all on
diff --git a/chrome/browser/ui/cocoa/about_window_controller.mm b/chrome/browser/ui/cocoa/about_window_controller.mm
index f6da6ab..f83c9a1 100644
--- a/chrome/browser/ui/cocoa/about_window_controller.mm
+++ b/chrome/browser/ui/cocoa/about_window_controller.mm
@@ -8,12 +8,13 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
+#include "chrome/browser/google/google_util.h"
#include "chrome/browser/platform_util.h"
#import "chrome/browser/ui/cocoa/background_tile_view.h"
#import "chrome/browser/ui/cocoa/keystone_glue.h"
@@ -100,7 +101,7 @@
@implementation AboutWindowController
- (id)initWithProfile:(Profile*)profile {
- NSString* nibPath = [mac_util::MainAppBundle() pathForResource:@"About"
+ NSString* nibPath = [base::mac::MainAppBundle() pathForResource:@"About"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
profile_ = profile;
@@ -128,7 +129,7 @@
static BOOL recentShownUserActionFailedStatus = NO;
- (void)awakeFromNib {
- NSBundle* bundle = mac_util::MainAppBundle();
+ NSBundle* bundle = base::mac::MainAppBundle();
NSString* chromeVersion =
[bundle objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
@@ -660,7 +661,9 @@
NSString* kEndLinkChr = @"END_LINK_CHR";
NSString* kEndLinkOss = @"END_LINK_OSS";
// The CHR link should go to here
- NSString* kChromiumProject = l10n_util::GetNSString(IDS_CHROMIUM_PROJECT_URL);
+ GURL url = google_util::AppendGoogleLocaleParam(
+ GURL(chrome::kChromiumProjectURL));
+ NSString* kChromiumProject = base::SysUTF8ToNSString(url.spec());
// The OSS link should go to here
NSString* kAcknowledgements =
[NSString stringWithUTF8String:chrome::kAboutCreditsURL];
diff --git a/chrome/browser/ui/cocoa/animatable_image.mm b/chrome/browser/ui/cocoa/animatable_image.mm
index a73f5a4..2d09bf0 100644
--- a/chrome/browser/ui/cocoa/animatable_image.mm
+++ b/chrome/browser/ui/cocoa/animatable_image.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/animatable_image.h"
#include "base/logging.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
@@ -131,7 +131,7 @@
// rasterize PDF resources.
- (void)setLayerContents:(CALayer*)layer {
base::mac::ScopedCFTypeRef<CGImageRef> image(
- mac_util::CopyNSImageToCGImage(image_.get()));
+ base::mac::CopyNSImageToCGImage(image_.get()));
// Create the layer that will be animated.
[layer setContents:(id)image.get()];
}
diff --git a/chrome/browser/ui/cocoa/authorization_util.mm b/chrome/browser/ui/cocoa/authorization_util.mm
index 5893711..9c434f3 100644
--- a/chrome/browser/ui/cocoa/authorization_util.mm
+++ b/chrome/browser/ui/cocoa/authorization_util.mm
@@ -12,7 +12,7 @@
#include "base/basictypes.h"
#include "base/eintr_wrapper.h"
#include "base/logging.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "chrome/browser/ui/cocoa/scoped_authorizationref.h"
@@ -41,14 +41,14 @@
// product_logo_32.png is used instead of app.icns because Authorization
// Services can't deal with .icns files.
NSString* icon_path =
- [mac_util::MainAppBundle() pathForResource:@"product_logo_32"
+ [base::mac::MainAppBundle() pathForResource:@"product_logo_32"
ofType:@"png"];
const char* icon_path_c = [icon_path fileSystemRepresentation];
size_t icon_path_length = icon_path_c ? strlen(icon_path_c) : 0;
// The OS will append " Type an administrator's name and password to allow
// <CFBundleDisplayName> to make changes."
- NSString* prompt_ns = mac_util::CFToNSCast(prompt);
+ NSString* prompt_ns = base::mac::CFToNSCast(prompt);
const char* prompt_c = [prompt_ns UTF8String];
size_t prompt_length = prompt_c ? strlen(prompt_c) : 0;
diff --git a/chrome/browser/ui/cocoa/back_forward_menu_controller.h b/chrome/browser/ui/cocoa/back_forward_menu_controller.h
index 13bb585..7e58051 100644
--- a/chrome/browser/ui/cocoa/back_forward_menu_controller.h
+++ b/chrome/browser/ui/cocoa/back_forward_menu_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,7 +12,7 @@
#include "base/scoped_ptr.h"
#include "chrome/browser/ui/toolbar/back_forward_menu_model.h"
-@class DelayedMenuButton;
+@class MenuButton;
typedef BackForwardMenuModel::ModelType BackForwardMenuType;
const BackForwardMenuType BACK_FORWARD_MENU_TYPE_BACK =
@@ -26,7 +26,7 @@
@interface BackForwardMenuController : NSObject {
@private
BackForwardMenuType type_;
- DelayedMenuButton* button_; // Weak; comes from nib.
+ MenuButton* button_; // Weak; comes from nib.
scoped_ptr<BackForwardMenuModel> model_;
scoped_nsobject<NSMenu> backForwardMenu_;
}
@@ -36,7 +36,7 @@
- (id)initWithBrowser:(Browser*)browser
modelType:(BackForwardMenuType)type
- button:(DelayedMenuButton*)button;
+ button:(MenuButton*)button;
@end // @interface BackForwardMenuController
diff --git a/chrome/browser/ui/cocoa/back_forward_menu_controller.mm b/chrome/browser/ui/cocoa/back_forward_menu_controller.mm
index 9db04cf..96a9a18 100644
--- a/chrome/browser/ui/cocoa/back_forward_menu_controller.mm
+++ b/chrome/browser/ui/cocoa/back_forward_menu_controller.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,8 +7,8 @@
#include "base/logging.h"
#include "base/scoped_ptr.h"
#include "base/sys_string_conversions.h"
-#import "chrome/browser/ui/cocoa/delayedmenu_button.h"
#import "chrome/browser/ui/cocoa/event_utils.h"
+#import "chrome/browser/ui/cocoa/menu_button.h"
#include "chrome/browser/ui/toolbar/back_forward_menu_model.h"
#include "skia/ext/skia_utils_mac.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -26,7 +26,7 @@
- (id)initWithBrowser:(Browser*)browser
modelType:(BackForwardMenuType)type
- button:(DelayedMenuButton*)button {
+ button:(MenuButton*)button {
if ((self = [super init])) {
type_ = type;
button_ = button;
@@ -37,7 +37,7 @@
[backForwardMenu_ setDelegate:self];
[button_ setAttachedMenu:backForwardMenu_];
- [button_ setAttachedMenuEnabled:YES];
+ [button_ setOpenMenuOnClick:NO];
}
return self;
}
diff --git a/chrome/browser/ui/cocoa/base_bubble_controller.mm b/chrome/browser/ui/cocoa/base_bubble_controller.mm
index 3c1e9d2..768e9f1 100644
--- a/chrome/browser/ui/cocoa/base_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/base_bubble_controller.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/scoped_nsobject.h"
#include "base/string_util.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
@@ -54,7 +54,7 @@
- (id)initWithWindowNibPath:(NSString*)nibPath
parentWindow:(NSWindow*)parentWindow
anchoredAt:(NSPoint)anchoredAt {
- nibPath = [mac_util::MainAppBundle() pathForResource:nibPath
+ nibPath = [base::mac::MainAppBundle() pathForResource:nibPath
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
parentWindow_ = parentWindow;
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
index c08aae0..261c742 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_editor.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -211,7 +211,7 @@
delegate:(id<BookmarkBarControllerDelegate>)delegate
resizeDelegate:(id<ViewResizer>)resizeDelegate {
if ((self = [super initWithNibName:@"BookmarkBar"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
// Initialize to an invalid state.
visualState_ = bookmarks::kInvalidState;
lastVisualState_ = bookmarks::kInvalidState;
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
index b86aab9..86420c2 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bar_folder_controller.h"
#include "app/mac/nsimage_cache.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_utils.h"
@@ -114,7 +114,7 @@
parentController:(BookmarkBarFolderController*)parentController
barController:(BookmarkBarController*)barController {
NSString* nibPath =
- [mac_util::MainAppBundle() pathForResource:@"BookmarkBarFolderWindow"
+ [base::mac::MainAppBundle() pathForResource:@"BookmarkBarFolderWindow"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
parentButton_.reset([button retain]);
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
index ae66081..82258da 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/bookmarks/bookmark_bubble_controller.h"
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h" // TODO(viettrungluu): remove
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -88,7 +88,7 @@
node:(const BookmarkNode*)node
alreadyBookmarked:(BOOL)alreadyBookmarked {
NSString* nibPath =
- [mac_util::MainAppBundle() pathForResource:@"BookmarkBubble"
+ [base::mac::MainAppBundle() pathForResource:@"BookmarkBubble"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
parentWindow_ = parentWindow;
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
index ffc9d69..8cce1b4 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_editor_base_controller.mm
@@ -9,7 +9,7 @@
#include "app/l10n_util.h"
#include "app/l10n_util_mac.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/profiles/profile.h"
@@ -161,7 +161,7 @@
profile:(Profile*)profile
parent:(const BookmarkNode*)parent
configuration:(BookmarkEditor::Configuration)configuration {
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:nibName
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm
index b4f23d2..4db77eb 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_name_folder_controller.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util.h"
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/cocoa/bookmarks/bookmark_model_observer_for_cocoa.h"
@@ -20,7 +20,7 @@
node:(const BookmarkNode*)node
parent:(const BookmarkNode*)parent
newIndex:(int)newIndex {
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:@"BookmarkNameFolder"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/browser_window_controller.mm b/chrome/browser/ui/cocoa/browser_window_controller.mm
index 589ed91..6240065 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller.mm
@@ -10,7 +10,7 @@
#include "app/l10n_util_mac.h"
#include "app/mac/scoped_nsdisable_screen_updates.h"
#include "app/mac/nsimage_cache.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import "base/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_command_ids.h" // IDC_*
@@ -219,7 +219,7 @@
- (id)initWithBrowser:(Browser*)browser takeOwnership:(BOOL)ownIt {
// Use initWithWindowNibPath:: instead of initWithWindowNibName: so we
// can override it in a unit test.
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:@"BrowserWindow"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/browser_window_controller_private.mm b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
index 702c52b..98f1718 100644
--- a/chrome/browser/ui/cocoa/browser_window_controller_private.mm
+++ b/chrome/browser/ui/cocoa/browser_window_controller_private.mm
@@ -4,7 +4,6 @@
#import "chrome/browser/ui/cocoa/browser_window_controller_private.h"
-#include "base/mac_util.h"
#import "base/scoped_nsobject.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
diff --git a/chrome/browser/ui/cocoa/bug_report_window_controller.mm b/chrome/browser/ui/cocoa/bug_report_window_controller.mm
index 82b3a36..5ea378a 100644
--- a/chrome/browser/ui/cocoa/bug_report_window_controller.mm
+++ b/chrome/browser/ui/cocoa/bug_report_window_controller.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/bug_report_window_controller.h"
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/bug_report_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -26,7 +26,7 @@
- (id)initWithTabContents:(TabContents*)currentTab
profile:(Profile*)profile {
- NSString* nibpath = [mac_util::MainAppBundle() pathForResource:@"ReportBug"
+ NSString* nibpath = [base::mac::MainAppBundle() pathForResource:@"ReportBug"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
currentTab_ = currentTab;
@@ -62,7 +62,7 @@
[self setPageURL:base::SysUTF8ToNSString(
currentTab_->controller().GetActiveEntry()->url().spec())];
[self setPageTitle:base::SysUTF16ToNSString(currentTab_->GetTitle())];
- mac_util::GrabWindowSnapshot(
+ base::mac::GrabWindowSnapshot(
currentTab_->view()->GetTopLevelNativeWindow(), &pngData_,
&pngWidth_, &pngHeight_);
} else {
diff --git a/chrome/browser/ui/cocoa/chrome_event_processing_window_unittest.mm b/chrome/browser/ui/cocoa/chrome_event_processing_window_unittest.mm
index 9cbb8e0..f2fd657 100644
--- a/chrome/browser/ui/cocoa/chrome_event_processing_window_unittest.mm
+++ b/chrome/browser/ui/cocoa/chrome_event_processing_window_unittest.mm
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <Carbon/Carbon.h>
+
#include "base/debug/debugger.h"
#include "base/scoped_nsobject.h"
#include "chrome/app/chrome_command_ids.h"
diff --git a/chrome/browser/ui/cocoa/clear_browsing_data_controller.mm b/chrome/browser/ui/cocoa/clear_browsing_data_controller.mm
index c0c927e..0ced443 100644
--- a/chrome/browser/ui/cocoa/clear_browsing_data_controller.mm
+++ b/chrome/browser/ui/cocoa/clear_browsing_data_controller.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util.h"
#include "base/lazy_instance.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/scoped_nsobject.h"
#include "chrome/browser/browsing_data_remover.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -98,7 +98,7 @@
DCHECK(profile);
// Use initWithWindowNibPath:: instead of initWithWindowNibName: so we
// can override it in a unit test.
- NSString *nibpath = [mac_util::MainAppBundle()
+ NSString *nibpath = [base::mac::MainAppBundle()
pathForResource:@"ClearBrowsingData"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/cocoa_test_helper.h b/chrome/browser/ui/cocoa/cocoa_test_helper.h
index 0be5903..d7eb150 100644
--- a/chrome/browser/ui/cocoa/cocoa_test_helper.h
+++ b/chrome/browser/ui/cocoa/cocoa_test_helper.h
@@ -8,8 +8,6 @@
#import <Cocoa/Cocoa.h>
-#include "base/debug_util.h"
-#include "base/mac_util.h"
#include "base/path_service.h"
#import "base/mac/scoped_nsautorelease_pool.h"
#import "base/scoped_nsobject.h"
diff --git a/chrome/browser/ui/cocoa/cocoa_test_helper.mm b/chrome/browser/ui/cocoa/cocoa_test_helper.mm
index 2cd2cc0..b4c68d9 100644
--- a/chrome/browser/ui/cocoa/cocoa_test_helper.mm
+++ b/chrome/browser/ui/cocoa/cocoa_test_helper.mm
@@ -6,6 +6,7 @@
#include "base/debug/debugger.h"
#include "base/logging.h"
+#include "base/mac/mac_util.h"
#include "base/test/test_timeouts.h"
#import "chrome/browser/chrome_browser_application_mac.h"
@@ -79,7 +80,7 @@
FilePath path;
PathService::Get(base::DIR_EXE, &path);
path = path.Append(chrome::kFrameworkName);
- mac_util::SetOverrideAppBundlePath(path);
+ base::mac::SetOverrideAppBundlePath(path);
// Bootstrap Cocoa. It's very unhappy without this.
[CrApplication sharedApplication];
@@ -131,7 +132,8 @@
(spins < kCloseSpins || one_more_time)) {
// Check the timeout before pumping events, so that we'll spin
// the loop once after the timeout.
- one_more_time = ([start_date timeIntervalSinceNow] > -kCloseTimeoutSeconds);
+ one_more_time =
+ ([start_date timeIntervalSinceNow] > -kCloseTimeoutSeconds);
// Autorelease anything thrown up by the event loop.
{
diff --git a/chrome/browser/ui/cocoa/collected_cookies_mac.mm b/chrome/browser/ui/cocoa/collected_cookies_mac.mm
index 23ff4a5..ef19437 100644
--- a/chrome/browser/ui/cocoa/collected_cookies_mac.mm
+++ b/chrome/browser/ui/cocoa/collected_cookies_mac.mm
@@ -8,7 +8,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -137,7 +137,7 @@
tabContents_ = tabContents;
NSString* nibpath =
- [mac_util::MainAppBundle() pathForResource:@"CollectedCookies"
+ [base::mac::MainAppBundle() pathForResource:@"CollectedCookies"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
[self loadTreeModelFromTabContents];
diff --git a/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm b/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
index 548b83a..6ad363b 100644
--- a/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
+++ b/chrome/browser/ui/cocoa/confirm_quit_panel_controller.mm
@@ -6,7 +6,7 @@
#import <QuartzCore/QuartzCore.h>
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/scoped_nsobject.h"
#import "chrome/browser/ui/cocoa/confirm_quit_panel_controller.h"
@@ -29,7 +29,7 @@
- (id)initInternal {
NSString* nibPath =
- [mac_util::MainAppBundle() pathForResource:@"ConfirmQuitPanel"
+ [base::mac::MainAppBundle() pathForResource:@"ConfirmQuitPanel"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
}
diff --git a/chrome/browser/ui/cocoa/content_exceptions_window_controller.mm b/chrome/browser/ui/cocoa/content_exceptions_window_controller.mm
index e9a426f..eaced8e 100644
--- a/chrome/browser/ui/cocoa/content_exceptions_window_controller.mm
+++ b/chrome/browser/ui/cocoa/content_exceptions_window_controller.mm
@@ -8,7 +8,7 @@
#include "app/l10n_util_mac.h"
#include "app/table_model_observer.h"
#include "base/command_line.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#import "base/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/content_exceptions_table_model.h"
@@ -151,7 +151,7 @@
settingsMap:(HostContentSettingsMap*)settingsMap
otrSettingsMap:(HostContentSettingsMap*)otrSettingsMap {
NSString* nibpath =
- [mac_util::MainAppBundle() pathForResource:@"ContentExceptionsWindow"
+ [base::mac::MainAppBundle() pathForResource:@"ContentExceptionsWindow"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
settingsType_ = settingsType;
diff --git a/chrome/browser/ui/cocoa/content_settings_dialog_controller.mm b/chrome/browser/ui/cocoa/content_settings_dialog_controller.mm
index f61c77a..1fb432e 100644
--- a/chrome/browser/ui/cocoa/content_settings_dialog_controller.mm
+++ b/chrome/browser/ui/cocoa/content_settings_dialog_controller.mm
@@ -8,7 +8,7 @@
#include "app/l10n_util.h"
#include "base/command_line.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import "chrome/browser/content_settings/content_settings_details.h"
#import "chrome/browser/content_settings/host_content_settings_map.h"
#import "chrome/browser/geolocation/geolocation_content_settings_map.h"
@@ -145,7 +145,7 @@
- (id)initWithProfile:(Profile*)profile {
DCHECK(profile);
NSString* nibpath =
- [mac_util::MainAppBundle() pathForResource:@"ContentSettings"
+ [base::mac::MainAppBundle() pathForResource:@"ContentSettings"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
profile_ = profile;
diff --git a/chrome/browser/ui/cocoa/cookie_details_view_controller.mm b/chrome/browser/ui/cocoa/cookie_details_view_controller.mm
index 9f47a54..d3e1ea5 100644
--- a/chrome/browser/ui/cocoa/cookie_details_view_controller.mm
+++ b/chrome/browser/ui/cocoa/cookie_details_view_controller.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#import "chrome/browser/ui/cocoa/cookie_tree_node.h"
#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
@@ -22,7 +22,7 @@
- (id)init {
return [super initWithNibName:@"CookieDetailsView"
- bundle:mac_util::MainAppBundle()];
+ bundle:base::mac::MainAppBundle()];
}
- (void)awakeFromNib {
diff --git a/chrome/browser/ui/cocoa/cookies_window_controller.mm b/chrome/browser/ui/cocoa/cookies_window_controller.mm
index bf1bf68..5e5f74f 100644
--- a/chrome/browser/ui/cocoa/cookies_window_controller.mm
+++ b/chrome/browser/ui/cocoa/cookies_window_controller.mm
@@ -9,7 +9,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/browsing_data_remover.h"
#include "chrome/browser/profiles/profile.h"
@@ -168,7 +168,7 @@
appcacheHelper:(BrowsingDataAppCacheHelper*)appcacheHelper
indexedDBHelper:(BrowsingDataIndexedDBHelper*)indexedDBHelper {
DCHECK(profile);
- NSString* nibpath = [mac_util::MainAppBundle() pathForResource:@"Cookies"
+ NSString* nibpath = [base::mac::MainAppBundle() pathForResource:@"Cookies"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
profile_ = profile;
diff --git a/chrome/browser/ui/cocoa/delayedmenu_button.h b/chrome/browser/ui/cocoa/delayedmenu_button.h
deleted file mode 100644
index 6363d30..0000000
--- a/chrome/browser/ui/cocoa/delayedmenu_button.h
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (c) 2009 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.
-
-#ifndef CHROME_BROWSER_UI_COCOA_DELAYEDMENU_BUTTON_H_
-#define CHROME_BROWSER_UI_COCOA_DELAYEDMENU_BUTTON_H_
-#pragma once
-
-#import <Cocoa/Cocoa.h>
-
-#include "base/scoped_nsobject.h"
-
-@interface DelayedMenuButton : NSButton {
- NSMenu* attachedMenu_; // Strong (retained).
- BOOL attachedMenuEnabled_;
- scoped_nsobject<NSPopUpButtonCell> popUpCell_;
-}
-
-// The menu to display. Note that it should have no (i.e., a blank) title and
-// that the 0-th entry should be blank (and won't be displayed). (This is
-// because we use a pulldown list, for which Cocoa uses the 0-th item as "title"
-// in the button. This might change if we ever switch to a pop-up. Our direct
-// use of the given NSMenu object means that the one can set and use NSMenu's
-// delegate as usual.)
-@property(retain, nonatomic) NSMenu* attachedMenu;
-
-// Is the menu enabled? (If not, don't act like a click-hold button.)
-@property(assign, nonatomic) BOOL attachedMenuEnabled;
-
-@end // @interface DelayedMenuButton
-
-#endif // CHROME_BROWSER_UI_COCOA_DELAYEDMENU_BUTTON_H_
diff --git a/chrome/browser/ui/cocoa/delayedmenu_button.mm b/chrome/browser/ui/cocoa/delayedmenu_button.mm
deleted file mode 100644
index 9a9d73d..0000000
--- a/chrome/browser/ui/cocoa/delayedmenu_button.mm
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (c) 2009 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 "chrome/browser/ui/cocoa/delayedmenu_button.h"
-
-#include "base/logging.h"
-#include "base/scoped_nsobject.h"
-#import "chrome/browser/ui/cocoa/clickhold_button_cell.h"
-
-@interface DelayedMenuButton (Private)
-
-- (void)setupCell;
-- (void)attachedMenuAction:(id)sender;
-
-@end // @interface DelayedMenuButton (Private)
-
-@implementation DelayedMenuButton
-
-// Overrides:
-
-+ (Class)cellClass {
- return [ClickHoldButtonCell class];
-}
-
-- (id)init {
- if ((self = [super init]))
- [self setupCell];
- return self;
-}
-
-- (id)initWithCoder:(NSCoder*)decoder {
- if ((self = [super initWithCoder:decoder]))
- [self setupCell];
- return self;
-}
-
-- (id)initWithFrame:(NSRect)frameRect {
- if ((self = [super initWithFrame:frameRect]))
- [self setupCell];
- return self;
-}
-
-- (void)dealloc {
- [attachedMenu_ release];
- [super dealloc];
-}
-
-- (void)awakeFromNib {
- [self setupCell];
-}
-
-- (void)setCell:(NSCell*)cell {
- [super setCell:cell];
- [self setupCell];
-}
-
-// Accessors and mutators:
-
-@synthesize attachedMenu = attachedMenu_;
-
-// Don't synthesize for attachedMenuEnabled_; its mutator must do other things.
-- (void)setAttachedMenuEnabled:(BOOL)enabled {
- attachedMenuEnabled_ = enabled;
- [[self cell] setEnableClickHold:attachedMenuEnabled_];
-}
-
-- (BOOL)attachedMenuEnabled {
- return attachedMenuEnabled_;
-}
-
-@end // @implementation DelayedMenuButton
-
-@implementation DelayedMenuButton (Private)
-
-// Set up the button's cell if we've reached a point where it's been set.
-- (void)setupCell {
- ClickHoldButtonCell* cell = [self cell];
- if (cell) {
- DCHECK([cell isKindOfClass:[ClickHoldButtonCell class]]);
- [self setEnabled:NO]; // Make the controller put in a menu and
- // enable it explicitly. This also takes
- // care of |[cell setEnableClickHold:]|.
- [cell setClickHoldAction:@selector(attachedMenuAction:)];
- [cell setClickHoldTarget:self];
- }
-}
-
-// Display the menu.
-- (void)attachedMenuAction:(id)sender {
- // We shouldn't get here unless the menu is enabled.
- DCHECK(attachedMenuEnabled_);
-
- // If we don't have a menu (in which case the person using this control is
- // being bad), just wait for a mouse up.
- if (!attachedMenu_) {
- LOG(WARNING) << "No menu available.";
- [NSApp nextEventMatchingMask:NSLeftMouseUpMask
- untilDate:[NSDate distantFuture]
- inMode:NSEventTrackingRunLoopMode
- dequeue:YES];
- return;
- }
-
- // TODO(viettrungluu): We have some fudge factors below to make things line up
- // (approximately). I wish I knew how to get rid of them. (Note that our view
- // is flipped, and that frame should be in our coordinates.) The y/height is
- // very odd, since it doesn't seem to respond to changes the way that it
- // should. I don't understand it.
- NSRect frame = [self convertRect:[self frame]
- fromView:[self superview]];
- frame.origin.x -= 2.0;
- frame.size.height += 10.0;
-
- // Make our pop-up button cell and set things up. This is, as of 10.5, the
- // official Apple-recommended hack. Later, perhaps |-[NSMenu
- // popUpMenuPositioningItem:atLocation:inView:]| may be a better option.
- // However, using a pulldown has the benefit that Cocoa automatically places
- // the menu correctly even when we're at the edge of the screen (including
- // "dragging upwards" when the button is close to the bottom of the screen).
- // A |scoped_nsobject| local variable cannot be used here because
- // Accessibility on 10.5 grabs the NSPopUpButtonCell without retaining it, and
- // uses it later. (This is fixed in 10.6.)
- if (!popUpCell_.get()) {
- popUpCell_.reset([[NSPopUpButtonCell alloc] initTextCell:@""
- pullsDown:YES]);
- }
- DCHECK(popUpCell_.get());
- [popUpCell_ setMenu:attachedMenu_];
- [popUpCell_ selectItem:nil];
- [popUpCell_ attachPopUpWithFrame:frame
- inView:self];
- [popUpCell_ performClickWithFrame:frame
- inView:self];
-}
-
-@end // @implementation DelayedMenuButton (Private)
diff --git a/chrome/browser/ui/cocoa/delayedmenu_button_unittest.mm b/chrome/browser/ui/cocoa/delayedmenu_button_unittest.mm
deleted file mode 100644
index d1d7b77..0000000
--- a/chrome/browser/ui/cocoa/delayedmenu_button_unittest.mm
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (c) 2009 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 "base/scoped_nsobject.h"
-#import "chrome/browser/ui/cocoa/clickhold_button_cell.h"
-#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
-#import "chrome/browser/ui/cocoa/delayedmenu_button.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/platform_test.h"
-
-namespace {
-
-class DelayedMenuButtonTest : public CocoaTest {
- public:
- DelayedMenuButtonTest() {
- NSRect frame = NSMakeRect(0, 0, 50, 30);
- scoped_nsobject<DelayedMenuButton>button([[DelayedMenuButton alloc]
- initWithFrame:frame]);
- button_ = button.get();
- scoped_nsobject<ClickHoldButtonCell> cell(
- [[ClickHoldButtonCell alloc] initTextCell:@"Testing"]);
- [button_ setCell:cell.get()];
- [[test_window() contentView] addSubview:button_];
- }
-
- DelayedMenuButton* button_;
-};
-
-TEST_VIEW(DelayedMenuButtonTest, button_)
-
-// Test assigning and enabling a menu, again mostly to ensure nothing leaks or
-// crashes.
-TEST_F(DelayedMenuButtonTest, MenuAssign) {
- scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
- ASSERT_TRUE(menu.get());
-
- [menu insertItemWithTitle:@"" action:nil keyEquivalent:@"" atIndex:0];
- [menu insertItemWithTitle:@"foo" action:nil keyEquivalent:@"" atIndex:1];
- [menu insertItemWithTitle:@"bar" action:nil keyEquivalent:@"" atIndex:2];
- [menu insertItemWithTitle:@"baz" action:nil keyEquivalent:@"" atIndex:3];
-
- [button_ setAttachedMenu:menu];
- EXPECT_TRUE([button_ attachedMenu]);
-
- [button_ setAttachedMenuEnabled:YES];
- EXPECT_TRUE([button_ attachedMenuEnabled]);
-
- // TODO(viettrungluu): Display the menu. (Calling DelayedMenuButton's private
- // |-attachedMenuAction:| method displays it fine, but the problem is
- // getting rid of the menu. We can catch the
- // |NSMenuDidBeginTrackingNotification| from |menu| fine, but then
- // |-cancelTracking| doesn't dismiss it. I don't know why.)
-}
-
-// TODO(viettrungluu): Test the two actions of the button (the normal one and
-// displaying the menu, also making sure the latter drags correctly)? It would
-// require "emulating" a mouse....
-
-} // namespace
diff --git a/chrome/browser/ui/cocoa/download/download_item_cell.mm b/chrome/browser/ui/cocoa/download/download_item_cell.mm
index b83d6f5..db5d5fa 100644
--- a/chrome/browser/ui/cocoa/download/download_item_cell.mm
+++ b/chrome/browser/ui/cocoa/download/download_item_cell.mm
@@ -6,7 +6,6 @@
#include "app/l10n_util.h"
#include "app/text_elider.h"
-#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_item_model.h"
@@ -237,14 +236,14 @@
// Set the name of the download.
downloadPath_ = downloadModel->download()->GetFileNameToReportUser();
- std::wstring statusText = downloadModel->GetStatusText();
+ string16 statusText = downloadModel->GetStatusText();
if (statusText.empty()) {
// Remove the status text label.
[self hideSecondaryTitle];
isStatusTextVisible_ = NO;
} else {
// Set status text.
- NSString* statusString = base::SysWideToNSString(statusText);
+ NSString* statusString = base::SysUTF16ToNSString(statusText);
[self setSecondaryTitle:statusString];
isStatusTextVisible_ = YES;
}
diff --git a/chrome/browser/ui/cocoa/download/download_item_controller.mm b/chrome/browser/ui/cocoa/download/download_item_controller.mm
index be0be80..23603f8 100644
--- a/chrome/browser/ui/cocoa/download/download_item_controller.mm
+++ b/chrome/browser/ui/cocoa/download/download_item_controller.mm
@@ -7,7 +7,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
#include "app/text_elider.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/metrics/histogram.h"
#include "base/string16.h"
#include "base/string_util.h"
@@ -98,7 +98,7 @@
- (id)initWithModel:(BaseDownloadItemModel*)downloadModel
shelf:(DownloadShelfController*)shelf {
if ((self = [super initWithNibName:@"DownloadItem"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
// Must be called before [self view], so that bridge_ is set in awakeFromNib
bridge_.reset(new DownloadItemMac(downloadModel, self));
menuBridge_.reset(new DownloadShelfContextMenuMac(downloadModel));
diff --git a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
index 4238b98..f88071f 100644
--- a/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
+++ b/chrome/browser/ui/cocoa/download/download_shelf_controller.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_manager.h"
@@ -83,7 +83,7 @@
- (id)initWithBrowser:(Browser*)browser
resizeDelegate:(id<ViewResizer>)resizeDelegate {
if ((self = [super initWithNibName:@"DownloadShelf"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
resizeDelegate_ = resizeDelegate;
maxShelfHeight_ = NSHeight([[self view] bounds]);
currentShelfHeight_ = maxShelfHeight_;
diff --git a/chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.mm b/chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.mm
index 06fc94b..7d83c74 100644
--- a/chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.mm
+++ b/chrome/browser/ui/cocoa/edit_search_engine_cocoa_controller.mm
@@ -7,7 +7,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
#include "base/logging.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/string16.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/search_engines/template_url.h"
@@ -32,7 +32,7 @@
delegate:(EditSearchEngineControllerDelegate*)delegate
templateURL:(const TemplateURL*)url {
DCHECK(profile);
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:@"EditSearchEngine"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/extension_installed_bubble_controller.mm b/chrome/browser/ui/cocoa/extension_installed_bubble_controller.mm
index f417ff7..ad30096 100644
--- a/chrome/browser/ui/cocoa/extension_installed_bubble_controller.mm
+++ b/chrome/browser/ui/cocoa/extension_installed_bubble_controller.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util.h"
#include "base/i18n/rtl.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/cocoa/browser_window_cocoa.h"
@@ -80,7 +80,7 @@
browser:(Browser*)browser
icon:(SkBitmap)icon {
NSString* nibPath =
- [mac_util::MainAppBundle() pathForResource:@"ExtensionInstalledBubble"
+ [base::mac::MainAppBundle() pathForResource:@"ExtensionInstalledBubble"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
DCHECK(parentWindow);
diff --git a/chrome/browser/ui/cocoa/extensions/chevron_menu_button.mm b/chrome/browser/ui/cocoa/extensions/chevron_menu_button.mm
index 04f1506..801bc46 100644
--- a/chrome/browser/ui/cocoa/extensions/chevron_menu_button.mm
+++ b/chrome/browser/ui/cocoa/extensions/chevron_menu_button.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,4 +12,10 @@
return [ChevronMenuButtonCell class];
}
+// Overrides:
+- (void)configureCell {
+ [super configureCell];
+ [self setOpenMenuOnClick:YES];
+}
+
@end
diff --git a/chrome/browser/ui/cocoa/extensions/extension_infobar_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_infobar_controller.mm
index 1214370..833b1a7 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_infobar_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_infobar_controller.mm
@@ -138,6 +138,7 @@
if ((self = [super initWithDelegate:delegate])) {
window_ = window;
dropdownButton_.reset([[MenuButton alloc] init]);
+ [dropdownButton_ setOpenMenuOnClick:YES];
ExtensionHost* extensionHost = delegate_->AsExtensionInfoBarDelegate()->
extension_host();
diff --git a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_controller.mm
index e40fcd4..09dc927 100644
--- a/chrome/browser/ui/cocoa/extensions/extension_install_prompt_controller.mm
+++ b/chrome/browser/ui/cocoa/extensions/extension_install_prompt_controller.mm
@@ -6,7 +6,7 @@
#include "app/l10n_util.h"
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
@@ -67,11 +67,11 @@
// We use a different XIB in the case of no warnings, that is a little bit
// more nicely laid out.
if (warnings.empty()) {
- nibpath = [mac_util::MainAppBundle()
+ nibpath = [base::mac::MainAppBundle()
pathForResource:@"ExtensionInstallPromptNoWarnings"
ofType:@"nib"];
} else {
- nibpath = [mac_util::MainAppBundle()
+ nibpath = [base::mac::MainAppBundle()
pathForResource:@"ExtensionInstallPrompt"
ofType:@"nib"];
}
diff --git a/chrome/browser/ui/cocoa/file_metadata.mm b/chrome/browser/ui/cocoa/file_metadata.mm
index d19e3ac..ca199a5 100644
--- a/chrome/browser/ui/cocoa/file_metadata.mm
+++ b/chrome/browser/ui/cocoa/file_metadata.mm
@@ -9,7 +9,7 @@
#include "base/file_path.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "googleurl/src/gurl.h"
@@ -98,7 +98,7 @@
void AddQuarantineMetadataToFile(const FilePath& file, const GURL& source,
const GURL& referrer) {
FSRef file_ref;
- if (!mac_util::FSRefFromPath(file.value(), &file_ref))
+ if (!base::mac::FSRefFromPath(file.value(), &file_ref))
return;
NSMutableDictionary* quarantine_properties = nil;
diff --git a/chrome/browser/ui/cocoa/find_bar_cocoa_controller.mm b/chrome/browser/ui/cocoa/find_bar_cocoa_controller.mm
index 05e5397..f8a4044 100644
--- a/chrome/browser/ui/cocoa/find_bar_cocoa_controller.mm
+++ b/chrome/browser/ui/cocoa/find_bar_cocoa_controller.mm
@@ -4,7 +4,7 @@
#import <Cocoa/Cocoa.h>
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -42,7 +42,7 @@
- (id)init {
if ((self = [super initWithNibName:@"FindBar"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(findPboardUpdated:)
diff --git a/chrome/browser/ui/cocoa/first_run_dialog.mm b/chrome/browser/ui/cocoa/first_run_dialog.mm
index 9590b9b..dae3e4e 100644
--- a/chrome/browser/ui/cocoa/first_run_dialog.mm
+++ b/chrome/browser/ui/cocoa/first_run_dialog.mm
@@ -5,9 +5,13 @@
#import "chrome/browser/ui/cocoa/first_run_dialog.h"
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/message_loop.h"
#include "base/ref_counted.h"
+#include "base/sys_string_conversions.h"
+#include "chrome/browser/google/google_util.h"
+#include "chrome/common/url_constants.h"
+#include "googleurl/src/gurl.h"
#include "grit/locale_settings.h"
#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
@@ -58,7 +62,7 @@
- (id)init {
NSString* nibpath =
- [mac_util::MainAppBundle() pathForResource:@"FirstRunDialog"
+ [base::mac::MainAppBundle() pathForResource:@"FirstRunDialog"
ofType:@"nib"];
self = [super initWithWindowNibPath:nibpath owner:self];
if (self != nil) {
@@ -187,7 +191,9 @@
}
- (IBAction)learnMore:(id)sender {
- NSString* urlStr = l10n_util::GetNSString(IDS_LEARN_MORE_REPORTING_URL);
+ GURL url = google_util::AppendGoogleLocaleParam(
+ GURL(chrome::kLearnMoreReportingURL));
+ NSString* urlStr = base::SysUTF8ToNSString(url.spec());;
NSURL* learnMoreUrl = [NSURL URLWithString:urlStr];
[[NSWorkspace sharedWorkspace] openURL:learnMoreUrl];
}
diff --git a/chrome/browser/ui/cocoa/floating_bar_backing_view.mm b/chrome/browser/ui/cocoa/floating_bar_backing_view.mm
index 70f785c..695946f 100644
--- a/chrome/browser/ui/cocoa/floating_bar_backing_view.mm
+++ b/chrome/browser/ui/cocoa/floating_bar_backing_view.mm
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/cocoa/floating_bar_backing_view.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import "chrome/browser/ui/cocoa/browser_frame_view.h"
@implementation FloatingBarBackingView
@@ -44,7 +44,7 @@
// a double-click in the blank area should try to minimize, to be consistent
// with double-clicks on the contiguous tab strip area. (It'll fail and beep.)
if ([event clickCount] == 2 &&
- mac_util::ShouldWindowsMiniaturizeOnDoubleClick())
+ base::mac::ShouldWindowsMiniaturizeOnDoubleClick())
[[self window] performMiniaturize:self];
}
diff --git a/chrome/browser/ui/cocoa/font_language_settings_controller.mm b/chrome/browser/ui/cocoa/font_language_settings_controller.mm
index 4beff2a..9bb9c6b 100644
--- a/chrome/browser/ui/cocoa/font_language_settings_controller.mm
+++ b/chrome/browser/ui/cocoa/font_language_settings_controller.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/font_language_settings_controller.h"
#import <Cocoa/Cocoa.h>
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/fonts_languages_window.h"
@@ -33,7 +33,7 @@
- (id)initWithProfile:(Profile*)profile {
DCHECK(profile);
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:@"FontLanguageSettings"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/framed_browser_window.h b/chrome/browser/ui/cocoa/framed_browser_window.h
index 40f330c..d3fd68b 100644
--- a/chrome/browser/ui/cocoa/framed_browser_window.h
+++ b/chrome/browser/ui/cocoa/framed_browser_window.h
@@ -11,17 +11,15 @@
#include "base/scoped_nsobject.h"
#include "chrome/browser/ui/cocoa/chrome_browser_window.h"
-// Offset from the top of the window frame to the top of the window controls
-// (zoom, close, miniaturize) for a window with a tabstrip.
-const NSInteger kFramedWindowButtonsWithTabStripOffsetFromTop = 6;
+// Offsets from the top/left of the window frame to the top of the window
+// controls (zoom, close, miniaturize) for a window with a tabstrip.
+const NSInteger kFramedWindowButtonsWithTabStripOffsetFromTop = 10;
+const NSInteger kFramedWindowButtonsWithTabStripOffsetFromLeft = 10;
-// Offset from the top of the window frame to the top of the window controls
-// (zoom, close, miniaturize) for a window without a tabstrip.
+// Offsets from the top/left of the window frame to the top of the window
+// controls (zoom, close, miniaturize) for a window without a tabstrip.
const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromTop = 4;
-
-// Offset from the left of the window frame to the top of the window controls
-// (zoom, close, miniaturize).
-const NSInteger kFramedWindowButtonsOffsetFromLeft = 8;
+const NSInteger kFramedWindowButtonsWithoutTabStripOffsetFromLeft = 8;
// Offset between the window controls (zoom, close, miniaturize).
const NSInteger kFramedWindowButtonsInterButtonSpacing = 7;
diff --git a/chrome/browser/ui/cocoa/framed_browser_window.mm b/chrome/browser/ui/cocoa/framed_browser_window.mm
index 9d63cb7..bf46c08 100644
--- a/chrome/browser/ui/cocoa/framed_browser_window.mm
+++ b/chrome/browser/ui/cocoa/framed_browser_window.mm
@@ -118,13 +118,16 @@
closeButton_ = [NSWindow standardWindowButton:NSWindowCloseButton
forStyleMask:aStyle];
NSRect closeButtonFrame = [closeButton_ frame];
- CGFloat yOffset = [browserController hasTabStrip] ?
+ BOOL hasTabStrip = [browserController hasTabStrip];
+ CGFloat xOffset = hasTabStrip ?
+ kFramedWindowButtonsWithTabStripOffsetFromLeft :
+ kFramedWindowButtonsWithoutTabStripOffsetFromLeft;
+ CGFloat yOffset = hasTabStrip ?
kFramedWindowButtonsWithTabStripOffsetFromTop :
kFramedWindowButtonsWithoutTabStripOffsetFromTop;
closeButtonFrame.origin =
- NSMakePoint(kFramedWindowButtonsOffsetFromLeft,
- (NSHeight(frameViewBounds) -
- NSHeight(closeButtonFrame) - yOffset));
+ NSMakePoint(xOffset, (NSHeight(frameViewBounds) -
+ NSHeight(closeButtonFrame) - yOffset));
[closeButton_ setFrame:closeButtonFrame];
[closeButton_ setTarget:self];
diff --git a/chrome/browser/ui/cocoa/framed_browser_window_unittest.mm b/chrome/browser/ui/cocoa/framed_browser_window_unittest.mm
index ad05334..b9d96c0 100644
--- a/chrome/browser/ui/cocoa/framed_browser_window_unittest.mm
+++ b/chrome/browser/ui/cocoa/framed_browser_window_unittest.mm
@@ -110,8 +110,9 @@
windowBounds.origin = NSZeroPoint;
EXPECT_EQ(NSMaxY(closeBoxFrame),
NSMaxY(windowBounds) -
- kFramedWindowButtonsWithoutTabStripOffsetFromTop);
- EXPECT_EQ(NSMinX(closeBoxFrame), kFramedWindowButtonsOffsetFromLeft);
+ kFramedWindowButtonsWithoutTabStripOffsetFromTop);
+ EXPECT_EQ(NSMinX(closeBoxFrame),
+ kFramedWindowButtonsWithoutTabStripOffsetFromLeft);
NSCell* miniaturizeCell = [window_ accessibilityAttributeValue:
NSAccessibilityMinimizeButtonAttribute];
@@ -120,7 +121,7 @@
NSRect miniaturizeFrame = [miniaturizeControl frame];
EXPECT_EQ(NSMaxY(miniaturizeFrame),
NSMaxY(windowBounds) -
- kFramedWindowButtonsWithoutTabStripOffsetFromTop);
+ kFramedWindowButtonsWithoutTabStripOffsetFromTop);
EXPECT_EQ(NSMinX(miniaturizeFrame),
NSMaxX(closeBoxFrame) + kFramedWindowButtonsInterButtonSpacing);
@@ -144,8 +145,9 @@
windowBounds.origin = NSZeroPoint;
EXPECT_EQ(NSMaxY(closeBoxFrame),
NSMaxY(windowBounds) -
- kFramedWindowButtonsWithTabStripOffsetFromTop);
- EXPECT_EQ(NSMinX(closeBoxFrame), kFramedWindowButtonsOffsetFromLeft);
+ kFramedWindowButtonsWithTabStripOffsetFromTop);
+ EXPECT_EQ(NSMinX(closeBoxFrame),
+ kFramedWindowButtonsWithTabStripOffsetFromLeft);
miniaturizeCell = [window_ accessibilityAttributeValue:
NSAccessibilityMinimizeButtonAttribute];
@@ -154,7 +156,7 @@
miniaturizeFrame = [miniaturizeControl frame];
EXPECT_EQ(NSMaxY(miniaturizeFrame),
NSMaxY(windowBounds) -
- kFramedWindowButtonsWithTabStripOffsetFromTop);
+ kFramedWindowButtonsWithTabStripOffsetFromTop);
EXPECT_EQ(NSMinX(miniaturizeFrame),
NSMaxX(closeBoxFrame) + kFramedWindowButtonsInterButtonSpacing);
[window_ setWindowController:nil];
diff --git a/chrome/browser/ui/cocoa/fullscreen_controller.h b/chrome/browser/ui/cocoa/fullscreen_controller.h
index 474d699..14aebfc 100644
--- a/chrome/browser/ui/cocoa/fullscreen_controller.h
+++ b/chrome/browser/ui/cocoa/fullscreen_controller.h
@@ -9,7 +9,7 @@
#import <Cocoa/Cocoa.h>
#import "base/mac/cocoa_protocols.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
@class BrowserWindowController;
@@ -69,7 +69,7 @@
// (which can happen when a fullscreen window is closed). Used to track the
// current state and make sure we properly restore the menu bar when this
// controller is destroyed.
- mac_util::FullScreenMode currentFullscreenMode_;
+ base::mac::FullScreenMode currentFullscreenMode_;
}
@property(readonly, nonatomic) BOOL isFullscreen;
diff --git a/chrome/browser/ui/cocoa/fullscreen_controller.mm b/chrome/browser/ui/cocoa/fullscreen_controller.mm
index 0f06e22..186ea78 100644
--- a/chrome/browser/ui/cocoa/fullscreen_controller.mm
+++ b/chrome/browser/ui/cocoa/fullscreen_controller.mm
@@ -6,6 +6,7 @@
#include <algorithm>
+#import "base/mac/mac_util.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
@@ -102,7 +103,7 @@
// Returns |kFullScreenModeHideAll| when the overlay is hidden and
// |kFullScreenModeHideDock| when the overlay is shown.
-- (mac_util::FullScreenMode)desiredFullscreenMode;
+- (base::mac::FullScreenMode)desiredFullscreenMode;
// Change the overlay to the given fraction, with or without animation. Only
// guaranteed to work properly with |fraction == 0| or |fraction == 1|. This
@@ -166,7 +167,7 @@
- (id)initWithBrowserController:(BrowserWindowController*)controller {
if ((self == [super init])) {
browserController_ = controller;
- currentFullscreenMode_ = mac_util::kFullScreenModeNormal;
+ currentFullscreenMode_ = base::mac::kFullScreenModeNormal;
}
// Let the world know what we're up to.
@@ -315,12 +316,12 @@
- (void)changeFloatingBarShownFraction:(CGFloat)fraction {
[browserController_ setFloatingBarShownFraction:fraction];
- mac_util::FullScreenMode desiredMode = [self desiredFullscreenMode];
+ base::mac::FullScreenMode desiredMode = [self desiredFullscreenMode];
if (desiredMode != currentFullscreenMode_ && [self shouldToggleMenuBar]) {
- if (currentFullscreenMode_ == mac_util::kFullScreenModeNormal)
- mac_util::RequestFullScreen(desiredMode);
+ if (currentFullscreenMode_ == base::mac::kFullScreenModeNormal)
+ base::mac::RequestFullScreen(desiredMode);
else
- mac_util::SwitchFullScreenModes(currentFullscreenMode_, desiredMode);
+ base::mac::SwitchFullScreenModes(currentFullscreenMode_, desiredMode);
currentFullscreenMode_ = desiredMode;
}
}
@@ -405,10 +406,10 @@
[[browserController_ window] isMainWindow];
}
-- (mac_util::FullScreenMode)desiredFullscreenMode {
+- (base::mac::FullScreenMode)desiredFullscreenMode {
if ([browserController_ floatingBarShownFraction] >= 1.0)
- return mac_util::kFullScreenModeHideDock;
- return mac_util::kFullScreenModeHideAll;
+ return base::mac::kFullScreenModeHideDock;
+ return base::mac::kFullScreenModeHideAll;
}
- (void)changeOverlayToFraction:(CGFloat)fraction
@@ -608,13 +609,13 @@
}
- (void)showActiveWindowUI {
- DCHECK_EQ(currentFullscreenMode_, mac_util::kFullScreenModeNormal);
- if (currentFullscreenMode_ != mac_util::kFullScreenModeNormal)
+ DCHECK_EQ(currentFullscreenMode_, base::mac::kFullScreenModeNormal);
+ if (currentFullscreenMode_ != base::mac::kFullScreenModeNormal)
return;
if ([self shouldToggleMenuBar]) {
- mac_util::FullScreenMode desiredMode = [self desiredFullscreenMode];
- mac_util::RequestFullScreen(desiredMode);
+ base::mac::FullScreenMode desiredMode = [self desiredFullscreenMode];
+ base::mac::RequestFullScreen(desiredMode);
currentFullscreenMode_ = desiredMode;
}
@@ -622,9 +623,9 @@
}
- (void)hideActiveWindowUI {
- if (currentFullscreenMode_ != mac_util::kFullScreenModeNormal) {
- mac_util::ReleaseFullScreen(currentFullscreenMode_);
- currentFullscreenMode_ = mac_util::kFullScreenModeNormal;
+ if (currentFullscreenMode_ != base::mac::kFullScreenModeNormal) {
+ base::mac::ReleaseFullScreen(currentFullscreenMode_);
+ currentFullscreenMode_ = base::mac::kFullScreenModeNormal;
}
// TODO(rohitrao): Remove the Exit Fullscreen button. http://crbug.com/35956
diff --git a/chrome/browser/ui/cocoa/fullscreen_window.mm b/chrome/browser/ui/cocoa/fullscreen_window.mm
index ecbb34c..ee4b881 100644
--- a/chrome/browser/ui/cocoa/fullscreen_window.mm
+++ b/chrome/browser/ui/cocoa/fullscreen_window.mm
@@ -4,7 +4,6 @@
#import "chrome/browser/ui/cocoa/fullscreen_window.h"
-#include "base/mac_util.h"
#include "chrome/browser/themes/browser_theme_provider.h"
#import "chrome/browser/ui/cocoa/themed_window.h"
diff --git a/chrome/browser/ui/cocoa/hung_renderer_controller.mm b/chrome/browser/ui/cocoa/hung_renderer_controller.mm
index 130a3f7..2c9d337 100644
--- a/chrome/browser/ui/cocoa/hung_renderer_controller.mm
+++ b/chrome/browser/ui/cocoa/hung_renderer_controller.mm
@@ -8,7 +8,7 @@
#include "app/resource_bundle.h"
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/process_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_list.h"
@@ -35,7 +35,7 @@
@implementation HungRendererController
- (id)initWithWindowNibName:(NSString*)nibName {
- NSString* nibpath = [mac_util::MainAppBundle() pathForResource:nibName
+ NSString* nibpath = [base::mac::MainAppBundle() pathForResource:nibName
ofType:@"nib"];
self = [super initWithWindowNibPath:nibpath owner:self];
if (self) {
diff --git a/chrome/browser/ui/cocoa/import_progress_dialog.mm b/chrome/browser/ui/cocoa/import_progress_dialog.mm
index 6ec0ed5..fe82f1f 100644
--- a/chrome/browser/ui/cocoa/import_progress_dialog.mm
+++ b/chrome/browser/ui/cocoa/import_progress_dialog.mm
@@ -7,7 +7,7 @@
#include "app/l10n_util.h"
#include "app/l10n_util_mac.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/message_loop.h"
#import "base/scoped_nsobject.h"
#import "base/sys_string_conversions.h"
@@ -57,7 +57,7 @@
observer:(ImportObserver*)observer
itemsEnabled:(int16)items {
NSString* nib_path =
- [mac_util::MainAppBundle() pathForResource:@"ImportProgressDialog"
+ [base::mac::MainAppBundle() pathForResource:@"ImportProgressDialog"
ofType:@"nib"];
self = [super initWithWindowNibPath:nib_path owner:self];
if (self != nil) {
diff --git a/chrome/browser/ui/cocoa/import_settings_dialog.mm b/chrome/browser/ui/cocoa/import_settings_dialog.mm
index 5e6da7a..d395999 100644
--- a/chrome/browser/ui/cocoa/import_settings_dialog.mm
+++ b/chrome/browser/ui/cocoa/import_settings_dialog.mm
@@ -4,7 +4,7 @@
#import "chrome/browser/ui/cocoa/import_settings_dialog.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/importer/importer_data_types.h"
#include "chrome/browser/importer/importer_list.h"
@@ -140,7 +140,7 @@
- (id)initWithProfiles:(NSArray*)profiles {
NSString* nibpath =
- [mac_util::MainAppBundle() pathForResource:@"ImportSettingsDialog"
+ [base::mac::MainAppBundle() pathForResource:@"ImportSettingsDialog"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
sourceBrowsersList_.reset([profiles retain]);
diff --git a/chrome/browser/ui/cocoa/importer_lock_dialog.mm b/chrome/browser/ui/cocoa/importer_lock_dialog.mm
index cc94ce5..2a140ae 100644
--- a/chrome/browser/ui/cocoa/importer_lock_dialog.mm
+++ b/chrome/browser/ui/cocoa/importer_lock_dialog.mm
@@ -7,7 +7,6 @@
#import "importer_lock_dialog.h"
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
#include "base/message_loop.h"
#include "base/scoped_nsobject.h"
#include "chrome/browser/importer/importer.h"
diff --git a/chrome/browser/ui/cocoa/infobar_container_controller.mm b/chrome/browser/ui/cocoa/infobar_container_controller.mm
index adca3e7..3eb29dc 100644
--- a/chrome/browser/ui/cocoa/infobar_container_controller.mm
+++ b/chrome/browser/ui/cocoa/infobar_container_controller.mm
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#import "chrome/browser/ui/cocoa/animatable_view.h"
@@ -71,7 +71,7 @@
- (id)initWithResizeDelegate:(id<ViewResizer>)resizeDelegate {
DCHECK(resizeDelegate);
if ((self = [super initWithNibName:@"InfoBarContainer"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
resizeDelegate_ = resizeDelegate;
infoBarObserver_.reset(new InfoBarNotificationObserver(self));
diff --git a/chrome/browser/ui/cocoa/infobar_controller.mm b/chrome/browser/ui/cocoa/infobar_controller.mm
index ae1414c..432c00b 100644
--- a/chrome/browser/ui/cocoa/infobar_controller.mm
+++ b/chrome/browser/ui/cocoa/infobar_controller.mm
@@ -5,7 +5,7 @@
#import <Cocoa/Cocoa.h>
#include "base/logging.h" // for NOTREACHED()
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#import "chrome/browser/ui/cocoa/animatable_view.h"
@@ -101,7 +101,7 @@
- (id)initWithDelegate:(InfoBarDelegate*)delegate {
DCHECK(delegate);
if ((self = [super initWithNibName:@"InfoBar"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
delegate_ = delegate;
}
return self;
diff --git a/chrome/browser/ui/cocoa/install_from_dmg.mm b/chrome/browser/ui/cocoa/install_from_dmg.mm
index d18e257..aa892cf 100644
--- a/chrome/browser/ui/cocoa/install_from_dmg.mm
+++ b/chrome/browser/ui/cocoa/install_from_dmg.mm
@@ -18,7 +18,7 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/logging.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "chrome/browser/ui/cocoa/authorization_util.h"
#include "chrome/browser/ui/cocoa/scoped_authorizationref.h"
@@ -409,7 +409,7 @@
}
NSString* installer_path =
- [mac_util::MainAppBundle() pathForResource:@"install" ofType:@"sh"];
+ [base::mac::MainAppBundle() pathForResource:@"install" ofType:@"sh"];
if (!installer_path) {
VLOG(1) << "Could not locate install.sh";
return false;
diff --git a/chrome/browser/ui/cocoa/instant_confirm_window_controller.mm b/chrome/browser/ui/cocoa/instant_confirm_window_controller.mm
index 299fd35..07405d6 100644
--- a/chrome/browser/ui/cocoa/instant_confirm_window_controller.mm
+++ b/chrome/browser/ui/cocoa/instant_confirm_window_controller.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/instant_confirm_window_controller.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/browser/instant/instant_confirm_dialog.h"
#include "chrome/browser/instant/instant_controller.h"
#include "chrome/browser/profiles/profile.h"
@@ -31,7 +31,7 @@
@implementation InstantConfirmWindowController
- (id)initWithProfile:(Profile*)profile {
- NSString* nibPath = [mac_util::MainAppBundle()
+ NSString* nibPath = [base::mac::MainAppBundle()
pathForResource:@"InstantConfirm"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm b/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm
index 5568d70..219c448 100644
--- a/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm
+++ b/chrome/browser/ui/cocoa/js_modal_dialog_cocoa.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -41,6 +41,7 @@
- (NSTextField*)textField {
textField_ = [[NSTextField alloc] initWithFrame:NSMakeRect(0, 0, 300, 22)];
+ [[textField_ cell] setLineBreakMode:NSLineBreakByTruncatingTail];
[alert_ setAccessoryView:textField_];
[textField_ release];
diff --git a/chrome/browser/ui/cocoa/keystone_glue.mm b/chrome/browser/ui/cocoa/keystone_glue.mm
index b42375a..8ac3daf 100644
--- a/chrome/browser/ui/cocoa/keystone_glue.mm
+++ b/chrome/browser/ui/cocoa/keystone_glue.mm
@@ -12,12 +12,12 @@
#include "app/l10n_util.h"
#import "app/l10n_util_mac.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/sys_string_conversions.h"
#include "base/ref_counted.h"
#include "base/task.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "chrome/browser/ui/cocoa/authorization_util.h"
#include "chrome/common/chrome_constants.h"
#include "grit/chromium_strings.h"
@@ -104,7 +104,7 @@
DCHECK(sel);
scoped_refptr<PerformBridge> op = new PerformBridge(target, sel, arg);
- WorkerPool::PostTask(
+ base::WorkerPool::PostTask(
FROM_HERE, NewRunnableMethod(op.get(), &PerformBridge::Run), true);
}
@@ -438,9 +438,9 @@
return NO;
// Load the KeystoneRegistration framework bundle if present. It lives
- // inside the framework, so use mac_util::MainAppBundle();
+ // inside the framework, so use base::mac::MainAppBundle();
NSString* ksrPath =
- [[mac_util::MainAppBundle() privateFrameworksPath]
+ [[base::mac::MainAppBundle() privateFrameworksPath]
stringByAppendingPathComponent:@"KeystoneRegistration.framework"];
NSBundle* ksrBundle = [NSBundle bundleWithPath:ksrPath];
[ksrBundle load];
@@ -722,7 +722,7 @@
// to files and directories.
NSFileManager* fileManager = [NSFileManager defaultManager];
NSString* executablePath = [[NSBundle mainBundle] executablePath];
- NSString* frameworkPath = [mac_util::MainAppBundle() bundlePath];
+ NSString* frameworkPath = [base::mac::MainAppBundle() bundlePath];
return ![fileManager isWritableFileAtPath:appPath_] ||
![fileManager isWritableFileAtPath:executablePath] ||
![fileManager isWritableFileAtPath:frameworkPath];
@@ -809,7 +809,7 @@
// However, preflight operation (and promotion) should only be asynchronous
// if the synchronous parameter is NO.
NSString* preflightPath =
- [mac_util::MainAppBundle() pathForResource:@"keystone_promote_preflight"
+ [base::mac::MainAppBundle() pathForResource:@"keystone_promote_preflight"
ofType:@"sh"];
const char* preflightPathC = [preflightPath fileSystemRepresentation];
const char* userBrandFile = NULL;
@@ -895,7 +895,7 @@
SEL selector = @selector(changePermissionsForPromotionWithTool:);
NSString* toolPath =
- [mac_util::MainAppBundle() pathForResource:@"keystone_promote_postflight"
+ [base::mac::MainAppBundle() pathForResource:@"keystone_promote_postflight"
ofType:@"sh"];
PerformBridge::PostPerform(self, selector, toolPath);
diff --git a/chrome/browser/ui/cocoa/keyword_editor_cocoa_controller.mm b/chrome/browser/ui/cocoa/keyword_editor_cocoa_controller.mm
index 1a0819f..2ae0fa6 100644
--- a/chrome/browser/ui/cocoa/keyword_editor_cocoa_controller.mm
+++ b/chrome/browser/ui/cocoa/keyword_editor_cocoa_controller.mm
@@ -6,7 +6,7 @@
#import "chrome/browser/ui/cocoa/keyword_editor_cocoa_controller.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/lazy_instance.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
@@ -146,7 +146,7 @@
- (id)initWithProfile:(Profile*)profile {
DCHECK(profile);
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:@"KeywordEditor"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
@@ -295,9 +295,9 @@
DCHECK(!tableColumn);
TableModel::Groups groups = controller_->table_model()->GetGroups();
if (row == 0) {
- return base::SysWideToNSString(groups[0].title);
+ return base::SysUTF16ToNSString(groups[0].title);
} else {
- return base::SysWideToNSString(groups[1].title);
+ return base::SysUTF16ToNSString(groups[1].title);
}
}
@@ -312,8 +312,8 @@
// The keyword object value is a normal string.
int index = [self indexInModelForRow:row];
int columnID = IDS_SEARCH_ENGINES_EDITOR_KEYWORD_COLUMN;
- std::wstring text = controller_->table_model()->GetText(index, columnID);
- return base::SysWideToNSString(text);
+ string16 text = controller_->table_model()->GetText(index, columnID);
+ return base::SysUTF16ToNSString(text);
}
// And we shouldn't have any other columns...
@@ -357,9 +357,9 @@
if ([[tableColumn identifier] isEqualToString:@"name"]) {
DCHECK([cell isKindOfClass:[NSButtonCell class]]);
NSButtonCell* buttonCell = static_cast<NSButtonCell*>(cell);
- std::wstring title = controller_->table_model()->GetText(offsetRow,
+ string16 title = controller_->table_model()->GetText(offsetRow,
IDS_SEARCH_ENGINES_EDITOR_DESCRIPTION_COLUMN);
- [buttonCell setTitle:base::SysWideToNSString(title)];
+ [buttonCell setTitle:base::SysUTF16ToNSString(title)];
[buttonCell setImage:observer_->GetImageForRow(offsetRow)];
[buttonCell setRefusesFirstResponder:YES]; // Don't push in like a button.
[buttonCell setHighlightsBy:NSNoCellMask];
diff --git a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
index 1598cad..845835a 100644
--- a/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
+++ b/chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm
@@ -6,6 +6,7 @@
#include "app/resource_bundle.h"
#include "base/scoped_nsobject.h"
+#include "base/utf_string_conversions.h"
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h"
#import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h"
@@ -133,7 +134,7 @@
KeywordHintDecoration keyword_hint_decoration([view_ font]);
keyword_hint_decoration.SetVisible(true);
- keyword_hint_decoration.SetKeyword(std::wstring(L"google"), false);
+ keyword_hint_decoration.SetKeyword(ASCIIToUTF16("google"), false);
[cell addRightDecoration:&keyword_hint_decoration];
EXPECT_NE(keyword_hint_decoration.GetWidthForSpace(kVeryWide),
LocationBarDecoration::kOmittedWidth);
diff --git a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
index 523eb6f..48abf2e 100644
--- a/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/content_setting_decoration.mm
@@ -188,8 +188,8 @@
bool has_animated_text =
content_setting_image_model_->explanatory_string_id();
// Check if the animation is enabled.
- bool animation_enabled = CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBlockContentAnimation);
+ bool animation_enabled = !CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableBlockContentAnimation);
if (has_animated_text && animation_enabled && !animation_) {
// Start animation, its timer will drive reflow. Note the text is
// cached so it is not allowed to change during the animation.
diff --git a/chrome/browser/ui/cocoa/location_bar/instant_opt_in_controller.mm b/chrome/browser/ui/cocoa/location_bar/instant_opt_in_controller.mm
index 17b0d15..9750caf 100644
--- a/chrome/browser/ui/cocoa/location_bar/instant_opt_in_controller.mm
+++ b/chrome/browser/ui/cocoa/location_bar/instant_opt_in_controller.mm
@@ -4,13 +4,13 @@
#import "chrome/browser/ui/cocoa/location_bar/instant_opt_in_controller.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
@implementation InstantOptInController
- (id)initWithDelegate:(InstantOptInControllerDelegate*)delegate {
if ((self = [super initWithNibName:@"InstantOptIn"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
delegate_ = delegate;
}
return self;
diff --git a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h
index 3b8c607..da8c42b 100644
--- a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h
+++ b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h
@@ -11,6 +11,7 @@
#import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
#import "base/scoped_nsobject.h"
+#include "base/string16.h"
// Draws the keyword hint, "Press [tab] to search <site>".
@@ -21,7 +22,7 @@
// Calculates the message to display and where to place the [tab]
// image.
- void SetKeyword(const std::wstring& keyword, bool is_extension_keyword);
+ void SetKeyword(const string16& keyword, bool is_extension_keyword);
// Implement |LocationBarDecoration|.
virtual void DrawInFrame(NSRect frame, NSView* control_view);
diff --git a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm
index 0b08031..767092b 100644
--- a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm
+++ b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.mm
@@ -34,10 +34,10 @@
// Helper to convert |s| to an |NSString|, trimming whitespace at
// ends.
-NSString* TrimAndConvert(const std::wstring& s) {
- std::wstring output;
+NSString* TrimAndConvert(const string16& s) {
+ string16 output;
TrimWhitespace(s, TRIM_ALL, &output);
- return base::SysWideToNSString(output);
+ return base::SysUTF16ToNSString(output);
}
} // namespace
@@ -65,7 +65,7 @@
return hint_image_;
}
-void KeywordHintDecoration::SetKeyword(const std::wstring& short_name,
+void KeywordHintDecoration::SetKeyword(const string16& short_name,
bool is_extension_keyword) {
// KEYWORD_HINT is a message like "Press [tab] to search <site>".
// [tab] is a parameter to be replaced by an image. "<site>" is
@@ -73,10 +73,10 @@
std::vector<size_t> content_param_offsets;
int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT;
- const std::wstring keyword_hint(
- l10n_util::GetStringF(message_id,
- std::wstring(), short_name,
- &content_param_offsets));
+ const string16 keyword_hint(
+ l10n_util::GetStringFUTF16(message_id,
+ string16(), short_name,
+ &content_param_offsets));
// Should always be 2 offsets, see the comment in
// location_bar_view.cc after IDS_OMNIBOX_KEYWORD_HINT fetch.
diff --git a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration_unittest.mm b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration_unittest.mm
index bfcf454..12ac5d8 100644
--- a/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration_unittest.mm
+++ b/chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration_unittest.mm
@@ -6,6 +6,7 @@
#import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h"
+#include "base/utf_string_conversions.h"
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -22,7 +23,7 @@
TEST_F(KeywordHintDecorationTest, GetWidthForSpace) {
decoration_.SetVisible(true);
- decoration_.SetKeyword(std::wstring(L"Google"), false);
+ decoration_.SetKeyword(ASCIIToUTF16("google"), false);
const CGFloat kVeryWide = 1000.0;
const CGFloat kFairlyWide = 100.0; // Estimate for full hint space.
diff --git a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
index d433822..91753c3 100644
--- a/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
+++ b/chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm
@@ -301,7 +301,7 @@
}
}
- if (browser_->instant())
+ if (browser_->instant() && !edit_view_->model()->popup_model()->IsOpen())
browser_->instant()->DestroyPreviewContents();
update_instant_ = true;
@@ -680,7 +680,8 @@
std::wstring label(toolbar_model_->GetEVCertName());
ev_bubble_decoration_->SetFullLabel(base::SysWideToNSString(label));
} else if (!keyword.empty() && is_keyword_hint) {
- keyword_hint_decoration_->SetKeyword(short_name, is_extension_keyword);
+ keyword_hint_decoration_->SetKeyword(WideToUTF16Hack(short_name),
+ is_extension_keyword);
keyword_hint_decoration_->SetVisible(true);
}
diff --git a/chrome/browser/ui/cocoa/menu_button.h b/chrome/browser/ui/cocoa/menu_button.h
index d7b00f5..93b1116 100644
--- a/chrome/browser/ui/cocoa/menu_button.h
+++ b/chrome/browser/ui/cocoa/menu_button.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,9 +13,20 @@
// This a button which displays a user-provided menu "attached" below it upon
// being clicked or dragged (or clicked and held). It expects a
// |ClickHoldButtonCell| as cell.
+//
+// There are two different behaviors of this button depending on the value of
+// the |openMenuOnClick| property. If YES, the target-action mechanism will be
+// handled internally to always show the menu when clicked. This behavior is
+// used for the Wrench menu, for example. When the property is NO, the button
+// can have a separate target-action but will open the menu when clicked and
+// held. This is used for the toolbar back/forward buttons, which have a
+// primary action and the menu as a secondary click-hold action. The default
+// value is NO so that custom actions can be hooked up in Interface Builder.
@interface MenuButton : NSButton {
@private
- IBOutlet NSMenu* attachedMenu_;
+ scoped_nsobject<NSMenu> attachedMenu_;
+ BOOL attachedMenuEnabled_;
+ BOOL openMenuOnClick_;
scoped_nsobject<NSPopUpButtonCell> popUpCell_;
}
@@ -25,8 +36,17 @@
// in the button. This might change if we ever switch to a pop-up. Our direct
// use of the given NSMenu object means that the one can set and use NSMenu's
// delegate as usual.)
-@property(assign, nonatomic) NSMenu* attachedMenu;
+@property (retain, nonatomic) IBOutlet NSMenu* attachedMenu;
+
+// Whether or not to open the menu when the button is clicked. Otherwise, the
+// menu will only be opened when clicked and held.
+@property (assign, nonatomic) BOOL openMenuOnClick;
@end // @interface MenuButton
+// Available for subclasses.
+@interface MenuButton (Protected)
+- (void)configureCell;
+@end
+
#endif // CHROME_BROWSER_UI_COCOA_MENU_BUTTON_H_
diff --git a/chrome/browser/ui/cocoa/menu_button.mm b/chrome/browser/ui/cocoa/menu_button.mm
index d1b9e88..c66b8d2 100644
--- a/chrome/browser/ui/cocoa/menu_button.mm
+++ b/chrome/browser/ui/cocoa/menu_button.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,16 +9,15 @@
#import "chrome/browser/ui/cocoa/clickhold_button_cell.h"
@interface MenuButton (Private)
-
-- (void)resetToDefaults;
- (void)showMenu:(BOOL)isDragging;
- (void)clickShowMenu:(id)sender;
- (void)dragShowMenu:(id)sender;
-
@end // @interface MenuButton (Private)
@implementation MenuButton
+@synthesize openMenuOnClick = openMenuOnClick_;
+
// Overrides:
+ (Class)cellClass {
@@ -27,25 +26,57 @@
- (id)init {
if ((self = [super init]))
- [self resetToDefaults];
+ [self configureCell];
return self;
}
- (id)initWithCoder:(NSCoder*)decoder {
if ((self = [super initWithCoder:decoder]))
- [self resetToDefaults];
+ [self configureCell];
return self;
}
- (id)initWithFrame:(NSRect)frameRect {
if ((self = [super initWithFrame:frameRect]))
- [self resetToDefaults];
+ [self configureCell];
return self;
}
+- (void)dealloc {
+ self.attachedMenu = nil;
+ [super dealloc];
+}
+
+- (void)awakeFromNib {
+ [self configureCell];
+}
+
+- (void)setCell:(NSCell*)cell {
+ [super setCell:cell];
+ [self configureCell];
+}
+
// Accessors and mutators:
-@synthesize attachedMenu = attachedMenu_;
+- (NSMenu*)attachedMenu {
+ return attachedMenu_.get();
+}
+
+- (void)setAttachedMenu:(NSMenu*)menu {
+ attachedMenu_.reset([menu retain]);
+ [[self cell] setEnableClickHold:(menu != nil)];
+}
+
+- (void)setOpenMenuOnClick:(BOOL)enabled {
+ openMenuOnClick_ = enabled;
+ if (enabled) {
+ [[self cell] setClickHoldTimeout:0.0]; // Make menu trigger immediately.
+ [[self cell] setAction:@selector(clickShowMenu:)];
+ [[self cell] setTarget:self];
+ } else {
+ [[self cell] setClickHoldTimeout:0.25]; // Default value.
+ }
+}
@end // @implementation MenuButton
@@ -53,15 +84,12 @@
// Reset various settings of the button and its associated |ClickHoldButtonCell|
// to the standard state which provides reasonable defaults.
-- (void)resetToDefaults {
+- (void)configureCell {
ClickHoldButtonCell* cell = [self cell];
DCHECK([cell isKindOfClass:[ClickHoldButtonCell class]]);
- [cell setEnableClickHold:YES];
- [cell setClickHoldTimeout:0.0]; // Make menu trigger immediately.
- [cell setAction:@selector(clickShowMenu:)];
- [cell setTarget:self];
[cell setClickHoldAction:@selector(dragShowMenu:)];
[cell setClickHoldTarget:self];
+ [cell setEnableClickHold:([self attachedMenu] != nil)];
}
// Actually show the menu (in the correct location). |isDragging| indicates
@@ -79,8 +107,11 @@
return;
}
- // TODO(viettrungluu): Remove silly fudge factors (same ones as in
- // delayedmenu_button.mm).
+ // TODO(viettrungluu): We have some fudge factors below to make things line up
+ // (approximately). I wish I knew how to get rid of them. (Note that our view
+ // is flipped, and that frame should be in our coordinates.) The y/height is
+ // very odd, since it doesn't seem to respond to changes the way that it
+ // should. I don't understand it.
NSRect frame = [self convertRect:[self frame]
fromView:[self superview]];
frame.origin.x -= 2.0;
@@ -111,11 +142,16 @@
// Called when the button is clicked and released. (Shouldn't happen with
// timeout of 0, though there may be some strange pointing devices out there.)
- (void)clickShowMenu:(id)sender {
+ // This should only be called if openMenuOnClick has been set (which hooks
+ // up this target-action).
+ DCHECK(openMenuOnClick_);
[self showMenu:NO];
}
// Called when the button is clicked and dragged/held.
- (void)dragShowMenu:(id)sender {
+ // We shouldn't get here unless the menu is enabled.
+ DCHECK([self attachedMenu]);
[self showMenu:YES];
}
diff --git a/chrome/browser/ui/cocoa/menu_button_unittest.mm b/chrome/browser/ui/cocoa/menu_button_unittest.mm
index ccfcb2c..8adceb4 100644
--- a/chrome/browser/ui/cocoa/menu_button_unittest.mm
+++ b/chrome/browser/ui/cocoa/menu_button_unittest.mm
@@ -1,12 +1,60 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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 "base/mac/cocoa_protocols.h"
#include "base/scoped_nsobject.h"
#import "chrome/browser/ui/cocoa/clickhold_button_cell.h"
#import "chrome/browser/ui/cocoa/cocoa_test_helper.h"
#import "chrome/browser/ui/cocoa/menu_button.h"
+@interface MenuButtonTestDelegate : NSObject<NSMenuDelegate> {
+ @private
+ scoped_nsobject<NSMenu> menu_;
+ BOOL open_;
+ BOOL didOpen_;
+}
+- (BOOL)isOpen;
+- (BOOL)didOpen;
+@end
+
+@implementation MenuButtonTestDelegate
+- (id)initWithMenu:(NSMenu*)menu {
+ if ((self = [super init])) {
+ menu_.reset([menu retain]);
+ }
+ return self;
+}
+
+- (BOOL)isOpen {
+ return open_;
+}
+
+- (BOOL)didOpen {
+ return didOpen_;
+}
+
+- (void)menuWillOpen:(NSMenu*)menu {
+ EXPECT_EQ(menu_.get(), menu);
+ EXPECT_FALSE(open_);
+ open_ = YES;
+ didOpen_ = YES;
+ NSArray* modes = [NSArray arrayWithObjects:NSEventTrackingRunLoopMode,
+ NSDefaultRunLoopMode,
+ nil];
+ [menu performSelector:@selector(cancelTracking)
+ withObject:nil
+ afterDelay:1.5
+ inModes:modes];
+}
+
+- (void)menuDidClose:(NSMenu*)menu {
+ EXPECT_EQ(menu_.get(), menu);
+ EXPECT_TRUE(open_);
+ open_ = NO;
+}
+@end
+
namespace {
class MenuButtonTest : public CocoaTest {
@@ -22,6 +70,15 @@
[[test_window() contentView] addSubview:button_];
}
+ NSMenu* CreateMenu() {
+ NSMenu* menu = [[NSMenu alloc] initWithTitle:@""];
+ [menu insertItemWithTitle:@"" action:nil keyEquivalent:@"" atIndex:0];
+ [menu insertItemWithTitle:@"foo" action:nil keyEquivalent:@"" atIndex:1];
+ [menu insertItemWithTitle:@"bar" action:nil keyEquivalent:@"" atIndex:2];
+ [menu insertItemWithTitle:@"baz" action:nil keyEquivalent:@"" atIndex:3];
+ return menu;
+ }
+
MenuButton* button_;
};
@@ -29,22 +86,33 @@
// Test assigning a menu, again mostly to ensure nothing leaks or crashes.
TEST_F(MenuButtonTest, MenuAssign) {
- scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
+ scoped_nsobject<NSMenu> menu(CreateMenu());
ASSERT_TRUE(menu.get());
- [menu insertItemWithTitle:@"" action:nil keyEquivalent:@"" atIndex:0];
- [menu insertItemWithTitle:@"foo" action:nil keyEquivalent:@"" atIndex:1];
- [menu insertItemWithTitle:@"bar" action:nil keyEquivalent:@"" atIndex:2];
- [menu insertItemWithTitle:@"baz" action:nil keyEquivalent:@"" atIndex:3];
-
[button_ setAttachedMenu:menu];
EXPECT_TRUE([button_ attachedMenu]);
+}
- // TODO(viettrungluu): Display the menu. (The tough part is closing the menu,
- // not opening it!)
+TEST_F(MenuButtonTest, OpenOnClick) {
+ scoped_nsobject<NSMenu> menu(CreateMenu());
+ ASSERT_TRUE(menu.get());
- // Since |button_| doesn't retain menu, we should probably unset it here.
- [button_ setAttachedMenu:nil];
+ scoped_nsobject<MenuButtonTestDelegate> delegate(
+ [[MenuButtonTestDelegate alloc] initWithMenu:menu.get()]);
+ ASSERT_TRUE(delegate.get());
+
+ [menu setDelegate:delegate.get()];
+ [button_ setAttachedMenu:menu];
+ [button_ setOpenMenuOnClick:YES];
+
+ EXPECT_FALSE([delegate isOpen]);
+ EXPECT_FALSE([delegate didOpen]);
+
+ // Should open the menu.
+ [button_ performClick:nil];
+
+ EXPECT_TRUE([delegate didOpen]);
+ EXPECT_FALSE([delegate isOpen]);
}
} // namespace
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller.h b/chrome/browser/ui/cocoa/notifications/balloon_controller.h
index 61376b4..fadd35a 100644
--- a/chrome/browser/ui/cocoa/notifications/balloon_controller.h
+++ b/chrome/browser/ui/cocoa/notifications/balloon_controller.h
@@ -52,9 +52,6 @@
// The host for the renderer of the HTML contents.
scoped_ptr<BalloonViewHost> htmlContents_;
-
- // The psn of the front application process.
- ProcessSerialNumber frontProcessNum_;
}
// Initialize with a balloon object containing the notification data.
@@ -86,9 +83,6 @@
// The BalloonHost
- (BalloonViewHost*)getHost;
-
-// Handle the event if it is for the balloon.
-- (BOOL)handleEvent:(NSEvent*)event;
@end
@interface BalloonController (UnitTesting)
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller.mm b/chrome/browser/ui/cocoa/notifications/balloon_controller.mm
index f0d914e..6fca0a1 100644
--- a/chrome/browser/ui/cocoa/notifications/balloon_controller.mm
+++ b/chrome/browser/ui/cocoa/notifications/balloon_controller.mm
@@ -8,7 +8,7 @@
#include "app/mac/nsimage_cache.h"
#include "app/resource_bundle.h"
#import "base/mac/cocoa_protocols.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import "base/scoped_nsobject.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/notifications/balloon.h"
@@ -43,7 +43,7 @@
- (id)initWithBalloon:(Balloon*)balloon {
NSString* nibpath =
- [mac_util::MainAppBundle() pathForResource:@"Notification"
+ [base::mac::MainAppBundle() pathForResource:@"Notification"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
balloon_ = balloon;
@@ -113,45 +113,12 @@
assumeInside:NO];
}
-- (BOOL)handleEvent:(NSEvent*)event {
- BOOL eventHandled = NO;
- if ([event type] == NSLeftMouseDown) {
- NSPoint mouse = [shelf_ convertPoint:[event locationInWindow]
- fromView:nil];
- if (NSPointInRect(mouse, [closeButton_ frame])) {
- [closeButton_ mouseDown:event];
-
- // Bring back the front process that is deactivated when we click the
- // close button.
- if (frontProcessNum_.highLongOfPSN || frontProcessNum_.lowLongOfPSN) {
- SetFrontProcessWithOptions(&frontProcessNum_,
- kSetFrontProcessFrontWindowOnly);
- frontProcessNum_.highLongOfPSN = 0;
- frontProcessNum_.lowLongOfPSN = 0;
- }
-
- eventHandled = YES;
- } else if (NSPointInRect(mouse, [optionsButton_ frame])) {
- [optionsButton_ mouseDown:event];
- eventHandled = YES;
- }
- }
- return eventHandled;
-}
-
- (void) mouseEntered:(NSEvent*)event {
[[closeButton_ cell] setHighlighted:YES];
-
- // Remember the current front process so that we can bring it back later.
- if (!frontProcessNum_.highLongOfPSN && !frontProcessNum_.lowLongOfPSN)
- GetFrontProcess(&frontProcessNum_);
}
- (void) mouseExited:(NSEvent*)event {
[[closeButton_ cell] setHighlighted:NO];
-
- frontProcessNum_.highLongOfPSN = 0;
- frontProcessNum_.lowLongOfPSN = 0;
}
- (IBAction)optionsButtonPressed:(id)sender {
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm b/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
index a63a327..3b168ef 100644
--- a/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/notifications/balloon_controller_unittest.mm
@@ -34,8 +34,9 @@
virtual bool RemoveBySourceOrigin(const GURL& origin) { return false; }
virtual void RemoveAll() {}
virtual bool HasSpace() const { return true; }
- virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size) {};
+ virtual void ResizeBalloon(Balloon* balloon, const gfx::Size& size) {}
virtual void DisplayChanged() {}
+ virtual void SetPositionPreference(PositionPreference preference) {}
virtual void OnBalloonClosed(Balloon* source) {};
virtual const Balloons& GetActiveBalloons() {
NOTREACHED();
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_view.h b/chrome/browser/ui/cocoa/notifications/balloon_view.h
index b742eaf..916bcec 100644
--- a/chrome/browser/ui/cocoa/notifications/balloon_view.h
+++ b/chrome/browser/ui/cocoa/notifications/balloon_view.h
@@ -24,5 +24,12 @@
}
@end
+// This view overlays the notification balloon on top. It is used to intercept
+// mouse input to prevent reordering of the other browser windows when clicking
+// on the notification balloon.
+@interface BalloonOverlayViewCocoa : NSView {
+}
+@end
+
#endif // CHROME_BROWSER_UI_COCOA_NOTIFICATIONS_BALLOON_VIEW_H_
diff --git a/chrome/browser/ui/cocoa/notifications/balloon_view.mm b/chrome/browser/ui/cocoa/notifications/balloon_view.mm
index e88331a..aa78be6 100644
--- a/chrome/browser/ui/cocoa/notifications/balloon_view.mm
+++ b/chrome/browser/ui/cocoa/notifications/balloon_view.mm
@@ -37,16 +37,6 @@
- (BOOL)canBecomeMainWindow {
return NO;
}
-
-- (void)sendEvent:(NSEvent*)event {
- // We do not want to bring chrome window to foreground when we click on close
- // or option button. To do this, we have to intercept the event.
- BalloonController* delegate =
- static_cast<BalloonController*>([self delegate]);
- if (![delegate handleEvent:event]) {
- [super sendEvent:event];
- }
-}
@end
@implementation BalloonShelfViewCocoa
@@ -82,3 +72,21 @@
[path stroke];
}
@end
+
+@implementation BalloonOverlayViewCocoa
+
+// We do not want to bring chrome window to foreground when we click on any
+// part of the notification balloon. To do this, we first postpone the window
+// reorder here (shouldDelayWindowOrderingForEvent is called during mouseDown)
+// and then complete canceling the reorder by [NSApp preventWindowOrdering] in
+// mouseDown handler of this view.
+- (BOOL)shouldDelayWindowOrderingForEvent:(NSEvent*)theEvent {
+ return YES;
+}
+
+- (void)mouseDown:(NSEvent*)event {
+ [NSApp preventWindowOrdering];
+ // Continue bubbling the event up the chain of responders.
+ [super mouseDown:event];
+}
+@end
diff --git a/chrome/browser/ui/cocoa/nsimage_cache_unittest.mm b/chrome/browser/ui/cocoa/nsimage_cache_unittest.mm
index b00fb5b..5425125 100644
--- a/chrome/browser/ui/cocoa/nsimage_cache_unittest.mm
+++ b/chrome/browser/ui/cocoa/nsimage_cache_unittest.mm
@@ -6,7 +6,7 @@
#include "app/mac/nsimage_cache.h"
#include "base/file_path.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/path_service.h"
#include "chrome/common/chrome_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -24,10 +24,10 @@
FilePath path;
PathService::Get(base::DIR_EXE, &path);
path = path.Append(chrome::kFrameworkName);
- mac_util::SetOverrideAppBundlePath(path);
+ base::mac::SetOverrideAppBundlePath(path);
}
virtual ~NSImageCacheTest() {
- mac_util::SetOverrideAppBundle(nil);
+ base::mac::SetOverrideAppBundle(nil);
}
};
diff --git a/chrome/browser/ui/cocoa/objc_zombie.mm b/chrome/browser/ui/cocoa/objc_zombie.mm
index 6802fd2..5cf6469 100644
--- a/chrome/browser/ui/cocoa/objc_zombie.mm
+++ b/chrome/browser/ui/cocoa/objc_zombie.mm
@@ -205,7 +205,7 @@
LOG(ERROR) << [aString UTF8String];
// This is how about:crash is implemented. Using instead of
- // |DebugUtil::BreakDebugger()| or |LOG(FATAL)| to make the top of
+ // |baes::debug::BreakDebugger()| or |LOG(FATAL)| to make the top of
// stack more immediately obvious in crash dumps.
int* zero = NULL;
*zero = 0;
diff --git a/chrome/browser/ui/cocoa/preferences_window_controller.mm b/chrome/browser/ui/cocoa/preferences_window_controller.mm
index d582680..950ec7b 100644
--- a/chrome/browser/ui/cocoa/preferences_window_controller.mm
+++ b/chrome/browser/ui/cocoa/preferences_window_controller.mm
@@ -10,7 +10,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_aedesc.h"
#include "base/string16.h"
#include "base/string_util.h"
@@ -489,7 +489,7 @@
DCHECK(profile);
// Use initWithWindowNibPath:: instead of initWithWindowNibName: so we
// can override it in a unit test.
- NSString* nibPath = [mac_util::MainAppBundle()
+ NSString* nibPath = [base::mac::MainAppBundle()
pathForResource:@"Preferences"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath owner:self])) {
@@ -675,9 +675,10 @@
verticalShift += AutoSizeGroup(basicsGroupDefaultBrowser_,
kAutoSizeGroupBehaviorVerticalFirstToFit,
verticalShift);
- verticalShift += AutoSizeGroup(basicsGroupSearchEngine_,
- kAutoSizeGroupBehaviorFirstTwoAsRowVerticalToFit,
- verticalShift);
+ verticalShift += AutoSizeGroup(
+ basicsGroupSearchEngine_,
+ kAutoSizeGroupBehaviorFirstTwoAsRowVerticalToFit,
+ verticalShift);
verticalShift += AutoSizeGroup(basicsGroupToolbar_,
kAutoSizeGroupBehaviorVerticalToFit,
verticalShift);
diff --git a/chrome/browser/ui/cocoa/previewable_contents_controller.mm b/chrome/browser/ui/cocoa/previewable_contents_controller.mm
index 2dfa146..74e29b0 100644
--- a/chrome/browser/ui/cocoa/previewable_contents_controller.mm
+++ b/chrome/browser/ui/cocoa/previewable_contents_controller.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/previewable_contents_controller.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@implementation PreviewableContentsController
@@ -14,7 +14,7 @@
- (id)init {
if ((self = [super initWithNibName:@"PreviewableContents"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
}
return self;
}
diff --git a/chrome/browser/ui/cocoa/sad_tab_controller.mm b/chrome/browser/ui/cocoa/sad_tab_controller.mm
index ba0b102..e340a9c 100644
--- a/chrome/browser/ui/cocoa/sad_tab_controller.mm
+++ b/chrome/browser/ui/cocoa/sad_tab_controller.mm
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/cocoa/sad_tab_controller.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import "chrome/browser/ui/cocoa/sad_tab_view.h"
@implementation SadTabController
@@ -12,7 +12,7 @@
- (id)initWithTabContents:(TabContents*)someTabContents
superview:(NSView*)superview {
if ((self = [super initWithNibName:@"SadTab"
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
tabContents_ = someTabContents;
NSView* view = [self view];
diff --git a/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm b/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm
index 2a79e09..fa53295 100644
--- a/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm
+++ b/chrome/browser/ui/cocoa/search_engine_dialog_controller.mm
@@ -8,7 +8,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "base/time.h"
#include "chrome/browser/profiles/profile.h"
@@ -68,7 +68,7 @@
- (id)init {
NSString* nibpath =
- [mac_util::MainAppBundle() pathForResource:@"SearchEngineDialog"
+ [base::mac::MainAppBundle() pathForResource:@"SearchEngineDialog"
ofType:@"nib"];
self = [super initWithWindowNibPath:nibpath owner:self];
if (self != nil) {
diff --git a/chrome/browser/ui/cocoa/shell_dialogs_mac.mm b/chrome/browser/ui/cocoa/shell_dialogs_mac.mm
index 257bb62..24b1bc9 100644
--- a/chrome/browser/ui/cocoa/shell_dialogs_mac.mm
+++ b/chrome/browser/ui/cocoa/shell_dialogs_mac.mm
@@ -15,11 +15,11 @@
#include "base/file_util.h"
#include "base/logging.h"
#import "base/mac/cocoa_protocols.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#import "base/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "grit/generated_resources.h"
static const int kFileTypePopupTag = 1234;
@@ -36,7 +36,7 @@
- (id)initWithSelectFileDialogImpl:(SelectFileDialogImpl*)s;
- (void)endedPanel:(NSSavePanel*)panel
withReturn:(int)returnCode
- context:(void *)context;
+ context:(void*)context;
// NSSavePanel delegate method
- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
@@ -126,7 +126,7 @@
for (std::vector<NSSavePanel*>::iterator it = panels.begin();
it != panels.end(); ++it) {
- [(*it) cancel:nil];
+ [*it cancel:*it];
}
}
@@ -216,8 +216,8 @@
SheetContext* context = new SheetContext;
// |context| should never be NULL, but we are seeing indications otherwise.
- // |This CHECK is here to confirm if we are actually getting NULL
- // ||context|s. http://crbug.com/58959
+ // This CHECK is here to confirm if we are actually getting NULL
+ // |context|s. http://crbug.com/58959
CHECK(context);
context->type = type;
context->owning_window = owning_window;
@@ -289,7 +289,7 @@
DCHECK(file_types);
scoped_nsobject<NSNib> nib (
[[NSNib alloc] initWithNibNamed:@"SaveAccessoryView"
- bundle:mac_util::MainAppBundle()]);
+ bundle:base::mac::MainAppBundle()]);
if (!nib)
return nil;
@@ -361,7 +361,7 @@
- (void)endedPanel:(NSSavePanel*)panel
withReturn:(int)returnCode
- context:(void *)context {
+ context:(void*)context {
// |context| should never be NULL, but we are seeing indications otherwise.
// |This CHECK is here to confirm if we are actually getting NULL
// ||context|s. http://crbug.com/58959
diff --git a/chrome/browser/ui/cocoa/simple_content_exceptions_window_controller.mm b/chrome/browser/ui/cocoa/simple_content_exceptions_window_controller.mm
index 7beac9c..7b4c1f8 100644
--- a/chrome/browser/ui/cocoa/simple_content_exceptions_window_controller.mm
+++ b/chrome/browser/ui/cocoa/simple_content_exceptions_window_controller.mm
@@ -7,7 +7,7 @@
#include "app/l10n_util_mac.h"
#include "app/table_model_observer.h"
#include "base/logging.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#import "base/scoped_nsobject.h"
#include "base/sys_string_conversions.h"
#include "grit/generated_resources.h"
@@ -36,7 +36,7 @@
}
- (id)initWithTableModel:(RemoveRowsTableModel*)model {
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:@"SimpleContentExceptionsWindow"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/speech_input_window_controller.mm b/chrome/browser/ui/cocoa/speech_input_window_controller.mm
index c490bc1..abb9128 100644
--- a/chrome/browser/ui/cocoa/speech_input_window_controller.mm
+++ b/chrome/browser/ui/cocoa/speech_input_window_controller.mm
@@ -7,9 +7,7 @@
#include "app/l10n_util_mac.h"
#include "app/resource_bundle.h"
#include "base/logging.h"
-#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
-
#include "chrome/browser/ui/cocoa/info_bubble_view.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
diff --git a/chrome/browser/ui/cocoa/status_bubble_mac.mm b/chrome/browser/ui/cocoa/status_bubble_mac.mm
index 6231e5d..685096d 100644
--- a/chrome/browser/ui/cocoa/status_bubble_mac.mm
+++ b/chrome/browser/ui/cocoa/status_bubble_mac.mm
@@ -613,7 +613,7 @@
// Scale width from gfx::Font in view coordinates to window coordinates.
int required_width_for_string =
- font_chr.GetStringWidth(UTF16ToWide(expanded_url)) +
+ font_chr.GetStringWidth(expanded_url) +
kTextPadding * 2 + kBubbleViewTextPositionX;
NSSize scaled_width = NSMakeSize(required_width_for_string, 0);
scaled_width = [[parent_ contentView] convertSize:scaled_width toView:nil];
diff --git a/chrome/browser/ui/cocoa/tab_contents_controller.mm b/chrome/browser/ui/cocoa/tab_contents_controller.mm
index c7b5cf8..f710755 100644
--- a/chrome/browser/ui/cocoa/tab_contents_controller.mm
+++ b/chrome/browser/ui/cocoa/tab_contents_controller.mm
@@ -4,7 +4,6 @@
#import "chrome/browser/ui/cocoa/tab_contents_controller.h"
-#include "base/mac_util.h"
#include "base/scoped_nsobject.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/renderer_host/render_widget_host_view.h"
diff --git a/chrome/browser/ui/cocoa/tab_controller.mm b/chrome/browser/ui/cocoa/tab_controller.mm
index 2ae2454..f05bb21 100644
--- a/chrome/browser/ui/cocoa/tab_controller.mm
+++ b/chrome/browser/ui/cocoa/tab_controller.mm
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#import "chrome/browser/themes/browser_theme_provider.h"
#import "chrome/browser/ui/cocoa/menu_controller.h"
#import "chrome/browser/ui/cocoa/tab_controller.h"
@@ -73,7 +73,7 @@
}
- (id)init {
- self = [super initWithNibName:@"TabView" bundle:mac_util::MainAppBundle()];
+ self = [super initWithNibName:@"TabView" bundle:base::mac::MainAppBundle()];
if (self != nil) {
isIconShowing_ = YES;
NSNotificationCenter* defaultCenter = [NSNotificationCenter defaultCenter];
diff --git a/chrome/browser/ui/cocoa/tab_strip_controller.mm b/chrome/browser/ui/cocoa/tab_strip_controller.mm
index 876067c..d9fb6fc 100644
--- a/chrome/browser/ui/cocoa/tab_strip_controller.mm
+++ b/chrome/browser/ui/cocoa/tab_strip_controller.mm
@@ -12,7 +12,6 @@
#include "app/l10n_util.h"
#include "app/mac/nsimage_cache.h"
#include "app/resource_bundle.h"
-#include "base/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/autocomplete/autocomplete.h"
@@ -431,7 +430,7 @@
+ (CGFloat)defaultIndentForControls {
// Default indentation leaves enough room so tabs don't overlap with the
// window controls.
- return 64.0;
+ return 68.0;
}
// Finds the TabContentsController associated with the given index into the tab
@@ -791,7 +790,6 @@
BOOL visible = [[tabStripView_ window] isVisible];
CGFloat offset = [self indentForControls];
- NSUInteger i = 0;
bool hasPlaceholderGap = false;
for (TabController* tab in tabArray_.get()) {
// Ignore a tab that is going through a close animation.
@@ -811,9 +809,8 @@
// If the tab is hidden, we consider it a new tab. We make it visible
// and animate it in.
BOOL newTab = [[tab view] isHidden];
- if (newTab) {
+ if (newTab)
[[tab view] setHidden:NO];
- }
if (isPlaceholder) {
// Move the current tab to the correct location instantly.
@@ -896,7 +893,6 @@
offset += NSWidth(tabFrame);
offset -= kTabOverlap;
}
- i++;
}
// Hide the new tab button if we're explicitly told to. It may already
@@ -909,10 +905,8 @@
// We've already ensured there's enough space for the new tab button
// so we don't have to check it against the available space. We do need
// to make sure we put it after any placeholder.
- newTabNewFrame.origin = NSMakePoint(offset, 0);
- newTabNewFrame.origin.x = MAX(newTabNewFrame.origin.x,
- NSMaxX(placeholderFrame_)) +
- kNewTabButtonOffset;
+ CGFloat maxTabX = MAX(offset, NSMaxX(placeholderFrame_) - kTabOverlap);
+ newTabNewFrame.origin = NSMakePoint(maxTabX + kNewTabButtonOffset, 0);
if ([tabContentsArray_ count])
[newTabButton_ setHidden:NO];
diff --git a/chrome/browser/ui/cocoa/tab_strip_view.mm b/chrome/browser/ui/cocoa/tab_strip_view.mm
index 2456362..857da65 100644
--- a/chrome/browser/ui/cocoa/tab_strip_view.mm
+++ b/chrome/browser/ui/cocoa/tab_strip_view.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/tab_strip_view.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "chrome/browser/themes/browser_theme_provider.h"
#import "chrome/browser/ui/cocoa/browser_window_controller.h"
#import "chrome/browser/ui/cocoa/tab_strip_controller.h"
@@ -156,7 +156,7 @@
// "short" as 0.8 seconds. (Measuring up-to-up isn't enough to properly
// detect double-clicks, but we're actually using Cocoa for that.)
if (clickCount == 2 && (timestamp - lastMouseUp_) < 0.8) {
- if (mac_util::ShouldWindowsMiniaturizeOnDoubleClick())
+ if (base::mac::ShouldWindowsMiniaturizeOnDoubleClick())
[[self window] performMiniaturize:self];
} else {
[super mouseUp:event];
diff --git a/chrome/browser/ui/cocoa/tab_view.mm b/chrome/browser/ui/cocoa/tab_view.mm
index 128b83f..0a655ad 100644
--- a/chrome/browser/ui/cocoa/tab_view.mm
+++ b/chrome/browser/ui/cocoa/tab_view.mm
@@ -5,7 +5,7 @@
#import "chrome/browser/ui/cocoa/tab_view.h"
#include "base/logging.h"
-#import "base/mac_util.h"
+#import "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "chrome/browser/accessibility/browser_accessibility_state.h"
#include "chrome/browser/themes/browser_theme_provider.h"
@@ -988,14 +988,14 @@
DCHECK(CFGetTypeID(dict) == CFDictionaryGetTypeID());
// Sanity check the ID.
- CFNumberRef otherIDRef = (CFNumberRef)mac_util::GetValueFromDictionary(
+ CFNumberRef otherIDRef = (CFNumberRef)base::mac::GetValueFromDictionary(
dict, kCGWindowNumber, CFNumberGetTypeID());
CGWindowID otherID;
if (otherIDRef &&
CFNumberGetValue(otherIDRef, kCGWindowIDCFNumberType, &otherID) &&
otherID == windowID) {
// And then get the workspace.
- CFNumberRef workspaceRef = (CFNumberRef)mac_util::GetValueFromDictionary(
+ CFNumberRef workspaceRef = (CFNumberRef)base::mac::GetValueFromDictionary(
dict, kCGWindowWorkspace, CFNumberGetTypeID());
if (!workspaceRef ||
!CFNumberGetValue(workspaceRef, kCFNumberIntType, &workspace)) {
diff --git a/chrome/browser/ui/cocoa/table_model_array_controller.mm b/chrome/browser/ui/cocoa/table_model_array_controller.mm
index e732127..02e573d 100644
--- a/chrome/browser/ui/cocoa/table_model_array_controller.mm
+++ b/chrome/browser/ui/cocoa/table_model_array_controller.mm
@@ -83,7 +83,7 @@
for (TableModel::Groups::const_iterator it = groups.begin();
it != groups.end(); ++it) {
NSDictionary* group = [NSDictionary dictionaryWithObjectsAndKeys:
- base::SysWideToNSString(it->title), groupTitle_.get(),
+ base::SysUTF16ToNSString(it->title), groupTitle_.get(),
[NSNumber numberWithBool:YES], kIsGroupRow,
nil];
[self addObject:group];
@@ -191,8 +191,8 @@
}
for (NSString* identifier in columns_.get()) {
int column_id = [[columns_ objectForKey:identifier] intValue];
- std::wstring text = model_->GetText(row, column_id);
- [dict setObject:base::SysWideToNSString(text) forKey:identifier];
+ string16 text = model_->GetText(row, column_id);
+ [dict setObject:base::SysUTF16ToNSString(text) forKey:identifier];
}
return dict;
}
diff --git a/chrome/browser/ui/cocoa/tabpose_window.mm b/chrome/browser/ui/cocoa/tabpose_window.mm
index 7f96f59..b9e4a3d 100644
--- a/chrome/browser/ui/cocoa/tabpose_window.mm
+++ b/chrome/browser/ui/cocoa/tabpose_window.mm
@@ -7,7 +7,7 @@
#import <QuartzCore/QuartzCore.h>
#include "app/resource_bundle.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/scoped_callback_factory.h"
#include "base/sys_string_conversions.h"
@@ -1020,7 +1020,7 @@
nsFavicon = defaultFavIcon;
}
base::mac::ScopedCFTypeRef<CGImageRef> favicon(
- mac_util::CopyNSImageToCGImage(nsFavicon));
+ base::mac::CopyNSImageToCGImage(nsFavicon));
CALayer* faviconLayer = [CALayer layer];
if (showZoom) {
diff --git a/chrome/browser/ui/cocoa/task_manager_mac.mm b/chrome/browser/ui/cocoa/task_manager_mac.mm
index c11564c..28cbba0 100644
--- a/chrome/browser/ui/cocoa/task_manager_mac.mm
+++ b/chrome/browser/ui/cocoa/task_manager_mac.mm
@@ -8,7 +8,7 @@
#include <vector>
#include "app/l10n_util_mac.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
#include "chrome/browser/browser_process.h"
#import "chrome/browser/ui/cocoa/window_size_autosaver.h"
@@ -103,7 +103,7 @@
@implementation TaskManagerWindowController
- (id)initWithTaskManagerObserver:(TaskManagerMac*)taskManagerObserver {
- NSString* nibpath = [mac_util::MainAppBundle()
+ NSString* nibpath = [base::mac::MainAppBundle()
pathForResource:@"TaskManager"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibpath owner:self])) {
diff --git a/chrome/browser/ui/cocoa/toolbar_controller.h b/chrome/browser/ui/cocoa/toolbar_controller.h
index 029f89d..4a815e6 100644
--- a/chrome/browser/ui/cocoa/toolbar_controller.h
+++ b/chrome/browser/ui/cocoa/toolbar_controller.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,7 +11,6 @@
#include "base/scoped_ptr.h"
#include "base/scoped_nsobject.h"
#import "chrome/browser/ui/cocoa/command_observer_bridge.h"
-#import "chrome/browser/ui/cocoa/delayedmenu_button.h"
#import "chrome/browser/ui/cocoa/url_drop_target.h"
#import "chrome/browser/ui/cocoa/view_resizer.h"
#include "chrome/browser/prefs/pref_member.h"
@@ -23,7 +22,6 @@
class Browser;
@class BrowserActionsController;
class CommandUpdater;
-@class DelayedMenuButton;
class LocationBar;
class LocationBarViewMac;
@class MenuButton;
@@ -49,8 +47,8 @@
// The ordering is important for unit tests. If new items are added or the
// ordering is changed, make sure to update |-toolbarViews| and the
// corresponding enum in the unit tests.
- IBOutlet DelayedMenuButton* backButton_;
- IBOutlet DelayedMenuButton* forwardButton_;
+ IBOutlet MenuButton* backButton_;
+ IBOutlet MenuButton* forwardButton_;
IBOutlet ReloadButton* reloadButton_;
IBOutlet NSButton* homeButton_;
IBOutlet MenuButton* wrenchButton_;
diff --git a/chrome/browser/ui/cocoa/toolbar_controller.mm b/chrome/browser/ui/cocoa/toolbar_controller.mm
index 1b953fd..3147738 100644
--- a/chrome/browser/ui/cocoa/toolbar_controller.mm
+++ b/chrome/browser/ui/cocoa/toolbar_controller.mm
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -12,7 +12,7 @@
#include "app/menus/accelerator_cocoa.h"
#include "app/menus/menu_model.h"
#include "app/resource_bundle.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/singleton.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -170,7 +170,7 @@
nibFileNamed:(NSString*)nibName {
DCHECK(model && commands && profile && [nibName length]);
if ((self = [super initWithNibName:nibName
- bundle:mac_util::MainAppBundle()])) {
+ bundle:base::mac::MainAppBundle()])) {
toolbarModel_ = model;
commands_ = commands;
profile_ = profile;
@@ -246,6 +246,8 @@
app::mac::GetCachedImageWithName(kWrenchButtonImageName)];
[self badgeWrenchMenuIfNeeded];
+ [wrenchButton_ setOpenMenuOnClick:YES];
+
[backButton_ setShowsBorderOnlyWhileMouseInside:YES];
[forwardButton_ setShowsBorderOnlyWhileMouseInside:YES];
[reloadButton_ setShowsBorderOnlyWhileMouseInside:YES];
diff --git a/chrome/browser/ui/cocoa/translate/translate_infobar_base.mm b/chrome/browser/ui/cocoa/translate/translate_infobar_base.mm
index 4a08895..a91cd11 100644
--- a/chrome/browser/ui/cocoa/translate/translate_infobar_base.mm
+++ b/chrome/browser/ui/cocoa/translate/translate_infobar_base.mm
@@ -7,7 +7,6 @@
#include "app/l10n_util.h"
#include "base/logging.h"
-#include "base/mac_util.h"
#include "base/metrics/histogram.h"
#include "base/sys_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
diff --git a/chrome/browser/ui/cocoa/web_drag_source.mm b/chrome/browser/ui/cocoa/web_drag_source.mm
index 1fb4c7f..24c121a 100644
--- a/chrome/browser/ui/cocoa/web_drag_source.mm
+++ b/chrome/browser/ui/cocoa/web_drag_source.mm
@@ -9,7 +9,7 @@
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_manager.h"
diff --git a/chrome/browser/ui/input_window_dialog_gtk.cc b/chrome/browser/ui/input_window_dialog_gtk.cc
index 1530701..87696bb 100644
--- a/chrome/browser/ui/input_window_dialog_gtk.cc
+++ b/chrome/browser/ui/input_window_dialog_gtk.cc
@@ -59,6 +59,7 @@
delegate_(delegate) {
gtk_dialog_set_default_response(GTK_DIALOG(dialog_), GTK_RESPONSE_ACCEPT);
gtk_dialog_set_has_separator(GTK_DIALOG(dialog_), FALSE);
+ gtk_window_set_resizable(GTK_WINDOW(dialog_), FALSE);
GtkWidget* content_area = GTK_DIALOG(dialog_)->vbox;
gtk_box_set_spacing(GTK_BOX(content_area), 18);
diff --git a/chrome/browser/ui/input_window_dialog_win.cc b/chrome/browser/ui/input_window_dialog_win.cc
index f6b8511..63b5255 100644
--- a/chrome/browser/ui/input_window_dialog_win.cc
+++ b/chrome/browser/ui/input_window_dialog_win.cc
@@ -77,8 +77,8 @@
// views::Textfield::Controller overrides:
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield*,
- const views::Textfield::Keystroke&) {
+ virtual bool HandleKeyEvent(views::Textfield*,
+ const views::KeyEvent&) {
return false;
}
diff --git a/chrome/browser/ui/login/login_prompt.cc b/chrome/browser/ui/login/login_prompt.cc
index d653457..e58d53a 100644
--- a/chrome/browser/ui/login/login_prompt.cc
+++ b/chrome/browser/ui/login/login_prompt.cc
@@ -116,7 +116,9 @@
void LoginHandler::SetAuth(const std::wstring& username,
const std::wstring& password) {
- if (WasAuthHandled(true))
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ if (TestAndSetAuthHandled())
return;
// Tell the password manager the credentials were submitted / accepted.
@@ -126,30 +128,40 @@
password_manager_->ProvisionallySavePassword(password_form_);
}
+ // Calling NotifyAuthSupplied() directly instead of posting a task
+ // allows other LoginHandler instances to queue their
+ // CloseContentsDeferred() before ours. Closing dialogs in the
+ // opposite order as they were created avoids races where remaining
+ // dialogs in the same tab may be briefly displayed to the user
+ // before they are removed.
+ NotifyAuthSupplied(username, password);
+
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &LoginHandler::CloseContentsDeferred));
BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(
- this, &LoginHandler::NotifyAuthSupplied, username, password));
- BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(
this, &LoginHandler::SetAuthDeferred, username, password));
}
void LoginHandler::CancelAuth() {
- if (WasAuthHandled(true))
+ if (TestAndSetAuthHandled())
return;
+ // Similar to how we deal with notifications above in SetAuth()
+ if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
+ NotifyAuthCancelled();
+ } else {
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
+ NewRunnableMethod(this, &LoginHandler::NotifyAuthCancelled));
+ }
+
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &LoginHandler::CloseContentsDeferred));
BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- NewRunnableMethod(this, &LoginHandler::NotifyAuthCancelled));
- BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this, &LoginHandler::CancelAuthDeferred));
}
@@ -196,17 +208,17 @@
if (!requesting_contents)
return;
- NavigationController* this_controller = &requesting_contents->controller();
- NavigationController* that_controller =
- Source<NavigationController>(source).ptr();
-
- // Only handle notifications from other handlers.
- if (this_controller == that_controller)
+ // Break out early if we aren't interested in the notification.
+ if (WasAuthHandled())
return;
LoginNotificationDetails* login_details =
Details<LoginNotificationDetails>(details).ptr();
+ // WasAuthHandled() should always test positive before we publish
+ // AUTH_SUPPLIED or AUTH_CANCELLED notifications.
+ DCHECK(login_details->handler() != this);
+
// Only handle notification for the identical auth info.
if (*login_details->handler()->auth_info() != *auth_info())
return;
@@ -236,7 +248,7 @@
void LoginHandler::NotifyAuthNeeded() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (WasAuthHandled(false))
+ if (WasAuthHandled())
return;
TabContents* requesting_contents = GetTabContentsForLogin();
@@ -254,7 +266,7 @@
void LoginHandler::NotifyAuthCancelled() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(WasAuthHandled(false));
+ DCHECK(WasAuthHandled());
TabContents* requesting_contents = GetTabContentsForLogin();
if (!requesting_contents)
@@ -272,7 +284,7 @@
void LoginHandler::NotifyAuthSupplied(const std::wstring& username,
const std::wstring& password) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- DCHECK(WasAuthHandled(false));
+ DCHECK(WasAuthHandled());
TabContents* requesting_contents = GetTabContentsForLogin();
if (!requesting_contents)
@@ -288,7 +300,7 @@
}
void LoginHandler::ReleaseSoon() {
- if (!WasAuthHandled(true)) {
+ if (!TestAndSetAuthHandled()) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this, &LoginHandler::CancelAuthDeferred));
@@ -306,12 +318,17 @@
}
// Returns whether authentication had been handled (SetAuth or CancelAuth).
-// If |set_handled| is true, it will mark authentication as handled.
-bool LoginHandler::WasAuthHandled(bool set_handled) {
+bool LoginHandler::WasAuthHandled() const {
AutoLock lock(handled_auth_lock_);
bool was_handled = handled_auth_;
- if (set_handled)
- handled_auth_ = true;
+ return was_handled;
+}
+
+// Marks authentication as handled and returns the previous handled state.
+bool LoginHandler::TestAndSetAuthHandled() {
+ AutoLock lock(handled_auth_lock_);
+ bool was_handled = handled_auth_;
+ handled_auth_ = true;
return was_handled;
}
@@ -365,7 +382,7 @@
void Run() {
TabContents* parent_contents = handler_->GetTabContentsForLogin();
- if (!parent_contents) {
+ if (!parent_contents || handler_->WasAuthHandled()) {
// The request may have been cancelled, or it may be for a renderer
// not hosted by a tab (e.g. an extension). Cancel just in case
// (cancelling twice is a no-op).
@@ -385,14 +402,16 @@
password_manager->PasswordFormsFound(v);
handler_->SetPasswordManager(password_manager);
- std::wstring explanation = auth_info_->realm.empty() ?
- l10n_util::GetStringF(IDS_LOGIN_DIALOG_DESCRIPTION_NO_REALM,
- auth_info_->host_and_port) :
- l10n_util::GetStringF(IDS_LOGIN_DIALOG_DESCRIPTION,
- auth_info_->host_and_port,
- auth_info_->realm);
+ string16 host_and_port_hack16 = WideToUTF16Hack(auth_info_->host_and_port);
+ string16 realm_hack16 = WideToUTF16Hack(auth_info_->realm);
+ string16 explanation = realm_hack16.empty() ?
+ l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION_NO_REALM,
+ host_and_port_hack16) :
+ l10n_util::GetStringFUTF16(IDS_LOGIN_DIALOG_DESCRIPTION,
+ host_and_port_hack16,
+ realm_hack16);
handler_->BuildViewForPasswordManager(password_manager,
- explanation);
+ UTF16ToWideHack(explanation));
}
private:
diff --git a/chrome/browser/ui/login/login_prompt.h b/chrome/browser/ui/login/login_prompt.h
index 8e3d15e..b566402 100644
--- a/chrome/browser/ui/login/login_prompt.h
+++ b/chrome/browser/ui/login/login_prompt.h
@@ -70,6 +70,12 @@
const NotificationSource& source,
const NotificationDetails& details);
+ // Who/where/what asked for the authentication.
+ const net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); }
+
+ // Returns whether authentication had been handled (SetAuth or CancelAuth).
+ bool WasAuthHandled() const;
+
protected:
void SetModel(LoginModel* model);
@@ -81,9 +87,6 @@
// Performs necessary cleanup before deletion.
void ReleaseSoon();
- // Who/where/what asked for the authentication.
- net::AuthChallengeInfo* auth_info() const { return auth_info_.get(); }
-
private:
// Starts observing notifications from other LoginHandlers.
void AddObservers();
@@ -98,9 +101,9 @@
// Notify observers that authentication is cancelled.
void NotifyAuthCancelled();
- // Returns whether authentication had been handled (SetAuth or CancelAuth).
- // If |set_handled| is true, it will mark authentication as handled.
- bool WasAuthHandled(bool set_handled);
+ // Marks authentication as handled and returns the previous handled
+ // state.
+ bool TestAndSetAuthHandled();
// Calls SetAuth from the IO loop.
void SetAuthDeferred(const std::wstring& username,
@@ -114,7 +117,7 @@
// True if we've handled auth (SetAuth or CancelAuth has been called).
bool handled_auth_;
- Lock handled_auth_lock_;
+ mutable Lock handled_auth_lock_;
// The ConstrainedWindow that is hosting our LoginView.
// This should only be accessed on the UI loop.
diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc
new file mode 100644
index 0000000..de9be6f
--- /dev/null
+++ b/chrome/browser/ui/login/login_prompt_browsertest.cc
@@ -0,0 +1,347 @@
+// 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 <algorithm>
+#include <list>
+#include <map>
+
+#include "chrome/browser/browser_thread.h"
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/login/login_prompt.h"
+#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
+#include "chrome/common/notification_service.h"
+#include "chrome/test/in_process_browser_test.h"
+#include "chrome/test/ui_test_utils.h"
+#include "net/base/auth.h"
+
+namespace {
+
+class LoginPromptBrowserTest : public InProcessBrowserTest {
+ public:
+ LoginPromptBrowserTest()
+ : bad_password_(L"incorrect"), bad_username_(L"nouser") {
+ set_show_window(true);
+
+ auth_map_[L"foo"] = AuthInfo(L"testuser", L"foopassword");
+ auth_map_[L"bar"] = AuthInfo(L"testuser", L"barpassword");
+ }
+
+ protected:
+ void SetAuthFor(LoginHandler* handler);
+
+ struct AuthInfo {
+ std::wstring username_;
+ std::wstring password_;
+
+ AuthInfo() {}
+
+ AuthInfo(const std::wstring username,
+ const std::wstring password)
+ : username_(username), password_(password) {}
+ };
+
+ std::map<std::wstring, AuthInfo> auth_map_;
+ std::wstring bad_password_;
+ std::wstring bad_username_;
+};
+
+void LoginPromptBrowserTest::SetAuthFor(LoginHandler* handler) {
+ const net::AuthChallengeInfo* challenge = handler->auth_info();
+
+ ASSERT_TRUE(challenge);
+ std::map<std::wstring, AuthInfo>::iterator i =
+ auth_map_.find(challenge->realm);
+ EXPECT_TRUE(auth_map_.end() != i);
+ if (i != auth_map_.end()) {
+ const AuthInfo& info = i->second;
+ handler->SetAuth(info.username_, info.password_);
+ }
+}
+
+// Maintains a set of LoginHandlers that are currently active and
+// keeps a count of the notifications that were observed.
+class LoginPromptBrowserTestObserver : public NotificationObserver {
+ public:
+ LoginPromptBrowserTestObserver()
+ : auth_needed_count_(0),
+ auth_supplied_count_(0),
+ auth_cancelled_count_(0) {}
+
+ virtual void Observe(NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details);
+
+ void AddHandler(LoginHandler* handler);
+
+ void RemoveHandler(LoginHandler* handler);
+
+ void Register(const NotificationSource& source);
+
+ std::list<LoginHandler*> handlers_;
+
+ // The exact number of notifications we receive is depedent on the
+ // number of requests that were dispatched and is subject to a
+ // number of factors that we don't directly control here. The
+ // values below should only be used qualitatively.
+ int auth_needed_count_;
+ int auth_supplied_count_;
+ int auth_cancelled_count_;
+
+ private:
+ NotificationRegistrar registrar_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoginPromptBrowserTestObserver);
+};
+
+void LoginPromptBrowserTestObserver::Observe(
+ NotificationType type,
+ const NotificationSource& source,
+ const NotificationDetails& details) {
+ if (type == NotificationType::AUTH_NEEDED) {
+ LoginNotificationDetails* login_details =
+ Details<LoginNotificationDetails>(details).ptr();
+ AddHandler(login_details->handler());
+ auth_needed_count_++;
+ } else if (type == NotificationType::AUTH_SUPPLIED) {
+ AuthSuppliedLoginNotificationDetails* login_details =
+ Details<AuthSuppliedLoginNotificationDetails>(details).ptr();
+ RemoveHandler(login_details->handler());
+ auth_supplied_count_++;
+ } else if (type == NotificationType::AUTH_CANCELLED) {
+ LoginNotificationDetails* login_details =
+ Details<LoginNotificationDetails>(details).ptr();
+ RemoveHandler(login_details->handler());
+ auth_cancelled_count_++;
+ }
+}
+
+void LoginPromptBrowserTestObserver::AddHandler(LoginHandler* handler) {
+ std::list<LoginHandler*>::iterator i = std::find(handlers_.begin(),
+ handlers_.end(),
+ handler);
+ EXPECT_TRUE(i == handlers_.end());
+ if (i == handlers_.end())
+ handlers_.push_back(handler);
+}
+
+void LoginPromptBrowserTestObserver::RemoveHandler(LoginHandler* handler) {
+ std::list<LoginHandler*>::iterator i = std::find(handlers_.begin(),
+ handlers_.end(),
+ handler);
+ EXPECT_TRUE(i != handlers_.end());
+ if (i != handlers_.end())
+ handlers_.erase(i);
+}
+
+void LoginPromptBrowserTestObserver::Register(
+ const NotificationSource& source) {
+ registrar_.Add(this, NotificationType::AUTH_NEEDED, source);
+ registrar_.Add(this, NotificationType::AUTH_SUPPLIED, source);
+ registrar_.Add(this, NotificationType::AUTH_CANCELLED, source);
+}
+
+template <NotificationType::Type T>
+class WindowedNavigationObserver
+ : public ui_test_utils::WindowedNotificationObserver {
+ public:
+ explicit WindowedNavigationObserver(NavigationController* controller)
+ : ui_test_utils::WindowedNotificationObserver(
+ T, Source<NavigationController>(controller)) {}
+};
+
+typedef WindowedNavigationObserver<NotificationType::LOAD_STOP>
+ WindowedLoadStopObserver;
+
+typedef WindowedNavigationObserver<NotificationType::AUTH_NEEDED>
+ WindowedAuthNeededObserver;
+
+typedef WindowedNavigationObserver<NotificationType::AUTH_CANCELLED>
+ WindowedAuthCancelledObserver;
+
+typedef WindowedNavigationObserver<NotificationType::AUTH_SUPPLIED>
+ WindowedAuthSuppliedObserver;
+
+const char* kMultiRealmTestPage = "files/login/multi_realm.html";
+const int kMultiRealmTestRealmCount = 2;
+const int kMultiRealmTestResourceCount = 4;
+
+const char* kSingleRealmTestPage = "files/login/single_realm.html";
+const int kSingleRealmTestResourceCount = 6;
+
+// Test handling of resources that require authentication even though
+// the page they are included on doesn't. In this case we should only
+// present the minimal number of prompts necessary for successfully
+// displaying the page. First we check whether cancelling works as
+// expected.
+IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, MultipleRealmCancellation) {
+ ASSERT_TRUE(test_server()->Start());
+ GURL test_page = test_server()->GetURL(kMultiRealmTestPage);
+
+ TabContentsWrapper* contents =
+ browser()->GetSelectedTabContentsWrapper();
+ ASSERT_TRUE(contents);
+
+ NavigationController* controller = &contents->controller();
+ LoginPromptBrowserTestObserver observer;
+
+ observer.Register(Source<NavigationController>(controller));
+
+ WindowedLoadStopObserver load_stop_waiter(controller);
+
+ {
+ WindowedAuthNeededObserver auth_needed_waiter(controller);
+ browser()->OpenURL(test_page, GURL(), CURRENT_TAB, PageTransition::TYPED);
+ auth_needed_waiter.Wait();
+ }
+
+ int n_handlers = 0;
+
+ while (n_handlers < kMultiRealmTestRealmCount) {
+ WindowedAuthNeededObserver auth_needed_waiter(controller);
+
+ while (!observer.handlers_.empty()) {
+ WindowedAuthCancelledObserver auth_cancelled_waiter(controller);
+ LoginHandler* handler = *observer.handlers_.begin();
+
+ ASSERT_TRUE(handler);
+ n_handlers++;
+ handler->CancelAuth();
+ auth_cancelled_waiter.Wait();
+ }
+
+ if (n_handlers < kMultiRealmTestRealmCount)
+ auth_needed_waiter.Wait();
+ }
+
+ load_stop_waiter.Wait();
+
+ EXPECT_EQ(kMultiRealmTestRealmCount, n_handlers);
+ EXPECT_EQ(0, observer.auth_supplied_count_);
+ EXPECT_LT(0, observer.auth_needed_count_);
+ EXPECT_LT(0, observer.auth_cancelled_count_);
+ EXPECT_TRUE(test_server()->Stop());
+}
+
+// Similar to the MultipleRealmCancellation test above, but tests
+// whether supplying credentials work as exepcted.
+IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, MultipleRealmConfirmation) {
+ ASSERT_TRUE(test_server()->Start());
+ GURL test_page = test_server()->GetURL(kMultiRealmTestPage);
+
+ TabContentsWrapper* contents =
+ browser()->GetSelectedTabContentsWrapper();
+ ASSERT_TRUE(contents);
+
+ NavigationController* controller = &contents->controller();
+ LoginPromptBrowserTestObserver observer;
+
+ observer.Register(Source<NavigationController>(controller));
+
+ WindowedLoadStopObserver load_stop_waiter(controller);
+ int n_handlers = 0;
+
+ {
+ WindowedAuthNeededObserver auth_needed_waiter(controller);
+
+ browser()->OpenURL(test_page, GURL(), CURRENT_TAB, PageTransition::TYPED);
+ auth_needed_waiter.Wait();
+ }
+
+ while (n_handlers < kMultiRealmTestRealmCount) {
+ WindowedAuthNeededObserver auth_needed_waiter(controller);
+
+ while (!observer.handlers_.empty()) {
+ WindowedAuthSuppliedObserver auth_supplied_waiter(controller);
+ LoginHandler* handler = *observer.handlers_.begin();
+
+ ASSERT_TRUE(handler);
+ n_handlers++;
+ SetAuthFor(handler);
+ auth_supplied_waiter.Wait();
+ }
+
+ if (n_handlers < kMultiRealmTestRealmCount)
+ auth_needed_waiter.Wait();
+ }
+
+ load_stop_waiter.Wait();
+
+ EXPECT_EQ(kMultiRealmTestRealmCount, n_handlers);
+ EXPECT_LT(0, observer.auth_needed_count_);
+ EXPECT_LT(0, observer.auth_supplied_count_);
+ EXPECT_EQ(0, observer.auth_cancelled_count_);
+ EXPECT_TRUE(test_server()->Stop());
+}
+
+// Testing for recovery from an incorrect password for the case where
+// there are multiple authenticated resources.
+// Marked as flaky. See crbug.com/68860
+IN_PROC_BROWSER_TEST_F(LoginPromptBrowserTest, FLAKY_IncorrectConfirmation) {
+ ASSERT_TRUE(test_server()->Start());
+ GURL test_page = test_server()->GetURL(kSingleRealmTestPage);
+
+ TabContentsWrapper* contents =
+ browser()->GetSelectedTabContentsWrapper();
+ ASSERT_TRUE(contents);
+
+ NavigationController* controller = &contents->controller();
+ LoginPromptBrowserTestObserver observer;
+
+ observer.Register(Source<NavigationController>(controller));
+
+ WindowedLoadStopObserver load_stop_waiter(controller);
+
+ {
+ WindowedAuthNeededObserver auth_needed_waiter(controller);
+ browser()->OpenURL(test_page, GURL(), CURRENT_TAB, PageTransition::TYPED);
+ auth_needed_waiter.Wait();
+ }
+
+ EXPECT_FALSE(observer.handlers_.empty());
+
+ if (!observer.handlers_.empty()) {
+ WindowedAuthNeededObserver auth_needed_waiter(controller);
+ WindowedAuthSuppliedObserver auth_supplied_waiter(controller);
+ LoginHandler* handler = *observer.handlers_.begin();
+
+ ASSERT_TRUE(handler);
+ handler->SetAuth(bad_username_, bad_password_);
+ auth_supplied_waiter.Wait();
+
+ // The request should be retried after the incorrect password is
+ // supplied. This should result in a new AUTH_NEEDED notification
+ // for the same realm.
+ auth_needed_waiter.Wait();
+ }
+
+ int n_handlers = 0;
+
+ while (n_handlers < 1) {
+ WindowedAuthNeededObserver auth_needed_waiter(controller);
+
+ while (!observer.handlers_.empty()) {
+ WindowedAuthSuppliedObserver auth_supplied_waiter(controller);
+ LoginHandler* handler = *observer.handlers_.begin();
+
+ ASSERT_TRUE(handler);
+ n_handlers++;
+ SetAuthFor(handler);
+ auth_supplied_waiter.Wait();
+ }
+
+ if (n_handlers < 1)
+ auth_needed_waiter.Wait();
+ }
+
+ load_stop_waiter.Wait();
+
+ // The single realm test has only one realm, and thus only one login
+ // prompt.
+ EXPECT_EQ(1, n_handlers);
+ EXPECT_LT(0, observer.auth_needed_count_);
+ EXPECT_LT(0, observer.auth_supplied_count_);
+ EXPECT_EQ(0, observer.auth_cancelled_count_);
+ EXPECT_TRUE(test_server()->Stop());
+}
+} // namespace
diff --git a/chrome/browser/ui/login/login_prompt_mac.mm b/chrome/browser/ui/login/login_prompt_mac.mm
index 2ee0252..0547e39 100644
--- a/chrome/browser/ui/login/login_prompt_mac.mm
+++ b/chrome/browser/ui/login/login_prompt_mac.mm
@@ -6,7 +6,7 @@
#import "chrome/browser/ui/login/login_prompt_mac.h"
#include "app/l10n_util.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
#include "base/utf_string_conversions.h"
@@ -127,7 +127,7 @@
- (id)initWithLoginHandler:(LoginHandlerMac*)handler {
NSString* nibPath =
- [mac_util::MainAppBundle() pathForResource:@"HttpAuthLoginSheet"
+ [base::mac::MainAppBundle() pathForResource:@"HttpAuthLoginSheet"
ofType:@"nib"];
if ((self = [super initWithWindowNibPath:nibPath
owner:self])) {
diff --git a/chrome/browser/ui/login/login_prompt_win.cc b/chrome/browser/ui/login/login_prompt_win.cc
index a167885..58a93bc 100644
--- a/chrome/browser/ui/login/login_prompt_win.cc
+++ b/chrome/browser/ui/login/login_prompt_win.cc
@@ -49,12 +49,12 @@
virtual std::wstring GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK)
- return l10n_util::GetString(IDS_LOGIN_DIALOG_OK_BUTTON_LABEL);
+ return l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_OK_BUTTON_LABEL);
return DialogDelegate::GetDialogButtonLabel(button);
}
virtual std::wstring GetWindowTitle() const {
- return l10n_util::GetString(IDS_LOGIN_DIALOG_TITLE);
+ return l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_TITLE);
}
virtual void WindowClosing() {
diff --git a/chrome/browser/ui/options/options_util.cc b/chrome/browser/ui/options/options_util.cc
index 0c8ba36..d23e5e5 100644
--- a/chrome/browser/ui/options/options_util.cc
+++ b/chrome/browser/ui/options/options_util.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/ui/options/options_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/download/download_prefs.h"
diff --git a/chrome/browser/ui/tabs/dock_info_win.cc b/chrome/browser/ui/tabs/dock_info_win.cc
index dee78cf..c9aa412 100644
--- a/chrome/browser/ui/tabs/dock_info_win.cc
+++ b/chrome/browser/ui/tabs/dock_info_win.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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 "chrome/browser/ui/tabs/dock_info.h"
+#include "base/win/scoped_gdi_object.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_window.h"
@@ -129,7 +130,7 @@
// in ShouldStopIterating if target_ is passed in.
bool is_top_most_;
- ScopedRegion tmp_region_;
+ base::win::ScopedRegion tmp_region_;
DISALLOW_COPY_AND_ASSIGN(TopMostFinder);
};
diff --git a/chrome/browser/ui/tests/browser_uitest.cc b/chrome/browser/ui/tests/browser_uitest.cc
index 6b8c735..680a86a 100644
--- a/chrome/browser/ui/tests/browser_uitest.cc
+++ b/chrome/browser/ui/tests/browser_uitest.cc
@@ -83,7 +83,7 @@
#ifdef CHROME_V8
TEST_F(BrowserTest, NullOpenerRedirectForksProcess) {
// This test only works in multi-process mode
- if (in_process_renderer())
+ if (ProxyLauncher::in_process_renderer())
return;
net::TestServer test_server(net::TestServer::TYPE_HTTP,
@@ -134,7 +134,7 @@
// a same-page-redirect) will not fork a new process.
TEST_F(BrowserTest, MAYBE_OtherRedirectsDontForkProcess) {
// This test only works in multi-process mode
- if (in_process_renderer())
+ if (ProxyLauncher::in_process_renderer())
return;
net::TestServer test_server(net::TestServer::TYPE_HTTP,
@@ -166,7 +166,7 @@
// Make sure that a new tab but not new process has been created.
ASSERT_TRUE(tab->NavigateToURLAsync(dont_fork_url));
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_EQ(orig_process_count, GetBrowserProcessCount());
int new_tab_count = -1;
ASSERT_TRUE(window->GetTabCount(&new_tab_count));
@@ -181,7 +181,7 @@
// Make sure that no new process has been created.
ASSERT_TRUE(tab->NavigateToURLAsync(dont_fork_url2));
- PlatformThread::Sleep(sleep_timeout_ms());
+ base::PlatformThread::Sleep(sleep_timeout_ms());
ASSERT_EQ(orig_process_count, GetBrowserProcessCount());
}
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model.cc b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
index 390dce0..9874ef9 100644
--- a/chrome/browser/ui/toolbar/back_forward_menu_model.cc
+++ b/chrome/browser/ui/toolbar/back_forward_menu_model.cc
@@ -14,7 +14,10 @@
#include "chrome/browser/tab_contents/navigation_controller.h"
#include "chrome/browser/tab_contents/navigation_entry.h"
#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/browser/prefs/pref_service.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
+#include "chrome/common/pref_names.h"
#include "chrome/common/url_constants.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
@@ -77,7 +80,8 @@
// super long.
NavigationEntry* entry = GetNavigationEntry(index);
string16 menu_text(entry->GetTitleForDisplay(
- &GetTabContents()->controller()));
+ GetTabContents()->profile()->GetPrefs()->
+ GetString(prefs::kAcceptLanguages)));
menu_text = gfx::ElideText(menu_text, gfx::Font(), kMaxWidth, false);
for (size_t i = menu_text.find('&'); i != string16::npos;
diff --git a/chrome/browser/ui/toolbar/encoding_menu_controller.cc b/chrome/browser/ui/toolbar/encoding_menu_controller.cc
index c93fb1e..177aa28 100644
--- a/chrome/browser/ui/toolbar/encoding_menu_controller.cc
+++ b/chrome/browser/ui/toolbar/encoding_menu_controller.cc
@@ -102,16 +102,16 @@
}
void EncodingMenuController::GetEncodingMenuItems(Profile* profile,
- EncodingMenuItemList* menuItems) {
+ EncodingMenuItemList* menu_items) {
- DCHECK(menuItems);
+ DCHECK(menu_items);
EncodingMenuItem separator(0, string16());
- menuItems->clear();
- menuItems->push_back(
+ menu_items->clear();
+ menu_items->push_back(
EncodingMenuItem(IDC_ENCODING_AUTO_DETECT,
l10n_util::GetStringUTF16(IDS_ENCODING_AUTO_DETECT)));
- menuItems->push_back(separator);
+ menu_items->push_back(separator);
// Create current display encoding list.
const std::vector<CharacterEncoding::EncodingInfo>* encodings;
@@ -130,12 +130,11 @@
std::vector<CharacterEncoding::EncodingInfo>::const_iterator it;
for (it = encodings->begin(); it != encodings->end(); ++it) {
if (it->encoding_id) {
- std::wstring encoding = it->encoding_display_name;
+ string16 encoding = it->encoding_display_name;
base::i18n::AdjustStringForLocaleDirection(&encoding);
- menuItems->push_back(EncodingMenuItem(it->encoding_id,
- WideToUTF16(encoding)));
+ menu_items->push_back(EncodingMenuItem(it->encoding_id, encoding));
} else {
- menuItems->push_back(separator);
+ menu_items->push_back(separator);
}
}
}
diff --git a/chrome/browser/ui/toolbar/encoding_menu_controller.h b/chrome/browser/ui/toolbar/encoding_menu_controller.h
index bfa8c57..b927778 100644
--- a/chrome/browser/ui/toolbar/encoding_menu_controller.h
+++ b/chrome/browser/ui/toolbar/encoding_menu_controller.h
@@ -42,7 +42,7 @@
// Fills in a list of menu items in the order they should appear in the menu.
// Items whose ids are 0 are separators.
void GetEncodingMenuItems(Profile* profile,
- EncodingMenuItemList* menuItems);
+ EncodingMenuItemList* menu_items);
private:
// List of all valid encoding GUI IDs.
diff --git a/chrome/browser/ui/toolbar/toolbar_model.cc b/chrome/browser/ui/toolbar/toolbar_model.cc
index 5a6a97c..98c392a 100644
--- a/chrome/browser/ui/toolbar/toolbar_model.cc
+++ b/chrome/browser/ui/toolbar/toolbar_model.cc
@@ -117,7 +117,7 @@
// the security level would be NONE.
CertStore::GetInstance()->RetrieveCert(
GetNavigationController()->GetActiveEntry()->ssl().cert_id(), &cert);
- return SSLManager::GetEVCertName(*cert);
+ return UTF16ToWideHack(SSLManager::GetEVCertName(*cert));
}
NavigationController* ToolbarModel::GetNavigationController() const {
diff --git a/chrome/browser/ui/toolbar/wrench_menu_model.cc b/chrome/browser/ui/toolbar/wrench_menu_model.cc
index cd8a114..a68922f 100644
--- a/chrome/browser/ui/toolbar/wrench_menu_model.cc
+++ b/chrome/browser/ui/toolbar/wrench_menu_model.cc
@@ -28,7 +28,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/toolbar/encoding_menu_controller.h"
#include "chrome/browser/upgrade_detector.h"
-#include "chrome/common/badge_util.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/notification_source.h"
@@ -56,22 +55,6 @@
#include "chrome/browser/enumerate_modules_model_win.h"
#endif
-// The size of the font used for dynamic text overlays on menu items.
-const float kMenuBadgeFontSize = 12.0;
-
-namespace {
-SkBitmap GetBackgroundPageIcon() {
- string16 pages = base::FormatNumber(
- BackgroundPageTracker::GetInstance()->GetBackgroundPageCount());
- return badge_util::DrawBadgeIconOverlay(
- *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_BACKGROUND_MENU),
- kMenuBadgeFontSize,
- pages,
- l10n_util::GetStringUTF16(IDS_BACKGROUND_PAGE_BADGE_OVERFLOW));
-}
-
-} // namespace
-
////////////////////////////////////////////////////////////////////////////////
// EncodingMenuModel
@@ -248,7 +231,8 @@
int num_pages = BackgroundPageTracker::GetInstance()->
GetUnacknowledgedBackgroundPageCount();
if (num_pages > 0) {
- *bitmap = GetBackgroundPageIcon();
+ *bitmap = *ResourceBundle::GetSharedInstance().GetBitmapNamed(
+ IDR_BACKGROUND_MENU);
return true;
} else {
// No icon.
@@ -435,12 +419,6 @@
tools_menu_model_.get());
AddSeparator();
-#if defined(ENABLE_REMOTING)
- if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kEnableRemoting)) {
- AddItem(IDC_REMOTING_SETUP,
- l10n_util::GetStringUTF16(IDS_REMOTING_SETUP_LABEL));
- }
-#endif
AddItemWithStringId(IDC_SHOW_BOOKMARK_MANAGER, IDS_BOOKMARK_MANAGER);
AddItemWithStringId(IDC_SHOW_HISTORY, IDS_SHOW_HISTORY);
AddItemWithStringId(IDC_SHOW_DOWNLOADS, IDS_SHOW_DOWNLOADS);
diff --git a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
index 839a9a0..cba6353 100644
--- a/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
+++ b/chrome/browser/ui/touch/frame/touch_browser_frame_view.cc
@@ -116,16 +116,16 @@
if (type == NotificationType::FOCUS_CHANGED_IN_PAGE) {
// Only modify the keyboard state if the currently active tab sent the
// notification.
- if (browser->GetSelectedTabContents()->render_view_host() ==
- Source<RenderViewHost>(source).ptr()) {
+ const TabContents* tab_contents = browser->GetSelectedTabContents();
+ if (tab_contents &&
+ tab_contents->render_view_host() ==
+ Source<RenderViewHost>(source).ptr())
UpdateKeyboardAndLayout(*Details<const bool>(details).ptr());
- }
} else if (type == NotificationType::NAV_ENTRY_COMMITTED) {
Browser* source_browser = Browser::GetBrowserForController(
Source<NavigationController>(source).ptr(), NULL);
// If the Browser for the keyboard has navigated, hide the keyboard.
- if (source_browser == browser) {
+ if (source_browser == browser)
UpdateKeyboardAndLayout(false);
- }
}
}
diff --git a/chrome/browser/ui/views/about_chrome_view.cc b/chrome/browser/ui/views/about_chrome_view.cc
index 215c6f0..341c6f8 100644
--- a/chrome/browser/ui/views/about_chrome_view.cc
+++ b/chrome/browser/ui/views/about_chrome_view.cc
@@ -20,6 +20,7 @@
#include "base/utf_string_conversions.h"
#include "base/win/windows_version.h"
#include "chrome/browser/browser_list.h"
+#include "chrome/browser/google/google_util.h"
#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -44,7 +45,7 @@
#include "webkit/glue/webkit_glue.h"
#if defined(OS_WIN)
-#include "base/win_util.h"
+#include "base/win/win_util.h"
#include "chrome/browser/views/restart_message_box.h"
#include "chrome/installer/util/install_util.h"
#endif // defined(OS_WIN)
@@ -202,7 +203,7 @@
// Add the dialog labels.
about_title_label_ = new views::Label(
- l10n_util::GetString(IDS_PRODUCT_NAME));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
about_title_label_->SetFont(ResourceBundle::GetSharedInstance().GetFont(
ResourceBundle::BaseFont).DeriveFont(18));
about_title_label_->SetColor(SK_ColorBLACK);
@@ -232,14 +233,15 @@
// The copyright URL portion of the main label.
copyright_label_ = new views::Label(
- l10n_util::GetString(IDS_ABOUT_VERSION_COPYRIGHT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_COPYRIGHT)));
copyright_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(copyright_label_);
main_text_label_ = new views::Label(L"");
// Figure out what to write in the main label of the About box.
- std::wstring text = l10n_util::GetString(IDS_ABOUT_VERSION_LICENSE);
+ std::wstring text =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_LICENSE));
chromium_url_appears_first_ =
text.find(kBeginLinkChr) < text.find(kBeginLinkOss);
@@ -301,17 +303,17 @@
#if defined(GOOGLE_CHROME_BUILD)
std::vector<size_t> url_offsets;
- text = l10n_util::GetStringF(IDS_ABOUT_TERMS_OF_SERVICE,
- std::wstring(),
- std::wstring(),
- &url_offsets);
+ text = UTF16ToWide(l10n_util::GetStringFUTF16(IDS_ABOUT_TERMS_OF_SERVICE,
+ string16(),
+ string16(),
+ &url_offsets));
main_label_chunk4_ = text.substr(0, url_offsets[0]);
main_label_chunk5_ = text.substr(url_offsets[0]);
// The Terms of Service URL at the bottom.
- terms_of_service_url_ =
- new views::Link(l10n_util::GetString(IDS_TERMS_OF_SERVICE));
+ terms_of_service_url_ = new views::Link(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_TERMS_OF_SERVICE)));
AddChildView(terms_of_service_url_);
terms_of_service_url_->SetController(this);
@@ -533,7 +535,7 @@
// for Vista is another option.
int service_pack_major = 0, service_pack_minor = 0;
base::win::GetServicePackLevel(&service_pack_major, &service_pack_minor);
- if (win_util::UserAccountControlIsEnabled() ||
+ if (base::win::UserAccountControlIsEnabled() ||
base::win::GetVersion() == base::win::VERSION_XP ||
(base::win::GetVersion() == base::win::VERSION_VISTA &&
service_pack_major >= 1) ||
@@ -563,14 +565,14 @@
std::wstring AboutChromeView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_RESTART_AND_UPDATE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_RESTART_AND_UPDATE));
} else if (button == MessageBoxFlags::DIALOGBUTTON_CANCEL) {
if (restart_button_visible_)
- return l10n_util::GetString(IDS_NOT_NOW);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_NOT_NOW));
// The OK button (which is the default button) has been re-purposed to be
// 'Restart Now' so we want the Cancel button should have the label
// OK but act like a Cancel button in all other ways.
- return l10n_util::GetString(IDS_OK);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK));
}
NOTREACHED();
@@ -578,7 +580,7 @@
}
std::wstring AboutChromeView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_ABOUT_CHROME_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_ABOUT_CHROME_TITLE));
}
bool AboutChromeView::IsDialogButtonEnabled(
@@ -646,14 +648,16 @@
void AboutChromeView::LinkActivated(views::Link* source,
int event_flags) {
GURL url;
- if (source == terms_of_service_url_)
+ if (source == terms_of_service_url_) {
url = GURL(chrome::kAboutTermsURL);
- else if (source == chromium_url_)
- url = GURL(l10n_util::GetStringUTF16(IDS_CHROMIUM_PROJECT_URL));
- else if (source == open_source_url_)
+ } else if (source == chromium_url_) {
+ url = google_util::AppendGoogleLocaleParam(
+ GURL(chrome::kChromiumProjectURL));
+ } else if (source == open_source_url_) {
url = GURL(chrome::kAboutCreditsURL);
- else
+ } else {
NOTREACHED() << "Unknown link source";
+ }
Browser* browser = BrowserList::GetLastActive();
#if defined(OS_CHROMEOS)
@@ -715,13 +719,15 @@
case UPGRADE_STARTED:
UserMetrics::RecordAction(UserMetricsAction("Upgrade_Started"), profile_);
show_throbber = true;
- update_label_.SetText(l10n_util::GetString(IDS_UPGRADE_STARTED));
+ update_label_.SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPGRADE_STARTED)));
break;
case UPGRADE_CHECK_STARTED:
UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Started"),
profile_);
show_throbber = true;
- update_label_.SetText(l10n_util::GetString(IDS_UPGRADE_CHECK_STARTED));
+ update_label_.SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_UPGRADE_CHECK_STARTED)));
break;
case UPGRADE_IS_AVAILABLE:
UserMetrics::RecordAction(
@@ -751,19 +757,19 @@
scoped_ptr<Version> running_version(
Version::GetVersionFromString(current_version_));
if (!installed_version.get() ||
- (installed_version->CompareTo(*running_version) < 0)) {
+ (installed_version->CompareTo(*running_version) <= 0)) {
#endif
UserMetrics::RecordAction(
UserMetricsAction("UpgradeCheck_AlreadyUpToDate"), profile_);
#if defined(OS_CHROMEOS)
- std::wstring update_label_text =
- l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE,
- l10n_util::GetString(IDS_PRODUCT_NAME));
+ std::wstring update_label_text = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_UPGRADE_ALREADY_UP_TO_DATE,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
#else
- std::wstring update_label_text =
- l10n_util::GetStringF(IDS_UPGRADE_ALREADY_UP_TO_DATE,
- l10n_util::GetString(IDS_PRODUCT_NAME),
- ASCIIToUTF16(current_version_));
+ std::wstring update_label_text = l10n_util::GetStringFUTF16(
+ IDS_UPGRADE_ALREADY_UP_TO_DATE,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME),
+ ASCIIToUTF16(current_version_));
#endif
if (base::i18n::IsRTL()) {
update_label_text.push_back(
@@ -786,8 +792,9 @@
profile_);
restart_button_visible_ = true;
const std::wstring& update_string =
- l10n_util::GetStringF(IDS_UPGRADE_SUCCESSFUL_RESTART,
- l10n_util::GetString(IDS_PRODUCT_NAME));
+ UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_UPGRADE_SUCCESSFUL_RESTART,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
update_label_.SetText(update_string);
show_success_indicator = true;
break;
@@ -796,8 +803,8 @@
UserMetrics::RecordAction(UserMetricsAction("UpgradeCheck_Error"),
profile_);
restart_button_visible_ = false;
- update_label_.SetText(l10n_util::GetStringF(IDS_UPGRADE_ERROR,
- UTF8ToWide(base::IntToString(error_code))));
+ update_label_.SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16Int(IDS_UPGRADE_ERROR, error_code)));
show_timeout_indicator = true;
break;
default:
diff --git a/chrome/browser/ui/views/about_ipc_dialog.cc b/chrome/browser/ui/views/about_ipc_dialog.cc
index 3e5d5d6..c072d3e 100644
--- a/chrome/browser/ui/views/about_ipc_dialog.cc
+++ b/chrome/browser/ui/views/about_ipc_dialog.cc
@@ -16,7 +16,7 @@
#include <set>
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
diff --git a/chrome/browser/ui/views/accelerator_table_gtk.cc b/chrome/browser/ui/views/accelerator_table_gtk.cc
index fae032a..c87580b 100644
--- a/chrome/browser/ui/views/accelerator_table_gtk.cc
+++ b/chrome/browser/ui/views/accelerator_table_gtk.cc
@@ -142,9 +142,6 @@
{ app::VKEY_F, false, false, true, IDC_SHOW_APP_MENU},
{ app::VKEY_E, false, false, true, IDC_SHOW_APP_MENU},
{ app::VKEY_ESCAPE, false, false, false, IDC_STOP },
-#if defined(OS_CHROMEOS)
- { app::VKEY_F5, false, false, false, IDC_SYSTEM_OPTIONS },
-#endif
{ app::VKEY_ESCAPE, true, false, false, IDC_TASK_MANAGER },
{ app::VKEY_U, false, true, false, IDC_VIEW_SOURCE },
{ app::VKEY_OEM_MINUS, false, true, false, IDC_ZOOM_MINUS },
diff --git a/chrome/browser/ui/views/app_launched_animation_win.cc b/chrome/browser/ui/views/app_launched_animation_win.cc
index 0fe5d05..a2007d3 100644
--- a/chrome/browser/ui/views/app_launched_animation_win.cc
+++ b/chrome/browser/ui/views/app_launched_animation_win.cc
@@ -4,14 +4,14 @@
#include "chrome/browser/app_launched_animation.h"
-#include "app/animation.h"
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "chrome/browser/extensions/image_loading_tracker.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_icon_set.h"
#include "chrome/common/extensions/extension_resource.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/image_view.h"
#include "views/widget/widget_win.h"
@@ -35,17 +35,17 @@
// AppLaunchedAnimation creates an animation. It loads the icon for the
// extension and once the image is loaded the animation starts. The icon fades
// out after a short delay.
-class AppLaunchedAnimationWin : public AnimationDelegate,
+class AppLaunchedAnimationWin : public ui::AnimationDelegate,
public ImageLoadingTracker::Observer,
public views::ImageView {
public:
AppLaunchedAnimationWin(const Extension* extension, const gfx::Rect& rect);
private:
- // AnimationDelegate
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // ui::AnimationDelegate
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// We use a HWND for the popup so that it may float above any HWNDs in our UI.
views::WidgetWin* popup_;
@@ -61,7 +61,7 @@
int index);
// Hover animation.
- scoped_ptr<SlideAnimation> animation_;
+ scoped_ptr<ui::SlideAnimation> animation_;
DISALLOW_COPY_AND_ASSIGN(AppLaunchedAnimationWin);
};
@@ -80,15 +80,17 @@
ImageLoadingTracker::DONT_CACHE);
}
-void AppLaunchedAnimationWin::AnimationCanceled(const Animation* animation) {
+void AppLaunchedAnimationWin::AnimationCanceled(
+ const ui::Animation* animation) {
AnimationEnded(animation);
}
-void AppLaunchedAnimationWin::AnimationEnded(const Animation* animation) {
+void AppLaunchedAnimationWin::AnimationEnded(const ui::Animation* animation) {
popup_->Close();
}
-void AppLaunchedAnimationWin::AnimationProgressed(const Animation* animation) {
+void AppLaunchedAnimationWin::AnimationProgressed(
+ const ui::Animation* animation) {
// GetCurrentValue goes from 1 to 0 since we are hiding.
const double current_value = 1.0 - animation->GetCurrentValue();
const double current_time = current_value * (kDelayMS + kDurationMS);
@@ -118,9 +120,9 @@
popup_->Show();
// Start animation.
- animation_.reset(new SlideAnimation(this));
+ animation_.reset(new ui::SlideAnimation(this));
animation_->SetSlideDuration(kDelayMS + kDurationMS);
- animation_->SetTweenType(Tween::LINEAR);
+ animation_->SetTweenType(ui::Tween::LINEAR);
animation_->Reset(1.0);
animation_->Hide();
}
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
index 199e631..059de7e 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.cc
@@ -42,7 +42,7 @@
#include <commctrl.h>
#include <dwmapi.h>
-#include "app/win_util.h"
+#include "app/win/hwnd_util.h"
#include "base/win/scoped_gdi_object.h"
#endif
@@ -200,8 +200,8 @@
bg_painter_(views::Painter::CreateVerticalGradient(
SkColorSetRGB(255, 242, 183),
SkColorSetRGB(250, 230, 145))) {
- views::Label* label =
- new views::Label(l10n_util::GetString(IDS_INSTANT_OPT_IN_LABEL));
+ views::Label* label = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_LABEL)));
label->SetFont(label_font);
views::GridLayout* layout = new views::GridLayout(this);
@@ -252,7 +252,7 @@
// TODO: these buttons look crap. Figure out the right border/background to
// use.
views::TextButton* button =
- new views::TextButton(this, l10n_util::GetString(id));
+ new views::TextButton(this, UTF16ToWide(l10n_util::GetStringUTF16(id)));
button->set_border(new OptInButtonBorder());
button->SetNormalHasBorder(true);
button->set_tag(id);
@@ -422,7 +422,7 @@
model_index_(model_index),
normal_font_(font),
bold_font_(bold_font),
- ellipsis_width_(font.GetStringWidth(kEllipsis)),
+ ellipsis_width_(font.GetStringWidth(WideToUTF16(kEllipsis))),
mirroring_context_(new MirroringContext()),
match_(NULL, 0, false, AutocompleteMatch::URL_WHAT_YOU_TYPED) {
CHECK(model_index >= 0);
@@ -458,8 +458,8 @@
// would also let us use a more properly-localizable string than we get with
// just the IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR.
if (!match_.description.empty()) {
- std::wstring separator =
- l10n_util::GetString(IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR);
+ std::wstring separator = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_AUTOCOMPLETE_MATCH_DESCRIPTION_SEPARATOR));
ACMatchClassifications classifications;
classifications.push_back(
ACMatchClassification(0, ACMatchClassification::NONE));
@@ -614,7 +614,8 @@
else
current_data->color = GetColor(state, force_dim ? DIMMED_TEXT : TEXT);
current_data->pixel_width =
- current_data->font->GetStringWidth(current_data->text);
+ current_data->font->GetStringWidth(
+ WideToUTF16Hack(current_data->text));
current_run->pixel_width += current_data->pixel_width;
}
DCHECK(!current_run->classifications.empty());
@@ -740,7 +741,7 @@
(prior_classification->font == &normal_font_)))
j->font = &normal_font_;
- j->pixel_width = j->font->GetStringWidth(elided_text);
+ j->pixel_width = j->font->GetStringWidth(WideToUTF16Hack(elided_text));
// Erase any other classifications that come after the elided one.
i->classifications.erase(j.base(), i->classifications.end());
@@ -938,7 +939,7 @@
// AutocompletePopupContentsView, AnimationDelegate implementation:
void AutocompletePopupContentsView::AnimationProgressed(
- const Animation* animation) {
+ const ui::Animation* animation) {
// We should only be running the animation when the popup is already visible.
DCHECK(popup_ != NULL);
popup_->SetBounds(GetPopupBounds());
@@ -1106,7 +1107,7 @@
void AutocompletePopupContentsView::UpdateBlurRegion() {
#if defined(OS_WIN)
// We only support background blurring on Vista with Aero-Glass enabled.
- if (!win_util::ShouldUseVistaFrame() || !GetWidget())
+ if (!app::win::ShouldUseVistaFrame() || !GetWidget())
return;
// Provide a blurred background effect within the contents region of the
diff --git a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
index d6adea1..72cb7bd 100644
--- a/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
+++ b/chrome/browser/ui/views/autocomplete/autocomplete_popup_contents_view.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_UI_VIEWS_AUTOCOMPLETE_AUTOCOMPLETE_POPUP_CONTENTS_VIEW_H_
#pragma once
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_popup_model.h"
#include "chrome/browser/autocomplete/autocomplete_popup_view.h"
#include "gfx/font.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/view.h"
#include "webkit/glue/window_open_disposition.h"
@@ -46,7 +46,7 @@
class AutocompletePopupContentsView : public views::View,
public AutocompleteResultViewModel,
public AutocompletePopupView,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
AutocompletePopupContentsView(const gfx::Font& font,
AutocompleteEditView* edit_view,
@@ -73,8 +73,8 @@
virtual bool IsHoveredIndex(size_t index) const;
virtual const SkBitmap* GetSpecialIcon(size_t index) const;
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Overridden from views::View:
virtual void Paint(gfx::Canvas* canvas);
@@ -165,7 +165,7 @@
// The popup sizes vertically using an animation when the popup is getting
// shorter (not larger, that makes it look "slow").
- SlideAnimation size_animation_;
+ ui::SlideAnimation size_animation_;
gfx::Rect start_bounds_;
gfx::Rect target_bounds_;
diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.cc b/chrome/browser/ui/views/autofill_profiles_view_win.cc
index 9c73a62..d7f1cc8 100644
--- a/chrome/browser/ui/views/autofill_profiles_view_win.cc
+++ b/chrome/browser/ui/views/autofill_profiles_view_win.cc
@@ -301,7 +301,7 @@
views::GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, 0);
views::Link* link = new views::Link(
- l10n_util::GetString(IDS_AUTOFILL_LEARN_MORE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_LEARN_MORE)));
link->SetController(this);
layout->AddView(link);
@@ -323,7 +323,7 @@
std::wstring AutoFillProfilesView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_AUTOFILL_OPTIONS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS_TITLE));
}
void AutoFillProfilesView::WindowClosing() {
@@ -448,7 +448,7 @@
GetData();
enable_auto_fill_button_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_AUTOFILL_ENABLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_AUTOFILL_ENABLE)));
enable_auto_fill_button_->set_listener(this);
table_model_.reset(new ContentListTableModel(&profiles_set_,
@@ -460,13 +460,13 @@
scroll_view_->SetObserver(this);
add_address_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_AUTOFILL_ADD_ADDRESS_BUTTON));
- add_credit_card_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_AUTOFILL_ADD_CREDITCARD_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_ADD_ADDRESS_BUTTON)));
+ add_credit_card_button_ = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_ADD_CREDITCARD_BUTTON)));
edit_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_AUTOFILL_EDIT_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_EDIT_BUTTON)));
remove_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_AUTOFILL_DELETE_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_DELETE_BUTTON)));
views::GridLayout* layout = CreatePanelGridLayout(this);
SetLayoutManager(layout);
@@ -746,7 +746,7 @@
MessageBoxFlags::DialogButton button) const {
switch (button) {
case MessageBoxFlags::DIALOGBUTTON_OK:
- return l10n_util::GetString(IDS_AUTOFILL_DIALOG_SAVE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_SAVE));
case MessageBoxFlags::DIALOGBUTTON_CANCEL:
return std::wstring();
default:
@@ -812,7 +812,7 @@
string_id = new_item_ ? IDS_AUTOFILL_ADD_CREDITCARD_CAPTION :
IDS_AUTOFILL_EDIT_CREDITCARD_CAPTION;
}
- return l10n_util::GetString(string_id);
+ return UTF16ToWide(l10n_util::GetStringUTF16(string_id));
}
void AutoFillProfilesView::EditableSetViewContents::WindowClosing() {
@@ -873,8 +873,8 @@
}
}
-bool AutoFillProfilesView::EditableSetViewContents::HandleKeystroke(
- views::Textfield* sender, const views::Textfield::Keystroke& keystroke) {
+bool AutoFillProfilesView::EditableSetViewContents::HandleKeyEvent(
+ views::Textfield* sender, const views::KeyEvent& key_event) {
if (sender == text_fields_[TEXT_CC_NUMBER] &&
!has_credit_card_number_been_edited_) {
// You cannot edit obfuscated number, you must retype it anew.
@@ -942,16 +942,16 @@
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, double_column_leading_view_set_id_);
- layout->AddView(new views::Label(l10n_util::GetString(
- IDS_AUTOFILL_DIALOG_ADDRESS_LINE_1)));
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_DIALOG_ADDRESS_LINE_1))));
layout->StartRow(0, double_column_fill_view_set_id_);
layout->AddView(text_fields_[TEXT_ADDRESS_LINE_1]);
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, double_column_leading_view_set_id_);
- layout->AddView(new views::Label(l10n_util::GetString(
- IDS_AUTOFILL_DIALOG_ADDRESS_LINE_2)));
+ layout->AddView(new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_AUTOFILL_DIALOG_ADDRESS_LINE_2))));
layout->StartRow(0, double_column_fill_view_set_id_);
layout->AddView(text_fields_[TEXT_ADDRESS_LINE_2]);
@@ -1152,11 +1152,11 @@
// The sizes: 4 characters for drop down icon + 2 for a month or 4 for a year.
column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
0, views::GridLayout::FIXED,
- font.GetStringWidth(std::wstring(L"000000")), 0);
+ font.GetStringWidth(ASCIIToUTF16("000000")), 0);
column_set->AddPaddingColumn(0, kRelatedControlHorizontalSpacing);
column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::CENTER,
0, views::GridLayout::FIXED,
- font.GetStringWidth(std::wstring(L"00000000")), 0);
+ font.GetStringWidth(ASCIIToUTF16("00000000")), 0);
column_set = layout->AddColumnSet(three_column_header_);
column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::FILL,
@@ -1172,7 +1172,8 @@
views::Label*
AutoFillProfilesView::EditableSetViewContents::CreateLeftAlignedLabel(
int label_id) {
- views::Label* label = new views::Label(l10n_util::GetString(label_id));
+ views::Label* label =
+ new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(label_id)));
label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
return label;
}
@@ -1266,14 +1267,14 @@
return profiles_->size() + credit_cards_->size();
}
-std::wstring AutoFillProfilesView::ContentListTableModel::GetText(
+string16 AutoFillProfilesView::ContentListTableModel::GetText(
int row, int column_id) {
DCHECK(row < static_cast<int>(profiles_->size() + credit_cards_->size()));
if (row < static_cast<int>(profiles_->size())) {
- return profiles_->at(row).address.Label();
+ return WideToUTF16Hack(profiles_->at(row).address.Label());
} else {
row -= profiles_->size();
- return credit_cards_->at(row).credit_card.PreviewSummary();
+ return WideToUTF16Hack(credit_cards_->at(row).credit_card.PreviewSummary());
}
}
@@ -1281,12 +1282,14 @@
TableModel::Groups groups;
TableModel::Group profile_group;
- profile_group.title = l10n_util::GetString(IDS_AUTOFILL_ADDRESSES_GROUP_NAME);
+ profile_group.title =
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_ADDRESSES_GROUP_NAME);
profile_group.id = kAddressGroup;
groups.push_back(profile_group);
Group cc_group;
- cc_group.title = l10n_util::GetString(IDS_AUTOFILL_CREDITCARDS_GROUP_NAME);
+ cc_group.title =
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_CREDITCARDS_GROUP_NAME);
cc_group.id = kCreditCardGroup;
groups.push_back(cc_group);
diff --git a/chrome/browser/ui/views/autofill_profiles_view_win.h b/chrome/browser/ui/views/autofill_profiles_view_win.h
index 6dbe8dd..b758b5a 100644
--- a/chrome/browser/ui/views/autofill_profiles_view_win.h
+++ b/chrome/browser/ui/views/autofill_profiles_view_win.h
@@ -12,6 +12,7 @@
#include "app/combobox_model.h"
#include "app/table_model.h"
+#include "base/compiler_specific.h"
#include "base/string16.h"
#include "chrome/browser/autofill/autofill_dialog.h"
#include "chrome/browser/autofill/autofill_profile.h"
@@ -286,8 +287,8 @@
// views::Textfield::Controller methods:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& keystroke);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& keystroke);
// views::Combobox::Listener methods:
virtual void ItemChanged(views::Combobox* combo_box,
@@ -398,12 +399,12 @@
void UpdateItem(int index);
// TableModel members:
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
- virtual bool HasGroups() { return true; }
- virtual TableModel::Groups GetGroups();
- virtual int GetGroupID(int row);
- virtual void SetObserver(TableModelObserver* observer);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column_id) OVERRIDE;
+ virtual bool HasGroups() OVERRIDE { return true; }
+ virtual TableModel::Groups GetGroups() OVERRIDE;
+ virtual int GetGroupID(int row) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
private:
std::vector<EditableSetInfo>* profiles_;
diff --git a/chrome/browser/ui/views/bookmark_bar_instructions_view.cc b/chrome/browser/ui/views/bookmark_bar_instructions_view.cc
index a89eb2d..36af2a6 100644
--- a/chrome/browser/ui/views/bookmark_bar_instructions_view.cc
+++ b/chrome/browser/ui/views/bookmark_bar_instructions_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/bookmark_bar_instructions_view.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/themes/browser_theme_provider.h"
#include "grit/generated_resources.h"
@@ -22,12 +23,12 @@
baseline_(-1),
updated_colors_(false) {
instructions_ = new views::Label(
- l10n_util::GetString(IDS_BOOKMARKS_NO_ITEMS));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS)));
AddChildView(instructions_);
if (browser_defaults::kShowImportOnBookmarkBar) {
import_link_ = new views::Link(
- l10n_util::GetString(IDS_BOOKMARK_BAR_IMPORT_LINK));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK)));
// We don't want the link to alter tab navigation.
import_link_->SetFocusable(false);
import_link_->SetController(this);
diff --git a/chrome/browser/ui/views/bookmark_bar_view.cc b/chrome/browser/ui/views/bookmark_bar_view.cc
index 37e9580..42f481e 100644
--- a/chrome/browser/ui/views/bookmark_bar_view.cc
+++ b/chrome/browser/ui/views/bookmark_bar_view.cc
@@ -12,7 +12,6 @@
#include "app/l10n_util.h"
#include "app/os_exchange_data.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "app/text_elider.h"
#include "base/i18n/rtl.h"
#include "base/string_util.h"
@@ -43,6 +42,7 @@
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/label.h"
#include "views/controls/menu/menu_item_view.h"
@@ -179,7 +179,7 @@
: TextButton(listener, title),
url_(url),
profile_(profile) {
- show_animation_.reset(new SlideAnimation(this));
+ show_animation_.reset(new ui::SlideAnimation(this));
if (BookmarkBarView::testing_) {
// For some reason during testing the events generated by animating
// throw off the test. So, don't animate while testing.
@@ -204,7 +204,7 @@
private:
const GURL& url_;
Profile* profile_;
- scoped_ptr<SlideAnimation> show_animation_;
+ scoped_ptr<ui::SlideAnimation> show_animation_;
DISALLOW_COPY_AND_ASSIGN(BookmarkButton);
};
@@ -220,7 +220,7 @@
views::ViewMenuDelegate* menu_delegate,
bool show_menu_marker)
: MenuButton(listener, title, menu_delegate, show_menu_marker) {
- show_animation_.reset(new SlideAnimation(this));
+ show_animation_.reset(new ui::SlideAnimation(this));
if (BookmarkBarView::testing_) {
// For some reason during testing the events generated by animating
// throw off the test. So, don't animate while testing.
@@ -247,7 +247,7 @@
}
private:
- scoped_ptr<SlideAnimation> show_animation_;
+ scoped_ptr<ui::SlideAnimation> show_animation_;
DISALLOW_COPY_AND_ASSIGN(BookmarkFolderButton);
};
@@ -779,12 +779,12 @@
return size_animation_->is_animating();
}
-void BookmarkBarView::AnimationProgressed(const Animation* animation) {
+void BookmarkBarView::AnimationProgressed(const ui::Animation* animation) {
if (browser_)
browser_->ToolbarSizeChanged(true);
}
-void BookmarkBarView::AnimationEnded(const Animation* animation) {
+void BookmarkBarView::AnimationEnded(const ui::Animation* animation) {
if (browser_)
browser_->ToolbarSizeChanged(false);
@@ -915,7 +915,7 @@
bookmarks_separator_view_ = new ButtonSeparatorView();
bookmarks_separator_view_->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_SEPARATOR));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR)));
AddChildView(bookmarks_separator_view_);
instructions_ = new BookmarkBarInstructionsView(this);
@@ -923,19 +923,21 @@
SetContextMenuController(this);
- size_animation_.reset(new SlideAnimation(this));
+ size_animation_.reset(new ui::SlideAnimation(this));
}
MenuButton* BookmarkBarView::CreateOtherBookmarkedButton() {
MenuButton* button = new BookmarkFolderButton(
- this, l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED), this,
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_BOOKMARKED)),
+ this,
false);
button->SetID(VIEW_ID_OTHER_BOOKMARKS);
button->SetIcon(GetGroupIcon());
button->SetContextMenuController(this);
button->set_tag(kOtherFolderButtonTag);
button->SetAccessibleName(
- l10n_util::GetString(IDS_BOOMARK_BAR_OTHER_BOOKMARKED));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BAR_OTHER_BOOKMARKED)));
return button;
}
@@ -957,7 +959,7 @@
button->SetVisible(false);
// Set accessibility name.
button->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_BOOKMARKS_CHEVRON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS_CHEVRON)));
return button;
}
@@ -1725,16 +1727,16 @@
views::TextButton* BookmarkBarView::CreateSyncErrorButton() {
views::TextButton* sync_error_button =
- new views::TextButton(this,
- l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR));
+ new views::TextButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR)));
sync_error_button->set_tag(kSyncErrorButtonTag);
// The tooltip is the only way we have to display text explaining the error
// to the user.
sync_error_button->SetTooltipText(
- l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC)));
sync_error_button->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SYNC_ERROR_BUTTON)));
sync_error_button->SetIcon(
*ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING));
return sync_error_button;
diff --git a/chrome/browser/ui/views/bookmark_bar_view.h b/chrome/browser/ui/views/bookmark_bar_view.h
index 9fadd8b..79709f4 100644
--- a/chrome/browser/ui/views/bookmark_bar_view.h
+++ b/chrome/browser/ui/views/bookmark_bar_view.h
@@ -8,7 +8,6 @@
#include <set>
-#include "app/animation_delegate.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/bookmarks/bookmark_model_observer.h"
#include "chrome/browser/sync/profile_sync_service.h"
@@ -16,13 +15,17 @@
#include "chrome/browser/views/bookmark_menu_controller_views.h"
#include "chrome/browser/views/detachable_toolbar_view.h"
#include "chrome/common/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/controls/button/button.h"
#include "views/controls/menu/view_menu_delegate.h"
class Browser;
class PageNavigator;
class PrefService;
+
+namespace ui {
class SlideAnimation;
+}
namespace views {
class CustomButton;
@@ -46,7 +49,7 @@
public NotificationObserver,
public views::ContextMenuController,
public views::DragController,
- public AnimationDelegate,
+ public ui::AnimationDelegate,
public BookmarkMenuController::Observer,
public BookmarkBarInstructionsView::Delegate {
friend class ShowFolderMenuTask;
@@ -180,8 +183,8 @@
bool is_animating();
// SlideAnimationDelegate implementation.
- void AnimationProgressed(const Animation* animation);
- void AnimationEnded(const Animation* animation);
+ void AnimationProgressed(const ui::Animation* animation);
+ void AnimationEnded(const ui::Animation* animation);
// BookmarkMenuController::Observer
virtual void BookmarkMenuDeleted(BookmarkMenuController* controller);
@@ -491,7 +494,7 @@
bool infobar_visible_;
// Animation controlling showing and hiding of the bar.
- scoped_ptr<SlideAnimation> size_animation_;
+ scoped_ptr<ui::SlideAnimation> size_animation_;
// If the bookmark bubble is showing, this is the visible ancestor of the URL.
// The visible ancestor is either the other_bookmarked_button_,
diff --git a/chrome/browser/ui/views/bookmark_bubble_view.cc b/chrome/browser/ui/views/bookmark_bubble_view.cc
index 0fca648..fdb47df 100644
--- a/chrome/browser/ui/views/bookmark_bubble_view.cc
+++ b/chrome/browser/ui/views/bookmark_bubble_view.cc
@@ -9,6 +9,7 @@
#include "app/resource_bundle.h"
#include "base/string16.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/bookmarks/bookmark_editor.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
@@ -92,6 +93,7 @@
parent->GetClientView()->GetWidget(), bounds, BubbleBorder::TOP_RIGHT,
bubble_, bubble_);
bubble_->set_info_bubble(info_bubble);
+ info_bubble->SizeToContents();
GURL url_ptr(url);
NotificationService::current()->Notify(
NotificationType::BOOKMARK_BUBBLE_SHOWN,
@@ -180,27 +182,28 @@
initialized = true;
}
- remove_link_ = new Link(l10n_util::GetString(
- IDS_BOOMARK_BUBBLE_REMOVE_BOOKMARK));
+ remove_link_ = new Link(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_BOOMARK_BUBBLE_REMOVE_BOOKMARK)));
remove_link_->SetController(this);
edit_button_ = new NativeButton(
- this, l10n_util::GetString(IDS_BOOMARK_BUBBLE_OPTIONS));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_OPTIONS)));
- close_button_ = new NativeButton(this, l10n_util::GetString(IDS_DONE));
+ close_button_ =
+ new NativeButton(this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE)));
close_button_->SetIsDefault(true);
Label* combobox_label = new Label(
- l10n_util::GetString(IDS_BOOMARK_BUBBLE_FOLDER_TEXT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_FOLDER_TEXT)));
parent_combobox_ = new Combobox(&parent_model_);
parent_combobox_->SetSelectedItem(parent_model_.node_parent_index());
parent_combobox_->set_listener(this);
parent_combobox_->SetAccessibleName(combobox_label->GetText());
- Label* title_label = new Label(l10n_util::GetString(
+ Label* title_label = new Label(UTF16ToWide(l10n_util::GetStringUTF16(
newly_bookmarked_ ? IDS_BOOMARK_BUBBLE_PAGE_BOOKMARKED :
- IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK));
+ IDS_BOOMARK_BUBBLE_PAGE_BOOKMARK)));
title_label->SetFont(
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont));
title_label->SetColor(kTitleColor);
@@ -243,8 +246,8 @@
layout->AddPaddingRow(0, kRelatedControlSmallVerticalSpacing);
layout->StartRow(0, 2);
- layout->AddView(
- new Label(l10n_util::GetString(IDS_BOOMARK_BUBBLE_TITLE_TEXT)));
+ layout->AddView(new Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_TITLE_TEXT))));
title_tf_ = new views::Textfield();
title_tf_->SetText(GetTitle());
layout->AddView(title_tf_);
@@ -327,7 +330,8 @@
}
std::wstring BookmarkBubbleView::accessible_name() {
- return l10n_util::GetString(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_BOOMARK_BUBBLE_ADD_BOOKMARK));
}
void BookmarkBubbleView::Close() {
diff --git a/chrome/browser/ui/views/bookmark_context_menu.cc b/chrome/browser/ui/views/bookmark_context_menu.cc
index bd435ae..9067dd9 100644
--- a/chrome/browser/ui/views/bookmark_context_menu.cc
+++ b/chrome/browser/ui/views/bookmark_context_menu.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/i18n/rtl.h"
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/notification_service.h"
@@ -73,7 +74,8 @@
}
void BookmarkContextMenu::AddItemWithStringId(int command_id, int string_id) {
- menu_->AppendMenuItemWithLabel(command_id, l10n_util::GetString(string_id));
+ menu_->AppendMenuItemWithLabel(
+ command_id, UTF16ToWide(l10n_util::GetStringUTF16(string_id)));
}
void BookmarkContextMenu::AddSeparator() {
@@ -81,7 +83,8 @@
}
void BookmarkContextMenu::AddCheckboxItem(int command_id, int string_id) {
- menu_->AppendMenuItem(command_id, l10n_util::GetString(string_id),
+ menu_->AppendMenuItem(command_id,
+ UTF16ToWide(l10n_util::GetStringUTF16(string_id)),
views::MenuItemView::CHECKBOX);
}
diff --git a/chrome/browser/ui/views/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmark_editor_view.cc
index a64d42e..c6768c4 100644
--- a/chrome/browser/ui/views/bookmark_editor_view.cc
+++ b/chrome/browser/ui/views/bookmark_editor_view.cc
@@ -106,7 +106,7 @@
}
std::wstring BookmarkEditorView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_BOOMARK_EDITOR_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_TITLE));
}
bool BookmarkEditorView::Accept() {
@@ -271,12 +271,13 @@
if (details_.type == EditDetails::EXISTING_NODE)
title = details_.existing_node->GetTitle();
else if (details_.type == EditDetails::NEW_FOLDER)
- title = l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME);
+ title = UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NEW_FOLDER_NAME));
title_tf_.SetText(title);
title_tf_.SetController(this);
title_label_ = new views::Label(
- l10n_util::GetString(IDS_BOOMARK_EDITOR_NAME_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_NAME_LABEL)));
title_tf_.SetAccessibleName(title_label_->GetText());
string16 url_text;
@@ -295,13 +296,15 @@
url_tf_.SetController(this);
url_label_ = new views::Label(
- l10n_util::GetString(IDS_BOOMARK_EDITOR_URL_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BOOMARK_EDITOR_URL_LABEL)));
url_tf_.SetAccessibleName(url_label_->GetText());
if (show_tree_) {
tree_view_ = new views::TreeView();
new_group_button_.reset(new views::NativeButton(
- this, l10n_util::GetString(IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON)));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_BOOMARK_EDITOR_NEW_FOLDER_BUTTON))));
new_group_button_->set_parent_owned(false);
tree_view_->SetContextMenuController(this);
diff --git a/chrome/browser/ui/views/bookmark_editor_view.h b/chrome/browser/ui/views/bookmark_editor_view.h
index de4c677..f6da363 100644
--- a/chrome/browser/ui/views/bookmark_editor_view.h
+++ b/chrome/browser/ui/views/bookmark_editor_view.h
@@ -99,8 +99,8 @@
// Textfield::Controller methods.
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke&) {
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
return false;
}
diff --git a/chrome/browser/ui/views/browser_actions_container.cc b/chrome/browser/ui/views/browser_actions_container.cc
index 1f6f61c..44a4a00 100644
--- a/chrome/browser/ui/views/browser_actions_container.cc
+++ b/chrome/browser/ui/views/browser_actions_container.cc
@@ -6,7 +6,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
@@ -38,6 +37,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkTypeface.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/button/text_button.h"
#include "views/controls/menu/menu_2.h"
@@ -288,8 +288,8 @@
button_->SetDragController(panel_);
AddChildView(button_);
button_->UpdateState();
- SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION));
+ SetAccessibleName(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_BROWSER_ACTION)));
}
BrowserActionView::~BrowserActionView() {
@@ -366,20 +366,22 @@
model_->AddObserver(this);
}
- resize_animation_.reset(new SlideAnimation(this));
+ resize_animation_.reset(new ui::SlideAnimation(this));
resize_area_ = new views::ResizeArea(this);
- resize_area_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_SEPARATOR));
+ resize_area_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SEPARATOR)));
AddChildView(resize_area_);
chevron_ = new views::MenuButton(NULL, std::wstring(), this, false);
chevron_->set_border(NULL);
chevron_->EnableCanvasFlippingForRTLUI(true);
chevron_->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_EXTENSIONS_CHEVRON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS_CHEVRON)));
chevron_->SetVisible(false);
AddChildView(chevron_);
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_EXTENSIONS));
+ SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_EXTENSIONS)));
}
BrowserActionsContainer::~BrowserActionsContainer() {
@@ -797,18 +799,19 @@
int max_width = IconCountToWidth(-1, false);
container_width_ =
std::min(std::max(0, container_width_ - resize_amount), max_width);
- SaveDesiredSizeAndAnimate(Tween::EASE_OUT,
+ SaveDesiredSizeAndAnimate(ui::Tween::EASE_OUT,
WidthToIconCount(container_width_));
}
-void BrowserActionsContainer::AnimationProgressed(const Animation* animation) {
+void BrowserActionsContainer::AnimationProgressed(
+ const ui::Animation* animation) {
DCHECK_EQ(resize_animation_.get(), animation);
resize_amount_ = static_cast<int>(resize_animation_->GetCurrentValue() *
(container_width_ - animation_target_size_));
OnBrowserActionVisibilityChanged();
}
-void BrowserActionsContainer::AnimationEnded(const Animation* animation) {
+void BrowserActionsContainer::AnimationEnded(const ui::Animation* animation) {
container_width_ = animation_target_size_;
animation_target_size_ = 0;
resize_amount_ = 0;
@@ -918,7 +921,7 @@
if ((model_->GetVisibleIconCount() < 0) &&
!profile_->GetExtensionService()->IsBeingUpgraded(extension)) {
suppress_chevron_ = true;
- SaveDesiredSizeAndAnimate(Tween::LINEAR, visible_actions + 1);
+ SaveDesiredSizeAndAnimate(ui::Tween::LINEAR, visible_actions + 1);
} else {
// Just redraw the (possibly modified) visible icon set.
OnBrowserActionVisibilityChanged();
@@ -954,7 +957,7 @@
// Either we went from overflow to no-overflow, or we shrunk the no-
// overflow container by 1. Either way the size changed, so animate.
chevron_->SetVisible(false);
- SaveDesiredSizeAndAnimate(Tween::EASE_OUT,
+ SaveDesiredSizeAndAnimate(ui::Tween::EASE_OUT,
browser_action_views_.size());
}
return;
@@ -1066,7 +1069,7 @@
}
void BrowserActionsContainer::SaveDesiredSizeAndAnimate(
- Tween::Type tween_type,
+ ui::Tween::Type tween_type,
size_t num_visible_icons) {
// Save off the desired number of visible icons. We do this now instead of at
// the end of the animation so that even if the browser is shut down while
diff --git a/chrome/browser/ui/views/browser_actions_container.h b/chrome/browser/ui/views/browser_actions_container.h
index 62b567f..5291ece 100644
--- a/chrome/browser/ui/views/browser_actions_container.h
+++ b/chrome/browser/ui/views/browser_actions_container.h
@@ -10,8 +10,6 @@
#include <string>
#include <vector>
-#include "app/animation_delegate.h"
-#include "app/tween.h"
#include "base/task.h"
#include "chrome/browser/extensions/extension_context_menu_model.h"
#include "chrome/browser/extensions/extension_toolbar_model.h"
@@ -21,6 +19,8 @@
#include "chrome/browser/views/extensions/extension_popup.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/tween.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/view_menu_delegate.h"
#include "views/controls/resize_area.h"
@@ -35,12 +35,15 @@
class ExtensionPopup;
class PrefService;
class Profile;
-class SlideAnimation;
namespace gfx {
class CanvasSkia;
}
+namespace ui {
+class SlideAnimation;
+}
+
namespace views {
class Menu2;
}
@@ -254,7 +257,7 @@
public views::ViewMenuDelegate,
public views::DragController,
public views::ResizeArea::ResizeAreaDelegate,
- public AnimationDelegate,
+ public ui::AnimationDelegate,
public ExtensionToolbarModel::Observer,
public BrowserActionOverflowMenuController::Observer,
public ExtensionContextMenuModel::PopupDelegate,
@@ -345,9 +348,9 @@
// Overridden from ResizeArea::ResizeAreaDelegate:
virtual void OnResize(int resize_amount, bool done_resizing);
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// Overridden from BrowserActionOverflowMenuController::Observer:
virtual void NotifyMenuDeleted(
@@ -439,7 +442,8 @@
// Animate to the target size (unless testing, in which case we go straight to
// the target size). This also saves the target number of visible icons in
// the pref if we're not off the record.
- void SaveDesiredSizeAndAnimate(Tween::Type type, size_t num_visible_icons);
+ void SaveDesiredSizeAndAnimate(ui::Tween::Type type,
+ size_t num_visible_icons);
// Returns true if this extension should be shown in this toolbar. This can
// return false if we are in an incognito window and the extension is disabled
@@ -483,7 +487,7 @@
BrowserActionOverflowMenuController* overflow_menu_;
// The animation that happens when the container snaps to place.
- scoped_ptr<SlideAnimation> resize_animation_;
+ scoped_ptr<ui::SlideAnimation> resize_animation_;
// Don't show the chevron while animating.
bool suppress_chevron_;
diff --git a/chrome/browser/ui/views/browser_dialogs.h b/chrome/browser/ui/views/browser_dialogs.h
index 50c0bbc..ce74e38 100644
--- a/chrome/browser/ui/views/browser_dialogs.h
+++ b/chrome/browser/ui/views/browser_dialogs.h
@@ -85,9 +85,6 @@
// Shows the keyword editor. See KeywordEditorView.
void ShowKeywordEditorView(Profile* profile);
-// Shows the "new profile" dialog box. See NewProfileDialog.
-void ShowNewProfileDialog();
-
// Shows the Task Manager.
void ShowTaskManager();
diff --git a/chrome/browser/ui/views/clear_browsing_data.cc b/chrome/browser/ui/views/clear_browsing_data.cc
index 0f9a331..0693d5a 100644
--- a/chrome/browser/ui/views/clear_browsing_data.cc
+++ b/chrome/browser/ui/views/clear_browsing_data.cc
@@ -86,42 +86,48 @@
throbber_->SetVisible(false);
status_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_DATA_DELETING));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_DELETING)));
status_label_->SetVisible(false);
// Regular view controls we draw by ourself. First, we add the dialog label.
delete_all_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_LABEL)));
AddChildView(delete_all_label_);
// Add all the check-boxes.
del_history_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_BROWSING_HISTORY_CHKBOX),
+ AddCheckbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_DEL_BROWSING_HISTORY_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteBrowsingHistory));
del_downloads_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX),
+ AddCheckbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteDownloadHistory));
del_cache_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_CACHE_CHKBOX),
+ AddCheckbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_DEL_CACHE_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteCache));
del_cookies_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX),
+ AddCheckbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_DEL_COOKIES_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteCookies));
del_passwords_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX),
+ AddCheckbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_DEL_PASSWORDS_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeletePasswords));
del_form_data_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_FORM_DATA_CHKBOX),
+ AddCheckbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_DEL_FORM_DATA_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteFormData));
// Add a label which appears before the combo box for the time period.
- time_period_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TIME_LABEL));
+ time_period_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_TIME_LABEL)));
AddChildView(time_period_label_);
// Add the combo box showing how far back in time we want to delete.
@@ -247,8 +253,9 @@
MessageBoxFlags::DialogButton button) const {
DCHECK((button == MessageBoxFlags::DIALOGBUTTON_OK) ||
(button == MessageBoxFlags::DIALOGBUTTON_CANCEL));
- return l10n_util::GetString((button == MessageBoxFlags::DIALOGBUTTON_OK) ?
- IDS_CLEAR_BROWSING_DATA_COMMIT : IDS_CANCEL);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ (button == MessageBoxFlags::DIALOGBUTTON_OK) ?
+ IDS_CLEAR_BROWSING_DATA_COMMIT : IDS_CANCEL));
}
bool ClearBrowsingDataView::IsDialogButtonEnabled(
@@ -289,7 +296,7 @@
}
std::wstring ClearBrowsingDataView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_TITLE));
}
bool ClearBrowsingDataView::Accept() {
@@ -324,8 +331,8 @@
views::ClientView* ClearBrowsingDataView::CreateClientView(
views::Window* window) {
- views::Link* flash_link =
- new views::Link(l10n_util::GetString(IDS_FLASH_STORAGE_SETTINGS));
+ views::Link* flash_link = new views::Link(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FLASH_STORAGE_SETTINGS)));
flash_link->SetController(this);
views::View* settings_view = new views::View();
diff --git a/chrome/browser/ui/views/clear_browsing_data_view.cc b/chrome/browser/ui/views/clear_browsing_data_view.cc
index 1aec286..2aced59 100644
--- a/chrome/browser/ui/views/clear_browsing_data_view.cc
+++ b/chrome/browser/ui/views/clear_browsing_data_view.cc
@@ -83,44 +83,45 @@
throbber_->SetVisible(false);
status_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_DATA_DELETING));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_DELETING)));
status_label_->SetVisible(false);
// Regular view controls we draw by ourself. First, we add the dialog label.
delete_all_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_LABEL)));
// Add all the check-boxes.
- del_history_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_BROWSING_HISTORY_CHKBOX),
+ del_history_checkbox_ = AddCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_DEL_BROWSING_HISTORY_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteBrowsingHistory));
- del_downloads_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX),
+ del_downloads_checkbox_ = AddCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_DEL_DOWNLOAD_HISTORY_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteDownloadHistory));
- del_cache_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_CACHE_CHKBOX),
+ del_cache_checkbox_ = AddCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_DEL_CACHE_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteCache));
- del_cookies_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_COOKIES_CHKBOX),
+ del_cookies_checkbox_ = AddCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_DEL_COOKIES_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteCookies));
- del_passwords_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_PASSWORDS_CHKBOX),
+ del_passwords_checkbox_ = AddCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_DEL_PASSWORDS_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeletePasswords));
- del_form_data_checkbox_ =
- AddCheckbox(l10n_util::GetString(IDS_DEL_FORM_DATA_CHKBOX),
+ del_form_data_checkbox_ = AddCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_DEL_FORM_DATA_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kDeleteFormData));
clear_browsing_data_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_BUTTON)));
// Add a label which appears before the combo box for the time period.
- time_period_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TIME_LABEL));
+ time_period_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_TIME_LABEL)));
// Add the combo box showing how far back in time we want to delete.
time_period_combobox_ = new views::Combobox(this);
diff --git a/chrome/browser/ui/views/clear_data_view.cc b/chrome/browser/ui/views/clear_data_view.cc
index 9703277..839d668 100644
--- a/chrome/browser/ui/views/clear_data_view.cc
+++ b/chrome/browser/ui/views/clear_data_view.cc
@@ -53,19 +53,22 @@
void ClearDataView::Init() {
tabs_ = new views::TabbedPane;
- tabs_->SetAccessibleName(l10n_util::GetStringF(IDS_OPTIONS_DIALOG_TITLE,
- l10n_util::GetString(IDS_OPTIONS_DIALOG_TITLE)));
+ tabs_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringFUTF16(IDS_OPTIONS_DIALOG_TITLE,
+ l10n_util::GetStringUTF16(IDS_OPTIONS_DIALOG_TITLE))));
AddChildView(tabs_);
int tab_index = 0;
clear_browsing_data_tab_ = new ClearBrowsingDataView2(profile_, this);
- tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_CLEAR_CHROME_DATA_TAB_LABEL),
- clear_browsing_data_tab_, false);
+ tabs_->AddTabAtIndex(
+ tab_index++,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_CHROME_DATA_TAB_LABEL)),
+ clear_browsing_data_tab_, false);
clear_server_data_tab_ = new ClearServerDataView(profile_, this);
- tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_CLEAR_OTHER_DATA_TAB_LABEL),
- clear_server_data_tab_, false);
+ tabs_->AddTabAtIndex(
+ tab_index++,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_OTHER_DATA_TAB_LABEL)),
+ clear_server_data_tab_, false);
tabs_->SelectTabAt(static_cast<int>(0));
}
@@ -126,7 +129,7 @@
std::wstring ClearDataView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
DCHECK(button == MessageBoxFlags::DIALOGBUTTON_CANCEL);
- return l10n_util::GetString(IDS_CANCEL);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL));
}
int ClearDataView::GetDialogButtons() const {
@@ -161,7 +164,7 @@
}
std::wstring ClearDataView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_CLEAR_BROWSING_DATA_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_BROWSING_DATA_TITLE));
}
views::View* ClearDataView::GetContentsView() {
diff --git a/chrome/browser/ui/views/clear_server_data.cc b/chrome/browser/ui/views/clear_server_data.cc
index da2ac87..34c158d 100644
--- a/chrome/browser/ui/views/clear_server_data.cc
+++ b/chrome/browser/ui/views/clear_server_data.cc
@@ -80,35 +80,36 @@
rb.GetFont(ResourceBundle::BaseFont).DeriveFont(0, gfx::Font::BOLD);
flash_title_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_DATA_ADOBE_FLASH_TITLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_ADOBE_FLASH_TITLE)));
flash_title_label_->SetFont(title_font);
- flash_description_label_= new views::Label(
- l10n_util::GetString(IDS_CLEAR_DATA_ADOBE_FLASH_DESCRIPTION));
- flash_link_ =
- new views::Link(l10n_util::GetString(IDS_FLASH_STORAGE_SETTINGS));
+ flash_description_label_= new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_CLEAR_DATA_ADOBE_FLASH_DESCRIPTION)));
+ flash_link_ = new views::Link(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FLASH_STORAGE_SETTINGS)));
flash_link_->SetController(this);
chrome_sync_title_label_= new views::Label(
- l10n_util::GetString(IDS_CLEAR_DATA_CHROME_SYNC_TITLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_CHROME_SYNC_TITLE)));
chrome_sync_title_label_->SetFont(title_font);
- chrome_sync_description_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_DATA_CLEAR_SERVER_DATA_DESCRIPTION));
+ chrome_sync_description_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_CLEAR_DATA_CLEAR_SERVER_DATA_DESCRIPTION)));
clear_server_data_button_= new views::NativeButton(
- this, l10n_util::GetString(IDS_CLEAR_DATA_CLEAR_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_CLEAR_BUTTON)));
dashboard_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_DASHBOARD_DESCRIPTION));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DASHBOARD_DESCRIPTION)));
dashboard_link_ = new views::Link();
dashboard_link_->SetController(this);
- dashboard_link_->SetText(
- l10n_util::GetString(IDS_SYNC_PRIVACY_DASHBOARD_LINK_LABEL));
+ dashboard_link_->SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SYNC_PRIVACY_DASHBOARD_LINK_LABEL)));
status_label_ = new views::Label(
- l10n_util::GetString(IDS_CLEAR_DATA_DELETING));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_DELETING)));
throbber_ = new views::Throbber(50, true);
}
@@ -234,8 +235,8 @@
ConfirmMessageBoxDialog::Run(
GetWindow()->GetNativeWindow(),
this,
- l10n_util::GetString(IDS_CONFIRM_CLEAR_DESCRIPTION),
- l10n_util::GetString(IDS_CONFIRM_CLEAR_TITLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CONFIRM_CLEAR_DESCRIPTION)),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CONFIRM_CLEAR_TITLE)));
}
}
@@ -303,14 +304,16 @@
case ProfileSyncService::CLEAR_CLEARING:
// Clearing buttons on all tabs are disabled at this
// point, throbber is going
- status_label_->SetText(l10n_util::GetString(IDS_CLEAR_DATA_SENDING));
+ status_label_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_SENDING)));
status_label_->SetVisible(true);
delete_in_progress = true;
break;
case ProfileSyncService::CLEAR_FAILED:
// Show an error and reallow clearing
clear_data_parent_window_->FailedClearingServerData();
- status_label_->SetText(l10n_util::GetString(IDS_CLEAR_DATA_ERROR));
+ status_label_->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLEAR_DATA_ERROR)));
status_label_->SetVisible(true);
delete_in_progress = false;
break;
diff --git a/chrome/browser/ui/views/collected_cookies_win.cc b/chrome/browser/ui/views/collected_cookies_win.cc
index 308c0c4..a545971 100644
--- a/chrome/browser/ui/views/collected_cookies_win.cc
+++ b/chrome/browser/ui/views/collected_cookies_win.cc
@@ -80,18 +80,21 @@
std::wstring label;
switch (setting) {
case CONTENT_SETTING_BLOCK:
- label = l10n_util::GetStringF(
- IDS_COLLECTED_COOKIES_BLOCK_RULE_CREATED, domain_name);
+ label = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_COLLECTED_COOKIES_BLOCK_RULE_CREATED,
+ WideToUTF16(domain_name)));
break;
case CONTENT_SETTING_ALLOW:
- label = l10n_util::GetStringF(
- IDS_COLLECTED_COOKIES_ALLOW_RULE_CREATED, domain_name);
+ label = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_COLLECTED_COOKIES_ALLOW_RULE_CREATED,
+ WideToUTF16(domain_name)));
break;
case CONTENT_SETTING_SESSION_ONLY:
- label = l10n_util::GetStringF(
- IDS_COLLECTED_COOKIES_SESSION_RULE_CREATED, domain_name);
+ label = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_COLLECTED_COOKIES_SESSION_RULE_CREATED,
+ WideToUTF16(domain_name)));
break;
default:
@@ -186,8 +189,8 @@
tab_contents_->profile()->GetHostContentSettingsMap();
// Allowed Cookie list.
- allowed_label_ = new views::Label(
- l10n_util::GetString(IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL));
+ allowed_label_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_COLLECTED_COOKIES_ALLOWED_COOKIES_LABEL)));
allowed_cookies_tree_model_.reset(
content_settings->GetAllowedCookiesTreeModel());
allowed_cookies_tree_ = new views::TreeView();
@@ -200,10 +203,10 @@
// Blocked Cookie list.
blocked_label_ = new views::Label(
- l10n_util::GetString(
+ UTF16ToWide(l10n_util::GetStringUTF16(
host_content_settings_map->BlockThirdPartyCookies() ?
IDS_COLLECTED_COOKIES_BLOCKED_THIRD_PARTY_BLOCKING_ENABLED :
- IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL));
+ IDS_COLLECTED_COOKIES_BLOCKED_COOKIES_LABEL)));
blocked_label_->SetMultiLine(true);
blocked_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
blocked_cookies_tree_model_.reset(
@@ -245,8 +248,8 @@
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, single_column_layout_id);
- block_allowed_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_COLLECTED_COOKIES_BLOCK_BUTTON));
+ block_allowed_button_ = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_BLOCK_BUTTON)));
layout->AddView(
block_allowed_button_, 1, 1, GridLayout::LEADING, GridLayout::CENTER);
layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
@@ -267,11 +270,11 @@
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
layout->StartRow(0, three_columns_layout_id);
- allow_blocked_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_COLLECTED_COOKIES_ALLOW_BUTTON));
+ allow_blocked_button_ = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_ALLOW_BUTTON)));
layout->AddView(allow_blocked_button_);
- for_session_blocked_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_COLLECTED_COOKIES_SESSION_ONLY_BUTTON));
+ for_session_blocked_button_ = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_SESSION_ONLY_BUTTON)));
layout->AddView(for_session_blocked_button_);
layout->StartRow(0, single_column_layout_id);
@@ -285,7 +288,8 @@
// ConstrainedDialogDelegate implementation.
std::wstring CollectedCookiesWin::GetWindowTitle() const {
- return l10n_util::GetString(IDS_COLLECTED_COOKIES_DIALOG_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COLLECTED_COOKIES_DIALOG_TITLE));
}
int CollectedCookiesWin::GetDialogButtons() const {
@@ -294,7 +298,7 @@
std::wstring CollectedCookiesWin::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
- return l10n_util::GetString(IDS_CLOSE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLOSE));
}
void CollectedCookiesWin::DeleteDelegate() {
diff --git a/chrome/browser/ui/views/confirm_message_box_dialog.cc b/chrome/browser/ui/views/confirm_message_box_dialog.cc
index 3f3a1a3..10569f9 100644
--- a/chrome/browser/ui/views/confirm_message_box_dialog.cc
+++ b/chrome/browser/ui/views/confirm_message_box_dialog.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
+#include "base/utf_string_conversions.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "views/standard_layout.h"
@@ -53,10 +54,10 @@
preferred_size_(gfx::Size(views::Window::GetLocalizedContentsSize(
IDS_CONFIRM_MESSAGE_BOX_DEFAULT_WIDTH_CHARS,
IDS_CONFIRM_MESSAGE_BOX_DEFAULT_HEIGHT_LINES))),
- confirm_label_(l10n_util::GetString(
- IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL)),
- reject_label_(l10n_util::GetString(
- IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL)) {
+ confirm_label_(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_CONFIRM_MESSAGEBOX_YES_BUTTON_LABEL))),
+ reject_label_(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_CONFIRM_MESSAGEBOX_NO_BUTTON_LABEL))) {
message_label_ = new views::Label(message_text);
message_label_->SetMultiLine(true);
message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
diff --git a/chrome/browser/ui/views/constrained_window_win.cc b/chrome/browser/ui/views/constrained_window_win.cc
index b042f5b..121605f 100644
--- a/chrome/browser/ui/views/constrained_window_win.cc
+++ b/chrome/browser/ui/views/constrained_window_win.cc
@@ -5,7 +5,8 @@
#include "chrome/browser/views/constrained_window_win.h"
#include "app/resource_bundle.h"
-#include "app/win_util.h"
+#include "app/win/hwnd_util.h"
+#include "app/win/win_util.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
@@ -197,7 +198,7 @@
SkColor GetTitleColor() const {
return (container_->owner()->profile()->IsOffTheRecord() ||
- !win_util::ShouldUseVistaFrame()) ? SK_ColorWHITE : SK_ColorBLACK;
+ !app::win::ShouldUseVistaFrame()) ? SK_ColorWHITE : SK_ColorBLACK;
}
// Loads the appropriate set of WindowResources for the frame view.
@@ -534,7 +535,7 @@
}
void ConstrainedWindowFrameView::InitWindowResources() {
- resources_.reset(win_util::ShouldUseVistaFrame() ?
+ resources_.reset(app::win::ShouldUseVistaFrame() ?
static_cast<views::WindowResources*>(new VistaWindowResources) :
new XPWindowResources);
}
@@ -543,7 +544,7 @@
void ConstrainedWindowFrameView::InitClass() {
static bool initialized = false;
if (!initialized) {
- title_font_ = new gfx::Font(win_util::GetWindowTitleFont());
+ title_font_ = new gfx::Font(app::win::GetWindowTitleFont());
initialized = true;
}
}
diff --git a/chrome/browser/ui/views/content_setting_bubble_contents.cc b/chrome/browser/ui/views/content_setting_bubble_contents.cc
index 27104a2..25122f2 100644
--- a/chrome/browser/ui/views/content_setting_bubble_contents.cc
+++ b/chrome/browser/ui/views/content_setting_bubble_contents.cc
@@ -336,6 +336,7 @@
layout->AddView(manage_link_);
close_button_ =
- new views::NativeButton(this, l10n_util::GetString(IDS_DONE));
+ new views::NativeButton(this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_DONE)));
layout->AddView(close_button_);
}
diff --git a/chrome/browser/ui/views/cookie_info_view.cc b/chrome/browser/ui/views/cookie_info_view.cc
index 7fe0d54..0b3fe98 100644
--- a/chrome/browser/ui/views/cookie_info_view.cc
+++ b/chrome/browser/ui/views/cookie_info_view.cc
@@ -67,14 +67,15 @@
std::wstring expire_text = cookie.DoesExpire() ?
base::TimeFormatFriendlyDateAndTime(cookie.ExpiryDate()) :
- l10n_util::GetString(IDS_COOKIES_COOKIE_EXPIRES_SESSION);
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_SESSION));
if (editable_expiration_date_) {
expire_combo_values_.clear();
if (cookie.DoesExpire())
expire_combo_values_.push_back(expire_text);
- expire_combo_values_.push_back(
- l10n_util::GetString(IDS_COOKIES_COOKIE_EXPIRES_SESSION));
+ expire_combo_values_.push_back(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_SESSION)));
expires_value_combobox_->ModelChanged();
expires_value_combobox_->SetSelectedItem(0);
expires_value_combobox_->SetEnabled(true);
@@ -84,8 +85,10 @@
}
send_for_value_field_->SetText(cookie.IsSecure() ?
- l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_SECURE) :
- l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_ANY));
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_SECURE)) :
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_ANY)));
EnableCookieDisplay(true);
Layout();
}
@@ -100,7 +103,7 @@
void CookieInfoView::ClearCookieDisplay() {
std::wstring no_cookie_string =
- l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NONESELECTED));
name_value_field_->SetText(no_cookie_string);
content_value_field_->SetText(no_cookie_string);
domain_value_field_->SetText(no_cookie_string);
@@ -184,25 +187,25 @@
set_border(border);
name_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_NAME_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL)));
name_value_field_ = new views::Textfield;
content_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_CONTENT_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CONTENT_LABEL)));
content_value_field_ = new views::Textfield;
domain_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_DOMAIN_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_DOMAIN_LABEL)));
domain_value_field_ = new views::Textfield;
path_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_PATH_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_PATH_LABEL)));
path_value_field_ = new views::Textfield;
send_for_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_SENDFOR_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_SENDFOR_LABEL)));
send_for_value_field_ = new views::Textfield;
created_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_CREATED_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_CREATED_LABEL)));
created_value_field_ = new views::Textfield;
expires_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_EXPIRES_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_EXPIRES_LABEL)));
if (editable_expiration_date_)
expires_value_combobox_ = new views::Combobox(this);
else
diff --git a/chrome/browser/ui/views/create_application_shortcut_view.cc b/chrome/browser/ui/views/create_application_shortcut_view.cc
index 4532222..61415fb 100644
--- a/chrome/browser/ui/views/create_application_shortcut_view.cc
+++ b/chrome/browser/ui/views/create_application_shortcut_view.cc
@@ -32,11 +32,6 @@
#include "views/standard_layout.h"
#include "views/window/window.h"
-
-#if defined(OS_WIN)
-#include "base/win_util.h"
-#endif // defined(OS_WIN)
-
namespace {
const int kAppIconSize = 32;
@@ -240,29 +235,30 @@
app_info_ = new AppInfoView(shortcut_info_.title, shortcut_info_.description,
shortcut_info_.favicon);
create_shortcuts_label_ = new views::Label(
- l10n_util::GetString(IDS_CREATE_SHORTCUTS_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_LABEL)));
create_shortcuts_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- desktop_check_box_ = AddCheckbox(
- l10n_util::GetString(IDS_CREATE_SHORTCUTS_DESKTOP_CHKBOX),
+ desktop_check_box_ = AddCheckbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_DESKTOP_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateOnDesktop));
menu_check_box_ = NULL;
quick_launch_check_box_ = NULL;
#if defined(OS_WIN)
- menu_check_box_ = AddCheckbox(
- l10n_util::GetString(IDS_CREATE_SHORTCUTS_START_MENU_CHKBOX),
+ menu_check_box_ = AddCheckbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_START_MENU_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInAppsMenu));
quick_launch_check_box_ = AddCheckbox(
(base::win::GetVersion() >= base::win::VERSION_WIN7) ?
- l10n_util::GetString(IDS_PIN_TO_TASKBAR_CHKBOX) :
- l10n_util::GetString(IDS_CREATE_SHORTCUTS_QUICK_LAUNCH_BAR_CHKBOX),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PIN_TO_TASKBAR_CHKBOX)) :
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_CREATE_SHORTCUTS_QUICK_LAUNCH_BAR_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInQuickLaunchBar));
#elif defined(OS_LINUX)
menu_check_box_ = AddCheckbox(
- l10n_util::GetString(IDS_CREATE_SHORTCUTS_MENU_CHKBOX),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_MENU_CHKBOX)),
profile_->GetPrefs()->GetBoolean(prefs::kWebAppCreateInAppsMenu));
#endif
@@ -316,7 +312,7 @@
std::wstring CreateApplicationShortcutView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_CREATE_SHORTCUTS_COMMIT);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_COMMIT));
}
return std::wstring();
@@ -355,7 +351,7 @@
}
std::wstring CreateApplicationShortcutView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_CREATE_SHORTCUTS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CREATE_SHORTCUTS_TITLE));
}
bool CreateApplicationShortcutView::Accept() {
diff --git a/chrome/browser/ui/views/database_info_view.cc b/chrome/browser/ui/views/database_info_view.cc
index 70596e3..065d814 100644
--- a/chrome/browser/ui/views/database_info_view.cc
+++ b/chrome/browser/ui/views/database_info_view.cc
@@ -35,7 +35,8 @@
void DatabaseInfoView::SetDatabaseInfo(
const BrowsingDataDatabaseHelper::DatabaseInfo& database_info) {
name_value_field_->SetText(database_info.database_name.empty() ?
- l10n_util::GetString(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME) :
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_WEB_DATABASE_UNNAMED_NAME)) :
UTF8ToWide(database_info.database_name));
description_value_field_->SetText(UTF8ToWide(database_info.description));
size_value_field_->SetText(
@@ -82,16 +83,19 @@
set_border(border);
views::Label* name_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_NAME_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NAME_LABEL)));
name_value_field_ = new views::Textfield;
views::Label* description_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_COOKIES_WEB_DATABASE_DESCRIPTION_LABEL)));
description_value_field_ = new views::Textfield;
views::Label* size_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL)));
size_value_field_ = new views::Textfield;
views::Label* last_modified_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL)));
last_modified_value_field_ = new views::Textfield;
using views::GridLayout;
diff --git a/chrome/browser/ui/views/default_search_view.cc b/chrome/browser/ui/views/default_search_view.cc
index 34dcbf1..b2c1e27 100644
--- a/chrome/browser/ui/views/default_search_view.cc
+++ b/chrome/browser/ui/views/default_search_view.cc
@@ -57,7 +57,7 @@
views::Label* CreateProviderLabel(int message_id) {
views::Label* choice_label =
- new views::Label(l10n_util::GetString(message_id));
+ new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(message_id)));
choice_label->SetColor(SK_ColorBLACK);
choice_label->SetFont(
choice_label->font().DeriveFont(1, gfx::Font::NORMAL));
@@ -101,8 +101,8 @@
views::ButtonListener* listener,
int message_id,
const std::wstring& short_name) {
- return new views::NativeButton(listener, l10n_util::GetStringF(
- message_id, short_name));
+ return new views::NativeButton(listener, UTF16ToWide(
+ l10n_util::GetStringFUTF16(message_id, WideToUTF16(short_name))));
}
} // namespace
@@ -144,7 +144,7 @@
}
std::wstring DefaultSearchView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_DEFAULT_SEARCH_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_DEFAULT_SEARCH_TITLE));
}
views::View* DefaultSearchView::GetInitiallyFocusedView() {
@@ -264,9 +264,9 @@
// Add text informing the user about the requested default change.
layout->StartRowWithPadding(0, kPaddedWholeDialogViewSetId,
1, kLabelToControlVerticalSpacing);
- Label* summary_label = new Label(l10n_util::GetStringF(
+ Label* summary_label = new Label(UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_DEFAULT_SEARCH_SUMMARY,
- proposed_short_name));
+ WideToUTF16(proposed_short_name))));
summary_label->SetColor(SK_ColorBLACK);
summary_label->SetFont(
summary_label->font().DeriveFont(1, gfx::Font::NORMAL));
diff --git a/chrome/browser/ui/views/dialog_stubs_gtk.cc b/chrome/browser/ui/views/dialog_stubs_gtk.cc
index de6c676..4dd0150 100644
--- a/chrome/browser/ui/views/dialog_stubs_gtk.cc
+++ b/chrome/browser/ui/views/dialog_stubs_gtk.cc
@@ -44,11 +44,6 @@
KeywordEditorView::Show(profile);
}
-void ShowNewProfileDialog() {
- // Hasn't been implemented yet on linux.
- NOTIMPLEMENTED();
-}
-
void ShowTaskManager() {
TaskManagerGtk::Show();
}
diff --git a/chrome/browser/ui/views/download_item_view.cc b/chrome/browser/ui/views/download_item_view.cc
index f6d022d..474b27b 100644
--- a/chrome/browser/ui/views/download_item_view.cc
+++ b/chrome/browser/ui/views/download_item_view.cc
@@ -8,7 +8,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "app/text_elider.h"
#include "base/callback.h"
#include "base/file_path.h"
@@ -26,6 +25,7 @@
#include "gfx/color_utils.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/button/native_button.h"
#include "views/controls/menu/menu_2.h"
#include "views/widget/root_view.h"
@@ -114,7 +114,8 @@
: warning_icon_(NULL),
download_(download),
parent_(parent),
- status_text_(l10n_util::GetString(IDS_DOWNLOAD_STATUS_STARTING)),
+ status_text_(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_DOWNLOAD_STATUS_STARTING))),
show_status_text_(true),
body_state_(NORMAL),
drop_down_state_(NORMAL),
@@ -236,8 +237,8 @@
drop_down_x_right_ = size.width();
}
- body_hover_animation_.reset(new SlideAnimation(this));
- drop_hover_animation_.reset(new SlideAnimation(this));
+ body_hover_animation_.reset(new ui::SlideAnimation(this));
+ drop_hover_animation_.reset(new ui::SlideAnimation(this));
if (download->safety_state() == DownloadItem::DANGEROUS) {
tooltip_text_.clear();
@@ -245,12 +246,13 @@
drop_down_state_ = DANGEROUS;
warning_icon_ = rb.GetBitmapNamed(IDR_WARNING);
- save_button_ = new views::NativeButton(this, l10n_util::GetString(
- download->is_extension_install() ?
- IDS_CONTINUE_EXTENSION_DOWNLOAD : IDS_SAVE_DOWNLOAD));
+ save_button_ = new views::NativeButton(this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ download->is_extension_install() ?
+ IDS_CONTINUE_EXTENSION_DOWNLOAD : IDS_SAVE_DOWNLOAD)));
save_button_->set_ignore_minimum_size(true);
discard_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_DISCARD_DOWNLOAD));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_DISCARD_DOWNLOAD)));
discard_button_->set_ignore_minimum_size(true);
AddChildView(save_button_);
AddChildView(discard_button_);
@@ -282,8 +284,8 @@
// The dangerous download label text is different for an extension file.
if (download->is_extension_install()) {
- dangerous_download_label_ = new views::Label(
- l10n_util::GetString(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION));
+ dangerous_download_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD_EXTENSION)));
} else {
gfx::ElideString(rootname,
kFileNameMaxLength - extension.length(),
@@ -291,8 +293,9 @@
std::wstring filename = rootname + L"." + extension;
filename = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(
WideToUTF16(filename)));
- dangerous_download_label_ = new views::Label(
- l10n_util::GetStringF(IDS_PROMPT_DANGEROUS_DOWNLOAD, filename));
+ dangerous_download_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_PROMPT_DANGEROUS_DOWNLOAD,
+ WideToUTF16(filename))));
}
dangerous_download_label_->SetMultiLine(true);
dangerous_download_label_->SetHorizontalAlignment(
@@ -353,7 +356,7 @@
ClearDangerousMode();
}
- std::wstring status_text = model_->GetStatusText();
+ string16 status_text = model_->GetStatusText();
switch (download_->state()) {
case DownloadItem::IN_PROGRESS:
download_->is_paused() ? StopDownloadProgress() : StartDownloadProgress();
@@ -364,9 +367,9 @@
return;
}
StopDownloadProgress();
- complete_animation_.reset(new SlideAnimation(this));
+ complete_animation_.reset(new ui::SlideAnimation(this));
complete_animation_->SetSlideDuration(kCompleteAnimationDurationMs);
- complete_animation_->SetTweenType(Tween::LINEAR);
+ complete_animation_->SetTweenType(ui::Tween::LINEAR);
complete_animation_->Show();
if (status_text.empty())
show_status_text_ = false;
@@ -384,7 +387,7 @@
NOTREACHED();
}
- status_text_ = status_text;
+ status_text_ = UTF16ToWideHack(status_text);
UpdateAccessibleName();
// We use the parent's (DownloadShelfView's) SchedulePaint, since there
@@ -609,9 +612,8 @@
font_, kTextWidth);
} else {
// First, Calculate the download status opening string width.
- std::wstring empty_string;
- std::wstring status_string =
- l10n_util::GetStringF(IDS_DOWNLOAD_STATUS_OPENING, empty_string);
+ string16 status_string =
+ l10n_util::GetStringFUTF16(IDS_DOWNLOAD_STATUS_OPENING, string16());
int status_string_width = font_.GetStringWidth(status_string);
// Then, elide the file name.
string16 filename_string =
@@ -940,7 +942,7 @@
}
}
-void DownloadItemView::AnimationProgressed(const Animation* animation) {
+void DownloadItemView::AnimationProgressed(const ui::Animation* animation) {
// We don't care if what animation (body button/drop button/complete),
// is calling back, as they all have to go through the same paint call.
SchedulePaint();
diff --git a/chrome/browser/ui/views/download_item_view.h b/chrome/browser/ui/views/download_item_view.h
index 476f479..c2beb3c 100644
--- a/chrome/browser/ui/views/download_item_view.h
+++ b/chrome/browser/ui/views/download_item_view.h
@@ -19,7 +19,6 @@
#include <string>
-#include "app/animation_delegate.h"
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/time.h"
@@ -29,24 +28,29 @@
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/icon_manager.h"
#include "gfx/font.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/event.h"
#include "views/controls/button/button.h"
#include "views/view.h"
+class BaseDownloadItemModel;
+class DownloadShelfView;
+class SkBitmap;
+class DownloadShelfContextMenuWin;
+
+namespace ui {
+class SlideAnimation;
+}
+
namespace views {
class Label;
class NativeButton;
}
-class BaseDownloadItemModel;
-class DownloadShelfView;
-class SkBitmap;
-class DownloadShelfContextMenuWin;
-class SlideAnimation;
class DownloadItemView : public views::ButtonListener,
public views::View,
public DownloadItem::Observer,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
DownloadItemView(DownloadItem* download,
DownloadShelfView* parent,
@@ -75,8 +79,8 @@
// ButtonListener implementation.
virtual void ButtonPressed(views::Button* sender, const views::Event& event);
- // AnimationDelegate implementation.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate implementation.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Timer callback for handling animations
void UpdateDownloadProgress();
@@ -231,11 +235,11 @@
scoped_ptr<BaseDownloadItemModel> model_;
// Hover animations for our body and drop buttons.
- scoped_ptr<SlideAnimation> body_hover_animation_;
- scoped_ptr<SlideAnimation> drop_hover_animation_;
+ scoped_ptr<ui::SlideAnimation> body_hover_animation_;
+ scoped_ptr<ui::SlideAnimation> drop_hover_animation_;
// Animation for download complete.
- scoped_ptr<SlideAnimation> complete_animation_;
+ scoped_ptr<ui::SlideAnimation> complete_animation_;
// Progress animation
base::RepeatingTimer<DownloadItemView> progress_timer_;
diff --git a/chrome/browser/ui/views/download_shelf_view.cc b/chrome/browser/ui/views/download_shelf_view.cc
index 5db8ba1..c3a4ea3 100644
--- a/chrome/browser/ui/views/download_shelf_view.cc
+++ b/chrome/browser/ui/views/download_shelf_view.cc
@@ -8,8 +8,8 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/download/download_item.h"
#include "chrome/browser/download/download_item_model.h"
#include "chrome/browser/download/download_manager.h"
@@ -22,6 +22,7 @@
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/background.h"
#include "views/controls/button/image_button.h"
#include "views/controls/image_view.h"
@@ -102,8 +103,8 @@
arrow_image_->SetImage(rb.GetBitmapNamed(IDR_DOWNLOADS_FAVICON));
AddChildView(arrow_image_);
- show_all_view_ =
- new views::Link(l10n_util::GetString(IDS_SHOW_ALL_DOWNLOADS));
+ show_all_view_ = new views::Link(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_SHOW_ALL_DOWNLOADS)));
show_all_view_->SetController(this);
AddChildView(show_all_view_);
@@ -114,14 +115,15 @@
rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
close_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
- close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
+ close_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)));
UpdateButtonColors();
AddChildView(close_button_);
- new_item_animation_.reset(new SlideAnimation(this));
+ new_item_animation_.reset(new ui::SlideAnimation(this));
new_item_animation_->SetSlideDuration(kNewItemAnimationDurationMs);
- shelf_animation_.reset(new SlideAnimation(this));
+ shelf_animation_.reset(new ui::SlideAnimation(this));
shelf_animation_->SetSlideDuration(kShelfAnimationDurationMs);
Show();
}
@@ -222,7 +224,7 @@
return prefsize;
}
-void DownloadShelfView::AnimationProgressed(const Animation *animation) {
+void DownloadShelfView::AnimationProgressed(const ui::Animation *animation) {
if (animation == new_item_animation_.get()) {
Layout();
SchedulePaint();
@@ -237,7 +239,7 @@
}
}
-void DownloadShelfView::AnimationEnded(const Animation *animation) {
+void DownloadShelfView::AnimationEnded(const ui::Animation *animation) {
if (animation == shelf_animation_.get()) {
parent_->SetDownloadShelfVisible(shelf_animation_->IsShowing());
if (!shelf_animation_->IsShowing())
diff --git a/chrome/browser/ui/views/download_shelf_view.h b/chrome/browser/ui/views/download_shelf_view.h
index 4394a2f..e7c1253 100644
--- a/chrome/browser/ui/views/download_shelf_view.h
+++ b/chrome/browser/ui/views/download_shelf_view.h
@@ -6,24 +6,27 @@
#define CHROME_BROWSER_UI_VIEWS_DOWNLOAD_SHELF_VIEW_H_
#pragma once
-#include "app/animation_delegate.h"
#include "chrome/browser/download/download_shelf.h"
#include "chrome/browser/views/accessible_pane_view.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/controls/button/button.h"
#include "views/controls/link.h"
#include "views/mouse_watcher.h"
-namespace views {
-class ImageButton;
-class ImageView;
-}
-
class BaseDownloadItemModel;
class Browser;
class BrowserView;
class DownloadAnimation;
class DownloadItemView;
+
+namespace ui {
class SlideAnimation;
+}
+
+namespace views {
+class ImageButton;
+class ImageView;
+}
// DownloadShelfView is a view that contains individual views for each download,
// as well as a close button and a link to show all downloads.
@@ -31,7 +34,7 @@
// DownloadShelfView does not hold an infinite number of download views, rather
// it'll automatically remove views once a certain point is reached.
class DownloadShelfView : public AccessiblePaneView,
- public AnimationDelegate,
+ public ui::AnimationDelegate,
public DownloadShelf,
public views::ButtonListener,
public views::LinkController,
@@ -48,9 +51,9 @@
virtual void Layout();
virtual void Paint(gfx::Canvas* canvas);
- // Implementation of AnimationDelegate.
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // Implementation of ui::AnimationDelegate.
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// Implementation of LinkController.
// Invoked when the user clicks the 'show all downloads' link button.
@@ -124,10 +127,10 @@
Browser* browser_;
// The animation for adding new items to the shelf.
- scoped_ptr<SlideAnimation> new_item_animation_;
+ scoped_ptr<ui::SlideAnimation> new_item_animation_;
// The show/hide animation for the shelf itself.
- scoped_ptr<SlideAnimation> shelf_animation_;
+ scoped_ptr<ui::SlideAnimation> shelf_animation_;
// The download views. These are also child Views, and deleted when
// the DownloadShelfView is deleted.
diff --git a/chrome/browser/ui/views/download_started_animation_win.cc b/chrome/browser/ui/views/download_started_animation_win.cc
index 2398993..cbcbc97 100644
--- a/chrome/browser/ui/views/download_started_animation_win.cc
+++ b/chrome/browser/ui/views/download_started_animation_win.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/download/download_started_animation.h"
-#include "app/linear_animation.h"
#include "app/resource_bundle.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_details.h"
@@ -12,6 +11,7 @@
#include "chrome/common/notification_source.h"
#include "gfx/rect.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/linear_animation.h"
#include "views/controls/image_view.h"
#include "views/widget/widget_win.h"
@@ -33,7 +33,7 @@
// provided on the constructor, while simultaneously fading it out. To use,
// simply call "new DownloadStartAnimation"; the class cleans itself up when it
// finishes animating.
-class DownloadStartedAnimationWin : public LinearAnimation,
+class DownloadStartedAnimationWin : public ui::LinearAnimation,
public NotificationObserver,
public views::ImageView {
public:
@@ -75,7 +75,7 @@
DownloadStartedAnimationWin::DownloadStartedAnimationWin(
TabContents* tab_contents)
- : LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL),
+ : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL),
popup_(NULL),
tab_contents_(tab_contents) {
static SkBitmap* kDownloadImage = NULL;
diff --git a/chrome/browser/ui/views/dropdown_bar_host.cc b/chrome/browser/ui/views/dropdown_bar_host.cc
index f3367d2..5a1c2ad 100644
--- a/chrome/browser/ui/views/dropdown_bar_host.cc
+++ b/chrome/browser/ui/views/dropdown_bar_host.cc
@@ -5,22 +5,33 @@
#include "chrome/browser/views/dropdown_bar_host.h"
#include "app/keyboard_codes.h"
-#include "app/slide_animation.h"
-#include "base/scoped_handle.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/browser/ui/views/dropdown_bar_view.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "gfx/path.h"
#include "gfx/scrollbar_size.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/focus/external_focus_tracker.h"
#include "views/focus/view_storage.h"
#include "views/widget/widget.h"
-#if defined(OS_LINUX)
+#if defined(OS_WIN)
+#include "base/win/scoped_gdi_object.h"
+#elif defined(OS_LINUX)
#include "app/scoped_handle_gtk.h"
#endif
+namespace {
+
+#if defined(OS_WIN)
+typedef base::win::ScopedRegion ScopedPlatformRegion;
+#elif defined(OS_LINUX)
+typedef ScopedRegion ScopedPlatformRegion;
+#endif
+
+} // namespace
+
using gfx::Path;
// static
@@ -57,7 +68,7 @@
}
// Start the process of animating the opening of the widget.
- animation_.reset(new SlideAnimation(this));
+ animation_.reset(new ui::SlideAnimation(this));
}
DropdownBarHost::~DropdownBarHost() {
@@ -139,9 +150,9 @@
}
////////////////////////////////////////////////////////////////////////////////
-// DropdownBarHost, AnimationDelegate implementation:
+// DropdownBarHost, ui::AnimationDelegate implementation:
-void DropdownBarHost::AnimationProgressed(const Animation* animation) {
+void DropdownBarHost::AnimationProgressed(const ui::Animation* animation) {
// First, we calculate how many pixels to slide the widget.
gfx::Size pref_size = view_->GetPreferredSize();
animation_offset_ = static_cast<int>((1.0 - animation_->GetCurrentValue()) *
@@ -158,7 +169,7 @@
view_->SchedulePaint();
}
-void DropdownBarHost::AnimationEnded(const Animation* animation) {
+void DropdownBarHost::AnimationEnded(const ui::Animation* animation) {
// Place the dropdown widget in its fully opened state.
animation_offset_ = 0;
@@ -212,8 +223,7 @@
// We then create the polygon and use SetWindowRgn to force the window to draw
// only within that area. This region may get reduced in size below.
Path path(polygon, arraysize(polygon));
- ScopedRegion region(path.CreateNativeRegion());
-
+ ScopedPlatformRegion region(path.CreateNativeRegion());
// Are we animating?
if (animation_offset() > 0) {
// The animation happens in two steps: First, we clip the window and then in
@@ -231,7 +241,8 @@
SkRect animation_rect = { SkIntToScalar(0), SkIntToScalar(y),
SkIntToScalar(max_x), SkIntToScalar(max_y) };
animation_path.addRect(animation_rect);
- ScopedRegion animation_region(animation_path.CreateNativeRegion());
+ ScopedPlatformRegion animation_region(
+ animation_path.CreateNativeRegion());
region.Set(Path::IntersectRegions(animation_region.Get(), region.Get()));
// Next, we need to increase the region a little bit to account for the
@@ -246,7 +257,7 @@
// Combine the region for the curve on the left with our main region.
Path left_path(left_curve, arraysize(left_curve));
- ScopedRegion r(left_path.CreateNativeRegion());
+ ScopedPlatformRegion r(left_path.CreateNativeRegion());
region.Set(Path::CombineRegions(r.Get(), region.Get()));
// Combine the region for the curve on the right with our main region.
@@ -284,7 +295,7 @@
// Subtract this region from the original region.
gfx::Path exclude_path(exclude, arraysize(exclude));
- ScopedRegion exclude_region(exclude_path.CreateNativeRegion());
+ ScopedPlatformRegion exclude_region(exclude_path.CreateNativeRegion());
region.Set(Path::SubtractRegion(region.Get(), exclude_region.Get()));
}
diff --git a/chrome/browser/ui/views/dropdown_bar_host.h b/chrome/browser/ui/views/dropdown_bar_host.h
index 71b0bf3..d9f1d7b 100644
--- a/chrome/browser/ui/views/dropdown_bar_host.h
+++ b/chrome/browser/ui/views/dropdown_bar_host.h
@@ -6,19 +6,22 @@
#define CHROME_BROWSER_UI_VIEWS_DROPDOWN_BAR_HOST_H_
#pragma once
-#include "app/animation_delegate.h"
#include "base/scoped_ptr.h"
#include "chrome/common/native_web_keyboard_event.h"
#include "gfx/native_widget_types.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/controls/textfield/textfield.h"
#include "views/focus/focus_manager.h"
class BrowserView;
class DropdownBarView;
-class SlideAnimation;
class TabContents;
+namespace ui {
+class SlideAnimation;
+}
+
namespace views {
class ExternalFocusTracker;
class View;
@@ -37,7 +40,7 @@
////////////////////////////////////////////////////////////////////////////////
class DropdownBarHost : public views::AcceleratorTarget,
public views::FocusChangeListener,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit DropdownBarHost(BrowserView* browser_view);
virtual ~DropdownBarHost();
@@ -74,9 +77,9 @@
// Overridden from views::AcceleratorTarget:
virtual bool AcceleratorPressed(const views::Accelerator& accelerator) = 0;
- // AnimationDelegate implementation:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // ui::AnimationDelegate implementation:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// During testing we can disable animations by setting this flag to true,
// so that opening and closing the dropdown bar is shown instantly, instead of
@@ -142,10 +145,10 @@
// Returns a keyboard event suitable for forwarding.
NativeWebKeyboardEvent GetKeyboardEvent(
const TabContents* contents,
- const views::Textfield::Keystroke& key_stroke);
+ const views::KeyEvent& key_event);
// Returns the animation for the dropdown.
- SlideAnimation* animation() {
+ ui::SlideAnimation* animation() {
return animation_.get();
}
@@ -161,7 +164,7 @@
int animation_offset_;
// The animation class to use when opening the Dropdown widget.
- scoped_ptr<SlideAnimation> animation_;
+ scoped_ptr<ui::SlideAnimation> animation_;
// The focus manager we register with to keep track of focus changes.
views::FocusManager* focus_manager_;
diff --git a/chrome/browser/ui/views/dropdown_bar_host_gtk.cc b/chrome/browser/ui/views/dropdown_bar_host_gtk.cc
index b321c30..298ca75 100644
--- a/chrome/browser/ui/views/dropdown_bar_host_gtk.cc
+++ b/chrome/browser/ui/views/dropdown_bar_host_gtk.cc
@@ -30,23 +30,22 @@
NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent(
const TabContents* contents,
- const views::Textfield::Keystroke& key_stroke) {
+ const views::KeyEvent& key_event) {
#if defined(TOUCH_UI)
// TODO(oshima): This is a copy from
// RenderWidgetHostViewViews::OnKeyPressed().
// Refactor and eliminate the dup code.
- const views::KeyEvent& e = key_stroke.key_event();
NativeWebKeyboardEvent wke;
wke.type = WebKit::WebInputEvent::KeyDown;
- wke.windowsKeyCode = e.GetKeyCode();
+ wke.windowsKeyCode = key_event.GetKeyCode();
wke.setKeyIdentifierFromWindowsKeyCode();
wke.text[0] = wke.unmodifiedText[0] =
static_cast<unsigned short>(gdk_keyval_to_unicode(
- app::GdkKeyCodeForWindowsKeyCode(e.GetKeyCode(),
- e.IsShiftDown() ^ e.IsCapsLockDown())));
+ app::GdkKeyCodeForWindowsKeyCode(key_event.GetKeyCode(),
+ key_event.IsShiftDown() ^ key_event.IsCapsLockDown())));
return wke;
#else
- return NativeWebKeyboardEvent(key_stroke.event());
+ return NativeWebKeyboardEvent(key_event.native_event());
#endif
}
diff --git a/chrome/browser/ui/views/dropdown_bar_host_win.cc b/chrome/browser/ui/views/dropdown_bar_host_win.cc
index e3d27c8..df55449 100644
--- a/chrome/browser/ui/views/dropdown_bar_host_win.cc
+++ b/chrome/browser/ui/views/dropdown_bar_host_win.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/views/dropdown_bar_host.h"
+#include "app/keyboard_code_conversion_win.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/tab_contents/tab_contents_view.h"
@@ -14,10 +15,11 @@
NativeWebKeyboardEvent DropdownBarHost::GetKeyboardEvent(
const TabContents* contents,
- const views::Textfield::Keystroke& key_stroke) {
+ const views::KeyEvent& key_event) {
HWND hwnd = contents->GetContentNativeView();
- return NativeWebKeyboardEvent(
- hwnd, key_stroke.message(), key_stroke.key(), 0);
+ WORD key = WindowsKeyCodeForKeyboardCode(key_event.GetKeyCode());
+
+ return NativeWebKeyboardEvent(hwnd, key_event.message(), key, 0);
}
views::Widget* DropdownBarHost::CreateHost() {
diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.cc b/chrome/browser/ui/views/edit_search_engine_dialog.cc
index 8919d9d..e699e97 100644
--- a/chrome/browser/ui/views/edit_search_engine_dialog.cc
+++ b/chrome/browser/ui/views/edit_search_engine_dialog.cc
@@ -77,9 +77,9 @@
}
std::wstring EditSearchEngineDialog::GetWindowTitle() const {
- return l10n_util::GetString(controller_->template_url() ?
+ return UTF16ToWide(l10n_util::GetStringUTF16(controller_->template_url() ?
IDS_SEARCH_ENGINES_EDITOR_EDIT_WINDOW_TITLE :
- IDS_SEARCH_ENGINES_EDITOR_NEW_WINDOW_TITLE);
+ IDS_SEARCH_ENGINES_EDITOR_NEW_WINDOW_TITLE));
}
bool EditSearchEngineDialog::IsDialogButtonEnabled(
@@ -114,9 +114,9 @@
UpdateImageViews();
}
-bool EditSearchEngineDialog::HandleKeystroke(
+bool EditSearchEngineDialog::HandleKeyEvent(
Textfield* sender,
- const views::Textfield::Keystroke& key) {
+ const views::KeyEvent& key_event) {
return false;
}
@@ -204,8 +204,8 @@
// In order to fix this problem we transform the substring "%s" so that it
// is displayed correctly when rendered in an RTL context.
layout->StartRowWithPadding(0, 2, 0, unrelated_y);
- std::wstring description =
- l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_URL_DESCRIPTION_LABEL);
+ std::wstring description = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_SEARCH_ENGINES_EDITOR_URL_DESCRIPTION_LABEL));
if (base::i18n::IsRTL()) {
const std::wstring reversed_percent(L"s%");
std::wstring::size_type percent_index =
@@ -224,7 +224,8 @@
}
views::Label* EditSearchEngineDialog::CreateLabel(int message_id) {
- views::Label* label = new views::Label(l10n_util::GetString(message_id));
+ views::Label* label =
+ new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(message_id)));
label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
return label;
}
@@ -258,7 +259,8 @@
ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_INPUT_GOOD));
} else {
- image_view->SetTooltipText(l10n_util::GetString(invalid_message_id));
+ image_view->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(invalid_message_id)));
image_view->SetImage(
ResourceBundle::GetSharedInstance().GetBitmapNamed(
IDR_INPUT_ALERT));
diff --git a/chrome/browser/ui/views/edit_search_engine_dialog.h b/chrome/browser/ui/views/edit_search_engine_dialog.h
index f68e803..cdc9e81 100644
--- a/chrome/browser/ui/views/edit_search_engine_dialog.h
+++ b/chrome/browser/ui/views/edit_search_engine_dialog.h
@@ -58,8 +58,8 @@
// valid.
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event);
private:
void Init();
diff --git a/chrome/browser/ui/views/extensions/extension_install_prompt.cc b/chrome/browser/ui/views/extensions/extension_install_prompt.cc
index 1e1ea37..ea32328 100644
--- a/chrome/browser/ui/views/extensions/extension_install_prompt.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_prompt.cc
@@ -21,10 +21,6 @@
#include "views/window/dialog_delegate.h"
#include "views/window/window.h"
-#if defined(OS_WIN)
-#include "app/win_util.h"
-#endif
-
class Profile;
namespace {
@@ -49,9 +45,9 @@
icon_->SetImage(*icon);
AddChildView(icon_);
- heading_ = new views::Label(
- l10n_util::GetStringF(ExtensionInstallUI::kHeadingIds[type_],
- UTF8ToWide(extension->name())));
+ heading_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringFUTF16(ExtensionInstallUI::kHeadingIds[type_],
+ UTF8ToUTF16(extension->name()))));
heading_->SetMultiLine(true);
heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(heading_);
@@ -63,9 +59,10 @@
MessageBoxFlags::DialogButton button) const {
switch (button) {
case MessageBoxFlags::DIALOGBUTTON_OK:
- return l10n_util::GetString(ExtensionInstallUI::kButtonIds[type_]);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(ExtensionInstallUI::kButtonIds[type_]));
case MessageBoxFlags::DIALOGBUTTON_CANCEL:
- return l10n_util::GetString(IDS_CANCEL);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL));
default:
NOTREACHED();
return L"";
@@ -89,7 +86,8 @@
// WindowDelegate
virtual bool IsModal() const { return true; }
virtual std::wstring GetWindowTitle() const {
- return l10n_util::GetString(ExtensionInstallUI::kTitleIds[type_]);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(ExtensionInstallUI::kTitleIds[type_]));
}
virtual views::View* GetContentsView() { return this; }
diff --git a/chrome/browser/ui/views/extensions/extension_install_prompt2.cc b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc
index 6ee8285..0a4e2d6 100644
--- a/chrome/browser/ui/views/extensions/extension_install_prompt2.cc
+++ b/chrome/browser/ui/views/extensions/extension_install_prompt2.cc
@@ -135,9 +135,9 @@
icon_->SetVerticalAlignment(views::ImageView::CENTER);
AddChildView(icon_);
- heading_ = new views::Label(
- l10n_util::GetStringF(IDS_EXTENSION_INSTALL_PROMPT_HEADING,
- UTF8ToWide(extension->name())));
+ heading_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALL_PROMPT_HEADING,
+ UTF8ToUTF16(extension->name()))));
heading_->SetFont(heading_->font().DeriveFont(kHeadingFontSizeDelta,
gfx::Font::BOLD));
heading_->SetMultiLine(true);
@@ -148,8 +148,8 @@
right_column_width_ = kNoPermissionsRightColumnWidth;
} else {
right_column_width_ = kPermissionBoxWidth;
- will_have_access_to_ = new views::Label(
- l10n_util::GetString(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO));
+ will_have_access_to_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_WILL_HAVE_ACCESS_TO)));
will_have_access_to_->SetMultiLine(true);
will_have_access_to_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(will_have_access_to_);
@@ -176,9 +176,10 @@
MessageBoxFlags::DialogButton button) const {
switch (button) {
case MessageBoxFlags::DIALOGBUTTON_OK:
- return l10n_util::GetString(IDS_EXTENSION_PROMPT_INSTALL_BUTTON);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_INSTALL_BUTTON));
case MessageBoxFlags::DIALOGBUTTON_CANCEL:
- return l10n_util::GetString(IDS_CANCEL);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL));
default:
NOTREACHED();
return L"";
@@ -204,7 +205,8 @@
}
std::wstring InstallDialogContent2::GetWindowTitle() const {
- return l10n_util::GetString(IDS_EXTENSION_INSTALL_PROMPT_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALL_PROMPT_TITLE));
}
views::View* InstallDialogContent2::GetContentsView() {
diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
index 1b549d3..b2e0697 100644
--- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
+++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc
@@ -84,19 +84,19 @@
icon_->SetImage(*icon);
AddChildView(icon_);
- std::wstring extension_name = UTF8ToWide(extension->name());
+ string16 extension_name = UTF8ToUTF16(extension->name());
base::i18n::AdjustStringForLocaleDirection(&extension_name);
- heading_ = new views::Label(
- l10n_util::GetStringF(IDS_EXTENSION_INSTALLED_HEADING,
- extension_name));
+ heading_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_EXTENSION_INSTALLED_HEADING,
+ extension_name)));
heading_->SetFont(rb.GetFont(ResourceBundle::MediumFont));
heading_->SetMultiLine(true);
heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(heading_);
if (type_ == ExtensionInstalledBubble::PAGE_ACTION) {
- info_ = new views::Label(l10n_util::GetString(
- IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO));
+ info_ = new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)));
info_->SetFont(font);
info_->SetMultiLine(true);
info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
@@ -104,17 +104,17 @@
}
if (type_ == ExtensionInstalledBubble::OMNIBOX_KEYWORD) {
- info_ = new views::Label(l10n_util::GetStringF(
+ info_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO,
- UTF8ToWide(extension->omnibox_keyword())));
+ UTF8ToUTF16(extension->omnibox_keyword()))));
info_->SetFont(font);
info_->SetMultiLine(true);
info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(info_);
}
- manage_ = new views::Label(
- l10n_util::GetString(IDS_EXTENSION_INSTALLED_MANAGE_INFO));
+ manage_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO)));
manage_->SetFont(font);
manage_->SetMultiLine(true);
manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
diff --git a/chrome/browser/ui/views/external_protocol_dialog.cc b/chrome/browser/ui/views/external_protocol_dialog.cc
index 6f402c3..1155770 100644
--- a/chrome/browser/ui/views/external_protocol_dialog.cc
+++ b/chrome/browser/ui/views/external_protocol_dialog.cc
@@ -9,8 +9,8 @@
#include "app/text_elider.h"
#include "base/metrics/histogram.h"
#include "base/string_util.h"
-#include "base/thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread.h"
+#include "base/threading/thread_restrictions.h"
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
#include "chrome/browser/external_protocol_handler.h"
@@ -62,13 +62,15 @@
std::wstring ExternalProtocolDialog::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK)
- return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_OK_BUTTON_TEXT));
else
- return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_CANCEL_BUTTON_TEXT);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CANCEL_BUTTON_TEXT));
}
std::wstring ExternalProtocolDialog::GetWindowTitle() const {
- return l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_TITLE));
}
void ExternalProtocolDialog::DeleteDelegate() {
@@ -127,22 +129,24 @@
kMaxUrlWithoutSchemeSize, &elided_url_without_scheme);
gfx::ElideString(command, kMaxCommandSize, &elided_command);
- std::wstring message_text = l10n_util::GetStringF(
+ std::wstring message_text = UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_EXTERNAL_PROTOCOL_INFORMATION,
- ASCIIToWide(url.scheme() + ":"),
- elided_url_without_scheme) + L"\n\n";
+ ASCIIToUTF16(url.scheme() + ":"),
+ elided_url_without_scheme) + ASCIIToUTF16("\n\n"));
- message_text += l10n_util::GetStringF(
- IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH, elided_command) + L"\n\n";
+ message_text += UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_EXTERNAL_PROTOCOL_APPLICATION_TO_LAUNCH,
+ elided_command) + ASCIIToUTF16("\n\n"));
- message_text += l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_WARNING);
+ message_text +=
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_WARNING));
message_box_view_ = new MessageBoxView(MessageBoxFlags::kIsConfirmMessageBox,
message_text,
std::wstring(),
kMessageWidth);
- message_box_view_->SetCheckBoxLabel(
- l10n_util::GetString(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT));
+ message_box_view_->SetCheckBoxLabel(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXTERNAL_PROTOCOL_CHECKBOX_TEXT)));
HWND root_hwnd;
if (tab_contents_) {
diff --git a/chrome/browser/ui/views/find_bar_host.cc b/chrome/browser/ui/views/find_bar_host.cc
index 0eabaaf..f54ba6c 100644
--- a/chrome/browser/ui/views/find_bar_host.cc
+++ b/chrome/browser/ui/views/find_bar_host.cc
@@ -39,14 +39,14 @@
FindBarHost::~FindBarHost() {
}
-bool FindBarHost::MaybeForwardKeystrokeToWebpage(
- const views::Textfield::Keystroke& key_stroke) {
- if (!ShouldForwardKeystrokeToWebpageNative(key_stroke)) {
+bool FindBarHost::MaybeForwardKeyEventToWebpage(
+ const views::KeyEvent& key_event) {
+ if (!ShouldForwardKeyEventToWebpageNative(key_event)) {
// Native implementation says not to forward these events.
return false;
}
- switch (key_stroke.GetKeyboardCode()) {
+ switch (key_event.GetKeyCode()) {
case app::VKEY_DOWN:
case app::VKEY_UP:
case app::VKEY_PRIOR:
@@ -54,7 +54,7 @@
break;
case app::VKEY_HOME:
case app::VKEY_END:
- if (key_stroke.IsControlHeld())
+ if (key_event.IsControlDown())
break;
// Fall through.
default:
@@ -70,7 +70,7 @@
// Make sure we don't have a text field element interfering with keyboard
// input. Otherwise Up and Down arrow key strokes get eaten. "Nom Nom Nom".
render_view_host->ClearFocusedNode();
- NativeWebKeyboardEvent event = GetKeyboardEvent(contents, key_stroke);
+ NativeWebKeyboardEvent event = GetKeyboardEvent(contents, key_event);
render_view_host->ForwardKeyboardEvent(event);
return true;
}
diff --git a/chrome/browser/ui/views/find_bar_host.h b/chrome/browser/ui/views/find_bar_host.h
index 6ab11ca..997d2f8 100644
--- a/chrome/browser/ui/views/find_bar_host.h
+++ b/chrome/browser/ui/views/find_bar_host.h
@@ -40,12 +40,11 @@
explicit FindBarHost(BrowserView* browser_view);
virtual ~FindBarHost();
- // Forwards selected keystrokes to the renderer. This is useful to make sure
+ // Forwards selected key events to the renderer. This is useful to make sure
// that arrow keys and PageUp and PageDown result in scrolling, instead of
// being eaten because the FindBar has focus. Returns true if the keystroke
// was forwarded, false if not.
- bool MaybeForwardKeystrokeToWebpage(
- const views::Textfield::Keystroke& key_stroke);
+ bool MaybeForwardKeyEventToWebpage(const views::KeyEvent& key_event);
// FindBar implementation:
virtual FindBarController* GetFindBarController() const;
@@ -116,9 +115,9 @@
// Allows implementation to tweak widget position.
void GetWidgetPositionNative(gfx::Rect* avoid_overlapping_rect);
- // Allows native implementation to prevent keystrokes from being forwarded.
- bool ShouldForwardKeystrokeToWebpageNative(
- const views::Textfield::Keystroke& key_stroke);
+ // Allows native implementation to prevent key events from being forwarded.
+ bool ShouldForwardKeyEventToWebpageNative(
+ const views::KeyEvent& key_event);
// Returns the FindBarView.
FindBarView* find_bar_view();
diff --git a/chrome/browser/ui/views/find_bar_host_gtk.cc b/chrome/browser/ui/views/find_bar_host_gtk.cc
index e17c6d0..7306361 100644
--- a/chrome/browser/ui/views/find_bar_host_gtk.cc
+++ b/chrome/browser/ui/views/find_bar_host_gtk.cc
@@ -24,7 +24,7 @@
avoid_overlapping_rect->Offset(0, webcontents_rect.y() - frame_rect.y());
}
-bool FindBarHost::ShouldForwardKeystrokeToWebpageNative(
- const views::Textfield::Keystroke& key_stroke) {
+bool FindBarHost::ShouldForwardKeyEventToWebpageNative(
+ const views::KeyEvent& key_event) {
return true;
}
diff --git a/chrome/browser/ui/views/find_bar_host_win.cc b/chrome/browser/ui/views/find_bar_host_win.cc
index 0133f60..d74a8d1 100644
--- a/chrome/browser/ui/views/find_bar_host_win.cc
+++ b/chrome/browser/ui/views/find_bar_host_win.cc
@@ -26,8 +26,8 @@
avoid_overlapping_rect->Offset(0, webcontents_rect.top - frame_rect.top);
}
-bool FindBarHost::ShouldForwardKeystrokeToWebpageNative(
- const views::Textfield::Keystroke& key_stroke) {
+bool FindBarHost::ShouldForwardKeyEventToWebpageNative(
+ const views::KeyEvent& key_event) {
// We specifically ignore WM_CHAR. See http://crbug.com/10509.
- return key_stroke.message() == WM_KEYDOWN || key_stroke.message() == WM_KEYUP;
+ return key_event.message() == WM_KEYDOWN || key_event.message() == WM_KEYUP;
}
diff --git a/chrome/browser/ui/views/find_bar_view.cc b/chrome/browser/ui/views/find_bar_view.cc
index 72f722c..4a98ec4 100644
--- a/chrome/browser/ui/views/find_bar_view.cc
+++ b/chrome/browser/ui/views/find_bar_view.cc
@@ -102,7 +102,8 @@
find_text_->SetFont(rb.GetFont(ResourceBundle::BaseFont));
find_text_->set_default_width_in_chars(kDefaultCharWidth);
find_text_->SetController(this);
- find_text_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_FIND));
+ find_text_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_FIND)));
AddChildView(find_text_);
match_count_text_ = new views::Label();
@@ -124,10 +125,10 @@
rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_H));
find_previous_button_->SetImage(views::CustomButton::BS_DISABLED,
rb.GetBitmapNamed(IDR_FINDINPAGE_PREV_P));
- find_previous_button_->SetTooltipText(
- l10n_util::GetString(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP));
+ find_previous_button_->SetTooltipText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_PREVIOUS_TOOLTIP)));
find_previous_button_->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_PREVIOUS));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_PREVIOUS)));
AddChildView(find_previous_button_);
find_next_button_ = new views::ImageButton(this);
@@ -140,8 +141,9 @@
find_next_button_->SetImage(views::CustomButton::BS_DISABLED,
rb.GetBitmapNamed(IDR_FINDINPAGE_NEXT_P));
find_next_button_->SetTooltipText(
- l10n_util::GetString(IDS_FIND_IN_PAGE_NEXT_TOOLTIP));
- find_next_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEXT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_NEXT_TOOLTIP)));
+ find_next_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_NEXT)));
AddChildView(find_next_button_);
close_button_ = new views::ImageButton(this);
@@ -154,8 +156,9 @@
close_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
close_button_->SetTooltipText(
- l10n_util::GetString(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP));
- close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIND_IN_PAGE_CLOSE_TOOLTIP)));
+ close_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)));
AddChildView(close_button_);
if (kDialog_left == NULL) {
@@ -209,10 +212,10 @@
}
if (!find_text.empty() && have_valid_range) {
- match_count_text_->SetText(
- l10n_util::GetStringF(IDS_FIND_IN_PAGE_COUNT,
- UTF8ToWide(base::IntToString(result.active_match_ordinal())),
- UTF8ToWide(base::IntToString(result.number_of_matches()))));
+ match_count_text_->SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_FIND_IN_PAGE_COUNT,
+ base::IntToString16(result.active_match_ordinal()),
+ base::IntToString16(result.number_of_matches()))));
UpdateMatchCountAppearance(result.number_of_matches() == 0 &&
result.final_update());
@@ -500,23 +503,23 @@
}
}
-bool FindBarView::HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key) {
+bool FindBarView::HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
// If the dialog is not visible, there is no reason to process keyboard input.
if (!host()->IsVisible())
return false;
- if (find_bar_host()->MaybeForwardKeystrokeToWebpage(key))
+ if (find_bar_host()->MaybeForwardKeyEventToWebpage(key_event))
return true; // Handled, we are done!
- if (key.GetKeyboardCode() == app::VKEY_RETURN) {
+ if (key_event.GetKeyCode() == app::VKEY_RETURN) {
// Pressing Return/Enter starts the search (unless text box is empty).
string16 find_string = find_text_->text();
if (!find_string.empty()) {
// Search forwards for enter, backwards for shift-enter.
find_bar_host()->GetFindBarController()->tab_contents()->StartFinding(
find_string,
- !key.IsShiftHeld(),
+ !key_event.IsShiftDown(),
false); // Not case sensitive.
}
}
diff --git a/chrome/browser/ui/views/find_bar_view.h b/chrome/browser/ui/views/find_bar_view.h
index 4047228..e3ef231 100644
--- a/chrome/browser/ui/views/find_bar_view.h
+++ b/chrome/browser/ui/views/find_bar_view.h
@@ -78,8 +78,8 @@
// Overridden from views::Textfield::Controller:
virtual void ContentsChanged(views::Textfield* sender,
const string16& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event);
private:
// Update the appearance for the match count label.
diff --git a/chrome/browser/ui/views/first_run_bubble.cc b/chrome/browser/ui/views/first_run_bubble.cc
index b858e21..8fe3cd4 100644
--- a/chrome/browser/ui/views/first_run_bubble.cc
+++ b/chrome/browser/ui/views/first_run_bubble.cc
@@ -7,7 +7,7 @@
#include "app/gfx/font_util.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/win_util.h"
+#include "app/win/hwnd_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
@@ -100,22 +100,25 @@
const gfx::Font& font =
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont);
- label1_ = new views::Label(l10n_util::GetString(IDS_FR_BUBBLE_TITLE));
+ label1_ = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_TITLE)));
label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD));
label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(label1_);
gfx::Size ps = GetPreferredSize();
- label2_ = new views::Label(l10n_util::GetString(IDS_FR_BUBBLE_SUBTEXT));
+ label2_ = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT)));
label2_->SetMultiLine(true);
label2_->SetFont(font);
label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
label2_->SizeToFit(ps.width() - kBubblePadding * 2);
AddChildView(label2_);
- std::wstring question_str = l10n_util::GetStringF(IDS_FR_BUBBLE_QUESTION,
- UTF16ToWideHack(GetDefaultSearchEngineName(profile)));
+ std::wstring question_str = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_FR_BUBBLE_QUESTION,
+ GetDefaultSearchEngineName(profile)));
label3_ = new views::Label(question_str);
label3_->SetMultiLine(true);
label3_->SetFont(font);
@@ -123,13 +126,15 @@
label3_->SizeToFit(ps.width() - kBubblePadding * 2);
AddChildView(label3_);
- std::wstring keep_str = l10n_util::GetStringF(IDS_FR_BUBBLE_OK,
- UTF16ToWideHack(GetDefaultSearchEngineName(profile)));
+ std::wstring keep_str = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_FR_BUBBLE_OK,
+ GetDefaultSearchEngineName(profile)));
keep_button_ = new views::NativeButton(this, keep_str);
keep_button_->SetIsDefault(true);
AddChildView(keep_button_);
- std::wstring change_str = l10n_util::GetString(IDS_FR_BUBBLE_CHANGE);
+ std::wstring change_str =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_CHANGE));
change_button_ = new views::NativeButton(this, change_str);
AddChildView(change_button_);
}
@@ -259,20 +264,23 @@
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont);
- label1_ = new views::Label(l10n_util::GetString(IDS_FR_OEM_BUBBLE_TITLE_1));
+ label1_ = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_TITLE_1)));
label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD));
label1_->SetColor(SK_ColorRED);
label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(label1_);
- label2_ = new views::Label(l10n_util::GetString(IDS_FR_OEM_BUBBLE_TITLE_2));
+ label2_ = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_TITLE_2)));
label2_->SetFont(font.DeriveFont(3, gfx::Font::BOLD));
label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(label2_);
gfx::Size ps = GetPreferredSize();
- label3_ = new views::Label(l10n_util::GetString(IDS_FR_OEM_BUBBLE_SUBTEXT));
+ label3_ = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_OEM_BUBBLE_SUBTEXT)));
label3_->SetMultiLine(true);
label3_->SetFont(font);
label3_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
@@ -350,7 +358,7 @@
// now, we force Vista to show a correctly-sized box by taking account of
// the difference in font size calculation. The coefficient should not be
// stored in a variable because it's a hack and should go away.
- if (win_util::ShouldUseVistaFrame()) {
+ if (app::win::ShouldUseVistaFrame()) {
size.set_width(static_cast<int>(size.width() * 0.85));
size.set_height(static_cast<int>(size.height() * 0.85));
}
@@ -402,15 +410,17 @@
const gfx::Font& font =
ResourceBundle::GetSharedInstance().GetFont(ResourceBundle::MediumFont);
- label1_ = new views::Label(l10n_util::GetStringF(IDS_FR_SE_BUBBLE_TITLE,
- UTF16ToWideHack(GetDefaultSearchEngineName(profile_))));
+ label1_ = new views::Label(UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_FR_SE_BUBBLE_TITLE,
+ GetDefaultSearchEngineName(profile_))));
label1_->SetFont(font.DeriveFont(3, gfx::Font::BOLD));
label1_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(label1_);
gfx::Size ps = GetPreferredSize();
- label2_ = new views::Label(l10n_util::GetString(IDS_FR_BUBBLE_SUBTEXT));
+ label2_ = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_BUBBLE_SUBTEXT)));
label2_->SetMultiLine(true);
label2_->SetFont(font);
label2_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
diff --git a/chrome/browser/ui/views/first_run_search_engine_view.cc b/chrome/browser/ui/views/first_run_search_engine_view.cc
index fa4e6a7..91cf367 100644
--- a/chrome/browser/ui/views/first_run_search_engine_view.cc
+++ b/chrome/browser/ui/views/first_run_search_engine_view.cc
@@ -13,6 +13,7 @@
#include "base/i18n/rtl.h"
#include "base/rand_util.h"
#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/search_engine_type.h"
#include "chrome/browser/search_engines/template_url.h"
@@ -53,7 +54,9 @@
SearchEngineChoice::SearchEngineChoice(views::ButtonListener* listener,
const TemplateURL* search_engine,
bool use_small_logos)
- : NativeButton(listener, l10n_util::GetString(IDS_FR_SEARCH_CHOOSE)),
+ : NativeButton(
+ listener,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FR_SEARCH_CHOOSE))),
is_image_label_(false),
search_engine_(search_engine),
slot_(0) {
@@ -293,8 +296,8 @@
int label_width = GetPreferredSize().width() - 2 * kPanelHorizMargin;
// Add title and text asking the user to choose a search engine:
- title_label_ = new Label(l10n_util::GetString(
- IDS_FR_SEARCH_MAIN_LABEL));
+ title_label_ = new Label(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FR_SEARCH_MAIN_LABEL)));
title_label_->SetColor(SK_ColorBLACK);
title_label_->SetFont(title_label_->font().DeriveFont(3, gfx::Font::BOLD));
title_label_->SetMultiLine(true);
@@ -302,8 +305,9 @@
title_label_->SizeToFit(label_width);
AddChildView(title_label_);
- text_label_ = new Label(l10n_util::GetStringF(IDS_FR_SEARCH_TEXT,
- l10n_util::GetString(IDS_PRODUCT_NAME)));
+ text_label_ = new Label(UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_FR_SEARCH_TEXT,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
text_label_->SetColor(SK_ColorBLACK);
text_label_->SetFont(text_label_->font().DeriveFont(1, gfx::Font::NORMAL));
text_label_->SetMultiLine(true);
@@ -426,5 +430,5 @@
}
std::wstring FirstRunSearchEngineView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_FIRSTRUN_DLG_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_FIRSTRUN_DLG_TITLE));
}
diff --git a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
index d7efbe9..fdfff0a 100644
--- a/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/compiler_specific.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/views/frame/browser_frame.h"
#include "chrome/browser/views/frame/browser_view.h"
@@ -71,7 +72,8 @@
rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
close_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
- close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
+ close_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)));
AddChildView(close_button_);
window_icon_ = new TabIconView(this);
diff --git a/chrome/browser/ui/views/frame/browser_frame_win.cc b/chrome/browser/ui/views/frame/browser_frame_win.cc
index d747f73..f1ef85d 100644
--- a/chrome/browser/ui/views/frame/browser_frame_win.cc
+++ b/chrome/browser/ui/views/frame/browser_frame_win.cc
@@ -9,8 +9,8 @@
#include <set>
-#include "app/win_util.h"
-#include "base/win_util.h"
+#include "app/win/hwnd_util.h"
+#include "app/win/win_util.h"
#include "chrome/browser/accessibility/browser_accessibility_state.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/browser_list.h"
@@ -19,6 +19,7 @@
#include "chrome/browser/views/frame/browser_root_view.h"
#include "chrome/browser/views/frame/browser_view.h"
#include "chrome/browser/views/frame/glass_browser_frame_view.h"
+#include "gfx/font.h"
#include "grit/theme_resources.h"
#include "views/screen.h"
#include "views/window/window_delegate.h"
@@ -40,7 +41,7 @@
// static
const gfx::Font& BrowserFrame::GetTitleFont() {
- static gfx::Font* title_font = new gfx::Font(win_util::GetWindowTitleFont());
+ static gfx::Font* title_font = new gfx::Font(app::win::GetWindowTitleFont());
return *title_font;
}
@@ -108,7 +109,7 @@
// We don't theme popup or app windows, so regardless of whether or not a
// theme is active for normal browser windows, we don't want to use the custom
// frame for popups/apps.
- if (!browser_view_->IsBrowserTypeNormal() && win_util::ShouldUseVistaFrame())
+ if (!browser_view_->IsBrowserTypeNormal() && app::win::ShouldUseVistaFrame())
return true;
// Otherwise, we use the native frame when we're told we should by the theme
diff --git a/chrome/browser/ui/views/frame/browser_root_view.cc b/chrome/browser/ui/views/frame/browser_root_view.cc
index 51a12a1..b6de9d6 100644
--- a/chrome/browser/ui/views/frame/browser_root_view.cc
+++ b/chrome/browser/ui/views/frame/browser_root_view.cc
@@ -7,6 +7,7 @@
#include "app/drag_drop_types.h"
#include "app/l10n_util.h"
#include "app/os_exchange_data.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/autocomplete/autocomplete_classifier.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
@@ -22,7 +23,7 @@
: views::RootView(widget),
browser_view_(browser_view),
forwarding_to_tab_strip_(false) {
- SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
+ SetAccessibleName(UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
}
bool BrowserRootView::GetDropFormats(
diff --git a/chrome/browser/ui/views/frame/browser_view.cc b/chrome/browser/ui/views/frame/browser_view.cc
index f00aef8..1559980 100644
--- a/chrome/browser/ui/views/frame/browser_view.cc
+++ b/chrome/browser/ui/views/frame/browser_view.cc
@@ -25,6 +25,7 @@
#include "chrome/browser/dom_ui/bug_report_ui.h"
#include "chrome/browser/download/download_manager.h"
#include "chrome/browser/instant/instant_controller.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/ntp_background_util.h"
#include "chrome/browser/page_info_window.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -83,7 +84,7 @@
#if defined(OS_WIN)
#include "app/view_prop.h"
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#include "chrome/browser/aeropeek_manager.h"
#include "chrome/browser/jumplist_win.h"
#elif defined(OS_LINUX)
@@ -289,35 +290,36 @@
public:
explicit DownloadInProgressConfirmDialogDelegate(Browser* browser)
: browser_(browser),
- product_name_(l10n_util::GetString(IDS_PRODUCT_NAME)) {
+ product_name_(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))) {
int download_count = browser->profile()->GetDownloadManager()->
in_progress_count();
std::wstring warning_text;
std::wstring explanation_text;
if (download_count == 1) {
- warning_text =
- l10n_util::GetStringF(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING,
- product_name_);
- explanation_text =
- l10n_util::GetStringF(IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION,
- product_name_);
- ok_button_text_ = l10n_util::GetString(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL);
- cancel_button_text_ = l10n_util::GetString(
- IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
+ warning_text = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_WARNING,
+ WideToUTF16(product_name_)));
+ explanation_text = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_EXPLANATION,
+ WideToUTF16(product_name_)));
+ ok_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_OK_BUTTON_LABEL));
+ cancel_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_SINGLE_DOWNLOAD_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL));
} else {
- warning_text =
- l10n_util::GetStringF(IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING,
- product_name_,
- UTF8ToWide(base::IntToString(download_count)));
- explanation_text =
- l10n_util::GetStringF(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION, product_name_);
- ok_button_text_ = l10n_util::GetString(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL);
- cancel_button_text_ = l10n_util::GetString(
- IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL);
+ warning_text = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_WARNING,
+ WideToUTF16(product_name_),
+ UTF8ToUTF16(base::IntToString(download_count))));
+ explanation_text = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_EXPLANATION,
+ WideToUTF16(product_name_)));
+ ok_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_OK_BUTTON_LABEL));
+ cancel_button_text_ = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_MULTIPLE_DOWNLOADS_REMOVE_CONFIRM_CANCEL_BUTTON_LABEL));
}
// There are two lines of text: the bold warning label and the text
@@ -606,8 +608,10 @@
std::map<views::Accelerator, int>::const_iterator iter =
accelerator_table_.find(accelerator);
DCHECK(iter != accelerator_table_.end());
-
int command_id = iter->second;
+
+ if (!browser_->block_command_execution())
+ UpdateAcceleratorMetrics(accelerator, command_id);
return browser_->ExecuteCommandIfEnabled(command_id);
}
@@ -1126,9 +1130,9 @@
void BrowserView::ShowProfileErrorDialog(int message_id) {
#if defined(OS_WIN)
- std::wstring title = l10n_util::GetString(IDS_PRODUCT_NAME);
- std::wstring message = l10n_util::GetString(message_id);
- win_util::MessageBox(GetNativeHandle(), message, title,
+ string16 title = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
+ string16 message = l10n_util::GetStringUTF16(message_id);
+ app::win::MessageBox(GetNativeHandle(), message, title,
MB_OK | MB_ICONWARNING | MB_TOPMOST);
#elif defined(OS_LINUX)
std::string title = l10n_util::GetStringUTF8(IDS_PRODUCT_NAME);
@@ -1228,7 +1232,7 @@
views::FocusManager* focus_manager = GetFocusManager();
DCHECK(focus_manager);
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) && !defined(TOUCH_UI)
// Views and WebKit use different tables for GdkEventKey -> views::KeyEvent
// conversion. We need to use View's conversion table here to keep consistent
// behavior with views::FocusManager::OnKeyEvent() method.
@@ -1275,12 +1279,14 @@
return false;
// Executing the command may cause |this| object to be destroyed.
-#if defined(OS_LINUX)
- if (browser_->IsReservedCommand(id) && !event.match_edit_command)
+#if defined(OS_LINUX) && !defined(TOUCH_UI)
+ if (browser_->IsReservedCommand(id) && !event.match_edit_command) {
#else
- if (browser_->IsReservedCommand(id))
+ if (browser_->IsReservedCommand(id)) {
#endif
+ UpdateAcceleratorMetrics(accelerator, id);
return browser_->ExecuteCommandIfEnabled(id);
+ }
DCHECK(is_keyboard_shortcut != NULL);
*is_keyboard_shortcut = true;
@@ -1289,7 +1295,7 @@
}
void BrowserView::HandleKeyboardEvent(const NativeWebKeyboardEvent& event) {
-#if defined(OS_LINUX)
+#if defined(OS_LINUX) && !defined(TOUCH_UI)
views::Window* window = GetWidget()->GetWindow();
if (window && event.os_event && !event.skip_in_browser)
static_cast<views::WindowGtk*>(window)->HandleKeyboardEvent(event.os_event);
@@ -1566,8 +1572,9 @@
std::wstring BrowserView::GetAccessibleWindowTitle() const {
if (IsOffTheRecord()) {
- return l10n_util::GetStringF(
- IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT, GetWindowTitle());
+ return UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_ACCESSIBLE_INCOGNITO_WINDOW_TITLE_FORMAT,
+ WideToUTF16(GetWindowTitle())));
}
return GetWindowTitle();
}
@@ -1855,9 +1862,9 @@
void BrowserView::InitTabStrip(TabStripModel* model) {
// Throw away the existing tabstrip if we're switching display modes.
+ scoped_ptr<BaseTabStrip> old_strip(tabstrip_);
if (tabstrip_) {
tabstrip_->GetParent()->RemoveChildView(tabstrip_);
- delete tabstrip_;
}
BrowserTabStripController* tabstrip_controller =
@@ -1868,7 +1875,8 @@
else
tabstrip_ = new TabStrip(tabstrip_controller);
- tabstrip_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TABSTRIP));
+ tabstrip_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TABSTRIP)));
AddChildView(tabstrip_);
tabstrip_controller->InitFromModel(tabstrip_);
@@ -1894,14 +1902,15 @@
}
LoadAccelerators();
- SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
+ SetAccessibleName(UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
InitTabStrip(browser_->tabstrip_model());
toolbar_ = new ToolbarView(browser_.get());
AddChildView(toolbar_);
toolbar_->Init(browser_->profile());
- toolbar_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_TOOLBAR));
+ toolbar_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLBAR)));
infobar_container_ = new InfoBarContainer(this);
AddChildView(infobar_container_);
@@ -1925,8 +1934,8 @@
sidebar_container_,
views::SingleSplitView::HORIZONTAL_SPLIT);
sidebar_split_->SetID(VIEW_ID_SIDE_BAR_SPLIT);
- sidebar_split_->
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_SIDE_BAR));
+ sidebar_split_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_SIDE_BAR)));
sidebar_split_->set_background(
views::Background::CreateSolidBackground(bg_color));
}
@@ -1945,8 +1954,8 @@
devtools_container_,
views::SingleSplitView::VERTICAL_SPLIT);
contents_split_->SetID(VIEW_ID_CONTENTS_SPLIT);
- contents_split_->
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_WEB_CONTENTS));
+ contents_split_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_WEB_CONTENTS)));
contents_split_->set_background(
views::Background::CreateSolidBackground(bg_color));
AddChildView(contents_split_);
@@ -2024,8 +2033,8 @@
bookmark_bar_view_->SetProfile(contents->profile());
}
bookmark_bar_view_->SetPageNavigator(contents->tab_contents());
- bookmark_bar_view_->
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_BOOKMARKS));
+ bookmark_bar_view_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_BOOKMARKS)));
new_bookmark_bar_view = bookmark_bar_view_.get();
}
return UpdateChildViewAndLayout(new_bookmark_bar_view, &active_bookmark_bar_);
@@ -2456,6 +2465,67 @@
#endif
}
+void BrowserView::UpdateAcceleratorMetrics(
+ const views::Accelerator& accelerator, int command_id) {
+#if defined(OS_CHROMEOS)
+ // Collect information about the relative popularity of various accelerators
+ // on Chrome OS.
+ const app::KeyboardCode key_code = accelerator.GetKeyCode();
+ switch (command_id) {
+ case IDC_BACK:
+ if (key_code == app::VKEY_BACK)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Back_Backspace"));
+ else if (key_code == app::VKEY_F1)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Back_F1"));
+ else if (key_code == app::VKEY_LEFT)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Back_Left"));
+ break;
+ case IDC_FORWARD:
+ if (key_code == app::VKEY_BACK)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_Backspace"));
+ else if (key_code == app::VKEY_F2)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_F2"));
+ else if (key_code == app::VKEY_LEFT)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Forward_Right"));
+ break;
+ case IDC_RELOAD:
+ case IDC_RELOAD_IGNORING_CACHE:
+ if (key_code == app::VKEY_R)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Reload_R"));
+ else if (key_code == app::VKEY_F3)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Reload_F3"));
+ break;
+ case IDC_FULLSCREEN:
+ if (key_code == app::VKEY_F4)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Fullscreen_F4"));
+ break;
+ case IDC_NEW_TAB:
+ if (key_code == app::VKEY_T)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_NewTab_T"));
+ break;
+ case IDC_SEARCH:
+ if (key_code == app::VKEY_LWIN)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_Search_LWin"));
+ break;
+ case IDC_FOCUS_LOCATION:
+ if (key_code == app::VKEY_D)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_FocusLocation_D"));
+ else if (key_code == app::VKEY_L)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_FocusLocation_L"));
+ break;
+ case IDC_FOCUS_SEARCH:
+ if (key_code == app::VKEY_E)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_FocusSearch_E"));
+ else if (key_code == app::VKEY_K)
+ UserMetrics::RecordAction(UserMetricsAction("Accel_FocusSearch_K"));
+ break;
+ default:
+ // Do nothing.
+ break;
+ }
+#endif
+}
+
void BrowserView::ProcessTabSelected(TabContentsWrapper* new_contents,
bool change_tab_contents) {
// Update various elements that are interested in knowing the current
@@ -2499,8 +2569,8 @@
BrowserView* view = new BrowserView(browser);
BrowserFrame::Create(view, browser->profile());
- view->GetWindow()->GetNonClientView()->
- SetAccessibleName(l10n_util::GetString(IDS_PRODUCT_NAME));
+ view->GetWindow()->GetNonClientView()->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
return view;
}
diff --git a/chrome/browser/ui/views/frame/browser_view.h b/chrome/browser/ui/views/frame/browser_view.h
index 19635e6..645b425 100644
--- a/chrome/browser/ui/views/frame/browser_view.h
+++ b/chrome/browser/ui/views/frame/browser_view.h
@@ -506,6 +506,12 @@
// Initialize the hung plugin detector.
void InitHangMonitor();
+ // Possibly records a user metrics action corresponding to the passed-in
+ // accelerator. Only implemented for Chrome OS, where we're interested in
+ // learning about how frequently the top-row keys are used.
+ void UpdateAcceleratorMetrics(const views::Accelerator& accelerator,
+ int command_id);
+
// Invoked from TabSelectedAt or when instant is made active. Is
// |change_tab_contents| is true, |new_contents| is added to the view
// hierarchy, if |change_tab_contents| is false, it's assumed |new_contents|
diff --git a/chrome/browser/ui/views/frame/contents_container.cc b/chrome/browser/ui/views/frame/contents_container.cc
index ccf0abd..1c8abfd 100644
--- a/chrome/browser/ui/views/frame/contents_container.cc
+++ b/chrome/browser/ui/views/frame/contents_container.cc
@@ -4,9 +4,9 @@
#include "chrome/browser/views/frame/contents_container.h"
-#include "app/slide_animation.h"
#include "base/logging.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/background.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
@@ -95,7 +95,7 @@
}
void ContentsContainer::FadeActiveContents() {
- if (active_overlay_ || !Animation::ShouldRenderRichAnimation())
+ if (active_overlay_ || !ui::Animation::ShouldRenderRichAnimation())
return;
#if !defined(OS_WIN)
@@ -104,7 +104,7 @@
return;
#endif
- overlay_animation_.reset(new SlideAnimation(this));
+ overlay_animation_.reset(new ui::SlideAnimation(this));
overlay_animation_->SetDuration(300);
overlay_animation_->SetSlideDuration(300);
overlay_animation_->Show();
@@ -113,7 +113,7 @@
}
void ContentsContainer::ShowFade() {
- if (active_overlay_ || !Animation::ShouldRenderRichAnimation())
+ if (active_overlay_ || !ui::Animation::ShouldRenderRichAnimation())
return;
CreateOverlay(kMaxOpacity);
@@ -129,10 +129,10 @@
}
}
-void ContentsContainer::AnimationProgressed(const Animation* animation) {
+void ContentsContainer::AnimationProgressed(const ui::Animation* animation) {
active_overlay_->SetOpacity(
- Tween::ValueBetween(animation->GetCurrentValue(), kMinOpacity,
- kMaxOpacity));
+ ui::Tween::ValueBetween(animation->GetCurrentValue(), kMinOpacity,
+ kMaxOpacity));
active_overlay_->GetRootView()->SchedulePaint();
}
diff --git a/chrome/browser/ui/views/frame/contents_container.h b/chrome/browser/ui/views/frame/contents_container.h
index 0429b9f..2a2ef68 100644
--- a/chrome/browser/ui/views/frame/contents_container.h
+++ b/chrome/browser/ui/views/frame/contents_container.h
@@ -6,13 +6,16 @@
#define CHROME_BROWSER_UI_VIEWS_FRAME_CONTENTS_CONTAINER_H_
#pragma once
-#include "app/animation_delegate.h"
#include "base/scoped_ptr.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/view.h"
-class SlideAnimation;
class TabContents;
+namespace ui {
+class SlideAnimation;
+}
+
namespace views {
class Widget;
}
@@ -20,7 +23,7 @@
// ContentsContainer is responsible for managing the TabContents views.
// ContentsContainer has up to two children: one for the currently active
// TabContents and one for instant's TabContents.
-class ContentsContainer : public views::View, public AnimationDelegate {
+class ContentsContainer : public views::View, public ui::AnimationDelegate {
public:
explicit ContentsContainer(views::View* active);
virtual ~ContentsContainer();
@@ -54,8 +57,8 @@
// View overrides:
virtual void Layout();
- // AnimationDelegate overrides:
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate overrides:
+ virtual void AnimationProgressed(const ui::Animation* animation);
private:
class OverlayContentView;
@@ -80,7 +83,7 @@
OverlayContentView* overlay_view_;
// Animation used to vary the opacity of active_overlay.
- scoped_ptr<SlideAnimation> overlay_animation_;
+ scoped_ptr<ui::SlideAnimation> overlay_animation_;
// The margin between the top and the active view. This is used to make the
// preview overlap the bookmark bar on the new tab page.
diff --git a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
index d5bd3b3..0704ebd 100644
--- a/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
+++ b/chrome/browser/ui/views/frame/opaque_browser_frame_view.cc
@@ -8,6 +8,7 @@
#include "app/resource_bundle.h"
#include "app/theme_provider.h"
#include "base/compiler_specific.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/themes/browser_theme_provider.h"
#include "chrome/browser/views/frame/browser_frame.h"
@@ -121,7 +122,7 @@
tp->GetBitmapNamed(IDR_MINIMIZE_BUTTON_MASK));
}
minimize_button_->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_MINIMIZE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_MINIMIZE)));
AddChildView(minimize_button_);
maximize_button_->SetImage(views::CustomButton::BS_NORMAL,
@@ -135,7 +136,7 @@
tp->GetBitmapNamed(IDR_MAXIMIZE_BUTTON_MASK));
}
maximize_button_->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_MAXIMIZE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_MAXIMIZE)));
AddChildView(maximize_button_);
restore_button_->SetImage(views::CustomButton::BS_NORMAL,
@@ -148,7 +149,8 @@
restore_button_->SetBackground(color, background,
tp->GetBitmapNamed(IDR_RESTORE_BUTTON_MASK));
}
- restore_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RESTORE));
+ restore_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_RESTORE)));
AddChildView(restore_button_);
close_button_->SetImage(views::CustomButton::BS_NORMAL,
@@ -161,7 +163,8 @@
close_button_->SetBackground(color, background,
tp->GetBitmapNamed(IDR_CLOSE_BUTTON_MASK));
}
- close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
+ close_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)));
AddChildView(close_button_);
// Initializing the TabIconView is expensive, so only do it if we need to.
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.cc b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
index 3e303a2..e94ed66 100644
--- a/chrome/browser/ui/views/fullscreen_exit_bubble.cc
+++ b/chrome/browser/ui/views/fullscreen_exit_bubble.cc
@@ -7,10 +7,11 @@
#include "app/keyboard_codes.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "gfx/canvas_skia.h"
#include "grit/generated_resources.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/screen.h"
#include "views/widget/root_view.h"
#include "views/window/window.h"
@@ -51,9 +52,12 @@
const std::wstring& accelerator) {
link_.set_parent_owned(false);
#if !defined(OS_CHROMEOS)
- link_.SetText(l10n_util::GetStringF(IDS_EXIT_FULLSCREEN_MODE, accelerator));
+ link_.SetText(
+ UTF16ToWide(l10n_util::GetStringFUTF16(IDS_EXIT_FULLSCREEN_MODE,
+ WideToUTF16(accelerator))));
#else
- link_.SetText(l10n_util::GetString(IDS_EXIT_FULLSCREEN_MODE));
+ link_.SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXIT_FULLSCREEN_MODE)));
#endif
link_.SetController(bubble);
link_.SetFont(ResourceBundle::GetSharedInstance().GetFont(
@@ -139,7 +143,7 @@
: root_view_(frame->GetRootView()),
delegate_(delegate),
popup_(NULL),
- size_animation_(new SlideAnimation(this)) {
+ size_animation_(new ui::SlideAnimation(this)) {
size_animation_->Reset(1);
// Create the contents view.
@@ -194,7 +198,7 @@
}
void FullscreenExitBubble::AnimationProgressed(
- const Animation* animation) {
+ const ui::Animation* animation) {
gfx::Rect popup_rect(GetPopupRect(false));
if (popup_rect.IsEmpty()) {
popup_->Hide();
@@ -209,7 +213,7 @@
}
}
void FullscreenExitBubble::AnimationEnded(
- const Animation* animation) {
+ const ui::Animation* animation) {
AnimationProgressed(animation);
}
diff --git a/chrome/browser/ui/views/fullscreen_exit_bubble.h b/chrome/browser/ui/views/fullscreen_exit_bubble.h
index bb1c550..32c56bd 100644
--- a/chrome/browser/ui/views/fullscreen_exit_bubble.h
+++ b/chrome/browser/ui/views/fullscreen_exit_bubble.h
@@ -6,26 +6,28 @@
#define CHROME_BROWSER_UI_VIEWS_FULLSCREEN_EXIT_BUBBLE_H__
#pragma once
-#include "app/animation_delegate.h"
#include "base/scoped_ptr.h"
#include "base/timer.h"
#include "chrome/browser/command_updater.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/controls/link.h"
+namespace ui {
+class SlideAnimation;
+}
+
#if defined(OS_LINUX)
namespace views {
class WidgetGtk;
}
#endif
-class SlideAnimation;
-
// FullscreenExitBubble is responsible for showing a bubble atop the screen in
// fullscreen mode, telling users how to exit and providing a click target.
// The bubble auto-hides, and re-shows when the user moves to the screen top.
class FullscreenExitBubble : public views::LinkController,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit FullscreenExitBubble(
views::Widget* frame,
@@ -48,9 +50,9 @@
// views::LinkController
virtual void LinkActivated(views::Link* source, int event_flags);
- // AnimationDelegate
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // ui::AnimationDelegate
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// Called repeatedly to get the current mouse position and animate the bubble
// on or off the screen as appropriate.
@@ -84,7 +86,7 @@
FullscreenExitView* view_;
// Animation controlling sliding into/out of the top of the screen.
- scoped_ptr<SlideAnimation> size_animation_;
+ scoped_ptr<ui::SlideAnimation> size_animation_;
// Timer to delay before allowing the bubble to hide after it's initially
// shown.
diff --git a/chrome/browser/ui/views/generic_info_view.cc b/chrome/browser/ui/views/generic_info_view.cc
index 81ebb4a..7eb6d90 100644
--- a/chrome/browser/ui/views/generic_info_view.cc
+++ b/chrome/browser/ui/views/generic_info_view.cc
@@ -5,8 +5,9 @@
#include "chrome/browser/views/generic_info_view.h"
#include "app/l10n_util.h"
-#include "gfx/color_utils.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
+#include "gfx/color_utils.h"
#include "views/grid_layout.h"
#include "views/controls/label.h"
#include "views/controls/textfield/textfield.h"
@@ -24,7 +25,7 @@
}
void GenericInfoView::SetNameByStringId(int row, int name_string_id) {
- SetName(row, l10n_util::GetString(name_string_id));
+ SetName(row, UTF16ToWide(l10n_util::GetStringUTF16(name_string_id)));
}
void GenericInfoView::SetName(int row, const string16& name) {
diff --git a/chrome/browser/ui/views/generic_info_view_unittest.cc b/chrome/browser/ui/views/generic_info_view_unittest.cc
index 6c26603..ba079f8 100644
--- a/chrome/browser/ui/views/generic_info_view_unittest.cc
+++ b/chrome/browser/ui/views/generic_info_view_unittest.cc
@@ -56,8 +56,8 @@
GenericInfoView* view2 = new GenericInfoView(ARRAYSIZE(kNameIds), kNameIds);
root_view->AddChildView(view2);
- string16 product_name = l10n_util::GetString(IDS_PRODUCT_NAME);
- string16 product_desc = l10n_util::GetString(IDS_PRODUCT_DESCRIPTION);
+ string16 product_name = l10n_util::GetStringUTF16(IDS_PRODUCT_NAME);
+ string16 product_desc = l10n_util::GetStringUTF16(IDS_PRODUCT_DESCRIPTION);
EXPECT_EQ(product_name, view2->name_views_[0]->GetText());
EXPECT_EQ(product_desc, view2->name_views_[1]->GetText());
window->CloseNow();
diff --git a/chrome/browser/ui/views/hung_renderer_view.cc b/chrome/browser/ui/views/hung_renderer_view.cc
index b50debf..95184af 100644
--- a/chrome/browser/ui/views/hung_renderer_view.cc
+++ b/chrome/browser/ui/views/hung_renderer_view.cc
@@ -48,7 +48,7 @@
// Overridden from views::GroupTableModel:
virtual int RowCount();
- virtual std::wstring GetText(int row, int column_id);
+ virtual string16 GetText(int row, int column_id);
virtual SkBitmap GetIcon(int row);
virtual void SetObserver(TableModelObserver* observer);
virtual void GetGroupRangeForItem(int item, views::GroupRange* range);
@@ -89,11 +89,11 @@
return static_cast<int>(tab_contentses_.size());
}
-std::wstring HungPagesTableModel::GetText(int row, int column_id) {
+string16 HungPagesTableModel::GetText(int row, int column_id) {
DCHECK(row >= 0 && row < RowCount());
- std::wstring title = UTF16ToWideHack(tab_contentses_[row]->GetTitle());
+ string16 title = tab_contentses_[row]->GetTitle();
if (title.empty())
- title = UTF16ToWideHack(TabContents::GetDefaultTitle());
+ title = TabContents::GetDefaultTitle();
// TODO(xji): Consider adding a special case if the title text is a URL,
// since those should always have LTR directionality. Please refer to
// http://crbug.com/6726 for more information.
@@ -267,7 +267,8 @@
// HungRendererDialogView, views::DialogDelegate implementation:
std::wstring HungRendererDialogView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_TITLE));
}
void HungRendererDialogView::WindowClosing() {
@@ -288,7 +289,8 @@
std::wstring HungRendererDialogView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK)
- return l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_WAIT));
return std::wstring();
}
@@ -344,7 +346,7 @@
frozen_icon_view_->SetImage(frozen_icon_);
info_label_ = new views::Label(
- l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER)));
info_label_->SetMultiLine(true);
info_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
@@ -387,8 +389,8 @@
}
void HungRendererDialogView::CreateKillButtonView() {
- kill_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_BROWSER_HANGMONITOR_RENDERER_END));
+ kill_button_ = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_BROWSER_HANGMONITOR_RENDERER_END)));
kill_button_container_ = new ButtonContainer;
diff --git a/chrome/browser/ui/views/importer_lock_view.cc b/chrome/browser/ui/views/importer_lock_view.cc
index 8fc1c9a..714265c 100644
--- a/chrome/browser/ui/views/importer_lock_view.cc
+++ b/chrome/browser/ui/views/importer_lock_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/message_loop.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/importer/importer.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -22,7 +23,7 @@
: description_label_(NULL),
importer_host_(host) {
description_label_ = new views::Label(
- l10n_util::GetString(IDS_IMPORTER_LOCK_TEXT));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TEXT)));
description_label_->SetMultiLine(true);
description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(description_label_);
@@ -46,9 +47,9 @@
std::wstring ImporterLockView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_IMPORTER_LOCK_OK);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_OK));
} else if (button == MessageBoxFlags::DIALOGBUTTON_CANCEL) {
- return l10n_util::GetString(IDS_IMPORTER_LOCK_CANCEL);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_CANCEL));
}
return std::wstring();
}
@@ -58,7 +59,7 @@
}
std::wstring ImporterLockView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_IMPORTER_LOCK_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORTER_LOCK_TITLE));
}
bool ImporterLockView::Accept() {
diff --git a/chrome/browser/ui/views/importer_view.cc b/chrome/browser/ui/views/importer_view.cc
index cbbfba7..9af35f4 100644
--- a/chrome/browser/ui/views/importer_view.cc
+++ b/chrome/browser/ui/views/importer_view.cc
@@ -53,28 +53,28 @@
void ImporterView::SetupControl() {
// Adds all controls.
- import_from_label_ =
- new views::Label(l10n_util::GetString(IDS_IMPORT_FROM_LABEL));
+ import_from_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_IMPORT_FROM_LABEL)));
profile_combobox_ = new views::Combobox(this);
profile_combobox_->set_listener(this);
profile_combobox_->SetAccessibleName(import_from_label_->GetText());
- import_items_label_ =
- new views::Label(l10n_util::GetString(IDS_IMPORT_ITEMS_LABEL));
+ import_items_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_IMPORT_ITEMS_LABEL)));
- history_checkbox_ =
- InitCheckbox(l10n_util::GetString(IDS_IMPORT_HISTORY_CHKBOX),
- (initial_state_ & importer::HISTORY) != 0);
- favorites_checkbox_ =
- InitCheckbox(l10n_util::GetString(IDS_IMPORT_FAVORITES_CHKBOX),
- (initial_state_ & importer::FAVORITES) != 0);
- passwords_checkbox_ =
- InitCheckbox(l10n_util::GetString(IDS_IMPORT_PASSWORDS_CHKBOX),
- (initial_state_ & importer::PASSWORDS) != 0);
- search_engines_checkbox_ =
- InitCheckbox(l10n_util::GetString(IDS_IMPORT_SEARCH_ENGINES_CHKBOX),
- (initial_state_ & importer::SEARCH_ENGINES) != 0);
+ history_checkbox_ = InitCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_HISTORY_CHKBOX)),
+ (initial_state_ & importer::HISTORY) != 0);
+ favorites_checkbox_ = InitCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_FAVORITES_CHKBOX)),
+ (initial_state_ & importer::FAVORITES) != 0);
+ passwords_checkbox_ = InitCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_PASSWORDS_CHKBOX)),
+ (initial_state_ & importer::PASSWORDS) != 0);
+ search_engines_checkbox_ = InitCheckbox(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_SEARCH_ENGINES_CHKBOX)),
+ (initial_state_ & importer::SEARCH_ENGINES) != 0);
// Arranges controls by using GridLayout.
const int column_set_id = 0;
@@ -122,7 +122,7 @@
std::wstring ImporterView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_IMPORT_COMMIT);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_COMMIT));
} else {
return std::wstring();
}
@@ -145,7 +145,7 @@
}
std::wstring ImporterView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_IMPORT_SETTINGS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_SETTINGS_TITLE));
}
bool ImporterView::Accept() {
diff --git a/chrome/browser/ui/views/importing_progress_view.cc b/chrome/browser/ui/views/importing_progress_view.cc
index ae3135e..2befd5f 100644
--- a/chrome/browser/ui/views/importing_progress_view.cc
+++ b/chrome/browser/ui/views/importing_progress_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/importing_progress_view.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -28,16 +29,16 @@
state_passwords_(new views::CheckmarkThrobber),
state_history_(new views::CheckmarkThrobber),
state_cookies_(new views::CheckmarkThrobber),
- label_bookmarks_(new views::Label(
- l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_BOOKMARKS))),
- label_searches_(new views::Label(
- l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_SEARCH))),
- label_passwords_(new views::Label(
- l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_PASSWORDS))),
- label_history_(new views::Label(
- l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_HISTORY))),
- label_cookies_(new views::Label(
- l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_COOKIES))),
+ label_bookmarks_(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_BOOKMARKS)))),
+ label_searches_(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_SEARCH)))),
+ label_passwords_(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_PASSWORDS)))),
+ label_history_(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_HISTORY)))),
+ label_cookies_(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_COOKIES)))),
parent_window_(parent_window),
coordinator_(coordinator),
import_observer_(observer),
@@ -45,8 +46,10 @@
importing_(true),
bookmarks_import_(bookmarks_import) {
std::wstring info_text = bookmarks_import ?
- l10n_util::GetString(IDS_IMPORT_BOOKMARKS) :
- l10n_util::GetStringF(IDS_IMPORT_PROGRESS_INFO, source_name);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_BOOKMARKS)) :
+ UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_IMPORT_PROGRESS_INFO,
+ WideToUTF16(source_name)));
label_info_ = new views::Label(info_text);
coordinator_->SetObserver(this);
label_info_->SetMultiLine(true);
@@ -188,7 +191,8 @@
std::wstring ImportingProgressView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
DCHECK(button == MessageBoxFlags::DIALOGBUTTON_CANCEL);
- return l10n_util::GetString(IDS_IMPORT_PROGRESS_STATUS_CANCEL);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_STATUS_CANCEL));
}
bool ImportingProgressView::IsModal() const {
@@ -196,7 +200,7 @@
}
std::wstring ImportingProgressView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_IMPORT_PROGRESS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMPORT_PROGRESS_TITLE));
}
bool ImportingProgressView::Cancel() {
diff --git a/chrome/browser/ui/views/indexed_db_info_view.cc b/chrome/browser/ui/views/indexed_db_info_view.cc
index 733ef6e..a1718ef 100644
--- a/chrome/browser/ui/views/indexed_db_info_view.cc
+++ b/chrome/browser/ui/views/indexed_db_info_view.cc
@@ -51,7 +51,7 @@
void IndexedDBInfoView::ClearIndexedDBDisplay() {
std::wstring no_cookie_string =
- l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NONESELECTED));
origin_value_field_->SetText(no_cookie_string);
size_value_field_->SetText(no_cookie_string);
last_modified_value_field_->SetText(no_cookie_string);
@@ -77,14 +77,15 @@
kIndexedDBInfoViewBorderSize, border_color);
set_border(border);
- views::Label* origin_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL));
+ views::Label* origin_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL)));
origin_value_field_ = new views::Textfield;
- views::Label* size_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL));
+ views::Label* size_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL)));
size_value_field_ = new views::Textfield;
- views::Label* last_modified_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL));
+ views::Label* last_modified_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(
+ IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL)));
last_modified_value_field_ = new views::Textfield;
using views::GridLayout;
diff --git a/chrome/browser/ui/views/info_bubble.cc b/chrome/browser/ui/views/info_bubble.cc
index cc9e574..8d07a57 100644
--- a/chrome/browser/ui/views/info_bubble.cc
+++ b/chrome/browser/ui/views/info_bubble.cc
@@ -7,13 +7,13 @@
#include <vector>
#include "app/keyboard_codes.h"
-#include "app/slide_animation.h"
#include "chrome/browser/ui/window_sizer.h"
#include "chrome/common/notification_service.h"
#include "gfx/canvas_skia.h"
#include "gfx/color_utils.h"
#include "gfx/path.h"
#include "third_party/skia/include/core/SkPaint.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/fill_layout.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
@@ -282,7 +282,7 @@
DoClose(false);
}
-void InfoBubble::AnimationEnded(const Animation* animation) {
+void InfoBubble::AnimationEnded(const ui::Animation* animation) {
if (static_cast<int>(animation_->GetCurrentValue()) == 0) {
// When fading out we just need to close the bubble at the end
DoClose(false);
@@ -295,7 +295,7 @@
}
}
-void InfoBubble::AnimationProgressed(const Animation* animation) {
+void InfoBubble::AnimationProgressed(const ui::Animation* animation) {
#if defined(OS_WIN)
// Set the opacity for the main contents window.
unsigned char opacity = static_cast<unsigned char>(
@@ -545,9 +545,9 @@
}
void InfoBubble::Fade(bool fade_in) {
- animation_.reset(new SlideAnimation(this));
+ animation_.reset(new ui::SlideAnimation(this));
animation_->SetSlideDuration(kHideFadeDurationMS);
- animation_->SetTweenType(Tween::LINEAR);
+ animation_->SetTweenType(ui::Tween::LINEAR);
animation_->Reset(fade_in ? 0.0 : 1.0);
if (fade_in)
diff --git a/chrome/browser/ui/views/info_bubble.h b/chrome/browser/ui/views/info_bubble.h
index d32b4b5..74fffb2 100644
--- a/chrome/browser/ui/views/info_bubble.h
+++ b/chrome/browser/ui/views/info_bubble.h
@@ -6,8 +6,8 @@
#define CHROME_BROWSER_UI_VIEWS_INFO_BUBBLE_H_
#pragma once
-#include "app/animation_delegate.h"
#include "third_party/skia/include/core/SkColor.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/accelerator.h"
#include "views/view.h"
#include "chrome/browser/views/bubble_border.h"
@@ -27,20 +27,22 @@
// InfoBubble insets the contents for you, so the contents typically shouldn't
// have any additional margins.
+#if defined(OS_WIN)
+class BorderWidget;
+#endif
class InfoBubble;
-class SlideAnimation;
-
-namespace views {
-class Widget;
-}
namespace gfx {
class Path;
}
-#if defined(OS_WIN)
-class BorderWidget;
-#endif
+namespace ui {
+class SlideAnimation;
+}
+
+namespace views {
+class Widget;
+}
// This is used to paint the border of the InfoBubble. Windows uses this via
// BorderWidget (see below), while others can use it directly in the bubble.
@@ -182,7 +184,7 @@
: public views::WidgetGtk,
#endif
public views::AcceleratorTarget,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
// Shows the InfoBubble. |parent| is set as the parent window, |contents| are
// the contents shown in the bubble, and |position_relative_to| is a rect in
@@ -229,9 +231,9 @@
// Overridden from WidgetWin:
virtual void Close();
- // Overridden from AnimationDelegate:
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
static const SkColor kBackgroundColor;
@@ -295,7 +297,7 @@
InfoBubbleDelegate* delegate_;
// The animation used to fade the bubble out.
- scoped_ptr<SlideAnimation> animation_;
+ scoped_ptr<ui::SlideAnimation> animation_;
// The current visibility status of the bubble.
ShowStatus show_status_;
diff --git a/chrome/browser/ui/views/infobars/extension_infobar.cc b/chrome/browser/ui/views/infobars/extension_infobar.cc
index e2fb43f..9540b5d 100644
--- a/chrome/browser/ui/views/infobars/extension_infobar.cc
+++ b/chrome/browser/ui/views/infobars/extension_infobar.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/views/infobars/extension_infobar.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "chrome/browser/extensions/extension_context_menu_model.h"
#include "chrome/browser/extensions/extension_infobar_delegate.h"
#include "chrome/browser/extensions/extension_host.h"
@@ -16,6 +15,7 @@
#include "chrome/common/extensions/extension_resource.h"
#include "gfx/canvas_skia.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/menu_2.h"
#include "views/widget/widget.h"
diff --git a/chrome/browser/ui/views/infobars/infobar_container.cc b/chrome/browser/ui/views/infobars/infobar_container.cc
index 527aacc..e9706ff 100644
--- a/chrome/browser/ui/views/infobars/infobar_container.cc
+++ b/chrome/browser/ui/views/infobars/infobar_container.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/infobars/infobar_container.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/ui/view_ids.h"
@@ -19,7 +20,8 @@
: delegate_(delegate),
tab_contents_(NULL) {
SetID(VIEW_ID_INFO_BAR_CONTAINER);
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_CONTAINER));
+ SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_CONTAINER)));
}
InfoBarContainer::~InfoBarContainer() {
diff --git a/chrome/browser/ui/views/infobars/infobars.cc b/chrome/browser/ui/views/infobars/infobars.cc
index 756ce70..d1af02e 100644
--- a/chrome/browser/ui/views/infobars/infobars.cc
+++ b/chrome/browser/ui/views/infobars/infobars.cc
@@ -6,7 +6,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/views/event_utils.h"
@@ -14,6 +13,7 @@
#include "gfx/canvas.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/background.h"
#include "views/controls/button/image_button.h"
#include "views/controls/button/native_button.h"
@@ -23,7 +23,7 @@
#include "views/widget/widget.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
+#include "app/win/hwnd_util.h"
#endif
// static
@@ -96,10 +96,12 @@
switch (delegate->GetInfoBarType()) {
case InfoBarDelegate::WARNING_TYPE:
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_WARNING));
+ SetAccessibleName(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_WARNING)));
break;
case InfoBarDelegate::PAGE_ACTION_TYPE:
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_INFOBAR_PAGE_ACTION));
+ SetAccessibleName(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_ACCNAME_INFOBAR_PAGE_ACTION)));
break;
default:
NOTREACHED();
@@ -113,11 +115,12 @@
rb.GetBitmapNamed(IDR_CLOSE_BAR_H));
close_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_CLOSE_BAR_P));
- close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
+ close_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)));
AddChildView(close_button_);
- animation_.reset(new SlideAnimation(this));
- animation_->SetTweenType(Tween::LINEAR);
+ animation_.reset(new ui::SlideAnimation(this));
+ animation_->SetTweenType(ui::Tween::LINEAR);
}
InfoBar::~InfoBar() {
@@ -207,14 +210,14 @@
}
}
-// InfoBar, AnimationDelegate implementation: ----------------------------------
+// InfoBar, ui::AnimationDelegate implementation: ------------------------------
-void InfoBar::AnimationProgressed(const Animation* animation) {
+void InfoBar::AnimationProgressed(const ui::Animation* animation) {
if (container_)
container_->InfoBarAnimated(true);
}
-void InfoBar::AnimationEnded(const Animation* animation) {
+void InfoBar::AnimationEnded(const ui::Animation* animation) {
if (container_) {
container_->InfoBarAnimated(false);
@@ -243,7 +246,7 @@
// Do not restore focus (and active state with it) on Windows if some other
// top-level window became active.
if (GetWidget() &&
- !win_util::DoesWindowBelongToActiveWindow(GetWidget()->GetNativeView())) {
+ !app::win::DoesWindowBelongToActiveWindow(GetWidget()->GetNativeView())) {
restore_focus = false;
}
#endif // defined(OS_WIN)
diff --git a/chrome/browser/ui/views/infobars/infobars.h b/chrome/browser/ui/views/infobars/infobars.h
index 2e32ac6..b6fc879 100644
--- a/chrome/browser/ui/views/infobars/infobars.h
+++ b/chrome/browser/ui/views/infobars/infobars.h
@@ -6,15 +6,19 @@
#define CHROME_BROWSER_UI_VIEWS_INFOBARS_INFOBARS_H_
#pragma once
-#include "app/animation_delegate.h"
#include "base/task.h"
#include "chrome/browser/tab_contents/infobar_delegate.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/controls/button/button.h"
#include "views/controls/link.h"
#include "views/focus/focus_manager.h"
class InfoBarContainer;
+
+namespace ui {
class SlideAnimation;
+}
+
namespace views {
class ExternalFocusTracker;
class ImageButton;
@@ -43,7 +47,7 @@
class InfoBar : public views::View,
public views::ButtonListener,
public views::FocusChangeListener,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit InfoBar(InfoBarDelegate* delegate);
virtual ~InfoBar();
@@ -86,7 +90,7 @@
void set_target_height(double height) { target_height_ = height; }
- SlideAnimation* animation() { return animation_.get(); }
+ ui::SlideAnimation* animation() { return animation_.get(); }
// Returns a centered y-position of a control of height specified in
// |prefsize| within the standard InfoBar height. Stable during an animation.
@@ -104,9 +108,9 @@
// Overridden from views::FocusChangeListener:
virtual void FocusWillChange(View* focused_before, View* focused_now);
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
private:
friend class InfoBarContainer;
@@ -150,7 +154,7 @@
views::ImageButton* close_button_;
// The animation that runs when the InfoBar is opened or closed.
- scoped_ptr<SlideAnimation> animation_;
+ scoped_ptr<ui::SlideAnimation> animation_;
// Tracks and stores the last focused view which is not the InfoBar or any of
// its children. Used to restore focus once the InfoBar is closed.
diff --git a/chrome/browser/ui/views/infobars/translate_infobar_base.cc b/chrome/browser/ui/views/infobars/translate_infobar_base.cc
index 4eb0bdd..fec6886 100644
--- a/chrome/browser/ui/views/infobars/translate_infobar_base.cc
+++ b/chrome/browser/ui/views/infobars/translate_infobar_base.cc
@@ -5,7 +5,6 @@
#include "chrome/browser/views/infobars/translate_infobar_base.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/translate/translate_infobar_delegate.h"
#include "chrome/browser/views/infobars/after_translate_infobar.h"
@@ -14,6 +13,7 @@
#include "chrome/browser/views/infobars/infobar_button_border.h"
#include "gfx/canvas_skia.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/image_view.h"
@@ -31,8 +31,8 @@
TranslateInfoBarDelegate::BackgroundAnimationType animation =
delegate->background_animation_type();
if (animation != TranslateInfoBarDelegate::NONE) {
- background_color_animation_.reset(new SlideAnimation(this));
- background_color_animation_->SetTweenType(Tween::LINEAR);
+ background_color_animation_.reset(new ui::SlideAnimation(this));
+ background_color_animation_->SetTweenType(ui::Tween::LINEAR);
background_color_animation_->SetSlideDuration(500);
if (animation == TranslateInfoBarDelegate::NORMAL_TO_ERROR) {
background_color_animation_->Show();
@@ -81,7 +81,7 @@
error_background_);
}
-void TranslateInfoBarBase::AnimationProgressed(const Animation* animation) {
+void TranslateInfoBarBase::AnimationProgressed(const ui::Animation* animation) {
if (background_color_animation_.get() == animation)
SchedulePaint(); // That'll trigger a PaintBackgroud.
else
diff --git a/chrome/browser/ui/views/infobars/translate_infobar_base.h b/chrome/browser/ui/views/infobars/translate_infobar_base.h
index 2c5d091..3f49c01 100644
--- a/chrome/browser/ui/views/infobars/translate_infobar_base.h
+++ b/chrome/browser/ui/views/infobars/translate_infobar_base.h
@@ -33,8 +33,8 @@
virtual void PaintBackground(gfx::Canvas* canvas);
protected:
- // Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
+ // Overridden from ui::AnimationDelegate:
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Creates a label with the appropriate font and color for the translate
// infobars.
@@ -57,7 +57,7 @@
InfoBarBackground normal_background_;
InfoBarBackground error_background_;
- scoped_ptr<SlideAnimation> background_color_animation_;
+ scoped_ptr<ui::SlideAnimation> background_color_animation_;
private:
// Returns the background that should be displayed when not animating.
diff --git a/chrome/browser/ui/views/instant_confirm_view.cc b/chrome/browser/ui/views/instant_confirm_view.cc
index cddc79b..cd338d2 100644
--- a/chrome/browser/ui/views/instant_confirm_view.cc
+++ b/chrome/browser/ui/views/instant_confirm_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/instant_confirm_view.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/instant/instant_confirm_dialog.h"
#include "chrome/browser/instant/instant_controller.h"
@@ -23,12 +24,12 @@
InstantConfirmView::InstantConfirmView(Profile* profile) : profile_(profile) {
views::Label* description_label = new views::Label(
- l10n_util::GetString(IDS_INSTANT_OPT_IN_MESSAGE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_MESSAGE)));
description_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
description_label->SetMultiLine(true);
views::Link* learn_more_link = new views::Link(
- l10n_util::GetString(IDS_LEARN_MORE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE)));
learn_more_link->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
learn_more_link->SetController(this);
@@ -63,7 +64,7 @@
}
std::wstring InstantConfirmView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_INSTANT_OPT_IN_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_OPT_IN_TITLE));
}
gfx::Size InstantConfirmView::GetPreferredSize() {
diff --git a/chrome/browser/ui/views/js_modal_dialog_views.cc b/chrome/browser/ui/views/js_modal_dialog_views.cc
index ac20b4e..a75d922 100644
--- a/chrome/browser/ui/views/js_modal_dialog_views.cc
+++ b/chrome/browser/ui/views/js_modal_dialog_views.cc
@@ -7,6 +7,7 @@
#include "app/keyboard_codes.h"
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
#include "chrome/browser/views/window.h"
#include "grit/generated_resources.h"
@@ -27,8 +28,8 @@
message_box_view_->AddAccelerator(
views::Accelerator(app::VKEY_C, false, true, false));
if (parent->display_suppress_checkbox()) {
- message_box_view_->SetCheckBoxLabel(
- l10n_util::GetString(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION));
+ message_box_view_->SetCheckBoxLabel(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_JAVASCRIPT_MESSAGEBOX_SUPPRESS_OPTION)));
}
}
@@ -119,10 +120,11 @@
MessageBoxFlags::DialogButton button) const {
if (parent_->is_before_unload_dialog()) {
if (button == MessageBoxFlags::DIALOGBUTTON_OK) {
- return l10n_util::GetString(IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_BEFOREUNLOAD_MESSAGEBOX_OK_BUTTON_LABEL));
} else if (button == MessageBoxFlags::DIALOGBUTTON_CANCEL) {
- return l10n_util::GetString(
- IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_BEFOREUNLOAD_MESSAGEBOX_CANCEL_BUTTON_LABEL));
}
}
return DialogDelegate::GetDialogButtonLabel(button);
diff --git a/chrome/browser/ui/views/keyboard_overlay_delegate.cc b/chrome/browser/ui/views/keyboard_overlay_delegate.cc
index 5673f02..6081316 100644
--- a/chrome/browser/ui/views/keyboard_overlay_delegate.cc
+++ b/chrome/browser/ui/views/keyboard_overlay_delegate.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/scoped_ptr.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/dom_ui/html_dialog_ui.h"
#include "chrome/browser/ui/browser.h"
@@ -16,7 +17,7 @@
void KeyboardOverlayDelegate::ShowDialog(gfx::NativeWindow owning_window) {
Browser* browser = BrowserList::GetLastActive();
KeyboardOverlayDelegate* delegate = new KeyboardOverlayDelegate(
- l10n_util::GetString(IDS_KEYBOARD_OVERLAY_TITLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_KEYBOARD_OVERLAY_TITLE)));
DCHECK(browser);
browser->BrowserShowHtmlDialog(delegate, owning_window);
}
diff --git a/chrome/browser/ui/views/keyword_editor_view.cc b/chrome/browser/ui/views/keyword_editor_view.cc
index 610fa9e..bd2c820 100644
--- a/chrome/browser/ui/views/keyword_editor_view.cc
+++ b/chrome/browser/ui/views/keyword_editor_view.cc
@@ -126,7 +126,8 @@
}
std::wstring KeywordEditorView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_WINDOW_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_WINDOW_TITLE));
}
std::wstring KeywordEditorView::GetWindowName() const {
@@ -165,19 +166,19 @@
views::ICON_AND_TEXT, false, true, true);
table_view_->SetObserver(this);
- add_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON));
+ add_button_ = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_NEW_BUTTON)));
add_button_->SetEnabled(controller_->loaded());
add_button_->AddAccelerator(
views::Accelerator(app::VKEY_A, false, false, true));
add_button_->SetAccessibleKeyboardShortcut(L"A");
- edit_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON));
+ edit_button_ = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_EDIT_BUTTON)));
edit_button_->SetEnabled(false);
- remove_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_REMOVE_BUTTON));
+ remove_button_ = new views::NativeButton(this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SEARCH_ENGINES_EDITOR_REMOVE_BUTTON)));
remove_button_->SetEnabled(false);
remove_button_->AddAccelerator(
views::Accelerator(app::VKEY_R, false, false, true));
@@ -185,7 +186,8 @@
make_default_button_ = new views::NativeButton(
this,
- l10n_util::GetString(IDS_SEARCH_ENGINES_EDITOR_MAKE_DEFAULT_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_SEARCH_ENGINES_EDITOR_MAKE_DEFAULT_BUTTON)));
make_default_button_->SetEnabled(false);
InitLayoutManager();
diff --git a/chrome/browser/ui/views/local_storage_info_view.cc b/chrome/browser/ui/views/local_storage_info_view.cc
index 35c7c49..b21b74e 100644
--- a/chrome/browser/ui/views/local_storage_info_view.cc
+++ b/chrome/browser/ui/views/local_storage_info_view.cc
@@ -52,7 +52,7 @@
void LocalStorageInfoView::ClearLocalStorageDisplay() {
std::wstring no_cookie_string =
- l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NONESELECTED));
origin_value_field_->SetText(no_cookie_string);
size_value_field_->SetText(no_cookie_string);
last_modified_value_field_->SetText(no_cookie_string);
@@ -78,14 +78,15 @@
kLocalStorageInfoViewBorderSize, border_color);
set_border(border);
- views::Label* origin_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL));
+ views::Label* origin_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_ORIGIN_LABEL)));
origin_value_field_ = new views::Textfield;
- views::Label* size_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL));
+ views::Label* size_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_SIZE_ON_DISK_LABEL)));
size_value_field_ = new views::Textfield;
- views::Label* last_modified_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL));
+ views::Label* last_modified_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(
+ IDS_COOKIES_LOCAL_STORAGE_LAST_MODIFIED_LABEL)));
last_modified_value_field_ = new views::Textfield;
using views::GridLayout;
diff --git a/chrome/browser/ui/views/local_storage_set_item_info_view.cc b/chrome/browser/ui/views/local_storage_set_item_info_view.cc
index 8df4de4..24b2d75 100644
--- a/chrome/browser/ui/views/local_storage_set_item_info_view.cc
+++ b/chrome/browser/ui/views/local_storage_set_item_info_view.cc
@@ -47,7 +47,7 @@
void LocalStorageSetItemInfoView::ClearLocalStorageDisplay() {
std::wstring no_cookie_string =
- l10n_util::GetString(IDS_COOKIES_COOKIE_NONESELECTED);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_NONESELECTED));
host_value_field_->SetText(no_cookie_string);
key_value_field_->SetText(no_cookie_string);
value_value_field_->SetText(no_cookie_string);
@@ -73,14 +73,15 @@
set_border(border);
// TODO(jorlow): These strings are not quite right, but we're post-freeze.
- views::Label* host_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_COOKIE_DOMAIN_LABEL));
+ // http://crbug.com/68688
+ views::Label* host_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_COOKIE_DOMAIN_LABEL)));
host_value_field_ = new views::Textfield;
- views::Label* key_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_KEY_LABEL));
+ views::Label* key_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_KEY_LABEL)));
key_value_field_ = new views::Textfield;
- views::Label* value_label = new views::Label(
- l10n_util::GetString(IDS_COOKIES_LOCAL_STORAGE_VALUE_LABEL));
+ views::Label* value_label = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_LOCAL_STORAGE_VALUE_LABEL)));
value_value_field_ = new views::Textfield;
using views::GridLayout;
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
index cd151bb..92f1cb8 100644
--- a/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.cc
@@ -48,7 +48,7 @@
ContentSettingsType content_type,
LocationBarView* parent,
Profile* profile)
- : LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL),
+ : ui::LinearAnimation(kMoveTimeMs, kFrameRateHz, NULL),
content_setting_image_model_(
ContentSettingImageModel::CreateContentSettingImageModel(
content_type)),
@@ -95,8 +95,8 @@
content_setting_image_model_->explanatory_string_id();
// Check if the animation is enabled and if the string for animation is
// available.
- if (!CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableBlockContentAnimation) || !animated_string_id)
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableBlockContentAnimation) || !animated_string_id)
return;
// Do not start animation if already in progress.
@@ -104,7 +104,7 @@
animation_in_progress_ = true;
// Initialize animated string. It will be cleared when animation is
// completed.
- animated_text_ = l10n_util::GetString(animated_string_id);
+ animated_text_ = l10n_util::GetStringUTF16(animated_string_id);
text_size_ = ResourceBundle::GetSharedInstance().GetFont(
ResourceBundle::MediumFont).GetStringWidth(animated_text_);
text_size_ += 2 * kTextMarginPixels + kIconLeftMargin;
@@ -183,7 +183,7 @@
if (animation_in_progress_) {
// Paint text to the right of the icon.
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- canvas->DrawStringInt(animated_text_,
+ canvas->DrawStringInt(UTF16ToWideHack(animated_text_),
rb.GetFont(ResourceBundle::MediumFont), SK_ColorBLACK,
GetImageBounds().right() + kTextMarginPixels, y(),
width() - GetImageBounds().width(), height(),
diff --git a/chrome/browser/ui/views/location_bar/content_setting_image_view.h b/chrome/browser/ui/views/location_bar/content_setting_image_view.h
index 297aadb..3281a38 100644
--- a/chrome/browser/ui/views/location_bar/content_setting_image_view.h
+++ b/chrome/browser/ui/views/location_bar/content_setting_image_view.h
@@ -6,10 +6,11 @@
#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_CONTENT_SETTING_IMAGE_VIEW_H_
#pragma once
-#include "app/linear_animation.h"
#include "base/scoped_ptr.h"
+#include "base/string16.h"
#include "chrome/browser/views/info_bubble.h"
#include "chrome/common/content_settings_types.h"
+#include "ui/base/animation/linear_animation.h"
#include "views/controls/image_view.h"
class ContentSettingImageModel;
@@ -24,7 +25,7 @@
class ContentSettingImageView : public views::ImageView,
public InfoBubbleDelegate,
- public LinearAnimation {
+ public ui::LinearAnimation {
public:
ContentSettingImageView(ContentSettingsType content_type,
LocationBarView* parent,
@@ -53,7 +54,7 @@
virtual bool CloseOnEscape();
virtual bool FadeInOnShow() { return false; }
- // LinearAnimation override:
+ // ui::LinearAnimation override:
virtual void AnimateToState(double state);
scoped_ptr<ContentSettingImageModel> content_setting_image_model_;
@@ -67,7 +68,7 @@
// The currently shown info bubble if any.
InfoBubble* info_bubble_;
- std::wstring animated_text_;
+ string16 animated_text_;
bool animation_in_progress_;
int text_size_;
int visible_text_size_;
diff --git a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
index 5d9192f..7b757e8 100644
--- a/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
+++ b/chrome/browser/ui/views/location_bar/keyword_hint_view.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search_engines/template_url_model.h"
@@ -61,8 +62,12 @@
GetKeywordShortName(keyword, &is_extension_keyword);
int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_HINT : IDS_OMNIBOX_KEYWORD_HINT;
- const std::wstring keyword_hint(l10n_util::GetStringF(
- message_id, std::wstring(), short_name, &content_param_offsets));
+ const std::wstring keyword_hint =
+ UTF16ToWide(l10n_util::GetStringFUTF16(
+ message_id,
+ string16(),
+ WideToUTF16(short_name),
+ &content_param_offsets));
if (content_param_offsets.size() == 2) {
leading_label_->SetText(
keyword_hint.substr(0, content_param_offsets.front()));
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 7915916..b5dad74 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -162,30 +162,16 @@
GetWidget()->GetNativeView(), profile_, command_updater_,
mode_ == POPUP, this));
#else
- location_entry_.reset(new AutocompleteEditViewGtk(this, model_, profile_,
- command_updater_, mode_ == POPUP, this));
- location_entry_->Init();
- // Make all the children of the widget visible. NOTE: this won't display
- // anything, it just toggles the visible flag.
- gtk_widget_show_all(location_entry_->GetNativeView());
- // Hide the widget. NativeViewHostGtk will make it visible again as
- // necessary.
- gtk_widget_hide(location_entry_->GetNativeView());
-
- // Associate an accessible name with the location entry.
- accessible_widget_helper_.reset(new AccessibleWidgetHelper(
- location_entry_->text_view(), profile_));
- accessible_widget_helper_->SetWidgetName(
- location_entry_->text_view(),
- l10n_util::GetStringUTF8(IDS_ACCNAME_LOCATION));
+ location_entry_.reset(
+ AutocompleteEditViewGtk::Create(
+ this, model_, profile_,
+ command_updater_, mode_ == POPUP, this));
#endif
- location_entry_view_ = new views::NativeViewHost;
+
+ location_entry_view_ = location_entry_->AddToView(this);
location_entry_view_->SetID(VIEW_ID_AUTOCOMPLETE);
- AddChildView(location_entry_view_);
- location_entry_view_->set_focus_view(this);
- location_entry_view_->Attach(location_entry_->GetNativeView());
location_entry_view_->SetAccessibleName(
- l10n_util::GetString(IDS_ACCNAME_LOCATION));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION)));
selected_keyword_view_ = new SelectedKeywordView(
kSelectedKeywordBackgroundImages, IDR_KEYWORD_SEARCH_MAGNIFIER,
@@ -221,7 +207,8 @@
// AutocompleteEditView to close its popup.
SetNotifyWhenVisibleBoundsInRootChanges(true);
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_LOCATION));
+ SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_LOCATION)));
// Initialize the location entry. We do this to avoid a black flash which is
// visible when the location entry has just been initialized.
@@ -784,17 +771,13 @@
InstantController* instant = delegate_->GetInstant();
if (!instant)
return false;
-
+ std::wstring suggestion;
#if defined(OS_WIN)
if (!HasValidSuggestText())
return false;
- location_entry_->model()->FinalizeInstantQuery(
- typed_text,
- suggested_text_view_->GetText());
- return true;
-#else
- return location_entry_->CommitInstantSuggestion();
+ suggestion = suggested_text_view_->GetText();
#endif
+ return location_entry_->CommitInstantSuggestion(typed_text, suggestion);
}
bool LocationBarView::AcceptCurrentInstantPreview() {
@@ -845,7 +828,8 @@
}
}
- if (delegate_->GetInstant())
+ if (delegate_->GetInstant() &&
+ !location_entry_->model()->popup_model()->IsOpen())
delegate_->GetInstant()->DestroyPreviewContents();
update_instant_ = true;
@@ -1169,7 +1153,7 @@
Layout();
SchedulePaint();
#else
- location_entry_->SetInstantSuggestion(UTF16ToUTF8(input));
+ location_entry_->SetInstantSuggestion(input);
#endif
}
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.h b/chrome/browser/ui/views/location_bar/location_bar_view.h
index 317bd78..1ffa5b1 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.h
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.h
@@ -25,9 +25,8 @@
#if defined(OS_WIN)
#include "chrome/browser/autocomplete/autocomplete_edit_view_win.h"
-#else
+#elif defined(OS_LINUX)
#include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
-#include "chrome/browser/gtk/accessible_widget_helper_gtk.h"
#endif
class CommandUpdater;
@@ -330,7 +329,7 @@
#if defined(OS_WIN)
scoped_ptr<AutocompleteEditViewWin> location_entry_;
#else
- scoped_ptr<AutocompleteEditViewGtk> location_entry_;
+ scoped_ptr<AutocompleteEditView> location_entry_;
#endif
// The CommandUpdater for the Browser object that corresponds to this View.
@@ -364,8 +363,8 @@
// A bubble displayed for EV HTTPS sites.
EVBubbleView* ev_bubble_view_;
- // Location_entry view wrapper
- views::NativeViewHost* location_entry_view_;
+ // Location_entry view
+ views::View* location_entry_view_;
// The following views are used to provide hints and remind the user as to
// what is going in the edit. They are all added a children of the
@@ -409,10 +408,6 @@
// crash.
TemplateURLModel* template_url_model_;
-#if defined(OS_LINUX)
- scoped_ptr<AccessibleWidgetHelper> accessible_widget_helper_;
-#endif
-
// Should instant be updated? This is set to false in OnAutocompleteWillAccept
// and true in OnAutocompleteAccept. This is needed as prior to accepting an
// autocomplete suggestion the model is reverted which triggers resetting
diff --git a/chrome/browser/ui/views/location_bar/page_action_image_view.cc b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
index 0b0bf35..3483095 100644
--- a/chrome/browser/ui/views/location_bar/page_action_image_view.cc
+++ b/chrome/browser/ui/views/location_bar/page_action_image_view.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -83,13 +83,16 @@
View::ConvertPointToScreen(this, &origin);
screen_bounds.set_origin(origin);
+ BubbleBorder::ArrowLocation arrow_location = base::i18n::IsRTL() ?
+ BubbleBorder::TOP_LEFT : BubbleBorder::TOP_RIGHT;
+
popup_ = ExtensionPopup::Show(
page_action_->GetPopupUrl(current_tab_id_),
browser,
browser->profile(),
browser->window()->GetNativeHandle(),
screen_bounds,
- BubbleBorder::TOP_RIGHT,
+ arrow_location,
true, // Activate the popup window.
inspect_with_devtools,
ExtensionPopup::BUBBLE_CHROME,
diff --git a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
index 69b639c..bf133b9 100644
--- a/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
+++ b/chrome/browser/ui/views/location_bar/selected_keyword_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/search_engines/template_url_model.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/omnibox/location_bar_util.h"
@@ -58,14 +59,16 @@
return;
bool is_extension_keyword;
- const std::wstring short_name = profile_->GetTemplateURLModel()->
- GetKeywordShortName(keyword, &is_extension_keyword);
+ const string16 short_name = WideToUTF16(profile_->GetTemplateURLModel()->
+ GetKeywordShortName(keyword, &is_extension_keyword));
int message_id = is_extension_keyword ?
IDS_OMNIBOX_EXTENSION_KEYWORD_TEXT : IDS_OMNIBOX_KEYWORD_TEXT;
- full_label_.SetText(l10n_util::GetStringF(message_id, short_name));
+ full_label_.SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16(message_id, short_name)));
const std::wstring min_string(
- location_bar_util::CalculateMinString(short_name));
+ location_bar_util::CalculateMinString(UTF16ToWide(short_name)));
partial_label_.SetText(min_string.empty() ?
full_label_.GetText() :
- l10n_util::GetStringF(message_id, min_string));
+ UTF16ToWide(l10n_util::GetStringFUTF16(message_id,
+ WideToUTF16(min_string))));
}
diff --git a/chrome/browser/ui/views/location_bar/star_view.cc b/chrome/browser/ui/views/location_bar/star_view.cc
index 95de4c0..f806037 100644
--- a/chrome/browser/ui/views/location_bar/star_view.cc
+++ b/chrome/browser/ui/views/location_bar/star_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/command_updater.h"
#include "chrome/browser/ui/view_ids.h"
@@ -24,12 +25,12 @@
}
void StarView::SetToggled(bool on) {
- SetTooltipText(l10n_util::GetString(
- on ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR));
+ SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16(
+ on ? IDS_TOOLTIP_STARRED : IDS_TOOLTIP_STAR)));
// Since StarView is an ImageView, the SetTooltipText changes the accessible
// name. To keep the accessible name unchanged, we need to set the accessible
// name right after we modify the tooltip text for this view.
- SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_STAR));
+ SetAccessibleName(UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_STAR)));
SetImage(ResourceBundle::GetSharedInstance().GetBitmapNamed(
on ? IDR_STAR_LIT : IDR_STAR));
}
diff --git a/chrome/browser/ui/views/location_bar/suggested_text_view.cc b/chrome/browser/ui/views/location_bar/suggested_text_view.cc
index 4c0d208..6da1a7b 100644
--- a/chrome/browser/ui/views/location_bar/suggested_text_view.cc
+++ b/chrome/browser/ui/views/location_bar/suggested_text_view.cc
@@ -4,11 +4,11 @@
#include "chrome/browser/ui/views/location_bar/suggested_text_view.h"
-#include "app/multi_animation.h"
#include "chrome/browser/instant/instant_controller.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "gfx/canvas.h"
#include "gfx/color_utils.h"
+#include "ui/base/animation/multi_animation.h"
SuggestedTextView::SuggestedTextView(LocationBarView* location_bar)
: location_bar_(location_bar),
@@ -49,11 +49,11 @@
canvas->FillRectInt(bg_color_, 0, 2, width(), height() - 5);
}
-void SuggestedTextView::AnimationEnded(const Animation* animation) {
+void SuggestedTextView::AnimationEnded(const ui::Animation* animation) {
location_bar_->OnCommitSuggestedText();
}
-void SuggestedTextView::AnimationProgressed(const Animation* animation) {
+void SuggestedTextView::AnimationProgressed(const ui::Animation* animation) {
UpdateBackgroundColor();
SkColor fg_color = LocationBarView::GetColor(
@@ -62,21 +62,21 @@
ToolbarModel::NONE, LocationBarView::SELECTED_TEXT);
SetColor(color_utils::AlphaBlend(
sel_fg_color, fg_color,
- Tween::ValueBetween(animation->GetCurrentValue(), 0, 255)));
+ ui::Tween::ValueBetween(animation->GetCurrentValue(), 0, 255)));
SchedulePaint();
}
-void SuggestedTextView::AnimationCanceled(const Animation* animation) {
+void SuggestedTextView::AnimationCanceled(const ui::Animation* animation) {
}
-Animation* SuggestedTextView::CreateAnimation() {
- MultiAnimation::Parts parts;
- parts.push_back(MultiAnimation::Part(
- InstantController::kAutoCommitPauseTimeMS, Tween::ZERO));
- parts.push_back(MultiAnimation::Part(
- InstantController::kAutoCommitFadeInTimeMS, Tween::EASE_IN));
- MultiAnimation* animation = new MultiAnimation(parts);
+ui::Animation* SuggestedTextView::CreateAnimation() {
+ ui::MultiAnimation::Parts parts;
+ parts.push_back(ui::MultiAnimation::Part(
+ InstantController::kAutoCommitPauseTimeMS, ui::Tween::ZERO));
+ parts.push_back(ui::MultiAnimation::Part(
+ InstantController::kAutoCommitFadeInTimeMS, ui::Tween::EASE_IN));
+ ui::MultiAnimation* animation = new ui::MultiAnimation(parts);
animation->set_delegate(this);
animation->set_continuous(false);
return animation;
@@ -99,5 +99,5 @@
SkColor s_color = SK_ColorLTGRAY;
#endif
bg_color_ = color_utils::AlphaBlend(s_color, bg_color,
- Tween::ValueBetween(value, 0, 255));
+ ui::Tween::ValueBetween(value, 0, 255));
}
diff --git a/chrome/browser/ui/views/location_bar/suggested_text_view.h b/chrome/browser/ui/views/location_bar/suggested_text_view.h
index 688346f..893901a 100644
--- a/chrome/browser/ui/views/location_bar/suggested_text_view.h
+++ b/chrome/browser/ui/views/location_bar/suggested_text_view.h
@@ -6,7 +6,7 @@
#define CHROME_BROWSER_UI_VIEWS_LOCATION_BAR_SUGGESTED_TEXT_VIEW_H_
#pragma once
-#include "app/animation_delegate.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/controls/label.h"
class LocationBarView;
@@ -15,7 +15,7 @@
// Invoke |StartAnimation| to start an animation that when done invokes
// |OnCommitSuggestedText| on the LocationBar to commit the suggested text.
class SuggestedTextView : public views::Label,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit SuggestedTextView(LocationBarView* location_bar);
virtual ~SuggestedTextView();
@@ -33,20 +33,20 @@
virtual void PaintBackground(gfx::Canvas* canvas);
// AnimationDelegate overrides:
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
private:
// Creates the animation to use.
- Animation* CreateAnimation();
+ ui::Animation* CreateAnimation();
// Resets the background color.
void UpdateBackgroundColor();
LocationBarView* location_bar_;
- scoped_ptr<Animation> animation_;
+ scoped_ptr<ui::Animation> animation_;
SkColor bg_color_;
diff --git a/chrome/browser/ui/views/login_view.cc b/chrome/browser/ui/views/login_view.cc
index 3bf2403..a7e4e40 100644
--- a/chrome/browser/ui/views/login_view.cc
+++ b/chrome/browser/ui/views/login_view.cc
@@ -9,6 +9,7 @@
#include "app/l10n_util.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
+#include "base/utf_string_conversions.h"
#include "grit/generated_resources.h"
#include "views/grid_layout.h"
#include "views/controls/label.h"
@@ -28,10 +29,10 @@
bool focus_view)
: username_field_(new views::Textfield),
password_field_(new views::Textfield(views::Textfield::STYLE_PASSWORD)),
- username_label_(new views::Label(
- l10n_util::GetString(IDS_LOGIN_DIALOG_USERNAME_FIELD))),
- password_label_(new views::Label(
- l10n_util::GetString(IDS_LOGIN_DIALOG_PASSWORD_FIELD))),
+ username_label_(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_USERNAME_FIELD)))),
+ password_label_(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_PASSWORD_FIELD)))),
message_label_(new views::Label(explanation)),
ALLOW_THIS_IN_INITIALIZER_LIST(focus_grabber_factory_(this)),
login_model_(NULL),
diff --git a/chrome/browser/ui/views/notifications/balloon_view.cc b/chrome/browser/ui/views/notifications/balloon_view.cc
index 034e0a0..43ed162 100644
--- a/chrome/browser/ui/views/notifications/balloon_view.cc
+++ b/chrome/browser/ui/views/notifications/balloon_view.cc
@@ -8,7 +8,6 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "base/message_loop.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/notifications/balloon.h"
@@ -29,6 +28,7 @@
#include "gfx/native_widget_types.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/button/button.h"
#include "views/controls/button/image_button.h"
#include "views/controls/button/text_button.h"
@@ -213,7 +213,7 @@
balloon_->GetPosition().x(), balloon_->GetPosition().y(),
GetTotalWidth(), GetTotalHeight());
frame_container_->GetBounds(&anim_frame_start_, false);
- animation_.reset(new SlideAnimation(this));
+ animation_.reset(new ui::SlideAnimation(this));
animation_->Show();
}
@@ -224,7 +224,7 @@
balloon_->notification().content_url());
}
-void BalloonViewImpl::AnimationProgressed(const Animation* animation) {
+void BalloonViewImpl::AnimationProgressed(const ui::Animation* animation) {
DCHECK(animation == animation_.get());
// Linear interpolation from start to end position.
@@ -299,8 +299,8 @@
options_menu_button_ = new views::MenuButton(NULL, L"", this, false);
AddChildView(options_menu_button_);
close_button_ = new views::ImageButton(this);
- close_button_->SetTooltipText(l10n_util::GetString(
- IDS_NOTIFICATION_BALLOON_DISMISS_LABEL));
+ close_button_->SetTooltipText(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_NOTIFICATION_BALLOON_DISMISS_LABEL)));
AddChildView(close_button_);
// We have to create two windows: one for the contents and one for the
diff --git a/chrome/browser/ui/views/notifications/balloon_view.h b/chrome/browser/ui/views/notifications/balloon_view.h
index c069a0a..a551f5a 100644
--- a/chrome/browser/ui/views/notifications/balloon_view.h
+++ b/chrome/browser/ui/views/notifications/balloon_view.h
@@ -8,7 +8,6 @@
#define CHROME_BROWSER_UI_VIEWS_NOTIFICATIONS_BALLOON_VIEW_H_
#pragma once
-#include "app/animation_delegate.h"
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
@@ -19,6 +18,7 @@
#include "gfx/point.h"
#include "gfx/rect.h"
#include "gfx/size.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/label.h"
#include "views/controls/menu/view_menu_delegate.h"
@@ -38,7 +38,10 @@
class NotificationDetails;
class NotificationOptionsMenuModel;
class NotificationSource;
+
+namespace ui {
class SlideAnimation;
+}
// A balloon view is the UI component for a desktop notification toasts.
// It draws a border, and within the border an HTML renderer.
@@ -48,7 +51,7 @@
public views::WidgetDelegate,
public views::ButtonListener,
public NotificationObserver,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
explicit BalloonViewImpl(BalloonCollection* collection);
~BalloonViewImpl();
@@ -83,8 +86,8 @@
const NotificationSource& source,
const NotificationDetails& details);
- // AnimationDelegate interface.
- virtual void AnimationProgressed(const Animation* animation);
+ // ui::AnimationDelegate interface.
+ virtual void AnimationProgressed(const ui::Animation* animation);
// Launches the options menu at screen coordinates |pt|.
void RunOptionsMenu(const gfx::Point& pt);
@@ -152,7 +155,7 @@
views::Label* source_label_;
// An animation to move the balloon on the screen as its position changes.
- scoped_ptr<SlideAnimation> animation_;
+ scoped_ptr<ui::SlideAnimation> animation_;
gfx::Rect anim_frame_start_;
gfx::Rect anim_frame_end_;
diff --git a/chrome/browser/ui/views/options/advanced_contents_view.cc b/chrome/browser/ui/views/options/advanced_contents_view.cc
index e6588aa..6314525 100644
--- a/chrome/browser/ui/views/options/advanced_contents_view.cc
+++ b/chrome/browser/ui/views/options/advanced_contents_view.cc
@@ -20,7 +20,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/scoped_callback_factory.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
@@ -477,8 +477,8 @@
enable_safe_browsing_checkbox_(NULL),
reporting_enabled_checkbox_(NULL),
learn_more_link_(NULL),
- AdvancedSection(profile,
- l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY)) {
+ AdvancedSection(profile, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_PRIVACY))) {
}
void PrivacySection::ButtonPressed(
@@ -548,31 +548,38 @@
AdvancedSection::InitControlLayout();
content_settings_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CONTENT_SETTINGS_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_PRIVACY_CONTENT_SETTINGS_BUTTON)));
clear_data_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_PRIVACY_CLEAR_DATA_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_PRIVACY_CLEAR_DATA_BUTTON)));
section_description_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_DISABLE_SERVICES));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_DISABLE_SERVICES)));
enable_link_doctor_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_LINKDOCTOR_PREF));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_LINKDOCTOR_PREF)));
enable_link_doctor_checkbox_->set_listener(this);
enable_suggest_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_SUGGEST_PREF));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SUGGEST_PREF)));
enable_suggest_checkbox_->set_listener(this);
enable_dns_prefetching_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_NETWORK_DNS_PREFETCH_ENABLED_DESCRIPTION));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_NETWORK_DNS_PREFETCH_ENABLED_DESCRIPTION)));
enable_dns_prefetching_checkbox_->set_listener(this);
enable_safe_browsing_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SAFEBROWSING_ENABLEPROTECTION)));
enable_safe_browsing_checkbox_->set_listener(this);
#if defined(GOOGLE_CHROME_BUILD)
reporting_enabled_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_ENABLE_LOGGING));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_LOGGING)));
reporting_enabled_checkbox_->SetMultiLine(true);
reporting_enabled_checkbox_->set_listener(this);
reporting_enabled_checkbox_->SetVisible(true);
#endif
- learn_more_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE));
+ learn_more_link_ = new views::Link(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE)));
learn_more_link_->SetController(this);
GridLayout* layout = new GridLayout(contents_);
@@ -702,8 +709,8 @@
change_content_fonts_button_(NULL),
gears_label_(NULL),
gears_settings_button_(NULL),
- AdvancedSection(profile,
- l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT)) {
+ AdvancedSection(profile, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_CONTENT))) {
}
void WebContentSection::ButtonPressed(
@@ -723,26 +730,28 @@
AdvancedSection::InitControlLayout();
if (!base::i18n::IsRTL()) {
- gears_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME));
+ gears_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME)));
} else {
// Add an RTL mark so that
// ":" in "Google Gears:" in Hebrew Chrome is displayed left-most.
- std::wstring gearssetting_group_name =
- l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME);
+ std::wstring gearssetting_group_name = UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_GEARSSETTINGS_GROUP_NAME));
gearssetting_group_name.push_back(
static_cast<wchar_t>(base::i18n::kRightToLeftMark));
gears_label_ = new views::Label(gearssetting_group_name);
}
gears_settings_button_ = new views::NativeButton(
this,
- l10n_util::GetString(IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_GEARSSETTINGS_CONFIGUREGEARS_BUTTON)));
fonts_and_languages_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_FONTSETTINGS_INFO));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_FONTSETTINGS_INFO)));
change_content_fonts_button_ = new views::NativeButton(
this,
- l10n_util::GetString(IDS_OPTIONS_FONTSETTINGS_CONFIGUREFONTS_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_FONTSETTINGS_CONFIGUREFONTS_BUTTON)));
GridLayout* layout = new GridLayout(contents_);
contents_->SetLayoutManager(layout);
@@ -803,8 +812,8 @@
check_for_cert_revocation_checkbox_(NULL),
manage_certificates_label_(NULL),
manage_certificates_button_(NULL),
- AdvancedSection(profile,
- l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY)) {
+ AdvancedSection(profile, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_SECURITY))) {
}
void SecuritySection::ButtonPressed(
@@ -847,21 +856,23 @@
void SecuritySection::InitControlLayout() {
AdvancedSection::InitControlLayout();
- ssl_info_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_SSL_GROUP_DESCRIPTION));
+ ssl_info_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_SSL_GROUP_DESCRIPTION)));
enable_ssl3_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_SSL_USESSL3));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SSL_USESSL3)));
enable_ssl3_checkbox_->set_listener(this);
enable_tls1_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_SSL_USETLS1));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SSL_USETLS1)));
enable_tls1_checkbox_->set_listener(this);
check_for_cert_revocation_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_SSL_CHECKREVOCATION));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_SSL_CHECKREVOCATION)));
check_for_cert_revocation_checkbox_->set_listener(this);
manage_certificates_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_CERTIFICATES_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_CERTIFICATES_LABEL)));
manage_certificates_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON));
+ this,
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_CERTIFICATES_MANAGE_BUTTON)));
GridLayout* layout = new GridLayout(contents_);
contents_->SetLayoutManager(layout);
@@ -975,8 +986,8 @@
NetworkSection::NetworkSection(Profile* profile)
: change_proxies_label_(NULL),
change_proxies_button_(NULL),
- AdvancedSection(profile,
- l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK)) {
+ AdvancedSection(profile, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_NETWORK))) {
}
void NetworkSection::ButtonPressed(
@@ -993,9 +1004,10 @@
AdvancedSection::InitControlLayout();
change_proxies_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_PROXIES_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_LABEL)));
change_proxies_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON));
+ this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_PROXIES_CONFIGURE_BUTTON)));
GridLayout* layout = new GridLayout(contents_);
contents_->SetLayoutManager(layout);
@@ -1086,15 +1098,15 @@
select_file_dialog_(SelectFileDialog::Create(this))),
reset_file_handlers_label_(NULL),
reset_file_handlers_button_(NULL),
- AdvancedSection(profile,
- l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_GROUP_NAME)) {
+ AdvancedSection(profile, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_DOWNLOADLOCATION_GROUP_NAME))) {
}
void DownloadSection::ButtonPressed(
views::Button* sender, const views::Event& event) {
if (sender == download_browse_button_) {
- const std::wstring dialog_title =
- l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE);
+ const std::wstring dialog_title = UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE));
select_file_dialog_->SelectFile(SelectFileDialog::SELECT_FOLDER,
dialog_title,
profile()->GetPrefs()->GetFilePath(
@@ -1140,20 +1152,25 @@
AdvancedSection::InitControlLayout();
// Layout the download components.
- download_file_location_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE));
+ download_file_location_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_TITLE)));
download_default_download_location_display_ = new FileDisplayArea;
download_browse_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_DOWNLOADLOCATION_BROWSE_BUTTON)));
download_ask_for_save_location_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_DOWNLOADLOCATION_ASKFORSAVELOCATION)));
download_ask_for_save_location_checkbox_->set_listener(this);
download_ask_for_save_location_checkbox_->SetMultiLine(true);
reset_file_handlers_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_AUTOOPENFILETYPES_INFO));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_AUTOOPENFILETYPES_INFO)));
reset_file_handlers_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_AUTOOPENFILETYPES_RESETTODEFAULT)));
GridLayout* layout = new GridLayout(contents_);
contents_->SetLayoutManager(layout);
@@ -1252,8 +1269,8 @@
TranslateSection::TranslateSection(Profile* profile)
: enable_translate_checkbox_(NULL),
- AdvancedSection(profile,
- l10n_util::GetString(IDS_OPTIONS_ADVANCED_SECTION_TITLE_TRANSLATE)) {
+ AdvancedSection(profile, UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_TRANSLATE))) {
}
void TranslateSection::ButtonPressed(
@@ -1275,8 +1292,8 @@
AddIndentedColumnSet(layout, 0);
- enable_translate_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE));
+ enable_translate_checkbox_ = new views::Checkbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_TRANSLATE_ENABLE_TRANSLATE)));
enable_translate_checkbox_->set_listener(this);
AddWrappingCheckboxRow(layout, enable_translate_checkbox_, 0, false);
@@ -1332,8 +1349,8 @@
manage_printer_button_(NULL),
factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
AdvancedSection(profile,
- l10n_util::GetString(
- IDS_OPTIONS_ADVANCED_SECTION_TITLE_CLOUD_PRINT)) {
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_ADVANCED_SECTION_TITLE_CLOUD_PRINT))) {
}
void CloudPrintProxySection::ButtonPressed(views::Button* sender,
@@ -1350,8 +1367,8 @@
// We open a new browser window so the Options dialog doesn't
// get lost behind other windows.
enable_disable_button_->SetEnabled(false);
- enable_disable_button_->SetLabel(
- l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLING_BUTTON));
+ enable_disable_button_->SetLabel(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLING_BUTTON)));
enable_disable_button_->InvalidateLayout();
Layout();
CloudPrintSetupFlow::OpenDialog(profile(), this,
@@ -1372,8 +1389,8 @@
// If the dialog is canceled, the preference won't change, and so we
// have to revert the button text back to the disabled state.
if (!Enabled()) {
- enable_disable_button_->SetLabel(
- l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON));
+ enable_disable_button_->SetLabel(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON)));
enable_disable_button_->InvalidateLayout();
Layout();
}
@@ -1383,12 +1400,14 @@
AdvancedSection::InitControlLayout();
section_description_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL)));
enable_disable_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON)));
manage_printer_button_ = new views::NativeButton(this,
- l10n_util::GetString(
- IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_MANAGE_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_MANAGE_BUTTON)));
GridLayout* layout = new GridLayout(contents_);
contents_->SetLayoutManager(layout);
@@ -1430,19 +1449,20 @@
if (profile()->GetPrefs()->HasPrefPath(prefs::kCloudPrintEmail))
email = profile()->GetPrefs()->GetString(prefs::kCloudPrintEmail);
- section_description_label_->SetText(
- l10n_util::GetStringF(IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_LABEL,
- UTF8ToWide(email)));
- enable_disable_button_->SetLabel(
- l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_BUTTON));
+ section_description_label_->SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_LABEL,
+ UTF8ToUTF16(email))));
+ enable_disable_button_->SetLabel(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_ENABLED_BUTTON)));
enable_disable_button_->InvalidateLayout();
manage_printer_button_->SetVisible(true);
manage_printer_button_->InvalidateLayout();
} else {
- section_description_label_->SetText(
- l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL));
- enable_disable_button_->SetLabel(
- l10n_util::GetString(IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON));
+ section_description_label_->SetText(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_LABEL)));
+ enable_disable_button_->SetLabel(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_CLOUD_PRINT_PROXY_DISABLED_BUTTON)));
enable_disable_button_->InvalidateLayout();
manage_printer_button_->SetVisible(false);
}
diff --git a/chrome/browser/ui/views/options/advanced_page_view.cc b/chrome/browser/ui/views/options/advanced_page_view.cc
index 287c124..62f8660 100644
--- a/chrome/browser/ui/views/options/advanced_page_view.cc
+++ b/chrome/browser/ui/views/options/advanced_page_view.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
#include "base/string_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/options/options_util.h"
#include "chrome/browser/ui/views/options/advanced_contents_view.h"
@@ -40,9 +41,11 @@
MessageBoxFlags::DialogButton button) const {
switch (button) {
case MessageBoxFlags::DIALOGBUTTON_OK:
- return l10n_util::GetString(IDS_OPTIONS_RESET_OKLABEL);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_OKLABEL));
case MessageBoxFlags::DIALOGBUTTON_CANCEL:
- return l10n_util::GetString(IDS_OPTIONS_RESET_CANCELLABEL);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_CANCELLABEL));
default:
break;
}
@@ -50,7 +53,7 @@
return std::wstring();
}
virtual std::wstring GetWindowTitle() const {
- return l10n_util::GetString(IDS_PRODUCT_NAME);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
}
virtual bool Accept() {
advanced_page_view_->ResetToDefaults();
@@ -69,7 +72,8 @@
// Also deleted when the window closes.
message_box_view_ = new MessageBoxView(
MessageBoxFlags::kFlagHasMessage | MessageBoxFlags::kFlagHasOKButton,
- l10n_util::GetString(IDS_OPTIONS_RESET_MESSAGE).c_str(),
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_RESET_MESSAGE)).c_str(),
std::wstring(),
dialog_width);
views::Window::CreateChromeWindow(parent_hwnd, gfx::Rect(), this)->Show();
@@ -118,7 +122,7 @@
void AdvancedPageView::InitControlLayout() {
reset_to_default_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_RESET));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_RESET)));
advanced_scroll_view_ = new AdvancedScrollViewContainer(profile());
using views::GridLayout;
diff --git a/chrome/browser/ui/views/options/content_filter_page_view.cc b/chrome/browser/ui/views/options/content_filter_page_view.cc
index 3e4ba8d..919ccbb 100644
--- a/chrome/browser/ui/views/options/content_filter_page_view.cc
+++ b/chrome/browser/ui/views/options/content_filter_page_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/command_line.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/content_settings/content_settings_details.h"
#include "chrome/browser/geolocation/geolocation_content_settings_map.h"
#include "chrome/browser/geolocation/geolocation_exceptions_table_model.h"
@@ -66,7 +67,7 @@
COMPILE_ASSERT(arraysize(kTitleIDs) == CONTENT_SETTINGS_NUM_TYPES,
Need_a_setting_for_every_content_settings_type);
views::Label* title_label = new views::Label(
- l10n_util::GetString(kTitleIDs[content_type_]));
+ UTF16ToWide(l10n_util::GetStringUTF16(kTitleIDs[content_type_])));
title_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
title_label->SetMultiLine(true);
@@ -87,7 +88,8 @@
Need_a_setting_for_every_content_settings_type);
const int radio_button_group = 0;
allow_radio_ = new views::RadioButton(
- l10n_util::GetString(kAllowIDs[content_type_]), radio_button_group);
+ UTF16ToWide(l10n_util::GetStringUTF16(kAllowIDs[content_type_])),
+ radio_button_group);
allow_radio_->set_listener(this);
allow_radio_->SetMultiLine(true);
layout->StartRow(0, single_column_set_id);
@@ -114,7 +116,7 @@
}
if (askID != 0) {
ask_radio_ = new views::RadioButton(
- l10n_util::GetString(askID), radio_button_group);
+ UTF16ToWide(l10n_util::GetStringUTF16(askID)), radio_button_group);
ask_radio_->set_listener(this);
ask_radio_->SetMultiLine(true);
layout->StartRow(0, single_column_set_id);
@@ -135,7 +137,8 @@
COMPILE_ASSERT(arraysize(kBlockIDs) == CONTENT_SETTINGS_NUM_TYPES,
Need_a_setting_for_every_content_settings_type);
block_radio_ = new views::RadioButton(
- l10n_util::GetString(kBlockIDs[content_type_]), radio_button_group);
+ UTF16ToWide(l10n_util::GetStringUTF16(kBlockIDs[content_type_])),
+ radio_button_group);
block_radio_->set_listener(this);
block_radio_->SetMultiLine(true);
layout->StartRow(0, single_column_set_id);
@@ -143,7 +146,7 @@
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
exceptions_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_COOKIES_EXCEPTIONS_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_EXCEPTIONS_BUTTON)));
layout->StartRow(0, single_column_set_id);
layout->AddView(exceptions_button_, 1, 1, GridLayout::LEADING,
diff --git a/chrome/browser/ui/views/options/content_page_view.cc b/chrome/browser/ui/views/options/content_page_view.cc
index 5118834..7bdba35 100644
--- a/chrome/browser/ui/views/options/content_page_view.cc
+++ b/chrome/browser/ui/views/options/content_page_view.cc
@@ -128,11 +128,14 @@
ConfirmMessageBoxDialog::RunWithCustomConfiguration(
GetWindow()->GetNativeWindow(),
this,
- l10n_util::GetStringF(IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL,
- l10n_util::GetString(IDS_PRODUCT_NAME)),
- l10n_util::GetString(IDS_SYNC_STOP_SYNCING_DIALOG_TITLE),
- l10n_util::GetString(IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL),
- l10n_util::GetString(IDS_CANCEL),
+ UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_SYNC_STOP_SYNCING_EXPLANATION_LABEL,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_SYNC_STOP_SYNCING_DIALOG_TITLE)),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_SYNC_STOP_SYNCING_CONFIRM_BUTTON_LABEL)),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL)),
gfx::Size(views::Window::GetLocalizedContentsSize(
IDS_CONFIRM_STOP_SYNCING_DIALOG_WIDTH_CHARS,
IDS_CONFIRM_STOP_SYNCING_DIALOG_HEIGHT_LINES)));
@@ -276,17 +279,18 @@
void ContentPageView::InitPasswordSavingGroup() {
passwords_asktosave_radio_ = new views::RadioButton(
- l10n_util::GetString(IDS_OPTIONS_PASSWORDS_ASKTOSAVE),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_ASKTOSAVE)),
kPasswordSavingRadioGroup);
passwords_asktosave_radio_->set_listener(this);
passwords_asktosave_radio_->SetMultiLine(true);
passwords_neversave_radio_ = new views::RadioButton(
- l10n_util::GetString(IDS_OPTIONS_PASSWORDS_NEVERSAVE),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_NEVERSAVE)),
kPasswordSavingRadioGroup);
passwords_neversave_radio_->set_listener(this);
passwords_neversave_radio_->SetMultiLine(true);
show_passwords_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_SHOWPASSWORDS));
+ this, UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_SHOWPASSWORDS)));
using views::GridLayout;
using views::ColumnSet;
@@ -312,13 +316,15 @@
layout->AddView(show_passwords_button_);
passwords_group_ = new OptionsGroupView(
- contents, l10n_util::GetString(IDS_OPTIONS_PASSWORDS_GROUP_NAME), L"",
+ contents,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_PASSWORDS_GROUP_NAME)),
+ L"",
true);
}
void ContentPageView::InitFormAutofillGroup() {
change_autofill_settings_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_AUTOFILL_OPTIONS));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_AUTOFILL_OPTIONS)));
using views::GridLayout;
using views::ColumnSet;
@@ -340,15 +346,17 @@
layout->AddView(change_autofill_settings_button_);
form_autofill_group_ = new OptionsGroupView(
- contents, l10n_util::GetString(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME),
+ contents,
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_AUTOFILL_SETTING_WINDOWS_GROUP_NAME)),
L"", true);
}
void ContentPageView::InitThemesGroup() {
themes_reset_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_THEMES_RESET_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_THEMES_RESET_BUTTON)));
themes_gallery_link_ = new views::Link(
- l10n_util::GetString(IDS_THEMES_GALLERY_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_THEMES_GALLERY_BUTTON)));
themes_gallery_link_->SetController(this);
using views::GridLayout;
@@ -371,13 +379,13 @@
layout->AddView(themes_gallery_link_);
themes_group_ = new OptionsGroupView(
- contents, l10n_util::GetString(IDS_THEMES_GROUP_NAME),
+ contents, UTF16ToWide(l10n_util::GetStringUTF16(IDS_THEMES_GROUP_NAME)),
L"", false);
}
void ContentPageView::InitBrowsingDataGroup() {
import_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_OPTIONS_IMPORT_DATA_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_IMPORT_DATA_BUTTON)));
using views::GridLayout;
using views::ColumnSet;
@@ -395,7 +403,9 @@
layout->AddView(import_button_);
browsing_data_group_ = new OptionsGroupView(
- contents, l10n_util::GetString(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME),
+ contents,
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_BROWSING_DATA_GROUP_NAME)),
L"", true);
}
@@ -416,8 +426,8 @@
privacy_dashboard_link_ = new views::Link();
privacy_dashboard_link_->set_collapse_when_hidden(true);
privacy_dashboard_link_->SetController(this);
- privacy_dashboard_link_->SetText(
- l10n_util::GetString(IDS_SYNC_PRIVACY_DASHBOARD_LINK_LABEL));
+ privacy_dashboard_link_->SetText(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_SYNC_PRIVACY_DASHBOARD_LINK_LABEL)));
sync_start_stop_button_ = new views::NativeButton(this, std::wstring());
sync_customize_button_ = new views::NativeButton(this, std::wstring());
@@ -450,8 +460,10 @@
layout->StartRow(0, single_column_view_set_id);
layout->AddView(privacy_dashboard_link_, 3, 1);
- sync_group_ = new OptionsGroupView(contents,
- l10n_util::GetString(IDS_SYNC_OPTIONS_GROUP_NAME), std::wstring(), true);
+ sync_group_ = new OptionsGroupView(
+ contents,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_SYNC_OPTIONS_GROUP_NAME)),
+ std::wstring(), true);
}
void ContentPageView::UpdateSyncControls() {
@@ -459,25 +471,26 @@
std::wstring status_label;
std::wstring link_label;
std::wstring customize_button_label;
- std::wstring button_label;
+ string16 button_label;
bool managed = sync_service_->IsManaged();
bool sync_setup_completed = sync_service_->HasSyncSetupCompleted();
bool status_has_error = sync_ui_util::GetStatusLabels(sync_service_,
&status_label, &link_label) == sync_ui_util::SYNC_ERROR;
customize_button_label =
- l10n_util::GetString(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_SYNC_CUSTOMIZE_BUTTON_LABEL));
if (sync_setup_completed) {
- button_label = l10n_util::GetString(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL);
+ button_label =
+ l10n_util::GetStringUTF16(IDS_SYNC_STOP_SYNCING_BUTTON_LABEL);
} else if (sync_service_->SetupInProgress()) {
- button_label = l10n_util::GetString(IDS_SYNC_NTP_SETUP_IN_PROGRESS);
+ button_label = l10n_util::GetStringUTF16(IDS_SYNC_NTP_SETUP_IN_PROGRESS);
} else {
- button_label = l10n_util::GetString(IDS_SYNC_START_SYNC_BUTTON_LABEL);
+ button_label = l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL);
}
sync_status_label_->SetText(status_label);
sync_start_stop_button_->SetEnabled(
!sync_service_->WizardIsVisible() && !managed);
- sync_start_stop_button_->SetLabel(button_label);
+ sync_start_stop_button_->SetLabel(UTF16ToWide(button_label));
sync_customize_button_->SetLabel(customize_button_label);
sync_customize_button_->SetVisible(sync_setup_completed && !status_has_error);
sync_customize_button_->SetEnabled(!managed);
diff --git a/chrome/browser/ui/views/options/content_settings_window_view.cc b/chrome/browser/ui/views/options/content_settings_window_view.cc
index ef0e746..eeaca4e 100644
--- a/chrome/browser/ui/views/options/content_settings_window_view.cc
+++ b/chrome/browser/ui/views/options/content_settings_window_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "base/stl_util-inl.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/views/options/advanced_page_view.h"
@@ -87,7 +88,7 @@
// ContentSettingsWindowView, views::DialogDelegate implementation:
std::wstring ContentSettingsWindowView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_CONTENT_SETTINGS_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CONTENT_SETTINGS_TITLE));
}
void ContentSettingsWindowView::WindowClosing() {
diff --git a/chrome/browser/ui/views/options/cookie_filter_page_view.cc b/chrome/browser/ui/views/options/cookie_filter_page_view.cc
index 7b8db39..055a964 100644
--- a/chrome/browser/ui/views/options/cookie_filter_page_view.cc
+++ b/chrome/browser/ui/views/options/cookie_filter_page_view.cc
@@ -42,8 +42,8 @@
const int single_column_set_id = 0;
layout->AddPaddingRow(0, kUnrelatedControlLargeVerticalSpacing);
- block_3rdparty_check_ = new views::Checkbox(
- l10n_util::GetString(IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX));
+ block_3rdparty_check_ = new views::Checkbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX)));
block_3rdparty_check_->set_listener(this);
layout->StartRow(0, single_column_set_id);
@@ -55,8 +55,8 @@
block_3rdparty_check_->SetChecked(
profile()->GetHostContentSettingsMap()->BlockThirdPartyCookies());
- clear_on_close_check_ = new views::Checkbox(
- l10n_util::GetString(IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX));
+ clear_on_close_check_ = new views::Checkbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX)));
clear_on_close_check_->SetMultiLine(true);
clear_on_close_check_->set_listener(this);
@@ -65,7 +65,7 @@
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
show_cookies_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_COOKIES_SHOW_COOKIES_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_SHOW_COOKIES_BUTTON)));
layout->StartRow(0, single_column_set_id);
layout->AddView(show_cookies_button_, 1, 1, GridLayout::LEADING,
@@ -73,7 +73,7 @@
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
views::Link* flash_settings_link = new views::Link(
- l10n_util::GetString(IDS_FLASH_STORAGE_SETTINGS));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_FLASH_STORAGE_SETTINGS)));
flash_settings_link->SetController(this);
layout->StartRow(0, single_column_set_id);
@@ -119,6 +119,7 @@
// CookieFilterPageView, views::LinkController implementation:
void CookieFilterPageView::LinkActivated(views::Link* source, int event_flags) {
- browser::ShowOptionsURL(profile(),
- GURL(l10n_util::GetString(IDS_FLASH_STORAGE_URL)));
+ browser::ShowOptionsURL(
+ profile(),
+ GURL(l10n_util::GetStringUTF8(IDS_FLASH_STORAGE_URL)));
}
diff --git a/chrome/browser/ui/views/options/cookies_view.cc b/chrome/browser/ui/views/options/cookies_view.cc
index e06b511..973e11b 100644
--- a/chrome/browser/ui/views/options/cookies_view.cc
+++ b/chrome/browser/ui/views/options/cookies_view.cc
@@ -144,11 +144,11 @@
&CookiesView::UpdateSearchResults), kSearchFilterDelayMs);
}
-bool CookiesView::HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key) {
- if (key.GetKeyboardCode() == app::VKEY_ESCAPE) {
+bool CookiesView::HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
+ if (key_event.GetKeyCode() == app::VKEY_ESCAPE) {
ResetSearchQuery();
- } else if (key.GetKeyboardCode() == app::VKEY_RETURN) {
+ } else if (key_event.GetKeyCode() == app::VKEY_RETURN) {
search_update_factory_.RevokeAll();
UpdateSearchResults();
}
@@ -159,7 +159,8 @@
// CookiesView, views::DialogDelegate implementation:
std::wstring CookiesView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_COOKIES_WEBSITE_PERMISSIONS_WINDOW_TITLE));
}
void CookiesView::WindowClosing() {
@@ -277,14 +278,15 @@
void CookiesView::Init() {
search_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_SEARCH_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_SEARCH_LABEL)));
search_field_ = new views::Textfield;
search_field_->SetController(this);
clear_search_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_COOKIES_CLEAR_SEARCH_LABEL));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_CLEAR_SEARCH_LABEL)));
clear_search_button_->SetEnabled(false);
description_label_ = new views::Label(
- l10n_util::GetString(IDS_COOKIES_INFO_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_INFO_LABEL)));
description_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
cookies_tree_model_.reset(new CookiesTreeModel(
profile_->GetRequestContext()->GetCookieStore()->GetCookieMonster(),
@@ -309,9 +311,11 @@
cookies_tree_ = new CookiesTreeView(cookies_tree_model_.get());
remove_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_COOKIES_REMOVE_LABEL));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_REMOVE_LABEL)));
remove_all_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_COOKIES_REMOVE_ALL_LABEL));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIES_REMOVE_ALL_LABEL)));
using views::GridLayout;
using views::ColumnSet;
diff --git a/chrome/browser/ui/views/options/cookies_view.h b/chrome/browser/ui/views/options/cookies_view.h
index 1d117f7..af0d9ec 100644
--- a/chrome/browser/ui/views/options/cookies_view.h
+++ b/chrome/browser/ui/views/options/cookies_view.h
@@ -77,8 +77,8 @@
// views::Textfield::Controller implementation.
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key);
// views::WindowDelegate implementation.
virtual int GetDialogButtons() const {
diff --git a/chrome/browser/ui/views/options/exception_editor_view.cc b/chrome/browser/ui/views/options/exception_editor_view.cc
index 7b111d8..d5ceaa7 100644
--- a/chrome/browser/ui/views/options/exception_editor_view.cc
+++ b/chrome/browser/ui/views/options/exception_editor_view.cc
@@ -56,8 +56,11 @@
}
std::wstring ExceptionEditorView::GetWindowTitle() const {
- return is_new() ? l10n_util::GetString(IDS_EXCEPTION_EDITOR_NEW_TITLE) :
- l10n_util::GetString(IDS_EXCEPTION_EDITOR_TITLE);
+ if (is_new())
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_EXCEPTION_EDITOR_NEW_TITLE));
+
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTION_EDITOR_TITLE));
}
bool ExceptionEditorView::IsDialogButtonEnabled(
@@ -95,9 +98,8 @@
UTF16ToUTF8(pattern_tf_->text())), incognito_cb_->checked()));
}
-bool ExceptionEditorView::HandleKeystroke(
- views::Textfield* sender,
- const views::Textfield::Keystroke& key) {
+bool ExceptionEditorView::HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
return false;
}
@@ -118,7 +120,7 @@
action_cb_->SetSelectedItem(cb_model_.IndexForSetting(setting_));
incognito_cb_ = new views::Checkbox(
- l10n_util::GetString(IDS_EXCEPTION_EDITOR_OTR_TITLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTION_EDITOR_OTR_TITLE)));
incognito_cb_->SetChecked(is_off_the_record_);
GridLayout* layout = CreatePanelGridLayout(this);
@@ -152,7 +154,8 @@
}
views::Label* ExceptionEditorView::CreateLabel(int message_id) {
- views::Label* label = new views::Label(l10n_util::GetString(message_id));
+ views::Label* label =
+ new views::Label(UTF16ToWide(l10n_util::GetStringUTF16(message_id)));
label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
return label;
}
diff --git a/chrome/browser/ui/views/options/exception_editor_view.h b/chrome/browser/ui/views/options/exception_editor_view.h
index db8ddf6..8921653 100644
--- a/chrome/browser/ui/views/options/exception_editor_view.h
+++ b/chrome/browser/ui/views/options/exception_editor_view.h
@@ -76,8 +76,8 @@
// valid.
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event);
private:
void Init();
diff --git a/chrome/browser/ui/views/options/exceptions_page_view.cc b/chrome/browser/ui/views/options/exceptions_page_view.cc
index eb5d8c6..3cb7488 100644
--- a/chrome/browser/ui/views/options/exceptions_page_view.cc
+++ b/chrome/browser/ui/views/options/exceptions_page_view.cc
@@ -29,7 +29,7 @@
ExceptionsTableModel::~ExceptionsTableModel() {
}
-std::wstring ExceptionsTableModel::GetText(int row, int col_id) {
+string16 ExceptionsTableModel::GetText(int row, int col_id) {
DCHECK_EQ(col_id, IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN);
return PasswordsTableModel::GetText(row, col_id);
}
@@ -69,14 +69,18 @@
: OptionsPageView(profile),
ALLOW_THIS_IN_INITIALIZER_LIST(show_button_(
this,
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON),
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON))),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON)),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)))),
ALLOW_THIS_IN_INITIALIZER_LIST(remove_button_(
this,
- l10n_util::GetString(IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_BUTTON))),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON)))),
ALLOW_THIS_IN_INITIALIZER_LIST(remove_all_button_(
this,
- l10n_util::GetString(IDS_EXCEPTIONS_PAGE_VIEW_REMOVE_ALL_BUTTON))),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON)))),
table_model_(profile),
table_view_(NULL) {
}
diff --git a/chrome/browser/ui/views/options/exceptions_page_view.h b/chrome/browser/ui/views/options/exceptions_page_view.h
index decb69b..618b408 100644
--- a/chrome/browser/ui/views/options/exceptions_page_view.h
+++ b/chrome/browser/ui/views/options/exceptions_page_view.h
@@ -8,6 +8,7 @@
#include <vector>
+#include "base/compiler_specific.h"
#include "chrome/browser/views/options/options_page_view.h"
#include "chrome/browser/views/options/passwords_page_view.h"
#include "views/controls/table/table_view_observer.h"
@@ -22,8 +23,8 @@
virtual ~ExceptionsTableModel();
// TableModel methods.
- virtual std::wstring GetText(int row, int column);
- virtual int CompareValues(int row1, int row2, int col_id);
+ virtual string16 GetText(int row, int column) OVERRIDE;
+ virtual int CompareValues(int row1, int row2, int col_id) OVERRIDE;
// PasswordStoreConsumer implementation.
virtual void OnPasswordStoreRequestDone(
diff --git a/chrome/browser/ui/views/options/exceptions_view.cc b/chrome/browser/ui/views/options/exceptions_view.cc
index 0a622a1..55de5aa 100644
--- a/chrome/browser/ui/views/options/exceptions_view.cc
+++ b/chrome/browser/ui/views/options/exceptions_view.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/views/options/content_exceptions_table_view.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
@@ -112,15 +113,16 @@
std::wstring ExceptionsView::GetWindowTitle() const {
switch (model_.content_type()) {
case CONTENT_SETTINGS_TYPE_COOKIES:
- return l10n_util::GetString(IDS_COOKIE_EXCEPTION_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_COOKIE_EXCEPTION_TITLE));
case CONTENT_SETTINGS_TYPE_IMAGES:
- return l10n_util::GetString(IDS_IMAGES_EXCEPTION_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_IMAGES_EXCEPTION_TITLE));
case CONTENT_SETTINGS_TYPE_JAVASCRIPT:
- return l10n_util::GetString(IDS_JS_EXCEPTION_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_JS_EXCEPTION_TITLE));
case CONTENT_SETTINGS_TYPE_PLUGINS:
- return l10n_util::GetString(IDS_PLUGINS_EXCEPTION_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_PLUGINS_EXCEPTION_TITLE));
case CONTENT_SETTINGS_TYPE_POPUPS:
- return l10n_util::GetString(IDS_POPUP_EXCEPTION_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_POPUP_EXCEPTION_TITLE));
default:
NOTREACHED();
}
@@ -177,16 +179,18 @@
table_->SetObserver(this);
add_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_EXCEPTIONS_ADD_BUTTON));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_ADD_BUTTON)));
add_button_->set_tag(IDS_EXCEPTIONS_ADD_BUTTON);
edit_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_EXCEPTIONS_EDIT_BUTTON));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_EDIT_BUTTON)));
edit_button_->set_tag(IDS_EXCEPTIONS_EDIT_BUTTON);
remove_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_EXCEPTIONS_REMOVE_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_REMOVE_BUTTON)));
remove_button_->set_tag(IDS_EXCEPTIONS_REMOVE_BUTTON);
remove_all_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_EXCEPTIONS_REMOVEALL_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_REMOVEALL_BUTTON)));
remove_all_button_->set_tag(IDS_EXCEPTIONS_REMOVEALL_BUTTON);
View* parent = GetParent();
@@ -212,8 +216,8 @@
layout->AddPaddingRow(0, kRelatedControlVerticalSpacing);
if (allow_off_the_record_) {
- views::Label* label = new views::Label(l10n_util::GetString(
- IDS_EXCEPTIONS_OTR_IN_ITALICS));
+ views::Label* label = new views::Label(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_OTR_IN_ITALICS)));
label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->StartRow(0, single_column_layout_id);
layout->AddView(label, 1, 1, GridLayout::LEADING, GridLayout::CENTER);
diff --git a/chrome/browser/ui/views/options/fonts_languages_window_view.cc b/chrome/browser/ui/views/options/fonts_languages_window_view.cc
index edf0fa2..79a146b 100644
--- a/chrome/browser/ui/views/options/fonts_languages_window_view.cc
+++ b/chrome/browser/ui/views/options/fonts_languages_window_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/options/fonts_languages_window_view.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/views/options/fonts_page_view.h"
@@ -49,7 +50,8 @@
// FontsLanguagesWindowView, views::WindowDelegate implementation:
std::wstring FontsLanguagesWindowView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_FONT_LANGUAGE_SETTING_WINDOWS_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_FONT_LANGUAGE_SETTING_WINDOWS_TITLE));
}
void FontsLanguagesWindowView::WindowClosing() {
@@ -109,12 +111,12 @@
AddChildView(tabs_);
fonts_page_ = new FontsPageView(profile_);
- tabs_->AddTab(l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_TAB_TITLE), fonts_page_);
+ tabs_->AddTab(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_TAB_TITLE)), fonts_page_);
languages_page_ = new LanguagesPageView(profile_);
- tabs_->AddTab(l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_LANGUAGES_TAB_TITLE), languages_page_);
+ tabs_->AddTab(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_LANGUAGES_TAB_TITLE)), languages_page_);
}
void ShowFontsLanguagesWindow(gfx::NativeWindow window,
diff --git a/chrome/browser/ui/views/options/fonts_page_view.cc b/chrome/browser/ui/views/options/fonts_page_view.cc
index ddbc676..b02a27e 100644
--- a/chrome/browser/ui/views/options/fonts_page_view.cc
+++ b/chrome/browser/ui/views/options/fonts_page_view.cc
@@ -267,8 +267,8 @@
column_set->AddColumn(GridLayout::FILL, GridLayout::LEADING, 1,
GridLayout::USE_PREF, 0, 0);
fonts_group_title_ = new views::Label(
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_FONT_TITLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_FONT_TITLE)));
EmbellishTitle(fonts_group_title_);
fonts_group_title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->StartRow(0, single_column_view_set_id);
@@ -281,8 +281,8 @@
// Encoding group.
encoding_group_title_ = new views::Label(
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_ENCODING_TITLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_SUB_DIALOG_ENCODING_TITLE)));
EmbellishTitle(encoding_group_title_);
encoding_group_title_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->StartRow(0, single_column_view_set_id);
@@ -319,36 +319,36 @@
fixed_width_font_display_view_ = new FontDisplayView;
fixed_width_font_change_page_button_ = new views::NativeButton(
this,
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL)));
fixed_width_font_label_ = new views::Label(
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_FIXED_WIDTH_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_FIXED_WIDTH_LABEL)));
fixed_width_font_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
// Serif font.
serif_font_display_view_ = new FontDisplayView;
serif_font_change_page_button_ = new views::NativeButton(
this,
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL)));
serif_font_label_ = new views::Label(
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SERIF_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SERIF_LABEL)));
serif_font_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
// Sans Serif font.
sans_serif_font_display_view_ = new FontDisplayView;
sans_serif_font_change_page_button_ = new views::NativeButton(
this,
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_BUTTON_LABEL)));
sans_serif_font_label_ = new views::Label(
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SANS_SERIF_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_SELECTOR_SANS_SERIF_LABEL)));
sans_serif_font_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
// Now add the views.
@@ -398,8 +398,8 @@
void FontsPageView::InitEncodingLayout() {
default_encoding_combobox_label_ = new views::Label(
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_FONT_DEFAULT_ENCODING_SELECTOR_LABEL));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_FONT_DEFAULT_ENCODING_SELECTOR_LABEL)));
default_encoding_combobox_model_.reset(new DefaultEncodingComboboxModel);
default_encoding_combobox_ = new views::Combobox(
default_encoding_combobox_model_.get());
diff --git a/chrome/browser/ui/views/options/general_page_view.cc b/chrome/browser/ui/views/options/general_page_view.cc
index 11be9c6..a0243cf 100644
--- a/chrome/browser/ui/views/options/general_page_view.cc
+++ b/chrome/browser/ui/views/options/general_page_view.cc
@@ -323,8 +323,8 @@
}
}
-bool GeneralPageView::HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke&) {
+bool GeneralPageView::HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
return false;
}
@@ -465,21 +465,21 @@
default_browser_use_as_default_button_->SetEnabled(button_enabled);
default_browser_use_as_default_button_->SetNeedElevation(true);
if (state == ShellIntegration::STATE_IS_DEFAULT) {
- default_browser_status_label_->SetText(
- l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_DEFAULT,
- l10n_util::GetString(IDS_PRODUCT_NAME)));
+ default_browser_status_label_->SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_DEFAULTBROWSER_DEFAULT,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
default_browser_status_label_->SetColor(kDefaultBrowserLabelColor);
Layout();
} else if (state == ShellIntegration::STATE_NOT_DEFAULT) {
- default_browser_status_label_->SetText(
- l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT,
- l10n_util::GetString(IDS_PRODUCT_NAME)));
+ default_browser_status_label_->SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_DEFAULTBROWSER_NOTDEFAULT,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
default_browser_status_label_->SetColor(kNotDefaultBrowserLabelColor);
Layout();
} else if (state == ShellIntegration::STATE_UNKNOWN) {
- default_browser_status_label_->SetText(
- l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN,
- l10n_util::GetString(IDS_PRODUCT_NAME)));
+ default_browser_status_label_->SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_DEFAULTBROWSER_UNKNOWN,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
default_browser_status_label_->SetColor(kNotDefaultBrowserLabelColor);
Layout();
}
@@ -487,34 +487,38 @@
void GeneralPageView::SetDefaultBrowserUIStateForSxS() {
default_browser_use_as_default_button_->SetEnabled(false);
- default_browser_status_label_->SetText(
- l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_SXS,
- l10n_util::GetString(IDS_PRODUCT_NAME)));
+ default_browser_status_label_->SetText(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_DEFAULTBROWSER_SXS,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
default_browser_status_label_->SetColor(kNotDefaultBrowserLabelColor);
Layout();
}
void GeneralPageView::InitStartupGroup() {
- startup_homepage_radio_ = new views::RadioButton(
- l10n_util::GetString(IDS_OPTIONS_STARTUP_SHOW_DEFAULT_AND_NEWTAB),
+ startup_homepage_radio_ = new views::RadioButton(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_STARTUP_SHOW_DEFAULT_AND_NEWTAB)),
kStartupRadioGroup);
startup_homepage_radio_->set_listener(this);
- startup_last_session_radio_ = new views::RadioButton(
- l10n_util::GetString(IDS_OPTIONS_STARTUP_SHOW_LAST_SESSION),
+ startup_last_session_radio_ = new views::RadioButton(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_STARTUP_SHOW_LAST_SESSION)),
kStartupRadioGroup);
startup_last_session_radio_->set_listener(this);
startup_last_session_radio_->SetMultiLine(true);
startup_custom_radio_ = new views::RadioButton(
- l10n_util::GetString(IDS_OPTIONS_STARTUP_SHOW_PAGES),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_STARTUP_SHOW_PAGES)),
kStartupRadioGroup);
startup_custom_radio_->set_listener(this);
startup_add_custom_page_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_STARTUP_ADD_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_STARTUP_ADD_BUTTON)));
startup_remove_custom_page_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_STARTUP_REMOVE_BUTTON));
+ this,
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_STARTUP_REMOVE_BUTTON)));
startup_remove_custom_page_button_->SetEnabled(false);
startup_use_current_page_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_OPTIONS_STARTUP_USE_CURRENT));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_STARTUP_USE_CURRENT)));
startup_custom_pages_table_model_.reset(
new CustomHomePagesTableModel(profile()));
@@ -581,18 +585,19 @@
layout->AddView(button_stack);
startup_group_ = new OptionsGroupView(
- contents, l10n_util::GetString(IDS_OPTIONS_STARTUP_GROUP_NAME),
+ contents,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_STARTUP_GROUP_NAME)),
std::wstring(), true);
}
void GeneralPageView::InitHomepageGroup() {
homepage_use_newtab_radio_ = new views::RadioButton(
- l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_NEWTAB),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_HOMEPAGE_USE_NEWTAB)),
kHomePageRadioGroup);
homepage_use_newtab_radio_->set_listener(this);
homepage_use_newtab_radio_->SetMultiLine(true);
homepage_use_url_radio_ = new views::RadioButton(
- l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_USE_URL),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_HOMEPAGE_USE_URL)),
kHomePageRadioGroup);
homepage_use_url_radio_->set_listener(this);
homepage_use_url_textfield_ = new views::Textfield;
@@ -600,7 +605,7 @@
homepage_use_url_textfield_->set_default_width_in_chars(
kHomePageTextfieldWidthChars);
homepage_show_home_button_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_SHOW_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_HOMEPAGE_SHOW_BUTTON)));
homepage_show_home_button_checkbox_->set_listener(this);
homepage_show_home_button_checkbox_->SetMultiLine(true);
@@ -637,7 +642,8 @@
GridLayout::FILL, GridLayout::LEADING);
homepage_group_ = new OptionsGroupView(
- contents, l10n_util::GetString(IDS_OPTIONS_HOMEPAGE_GROUP_NAME),
+ contents,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_HOMEPAGE_GROUP_NAME)),
std::wstring(), true);
}
@@ -651,14 +657,16 @@
default_search_manage_engines_button_ = new views::NativeButton(
this,
- l10n_util::GetString(IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES_LINK));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_OPTIONS_DEFAULTSEARCH_MANAGE_ENGINES_LINK)));
instant_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_INSTANT_PREF));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_INSTANT_PREF)));
instant_checkbox_->SetMultiLine(false);
instant_checkbox_->set_listener(this);
- instant_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE));
+ instant_link_ = new views::Link(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_LEARN_MORE)));
instant_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
instant_link_->SetController(this);
@@ -702,12 +710,14 @@
layout->AddPaddingRow(0, 0);
layout->StartRow(0, link_column_set_id);
- layout->AddView(
- new views::Label(l10n_util::GetString(IDS_INSTANT_PREF_WARNING)));
+ layout->AddView(new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_INSTANT_PREF_WARNING))));
layout->AddView(instant_link_);
default_search_group_ = new OptionsGroupView(
- contents, l10n_util::GetString(IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME),
+ contents,
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_DEFAULTSEARCH_GROUP_NAME)),
std::wstring(), true);
}
@@ -718,8 +728,9 @@
views::Label::ALIGN_LEFT);
default_browser_use_as_default_button_ = new views::NativeButton(
this,
- l10n_util::GetStringF(IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT,
- l10n_util::GetString(IDS_PRODUCT_NAME)));
+ UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_DEFAULTBROWSER_USEASDEFAULT,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
using views::GridLayout;
using views::ColumnSet;
@@ -741,7 +752,9 @@
layout->AddView(default_browser_use_as_default_button_);
default_browser_group_ = new OptionsGroupView(
- contents, l10n_util::GetString(IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME),
+ contents,
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_DEFAULTBROWSER_GROUP_NAME)),
std::wstring(), false);
if (BrowserDistribution::GetDistribution()->CanSetAsDefault())
diff --git a/chrome/browser/ui/views/options/general_page_view.h b/chrome/browser/ui/views/options/general_page_view.h
index 129fe5e..928fc42 100644
--- a/chrome/browser/ui/views/options/general_page_view.h
+++ b/chrome/browser/ui/views/options/general_page_view.h
@@ -58,8 +58,8 @@
// views::Textfield::Controller implementation:
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key);
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event);
// OptionsPageView implementation:
virtual void InitControlLayout();
diff --git a/chrome/browser/ui/views/options/languages_page_view.cc b/chrome/browser/ui/views/options/languages_page_view.cc
index 9abe7c4..afe1e84 100644
--- a/chrome/browser/ui/views/options/languages_page_view.cc
+++ b/chrome/browser/ui/views/options/languages_page_view.cc
@@ -115,7 +115,8 @@
}
std::wstring AddLanguageWindowView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_FONT_LANGUAGE_SETTING_LANGUAGES_TAB_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_FONT_LANGUAGE_SETTING_LANGUAGES_TAB_TITLE));
}
bool AddLanguageWindowView::Accept() {
@@ -240,16 +241,24 @@
void LanguagesPageView::InitControlLayout() {
// Define the buttons.
- add_button_ = new views::NativeButton(this, l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_ADD_BUTTON_LABEL));
- remove_button_ = new views::NativeButton(this, l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_REMOVE_BUTTON_LABEL));
+ add_button_ = new views::NativeButton(
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_ADD_BUTTON_LABEL)));
+ remove_button_ = new views::NativeButton(
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_REMOVE_BUTTON_LABEL)));
remove_button_->SetEnabled(false);
- move_up_button_ = new views::NativeButton(this, l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_MOVEUP_BUTTON_LABEL));
+ move_up_button_ = new views::NativeButton(
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_MOVEUP_BUTTON_LABEL)));
move_up_button_->SetEnabled(false);
- move_down_button_ = new views::NativeButton(this, l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_MOVEDOWN_BUTTON_LABEL));
+ move_down_button_ = new views::NativeButton(
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_LANGUAGES_SELECTOR_MOVEDOWN_BUTTON_LABEL)));
move_down_button_->SetEnabled(false);
languages_contents_ = new views::View;
@@ -266,8 +275,8 @@
column_set->AddColumn(GridLayout::FILL, GridLayout::CENTER, 1,
GridLayout::USE_PREF, 0, 0);
languages_instructions_ = new views::Label(
- l10n_util::GetString(
- IDS_FONT_LANGUAGE_SETTING_LANGUAGES_INSTRUCTIONS));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_FONT_LANGUAGE_SETTING_LANGUAGES_INSTRUCTIONS)));
languages_instructions_->SetMultiLine(true);
languages_instructions_->SetHorizontalAlignment(
views::Label::ALIGN_LEFT);
@@ -326,25 +335,25 @@
layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
language_info_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_CHROME_LANGUAGE_INFO));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_CHROME_LANGUAGE_INFO)));
language_info_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
ui_language_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_CHROME_UI_LANGUAGE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_CHROME_UI_LANGUAGE)));
ui_language_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
ui_language_model_.reset(new LanguageComboboxModel);
change_ui_language_combobox_ =
new views::Combobox(ui_language_model_.get());
change_ui_language_combobox_->set_listener(this);
- dictionary_language_label_ = new views::Label(
- l10n_util::GetString(IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE));
+ dictionary_language_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_CHROME_DICTIONARY_LANGUAGE)));
dictionary_language_label_->SetHorizontalAlignment(
views::Label::ALIGN_LEFT);
enable_spellchecking_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_ENABLE_SPELLCHECK));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_SPELLCHECK)));
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
if (command_line.HasSwitch(switches::kExperimentalSpellcheckerFeatures)) {
- enable_autospellcorrect_checkbox_ = new views::Checkbox(
- l10n_util::GetString(IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION));
+ enable_autospellcorrect_checkbox_ = new views::Checkbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_ENABLE_AUTO_SPELL_CORRECTION)));
enable_autospellcorrect_checkbox_->set_listener(this);
}
enable_spellchecking_checkbox_->set_listener(this);
diff --git a/chrome/browser/ui/views/options/options_group_view.cc b/chrome/browser/ui/views/options/options_group_view.cc
index ef3e5dd..70f88b8 100644
--- a/chrome/browser/ui/views/options/options_group_view.cc
+++ b/chrome/browser/ui/views/options/options_group_view.cc
@@ -9,6 +9,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "base/string_number_conversions.h"
#include "gfx/canvas.h"
#include "gfx/font.h"
#include "gfx/native_theme_win.h"
@@ -103,10 +104,11 @@
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
const gfx::Font& font = rb.GetFont(ResourceBundle::BaseFont);
- std::wstring left_column_chars =
- l10n_util::GetString(IDS_OPTIONS_DIALOG_LEFT_COLUMN_WIDTH_CHARS);
- int left_column_width =
- font.GetExpectedTextWidth(_wtoi(left_column_chars.c_str()));
+ int left_column_chars = 0;
+ base::StringToInt(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_DIALOG_LEFT_COLUMN_WIDTH_CHARS),
+ &left_column_chars);
+ int left_column_width = font.GetExpectedTextWidth(left_column_chars);
const int two_column_layout_id = 0;
ColumnSet* column_set = layout->AddColumnSet(two_column_layout_id);
diff --git a/chrome/browser/ui/views/options/options_window_view.cc b/chrome/browser/ui/views/options/options_window_view.cc
index ae7f545..e2940d6 100644
--- a/chrome/browser/ui/views/options/options_window_view.cc
+++ b/chrome/browser/ui/views/options/options_window_view.cc
@@ -127,8 +127,9 @@
// OptionsWindowView, views::DialogDelegate implementation:
std::wstring OptionsWindowView::GetWindowTitle() const {
- return l10n_util::GetStringF(IDS_OPTIONS_DIALOG_TITLE,
- l10n_util::GetString(IDS_PRODUCT_NAME));
+ return UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_DIALOG_TITLE,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
}
std::wstring OptionsWindowView::GetWindowName() const {
@@ -196,26 +197,30 @@
void OptionsWindowView::Init() {
tabs_ = new views::TabbedPane;
- tabs_->SetAccessibleName(l10n_util::GetStringF(IDS_OPTIONS_DIALOG_TITLE,
- l10n_util::GetString(IDS_PRODUCT_NAME)));
+ tabs_->SetAccessibleName(UTF16ToWide(
+ l10n_util::GetStringFUTF16(IDS_OPTIONS_DIALOG_TITLE,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
tabs_->SetListener(this);
AddChildView(tabs_);
int tab_index = 0;
GeneralPageView* general_page = new GeneralPageView(profile_);
- tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_OPTIONS_GENERAL_TAB_LABEL),
- general_page, false);
+ tabs_->AddTabAtIndex(
+ tab_index++,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_GENERAL_TAB_LABEL)),
+ general_page, false);
ContentPageView* content_page = new ContentPageView(profile_);
- tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_OPTIONS_CONTENT_TAB_LABEL),
- content_page, false);
+ tabs_->AddTabAtIndex(
+ tab_index++,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_CONTENT_TAB_LABEL)),
+ content_page, false);
AdvancedPageView* advanced_page = new AdvancedPageView(profile_);
- tabs_->AddTabAtIndex(tab_index++,
- l10n_util::GetString(IDS_OPTIONS_ADVANCED_TAB_LABEL),
- advanced_page, false);
+ tabs_->AddTabAtIndex(
+ tab_index++,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_OPTIONS_ADVANCED_TAB_LABEL)),
+ advanced_page, false);
DCHECK(tabs_->GetTabCount() == OPTIONS_PAGE_COUNT);
}
diff --git a/chrome/browser/ui/views/options/passwords_exceptions_window_view.cc b/chrome/browser/ui/views/options/passwords_exceptions_window_view.cc
index 5c786ac..c9f5c73 100644
--- a/chrome/browser/ui/views/options/passwords_exceptions_window_view.cc
+++ b/chrome/browser/ui/views/options/passwords_exceptions_window_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/options/passwords_exceptions_window_view.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/views/options/passwords_page_view.h"
#include "chrome/browser/views/options/exceptions_page_view.h"
#include "grit/generated_resources.h"
@@ -81,7 +82,8 @@
}
std::wstring PasswordsExceptionsWindowView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_PASSWORDS_EXCEPTIONS_WINDOW_TITLE));
}
void PasswordsExceptionsWindowView::WindowClosing() {
@@ -102,10 +104,10 @@
AddChildView(tabs_);
passwords_page_view_ = new PasswordsPageView(profile_);
- tabs_->AddTab(l10n_util::GetString(
- IDS_PASSWORDS_SHOW_PASSWORDS_TAB_TITLE), passwords_page_view_);
+ tabs_->AddTab(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_SHOW_PASSWORDS_TAB_TITLE)), passwords_page_view_);
exceptions_page_view_ = new ExceptionsPageView(profile_);
- tabs_->AddTab(l10n_util::GetString(
- IDS_PASSWORDS_EXCEPTIONS_TAB_TITLE), exceptions_page_view_);
+ tabs_->AddTab(UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_EXCEPTIONS_TAB_TITLE)), exceptions_page_view_);
}
diff --git a/chrome/browser/ui/views/options/passwords_page_view.cc b/chrome/browser/ui/views/options/passwords_page_view.cc
index cdb3187..8e30879 100644
--- a/chrome/browser/ui/views/options/passwords_page_view.cc
+++ b/chrome/browser/ui/views/options/passwords_page_view.cc
@@ -70,24 +70,23 @@
return static_cast<int>(saved_signons_.size());
}
-std::wstring PasswordsTableModel::GetText(int row,
- int col_id) {
+string16 PasswordsTableModel::GetText(int row,
+ int col_id) {
switch (col_id) {
case IDS_PASSWORDS_PAGE_VIEW_SITE_COLUMN: { // Site.
// Force URL to have LTR directionality.
std::wstring url(saved_signons_[row]->display_url.display_url());
- url = UTF16ToWide(base::i18n::GetDisplayStringInLTRDirectionality(
- WideToUTF16(url)));
- return url;
+ return base::i18n::GetDisplayStringInLTRDirectionality(
+ WideToUTF16Hack(url));
}
case IDS_PASSWORDS_PAGE_VIEW_USERNAME_COLUMN: { // Username.
std::wstring username = GetPasswordFormAt(row)->username_value;
base::i18n::AdjustStringForLocaleDirection(&username);
- return username;
+ return WideToUTF16Hack(username);
}
default:
NOTREACHED() << "Invalid column.";
- return std::wstring();
+ return string16();
}
}
@@ -177,14 +176,18 @@
: OptionsPageView(profile),
ALLOW_THIS_IN_INITIALIZER_LIST(show_button_(
this,
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON),
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON))),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON)),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)))),
ALLOW_THIS_IN_INITIALIZER_LIST(remove_button_(
this,
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON))),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_REMOVE_BUTTON)))),
ALLOW_THIS_IN_INITIALIZER_LIST(remove_all_button_(
this,
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON))),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_REMOVE_ALL_BUTTON)))),
table_model_(profile),
table_view_(NULL),
current_selected_password_(NULL) {
@@ -212,8 +215,8 @@
if (selected != current_selected_password_) {
// Reset the password related views.
- show_button_.SetLabel(
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON));
+ show_button_.SetLabel(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON)));
show_button_.SetEnabled(has_selection);
password_label_.SetText(std::wstring());
@@ -228,9 +231,10 @@
ConfirmMessageBoxDialog::Run(
GetWindow()->GetNativeWindow(),
this,
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_TEXT_DELETE_ALL_PASSWORDS),
- l10n_util::GetString(
- IDS_PASSWORDS_PAGE_VIEW_CAPTION_DELETE_ALL_PASSWORDS));
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_TEXT_DELETE_ALL_PASSWORDS)),
+ UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_PASSWORDS_PAGE_VIEW_CAPTION_DELETE_ALL_PASSWORDS)));
return;
}
@@ -247,8 +251,8 @@
if (password_label_.GetText().length() == 0 &&
allow_show_passwords_.GetValue()) {
password_label_.SetText(selected->password_value);
- show_button_.SetLabel(
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON));
+ show_button_.SetLabel(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_HIDE_BUTTON)));
} else {
HidePassword();
}
@@ -349,8 +353,8 @@
void PasswordsPageView::HidePassword() {
password_label_.SetText(L"");
- show_button_.SetLabel(
- l10n_util::GetString(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON));
+ show_button_.SetLabel(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_PASSWORDS_PAGE_VIEW_SHOW_BUTTON)));
}
void PasswordsPageView::NotifyPrefChanged(const std::string* pref_name) {
diff --git a/chrome/browser/ui/views/options/passwords_page_view.h b/chrome/browser/ui/views/options/passwords_page_view.h
index f465b57..39428bf 100644
--- a/chrome/browser/ui/views/options/passwords_page_view.h
+++ b/chrome/browser/ui/views/options/passwords_page_view.h
@@ -10,6 +10,7 @@
#include "app/table_model.h"
#include "app/text_elider.h"
+#include "base/compiler_specific.h"
#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
#include "chrome/browser/password_manager/password_store.h"
@@ -69,10 +70,10 @@
virtual ~PasswordsTableModel();
// TableModel methods.
- virtual int RowCount();
- virtual std::wstring GetText(int row, int column);
- virtual int CompareValues(int row1, int row2, int column_id);
- virtual void SetObserver(TableModelObserver* observer);
+ virtual int RowCount() OVERRIDE;
+ virtual string16 GetText(int row, int column) OVERRIDE;
+ virtual int CompareValues(int row1, int row2, int column_id) OVERRIDE;
+ virtual void SetObserver(TableModelObserver* observer) OVERRIDE;
// Delete the PasswordForm at specified row from the database (and remove
// from view).
diff --git a/chrome/browser/ui/views/options/plugin_filter_page_view.cc b/chrome/browser/ui/views/options/plugin_filter_page_view.cc
index 94ae40d..b527960 100644
--- a/chrome/browser/ui/views/options/plugin_filter_page_view.cc
+++ b/chrome/browser/ui/views/options/plugin_filter_page_view.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/options/plugin_filter_page_view.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/options/show_options_url.h"
#include "chrome/common/url_constants.h"
@@ -32,7 +33,7 @@
layout->AddPaddingRow(0, kUnrelatedControlVerticalSpacing);
views::Link* plugins_page_link = new views::Link(
- l10n_util::GetString(IDS_PLUGIN_SELECTIVE_DISABLE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PLUGIN_SELECTIVE_DISABLE)));
plugins_page_link->SetController(this);
layout->StartRow(0, single_column_set_id);
diff --git a/chrome/browser/ui/views/options/simple_content_exceptions_view.cc b/chrome/browser/ui/views/options/simple_content_exceptions_view.cc
index 5df84aa..51be466 100644
--- a/chrome/browser/ui/views/options/simple_content_exceptions_view.cc
+++ b/chrome/browser/ui/views/options/simple_content_exceptions_view.cc
@@ -8,6 +8,7 @@
#include <vector>
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
#include "gfx/rect.h"
@@ -96,7 +97,7 @@
}
std::wstring SimpleContentExceptionsView::GetWindowTitle() const {
- return l10n_util::GetString(title_message_id_);
+ return UTF16ToWide(l10n_util::GetStringUTF16(title_message_id_));
}
SimpleContentExceptionsView::SimpleContentExceptionsView(
@@ -131,10 +132,12 @@
table_->SetObserver(this);
remove_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_EXCEPTIONS_REMOVE_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_REMOVE_BUTTON)));
remove_button_->set_tag(IDS_EXCEPTIONS_REMOVE_BUTTON);
remove_all_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_EXCEPTIONS_REMOVEALL_BUTTON));
+ this,
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_EXCEPTIONS_REMOVEALL_BUTTON)));
remove_all_button_->set_tag(IDS_EXCEPTIONS_REMOVEALL_BUTTON);
View* parent = GetParent();
diff --git a/chrome/browser/ui/views/page_info_bubble_view.cc b/chrome/browser/ui/views/page_info_bubble_view.cc
index 073c6f7..d872399 100644
--- a/chrome/browser/ui/views/page_info_bubble_view.cc
+++ b/chrome/browser/ui/views/page_info_bubble_view.cc
@@ -154,8 +154,8 @@
// Then add the help center link at the bottom.
layout->StartRow(0, 1);
- help_center_link_ =
- new views::Link(l10n_util::GetString(IDS_PAGE_INFO_HELP_CENTER_LINK));
+ help_center_link_ = new views::Link(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PAGE_INFO_HELP_CENTER_LINK)));
help_center_link_->SetController(this);
layout->AddView(help_center_link_);
}
@@ -213,11 +213,11 @@
browser->OpenURL(url, GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK);
}
-void PageInfoBubbleView::AnimationEnded(const Animation* animation) {
+void PageInfoBubbleView::AnimationEnded(const ui::Animation* animation) {
info_bubble_->SizeToContents();
}
-void PageInfoBubbleView::AnimationProgressed(const Animation* animation) {
+void PageInfoBubbleView::AnimationProgressed(const ui::Animation* animation) {
info_bubble_->SizeToContents();
}
@@ -254,7 +254,7 @@
if (info_.type == PageInfoModel::SECTION_INFO_IDENTITY && show_cert) {
link_ = new views::Link(
- l10n_util::GetString(IDS_PAGEINFO_CERT_INFO_BUTTON));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_PAGEINFO_CERT_INFO_BUTTON)));
link_->SetController(this);
AddChildView(link_);
}
diff --git a/chrome/browser/ui/views/page_info_bubble_view.h b/chrome/browser/ui/views/page_info_bubble_view.h
index f0df41f..fc2917b 100644
--- a/chrome/browser/ui/views/page_info_bubble_view.h
+++ b/chrome/browser/ui/views/page_info_bubble_view.h
@@ -6,10 +6,10 @@
#define CHROME_BROWSER_UI_VIEWS_PAGE_INFO_BUBBLE_VIEW_H_
#pragma once
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "chrome/browser/page_info_model.h"
#include "chrome/browser/views/info_bubble.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/link.h"
#include "views/view.h"
@@ -21,7 +21,7 @@
public PageInfoModel::PageInfoModelObserver,
public InfoBubbleDelegate,
public views::LinkController,
- public AnimationDelegate {
+ public ui::AnimationDelegate {
public:
PageInfoBubbleView(gfx::NativeWindow parent_window,
Profile* profile,
@@ -51,9 +51,9 @@
// LinkController methods:
virtual void LinkActivated(views::Link* source, int event_flags);
- // Overridden from AnimationDelegate.
- virtual void AnimationEnded(const Animation* animation);
- virtual void AnimationProgressed(const Animation* animation);
+ // Overridden from ui::AnimationDelegate.
+ virtual void AnimationEnded(const ui::Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
private:
// Layout the sections within the bubble.
@@ -74,7 +74,7 @@
views::Link* help_center_link_;
// Animation that helps us change size smoothly as more data comes in.
- SlideAnimation resize_animation_;
+ ui::SlideAnimation resize_animation_;
// The height of the info bubble at the start of the resize animation.
int animation_start_height_;
diff --git a/chrome/browser/ui/views/reload_button.cc b/chrome/browser/ui/views/reload_button.cc
index 941ae3a..0df1030 100644
--- a/chrome/browser/ui/views/reload_button.cc
+++ b/chrome/browser/ui/views/reload_button.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/views/reload_button.h"
#include "app/l10n_util.h"
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/views/event_utils.h"
@@ -120,8 +121,9 @@
}
bool ReloadButton::GetTooltipText(const gfx::Point& p, std::wstring* tooltip) {
- tooltip->assign(l10n_util::GetString((visible_mode_ == MODE_RELOAD) ?
- IDS_TOOLTIP_RELOAD : IDS_TOOLTIP_STOP));
+ int text_id = visible_mode_ == MODE_RELOAD ? IDS_TOOLTIP_RELOAD
+ : IDS_TOOLTIP_STOP;
+ tooltip->assign(UTF16ToWide(l10n_util::GetStringUTF16(text_id)));
return true;
}
diff --git a/chrome/browser/ui/views/repost_form_warning_view.cc b/chrome/browser/ui/views/repost_form_warning_view.cc
index d29258b..18022e8 100644
--- a/chrome/browser/ui/views/repost_form_warning_view.cc
+++ b/chrome/browser/ui/views/repost_form_warning_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_window.h"
#include "chrome/browser/repost_form_warning_controller.h"
@@ -35,7 +36,7 @@
message_box_view_(NULL) {
message_box_view_ = new MessageBoxView(
MessageBoxFlags::kIsConfirmMessageBox,
- l10n_util::GetString(IDS_HTTP_POST_WARNING),
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING)),
std::wstring());
controller_->Show(this);
}
@@ -47,15 +48,15 @@
// RepostFormWarningView, views::DialogDelegate implementation:
std::wstring RepostFormWarningView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_HTTP_POST_WARNING_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE));
}
std::wstring RepostFormWarningView::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK)
- return l10n_util::GetString(IDS_HTTP_POST_WARNING_RESEND);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_RESEND));
if (button == MessageBoxFlags::DIALOGBUTTON_CANCEL)
- return l10n_util::GetString(IDS_CANCEL);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_CANCEL));
return std::wstring();
}
diff --git a/chrome/browser/ui/views/restart_message_box.cc b/chrome/browser/ui/views/restart_message_box.cc
index c054098..4e2804d 100644
--- a/chrome/browser/ui/views/restart_message_box.cc
+++ b/chrome/browser/ui/views/restart_message_box.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
+#include "base/utf_string_conversions.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "views/controls/message_box_view.h"
@@ -27,11 +28,11 @@
std::wstring RestartMessageBox::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
DCHECK(button == MessageBoxFlags::DIALOGBUTTON_OK);
- return l10n_util::GetString(IDS_OK);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_OK));
}
std::wstring RestartMessageBox::GetWindowTitle() const {
- return l10n_util::GetString(IDS_PRODUCT_NAME);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
}
void RestartMessageBox::DeleteDelegate() {
@@ -54,7 +55,8 @@
// Also deleted when the window closes.
message_box_view_ = new MessageBoxView(
MessageBoxFlags::kFlagHasMessage | MessageBoxFlags::kFlagHasOKButton,
- l10n_util::GetString(IDS_OPTIONS_RESTART_REQUIRED).c_str(),
+ UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_OPTIONS_RESTART_REQUIRED)).c_str(),
std::wstring(),
kDialogWidth);
views::Window::CreateChromeWindow(parent_window, gfx::Rect(), this)->Show();
diff --git a/chrome/browser/ui/views/sad_tab_view.cc b/chrome/browser/ui/views/sad_tab_view.cc
index 3af2197..876f9ed 100644
--- a/chrome/browser/ui/views/sad_tab_view.cc
+++ b/chrome/browser/ui/views/sad_tab_view.cc
@@ -56,7 +56,8 @@
InitClass();
if (tab_contents != NULL) {
- learn_more_link_ = new views::Link(l10n_util::GetString(IDS_LEARN_MORE));
+ learn_more_link_ =
+ new views::Link(UTF16ToWide(l10n_util::GetStringUTF16(IDS_LEARN_MORE)));
learn_more_link_->SetFont(*message_font_);
learn_more_link_->SetNormalColor(kLinkColor);
learn_more_link_->SetController(this);
@@ -149,9 +150,9 @@
rb.GetFont(ResourceBundle::BaseFont).DeriveFont(kMessageFontSizeDelta));
sad_tab_bitmap_ = rb.GetBitmapNamed(IDR_SAD_TAB);
- title_ = l10n_util::GetString(IDS_SAD_TAB_TITLE);
- title_width_ = title_font_->GetStringWidth(title_);
- message_ = l10n_util::GetString(IDS_SAD_TAB_MESSAGE);
+ title_ = UTF16ToWide(l10n_util::GetStringUTF16(IDS_SAD_TAB_TITLE));
+ title_width_ = title_font_->GetStringWidth(WideToUTF16Hack(title_));
+ message_ = UTF16ToWide(l10n_util::GetStringUTF16(IDS_SAD_TAB_MESSAGE));
initialized = true;
}
diff --git a/chrome/browser/ui/views/select_file_dialog.cc b/chrome/browser/ui/views/select_file_dialog.cc
index f012838..1ebf2e5 100644
--- a/chrome/browser/ui/views/select_file_dialog.cc
+++ b/chrome/browser/ui/views/select_file_dialog.cc
@@ -213,7 +213,7 @@
NOTREACHED();
return;
}
- title_string = l10n_util::GetString(string_id);
+ title_string = UTF16ToWide(l10n_util::GetStringUTF16(string_id));
} else {
title_string = UTF16ToWide(title);
}
diff --git a/chrome/browser/ui/views/shell_dialogs_win.cc b/chrome/browser/ui/views/shell_dialogs_win.cc
index bc5f92b..f1c59b4 100644
--- a/chrome/browser/ui/views/shell_dialogs_win.cc
+++ b/chrome/browser/ui/views/shell_dialogs_win.cc
@@ -16,7 +16,7 @@
#include "base/message_loop.h"
#include "base/scoped_comptr_win.h"
#include "base/string_split.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/win/registry.h"
#include "base/win/windows_version.h"
@@ -104,7 +104,8 @@
const std::vector<std::wstring>& ext_desc,
bool include_all_files) {
const std::wstring all_ext = L"*.*";
- const std::wstring all_desc = l10n_util::GetString(IDS_APP_SAVEAS_ALL_FILES);
+ const std::wstring all_desc =
+ l10n_util::GetStringUTF16(IDS_APP_SAVEAS_ALL_FILES);
DCHECK(file_ext.size() >= ext_desc.size());
@@ -141,9 +142,9 @@
// based on the unknown extension type (i.e. if the extension is .qqq,
// the we create a description "QQQ File (.qqq)").
include_all_files = true;
- desc = l10n_util::GetStringF(IDS_APP_SAVEAS_EXTENSION_FORMAT,
- l10n_util::ToUpper(ext_name),
- ext_name);
+ desc = l10n_util::GetStringFUTF16(IDS_APP_SAVEAS_EXTENSION_FORMAT,
+ l10n_util::ToUpper(ext_name),
+ ext_name);
}
if (desc.empty())
desc = L"*." + ext_name;
@@ -238,7 +239,7 @@
// Having an empty filter makes for a bad user experience. We should always
// specify a filter when saving.
DCHECK(!filter.empty());
- std::wstring file_part = file_util::GetFilenameFromPath(suggested_name);
+ std::wstring file_part = FilePath(suggested_name).BaseName().value();
// The size of the in/out buffer in number of characters we pass to win32
// GetSaveFileName. From MSDN "The buffer must be large enough to store the
@@ -269,7 +270,7 @@
save_as.nMaxFileTitle = 0;
// Set up the initial directory for the dialog.
- std::wstring directory = file_util::GetDirectoryFromPath(suggested_name);
+ std::wstring directory = FilePath(suggested_name).DirName().value();
save_as.lpstrInitialDir = directory.c_str();
save_as.lpstrTitle = NULL;
save_as.Flags = OFN_OVERWRITEPROMPT | OFN_EXPLORER | OFN_ENABLESIZING |
diff --git a/chrome/browser/ui/views/ssl_client_certificate_selector_win.cc b/chrome/browser/ui/views/ssl_client_certificate_selector_win.cc
index c7ddab3..45bb28f 100644
--- a/chrome/browser/ui/views/ssl_client_certificate_selector_win.cc
+++ b/chrome/browser/ui/views/ssl_client_certificate_selector_win.cc
@@ -41,10 +41,11 @@
DCHECK(ok);
}
- std::wstring title = l10n_util::GetString(IDS_CLIENT_CERT_DIALOG_TITLE);
- std::wstring text = l10n_util::GetStringF(
+ std::wstring title =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_CLIENT_CERT_DIALOG_TITLE));
+ std::wstring text = UTF16ToWide(l10n_util::GetStringFUTF16(
IDS_CLIENT_CERT_DIALOG_TEXT,
- ASCIIToWide(cert_request_info->host_and_port));
+ ASCIIToUTF16(cert_request_info->host_and_port)));
PCCERT_CONTEXT cert_context = CryptUIDlgSelectCertificateFromStore(
client_certs, parent->GetMessageBoxRootWindow(),
title.c_str(), text.c_str(), 0, 0, NULL);
diff --git a/chrome/browser/ui/views/status_bubble_views.cc b/chrome/browser/ui/views/status_bubble_views.cc
index 599e726..a684464 100644
--- a/chrome/browser/ui/views/status_bubble_views.cc
+++ b/chrome/browser/ui/views/status_bubble_views.cc
@@ -6,8 +6,6 @@
#include <algorithm>
-#include "app/animation_delegate.h"
-#include "app/linear_animation.h"
#include "app/resource_bundle.h"
#include "app/text_elider.h"
#include "base/i18n/rtl.h"
@@ -24,6 +22,8 @@
#include "third_party/skia/include/core/SkPaint.h"
#include "third_party/skia/include/core/SkPath.h"
#include "third_party/skia/include/core/SkRect.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/linear_animation.h"
#include "views/controls/label.h"
#include "views/controls/scrollbar/native_scroll_bar.h"
#include "views/screen.h"
@@ -69,12 +69,12 @@
// StatusView manages the display of the bubble, applying text changes and
// fading in or out the bubble as required.
class StatusBubbleViews::StatusView : public views::Label,
- public LinearAnimation,
- public AnimationDelegate {
+ public ui::LinearAnimation,
+ public ui::AnimationDelegate {
public:
StatusView(StatusBubble* status_bubble, views::Widget* popup,
ThemeProvider* theme_provider)
- : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(kFramerate, this)),
+ : ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(kFramerate, this)),
stage_(BUBBLE_HIDDEN),
style_(STYLE_STANDARD),
ALLOW_THIS_IN_INITIALIZER_LIST(timer_factory_(this)),
@@ -304,7 +304,7 @@
// Animation functions.
double StatusBubbleViews::StatusView::GetCurrentOpacity() {
return opacity_start_ + (opacity_end_ - opacity_start_) *
- LinearAnimation::GetCurrentValue();
+ ui::LinearAnimation::GetCurrentValue();
}
void StatusBubbleViews::StatusView::SetOpacity(double opacity) {
@@ -317,7 +317,7 @@
}
void StatusBubbleViews::StatusView::AnimationEnded(
- const Animation* animation) {
+ const ui::Animation* animation) {
SetOpacity(opacity_end_);
if (stage_ == BUBBLE_HIDING_FADE) {
@@ -430,7 +430,7 @@
// is aligned to the right on RTL UIs, we mirror the text bounds if the
// locale is RTL.
int text_width = std::min(
- views::Label::font().GetStringWidth(UTF16ToWide(text_)),
+ views::Label::font().GetStringWidth(text_),
width - (kShadowThickness * 2) - kTextPositionX - kTextHorizPadding);
int text_height = height - (kShadowThickness * 2);
gfx::Rect body_bounds(kShadowThickness + kTextPositionX,
@@ -460,12 +460,12 @@
// Manages the expansion and contraction of the status bubble as it accommodates
// URLs too long to fit in the standard bubble. Changes are passed through the
// StatusView to paint.
-class StatusBubbleViews::StatusViewExpander : public LinearAnimation,
- public AnimationDelegate {
+class StatusBubbleViews::StatusViewExpander : public ui::LinearAnimation,
+ public ui::AnimationDelegate {
public:
StatusViewExpander(StatusBubbleViews* status_bubble,
StatusView* status_view)
- : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(kFramerate, this)),
+ : ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(kFramerate, this)),
status_bubble_(status_bubble),
status_view_(status_view),
expansion_start_(0),
@@ -484,7 +484,7 @@
int GetCurrentBubbleWidth();
void SetBubbleWidth(int width);
void AnimateToState(double state);
- void AnimationEnded(const Animation* animation);
+ void AnimationEnded(const ui::Animation* animation);
// Manager that owns us.
StatusBubbleViews* status_bubble_;
@@ -505,7 +505,7 @@
}
void StatusBubbleViews::StatusViewExpander::AnimationEnded(
- const Animation* animation) {
+ const ui::Animation* animation) {
SetBubbleWidth(expansion_end_);
status_view_->SetText(expanded_text_, false);
}
@@ -525,7 +525,8 @@
int StatusBubbleViews::StatusViewExpander::GetCurrentBubbleWidth() {
return static_cast<int>(expansion_start_ +
- (expansion_end_ - expansion_start_) * LinearAnimation::GetCurrentValue());
+ (expansion_end_ - expansion_start_) *
+ ui::LinearAnimation::GetCurrentValue());
}
void StatusBubbleViews::StatusViewExpander::SetBubbleWidth(int width) {
@@ -805,7 +806,7 @@
url_text_ = gfx::ElideUrl(url_, view_->Label::font(),
max_status_bubble_width, UTF16ToWideHack(languages_));
int expanded_bubble_width =std::max(GetStandardStatusBubbleWidth(),
- std::min(view_->Label::font().GetStringWidth(UTF16ToWide(url_text_)) +
+ std::min(view_->Label::font().GetStringWidth(url_text_) +
(kShadowThickness * 2) + kTextPositionX +
kTextHorizPadding + 1,
max_status_bubble_width));
diff --git a/chrome/browser/ui/views/status_icons/status_icon_win.h b/chrome/browser/ui/views/status_icons/status_icon_win.h
index 74c3742..6bbda23 100644
--- a/chrome/browser/ui/views/status_icons/status_icon_win.h
+++ b/chrome/browser/ui/views/status_icons/status_icon_win.h
@@ -9,7 +9,7 @@
#include <windows.h>
#include <shellapi.h>
-#include "base/scoped_handle_win.h"
+#include "base/win/scoped_gdi_object.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/status_icons/status_icon.h"
@@ -54,7 +54,7 @@
UINT message_id_;
// The currently-displayed icon for the window.
- ScopedHICON icon_;
+ base::win::ScopedHICON icon_;
// Context menu associated with this icon (if any).
scoped_ptr<views::Menu2> context_menu_;
diff --git a/chrome/browser/ui/views/status_icons/status_tray_win.cc b/chrome/browser/ui/views/status_icons/status_tray_win.cc
index 29ed025..53f80f9 100644
--- a/chrome/browser/ui/views/status_icons/status_tray_win.cc
+++ b/chrome/browser/ui/views/status_icons/status_tray_win.cc
@@ -4,7 +4,7 @@
#include "chrome/browser/views/status_icons/status_tray_win.h"
-#include "base/win_util.h"
+#include "app/win/hwnd_util.h"
#include "chrome/browser/views/status_icons/status_icon_win.h"
#include "chrome/common/chrome_constants.h"
@@ -25,7 +25,7 @@
// Create an offscreen window for handling messages for the status icons.
window_ = CreateWindow(chrome::kStatusTrayWindowClass,
0, 0, 0, 0, 0, 0, HWND_MESSAGE, 0, hinst, 0);
- win_util::SetWindowUserData(window_, this);
+ app::win::SetWindowUserData(window_, this);
}
LRESULT CALLBACK StatusTrayWin::WndProcStatic(HWND hwnd,
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc
index 7ea2501..4b21ec0 100644
--- a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.cc
@@ -11,7 +11,8 @@
#include "base/file_path.h"
#include "base/message_loop.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_node_data.h"
#include "chrome/browser/browser_thread.h"
@@ -171,7 +172,7 @@
const std::string& page_encoding,
const SkBitmap& image,
const gfx::Point& image_offset) {
- drag_drop_thread_id_ = PlatformThread::CurrentId();
+ drag_drop_thread_id_ = base::PlatformThread::CurrentId();
DoDragging(drop_data, ops, page_url, page_encoding, image, image_offset);
BrowserThread::PostTask(
@@ -345,7 +346,7 @@
}
void TabContentsDragWin::OnWaitForData() {
- DCHECK(drag_drop_thread_id_ == PlatformThread::CurrentId());
+ DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
// When the left button is release and we start to wait for the data, end
// the dragging before DoDragDrop returns. This makes the page leave the drag
@@ -356,7 +357,7 @@
}
void TabContentsDragWin::OnDataObjectDisposed() {
- DCHECK(drag_drop_thread_id_ == PlatformThread::CurrentId());
+ DCHECK(drag_drop_thread_id_ == base::PlatformThread::CurrentId());
// The drag-and-drop thread is only closed after OLE is done with
// DataObjectImpl.
diff --git a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h
index d787931..7e2b7c8 100644
--- a/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h
+++ b/chrome/browser/ui/views/tab_contents/tab_contents_drag_win.h
@@ -7,9 +7,9 @@
#pragma once
#include "app/os_exchange_data_provider_win.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/threading/platform_thread.h"
#include "gfx/point.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
@@ -71,7 +71,7 @@
void CloseThread();
// For debug check only. Access only on drag-and-drop thread.
- PlatformThreadId drag_drop_thread_id_;
+ base::PlatformThreadId drag_drop_thread_id_;
// All the member variables below are accessed on UI thread.
diff --git a/chrome/browser/ui/views/tabs/base_tab.cc b/chrome/browser/ui/views/tabs/base_tab.cc
index 01a5344..0a60a11 100644
--- a/chrome/browser/ui/views/tabs/base_tab.cc
+++ b/chrome/browser/ui/views/tabs/base_tab.cc
@@ -8,9 +8,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
#include "app/theme_provider.h"
-#include "app/throb_animation.h"
#include "base/command_line.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/tab_contents/tab_contents.h"
@@ -24,12 +22,10 @@
#include "grit/app_resources.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/throb_animation.h"
#include "views/controls/button/image_button.h"
-#ifdef WIN32
-#include "app/win_util.h"
-#endif
-
// How long the pulse throb takes.
static const int kPulseDurationMs = 200;
@@ -85,16 +81,16 @@
// FaviconCrashAnimation
//
// A custom animation subclass to manage the favicon crash animation.
-class BaseTab::FavIconCrashAnimation : public LinearAnimation,
- public AnimationDelegate {
+class BaseTab::FavIconCrashAnimation : public ui::LinearAnimation,
+ public ui::AnimationDelegate {
public:
explicit FavIconCrashAnimation(BaseTab* target)
- : ALLOW_THIS_IN_INITIALIZER_LIST(LinearAnimation(1000, 25, this)),
+ : ALLOW_THIS_IN_INITIALIZER_LIST(ui::LinearAnimation(1000, 25, this)),
target_(target) {
}
virtual ~FavIconCrashAnimation() {}
- // Animation overrides:
+ // ui::Animation overrides:
virtual void AnimateToState(double state) {
const double kHidingOffset = 27;
@@ -109,8 +105,8 @@
}
}
- // AnimationDelegate overrides:
- virtual void AnimationCanceled(const Animation* animation) {
+ // ui::AnimationDelegate overrides:
+ virtual void AnimationCanceled(const ui::Animation* animation) {
target_->SetFavIconHidingOffset(0);
}
@@ -142,8 +138,10 @@
rb.GetBitmapNamed(IDR_TAB_CLOSE_H));
close_button_->SetImage(views::CustomButton::BS_PUSHED,
rb.GetBitmapNamed(IDR_TAB_CLOSE_P));
- close_button_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_CLOSE_TAB));
- close_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_CLOSE));
+ close_button_->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_CLOSE_TAB)));
+ close_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_CLOSE)));
// Disable animation so that the red danger sign shows up immediately
// to help avoid mis-clicks.
close_button_->SetAnimationDuration(0);
@@ -199,7 +197,7 @@
void BaseTab::StartPulse() {
if (!pulse_animation_.get()) {
- pulse_animation_.reset(new ThrobAnimation(this));
+ pulse_animation_.reset(new ui::ThrobAnimation(this));
pulse_animation_->SetSlideDuration(kPulseDurationMs);
if (animation_container_.get())
pulse_animation_->SetContainer(animation_container_.get());
@@ -226,16 +224,16 @@
void BaseTab::OnMouseEntered(const views::MouseEvent& e) {
if (!hover_animation_.get()) {
- hover_animation_.reset(new SlideAnimation(this));
+ hover_animation_.reset(new ui::SlideAnimation(this));
hover_animation_->SetContainer(animation_container_.get());
hover_animation_->SetSlideDuration(kHoverDurationMs);
}
- hover_animation_->SetTweenType(Tween::EASE_OUT);
+ hover_animation_->SetTweenType(ui::Tween::EASE_OUT);
hover_animation_->Show();
}
void BaseTab::OnMouseExited(const views::MouseEvent& e) {
- hover_animation_->SetTweenType(Tween::EASE_IN);
+ hover_animation_->SetTweenType(ui::Tween::EASE_IN);
hover_animation_->Hide();
}
@@ -295,10 +293,9 @@
if (data_.title.empty())
return false;
- std::wstring title = UTF16ToWide(data_.title);
// Only show the tooltip if the title is truncated.
- if (font_->GetStringWidth(title) > title_bounds().width()) {
- *tooltip = title;
+ if (font_->GetStringWidth(data_.title) > title_bounds().width()) {
+ *tooltip = UTF16ToWide(data_.title);
return true;
}
return false;
@@ -414,15 +411,15 @@
title_bounds().width(), title_bounds().height());
}
-void BaseTab::AnimationProgressed(const Animation* animation) {
+void BaseTab::AnimationProgressed(const ui::Animation* animation) {
SchedulePaint();
}
-void BaseTab::AnimationCanceled(const Animation* animation) {
+void BaseTab::AnimationCanceled(const ui::Animation* animation) {
SchedulePaint();
}
-void BaseTab::AnimationEnded(const Animation* animation) {
+void BaseTab::AnimationEnded(const ui::Animation* animation) {
SchedulePaint();
}
diff --git a/chrome/browser/ui/views/tabs/base_tab.h b/chrome/browser/ui/views/tabs/base_tab.h
index 8f47c51..1a98bdc 100644
--- a/chrome/browser/ui/views/tabs/base_tab.h
+++ b/chrome/browser/ui/views/tabs/base_tab.h
@@ -6,30 +6,33 @@
#define CHROME_BROWSER_UI_VIEWS_TABS_BASE_TAB_H_
#pragma once
-#include "app/animation_container.h"
-#include "app/animation_delegate.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/views/tabs/tab_renderer_data.h"
+#include "ui/base/animation/animation_container.h"
+#include "ui/base/animation/animation_delegate.h"
#include "views/controls/button/button.h"
#include "views/view.h"
-class AnimationContainer;
class BaseTab;
-class SlideAnimation;
class TabController;
-class ThrobAnimation;
namespace gfx {
class Font;
-} // namespace gfx
+}
+
+namespace ui {
+class AnimationContainer;
+class SlideAnimation;
+class ThrobAnimation;
+}
namespace views {
class ImageButton;
-} // namespace views
+}
// Base class for tab renderers.
-class BaseTab : public AnimationDelegate,
+class BaseTab : public ui::AnimationDelegate,
public views::ButtonListener,
public views::ContextMenuController,
public views::View {
@@ -59,10 +62,10 @@
bool dragging() const { return dragging_; }
// Sets the container all animations run from.
- void set_animation_container(AnimationContainer* container) {
+ void set_animation_container(ui::AnimationContainer* container) {
animation_container_ = container;
}
- AnimationContainer* animation_container() const {
+ ui::AnimationContainer* animation_container() const {
return animation_container_.get();
}
@@ -102,10 +105,10 @@
// Returns the pulse animation. The pulse animation is non-null if StartPulse
// has been invoked.
- ThrobAnimation* pulse_animation() const { return pulse_animation_.get(); }
+ ui::ThrobAnimation* pulse_animation() const { return pulse_animation_.get(); }
// Returns the hover animation. This may return null.
- const SlideAnimation* hover_animation() const {
+ const ui::SlideAnimation* hover_animation() const {
return hover_animation_.get();
}
@@ -116,9 +119,9 @@
void PaintTitle(gfx::Canvas* canvas, SkColor title_color);
// Overridden from AnimationDelegate:
- virtual void AnimationProgressed(const Animation* animation);
- virtual void AnimationCanceled(const Animation* animation);
- virtual void AnimationEnded(const Animation* animation);
+ virtual void AnimationProgressed(const ui::Animation* animation);
+ virtual void AnimationCanceled(const ui::Animation* animation);
+ virtual void AnimationEnded(const ui::Animation* animation);
// views::ButtonListener overrides:
virtual void ButtonPressed(views::Button* sender,
@@ -168,15 +171,15 @@
bool dragging_;
// Pulse animation.
- scoped_ptr<ThrobAnimation> pulse_animation_;
+ scoped_ptr<ui::ThrobAnimation> pulse_animation_;
// Hover animation.
- scoped_ptr<SlideAnimation> hover_animation_;
+ scoped_ptr<ui::SlideAnimation> hover_animation_;
// Crash animation.
scoped_ptr<FavIconCrashAnimation> crash_animation_;
- scoped_refptr<AnimationContainer> animation_container_;
+ scoped_refptr<ui::AnimationContainer> animation_container_;
views::ImageButton* close_button_;
diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.cc b/chrome/browser/ui/views/tabs/base_tab_strip.cc
index 3035d30..8a467d9 100644
--- a/chrome/browser/ui/views/tabs/base_tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/base_tab_strip.cc
@@ -12,7 +12,6 @@
#include "views/window/window.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
#include "views/widget/widget_win.h"
#endif
@@ -26,11 +25,11 @@
explicit ResetDraggingStateDelegate(BaseTab* tab) : tab_(tab) {
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
tab_->set_dragging(false);
}
- virtual void AnimationCanceled(const Animation* animation) {
+ virtual void AnimationCanceled(const ui::Animation* animation) {
tab_->set_dragging(false);
}
@@ -52,11 +51,11 @@
tab_(tab) {
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
CompleteRemove();
}
- virtual void AnimationCanceled(const Animation* animation) {
+ virtual void AnimationCanceled(const ui::Animation* animation) {
// We can be canceled for two interesting reasons:
// . The tab we reference was dragged back into the tab strip. In this case
// we don't want to remove the tab (closing is false).
@@ -464,7 +463,7 @@
}
}
-AnimationDelegate* BaseTabStrip::CreateRemoveTabDelegate(BaseTab* tab) {
+ui::AnimationDelegate* BaseTabStrip::CreateRemoveTabDelegate(BaseTab* tab) {
return new RemoveTabDelegate(this, tab);
}
diff --git a/chrome/browser/ui/views/tabs/base_tab_strip.h b/chrome/browser/ui/views/tabs/base_tab_strip.h
index 491f991..98b304e 100644
--- a/chrome/browser/ui/views/tabs/base_tab_strip.h
+++ b/chrome/browser/ui/views/tabs/base_tab_strip.h
@@ -224,7 +224,7 @@
// Creates an AnimationDelegate that resets state after a remove animation
// completes. The caller owns the returned object.
- AnimationDelegate* CreateRemoveTabDelegate(BaseTab* tab);
+ ui::AnimationDelegate* CreateRemoveTabDelegate(BaseTab* tab);
// Invoked from Layout if the size changes or layout is really needed.
virtual void DoLayout();
diff --git a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
index 3a64df6..51e24af 100644
--- a/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
+++ b/chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc
@@ -54,11 +54,8 @@
}
void RunMenuAt(const gfx::Point& point) {
- BrowserTabStripController* controller = controller_;
menu_->RunMenuAt(point, views::Menu2::ALIGN_TOPLEFT);
// We could be gone now. Assume |this| is junk!
- if (controller)
- controller->tabstrip_->StopAllHighlighting();
}
// Overridden from menus::SimpleMenuModel::Delegate:
@@ -88,6 +85,10 @@
controller_->StartHighlightTabsForCommand(last_command_, tab_);
}
virtual void ExecuteCommand(int command_id) {
+ // Executing the command destroys |this|, and can also end up destroying
+ // |controller_| (e.g. for |CommandUseVerticalTabs|). So stop the highlights
+ // before executing the command.
+ controller_->tabstrip_->StopAllHighlighting();
controller_->ExecuteCommandForTab(
static_cast<TabStripModel::ContextMenuCommand>(command_id),
tab_);
diff --git a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
index d7e350a..e23e1c4 100644
--- a/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
+++ b/chrome/browser/ui/views/tabs/dragged_tab_controller.cc
@@ -7,9 +7,6 @@
#include <math.h>
#include <set>
-#include "app/animation.h"
-#include "app/animation_delegate.h"
-#include "app/slide_animation.h"
#include "app/resource_bundle.h"
#include "base/callback.h"
#include "base/i18n/rtl.h"
@@ -33,6 +30,9 @@
#include "gfx/canvas_skia.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/core/SkBitmap.h"
+#include "ui/base/animation/animation.h"
+#include "ui/base/animation/animation_delegate.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/event.h"
#include "views/widget/root_view.h"
#include "views/widget/widget.h"
@@ -199,7 +199,7 @@
// possible dock position (as represented by DockInfo). DockDisplayer shows
// a window with a DockView in it. Two animations are used that correspond to
// the state of DockInfo::in_enable_area.
-class DraggedTabController::DockDisplayer : public AnimationDelegate {
+class DraggedTabController::DockDisplayer : public ui::AnimationDelegate {
public:
DockDisplayer(DraggedTabController* controller,
const DockInfo& info)
@@ -265,11 +265,11 @@
animation_.Hide();
}
- virtual void AnimationProgressed(const Animation* animation) {
+ virtual void AnimationProgressed(const ui::Animation* animation) {
UpdateLayeredAlpha();
}
- virtual void AnimationEnded(const Animation* animation) {
+ virtual void AnimationEnded(const ui::Animation* animation) {
if (!hidden_)
return;
#if defined(OS_WIN)
@@ -303,7 +303,7 @@
gfx::NativeView popup_view_;
// Animation for when first made visible.
- SlideAnimation animation_;
+ ui::SlideAnimation animation_;
// Have we been hidden?
bool hidden_;
@@ -1021,12 +1021,12 @@
const gfx::Size& tab_size = attached_tab_->bounds().size();
if (attached_tabstrip_->type() == BaseTabStrip::HORIZONTAL_TAB_STRIP) {
- int max_x = attached_tabstrip_->bounds().right() - tab_size.width();
+ int max_x = attached_tabstrip_->width() - tab_size.width();
x = std::min(std::max(x, 0), max_x);
y = 0;
} else {
x = SideTabStrip::kTabStripInset;
- int max_y = attached_tabstrip_->bounds().bottom() - tab_size.height();
+ int max_y = attached_tabstrip_->height() - tab_size.height();
y = std::min(std::max(y, SideTabStrip::kTabStripInset), max_y);
}
return gfx::Point(x, y);
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index 59cab04..98e19cc 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -6,10 +6,7 @@
#include <limits>
-#include "app/multi_animation.h"
#include "app/resource_bundle.h"
-#include "app/slide_animation.h"
-#include "app/throb_animation.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/themes/browser_theme_provider.h"
@@ -22,6 +19,9 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "third_party/skia/include/effects/SkGradientShader.h"
+#include "ui/base/animation/multi_animation.h"
+#include "ui/base/animation/slide_animation.h"
+#include "ui/base/animation/throb_animation.h"
#include "views/controls/button/image_button.h"
#include "views/widget/tooltip_manager.h"
#include "views/widget/widget.h"
@@ -114,18 +114,21 @@
void Tab::StartMiniTabTitleAnimation() {
if (!mini_title_animation_.get()) {
- MultiAnimation::Parts parts;
- parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS,
- Tween::EASE_OUT));
- parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS,
- Tween::ZERO));
- parts.push_back(MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS,
- Tween::EASE_IN));
+ ui::MultiAnimation::Parts parts;
+ parts.push_back(
+ ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration1MS,
+ ui::Tween::EASE_OUT));
+ parts.push_back(
+ ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration2MS,
+ ui::Tween::ZERO));
+ parts.push_back(
+ ui::MultiAnimation::Part(kMiniTitleChangeAnimationDuration3MS,
+ ui::Tween::EASE_IN));
parts[0].start_time_ms = kMiniTitleChangeAnimationStart1MS;
parts[0].end_time_ms = kMiniTitleChangeAnimationEnd1MS;
parts[2].start_time_ms = kMiniTitleChangeAnimationStart3MS;
parts[2].end_time_ms = kMiniTitleChangeAnimationEnd3MS;
- mini_title_animation_.reset(new MultiAnimation(parts));
+ mini_title_animation_.reset(new ui::MultiAnimation(parts));
mini_title_animation_->SetContainer(animation_container());
mini_title_animation_->set_delegate(this);
}
@@ -588,7 +591,7 @@
SkPoint loc = { SkIntToScalar(hover_point_.x()),
SkIntToScalar(hover_point_.y()) };
SkColor colors[2];
- const SlideAnimation* hover_slide = hover_animation();
+ const ui::SlideAnimation* hover_slide = hover_animation();
int hover_alpha = 0;
if (hover_slide) {
hover_alpha =
@@ -603,12 +606,15 @@
NULL,
2,
SkShader::kClamp_TileMode);
- paint.setShader(shader);
- shader->unref();
- hover_canvas.DrawRectInt(hover_point_.x() - radius,
- hover_point_.y() - radius,
- radius * 2, radius * 2, paint);
-
+ // Shader can end up null when radius = 0.
+ // If so, this results in default full tab glow behavior.
+ if (shader) {
+ paint.setShader(shader);
+ shader->unref();
+ hover_canvas.DrawRectInt(hover_point_.x() - radius,
+ hover_point_.y() - radius,
+ radius * 2, radius * 2, paint);
+ }
return hover_canvas.ExtractBitmap();
}
diff --git a/chrome/browser/ui/views/tabs/tab.h b/chrome/browser/ui/views/tabs/tab.h
index a3da1c5..743f818 100644
--- a/chrome/browser/ui/views/tabs/tab.h
+++ b/chrome/browser/ui/views/tabs/tab.h
@@ -12,8 +12,10 @@
#include "chrome/browser/views/tabs/base_tab.h"
#include "gfx/point.h"
+namespace ui {
class MultiAnimation;
class SlideAnimation;
+}
///////////////////////////////////////////////////////////////////////////////
//
@@ -110,7 +112,7 @@
gfx::Point hover_point_;
// Animation used when the title of an inactive mini tab changes.
- scoped_ptr<MultiAnimation> mini_title_animation_;
+ scoped_ptr<ui::MultiAnimation> mini_title_animation_;
struct TabImage {
SkBitmap* image_l;
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index d8e03f2..f0c6017 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -4,12 +4,12 @@
#include "chrome/browser/views/tabs/tab_strip.h"
-#include "app/animation_container.h"
#include "app/drag_drop_types.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/compiler_specific.h"
#include "base/stl_util-inl.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/themes/browser_theme_provider.h"
#include "chrome/browser/ui/browser.h"
@@ -22,13 +22,14 @@
#include "gfx/size.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "ui/base/animation/animation_container.h"
#include "views/controls/image_view.h"
#include "views/widget/default_theme_provider.h"
#include "views/window/non_client_view.h"
#include "views/window/window.h"
#if defined(OS_WIN)
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#include "views/widget/widget_win.h"
#elif defined(OS_LINUX)
#include "views/widget/widget_gtk.h"
@@ -119,7 +120,7 @@
current_selected_width_(Tab::GetStandardSize().width()),
available_width_for_tabs_(-1),
in_tab_close_(false),
- animation_container_(new AnimationContainer()) {
+ animation_container_(new ui::AnimationContainer()) {
Init();
}
@@ -147,7 +148,8 @@
views::ImageButton::ALIGN_BOTTOM);
}
LoadNewTabButtonImage();
- newtab_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEWTAB));
+ newtab_button_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_NEWTAB)));
AddChildView(newtab_button_);
}
@@ -687,7 +689,7 @@
// If the rect doesn't fit on the monitor, push the arrow to the bottom.
#if defined(OS_WIN)
- gfx::Rect monitor_bounds = win_util::GetMonitorBoundsForRect(drop_bounds);
+ gfx::Rect monitor_bounds = app::win::GetMonitorBoundsForRect(drop_bounds);
*is_beneath = (monitor_bounds.IsEmpty() ||
!monitor_bounds.Contains(drop_bounds));
#else
diff --git a/chrome/browser/ui/views/tabs/tab_strip.h b/chrome/browser/ui/views/tabs/tab_strip.h
index d01938e..ca2aed3 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.h
+++ b/chrome/browser/ui/views/tabs/tab_strip.h
@@ -6,12 +6,12 @@
#define CHROME_BROWSER_UI_VIEWS_TABS_TAB_STRIP_H_
#pragma once
-#include "app/animation_container.h"
#include "base/ref_counted.h"
#include "base/timer.h"
#include "chrome/browser/views/tabs/base_tab_strip.h"
#include "gfx/point.h"
#include "gfx/rect.h"
+#include "ui/base/animation/animation_container.h"
#include "views/controls/button/image_button.h"
#include "views/mouse_watcher.h"
@@ -271,7 +271,7 @@
// To ensure all tabs pulse at the same time they share the same animation
// container. This is that animation container.
- scoped_refptr<AnimationContainer> animation_container_;
+ scoped_refptr<ui::AnimationContainer> animation_container_;
// Used for stage 1 of new tab animation.
base::OneShotTimer<TabStrip> new_tab_timer_;
diff --git a/chrome/browser/ui/views/task_manager_view.cc b/chrome/browser/ui/views/task_manager_view.cc
index 99061c6..a80d6de 100644
--- a/chrome/browser/ui/views/task_manager_view.cc
+++ b/chrome/browser/ui/views/task_manager_view.cc
@@ -7,6 +7,7 @@
#include "app/l10n_util.h"
#include "app/table_model_observer.h"
#include "base/command_line.h"
+#include "base/compiler_specific.h"
#include "base/metrics/stats_table.h"
#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
@@ -57,12 +58,12 @@
}
// GroupTableModel.
- int RowCount();
- std::wstring GetText(int row, int column);
- SkBitmap GetIcon(int row);
- void GetGroupRangeForItem(int item, views::GroupRange* range);
- void SetObserver(TableModelObserver* observer);
- virtual int CompareValues(int row1, int row2, int column_id);
+ int RowCount() OVERRIDE;
+ string16 GetText(int row, int column) OVERRIDE;
+ SkBitmap GetIcon(int row) OVERRIDE;
+ void GetGroupRangeForItem(int item, views::GroupRange* range) OVERRIDE;
+ void SetObserver(TableModelObserver* observer) OVERRIDE;
+ virtual int CompareValues(int row1, int row2, int column_id) OVERRIDE;
// TaskManagerModelObserver.
virtual void OnModelChanged();
@@ -79,70 +80,70 @@
return model_->ResourceCount();
}
-std::wstring TaskManagerTableModel::GetText(int row, int col_id) {
+string16 TaskManagerTableModel::GetText(int row, int col_id) {
switch (col_id) {
case IDS_TASK_MANAGER_PAGE_COLUMN: // Process
- return UTF16ToWide(model_->GetResourceTitle(row));
+ return model_->GetResourceTitle(row);
case IDS_TASK_MANAGER_NET_COLUMN: // Net
- return UTF16ToWide(model_->GetResourceNetworkUsage(row));
+ return model_->GetResourceNetworkUsage(row);
case IDS_TASK_MANAGER_CPU_COLUMN: // CPU
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourceCPUUsage(row));
+ return string16();
+ return model_->GetResourceCPUUsage(row);
case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: // Memory
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourcePrivateMemory(row));
+ return string16();
+ return model_->GetResourcePrivateMemory(row);
case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: // Memory
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourceSharedMemory(row));
+ return string16();
+ return model_->GetResourceSharedMemory(row);
case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: // Memory
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourcePhysicalMemory(row));
+ return string16();
+ return model_->GetResourcePhysicalMemory(row);
case IDS_TASK_MANAGER_PROCESS_ID_COLUMN:
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourceProcessId(row));
+ return string16();
+ return model_->GetResourceProcessId(row);
case IDS_TASK_MANAGER_GOATS_TELEPORTED_COLUMN: // Goats Teleported!
- return UTF16ToWide(model_->GetResourceGoatsTeleported(row));
+ return model_->GetResourceGoatsTeleported(row);
case IDS_TASK_MANAGER_WEBCORE_IMAGE_CACHE_COLUMN:
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourceWebCoreImageCacheSize(row));
+ return string16();
+ return model_->GetResourceWebCoreImageCacheSize(row);
case IDS_TASK_MANAGER_WEBCORE_SCRIPTS_CACHE_COLUMN:
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourceWebCoreScriptsCacheSize(row));
+ return string16();
+ return model_->GetResourceWebCoreScriptsCacheSize(row);
case IDS_TASK_MANAGER_WEBCORE_CSS_CACHE_COLUMN:
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourceWebCoreCSSCacheSize(row));
+ return string16();
+ return model_->GetResourceWebCoreCSSCacheSize(row);
case IDS_TASK_MANAGER_SQLITE_MEMORY_USED_COLUMN:
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourceSqliteMemoryUsed(row));
+ return string16();
+ return model_->GetResourceSqliteMemoryUsed(row);
case IDS_TASK_MANAGER_JAVASCRIPT_MEMORY_ALLOCATED_COLUMN:
if (!model_->IsResourceFirstInGroup(row))
- return std::wstring();
- return UTF16ToWide(model_->GetResourceV8MemoryAllocatedSize(row));
+ return string16();
+ return model_->GetResourceV8MemoryAllocatedSize(row);
default:
NOTREACHED();
- return std::wstring();
+ return string16();
}
}
@@ -379,15 +380,15 @@
if (CommandLine::ForCurrentProcess()->HasSwitch(
switches::kPurgeMemoryButton)) {
purge_memory_button_ = new views::NativeButton(this,
- l10n_util::GetString(IDS_TASK_MANAGER_PURGE_MEMORY));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_PURGE_MEMORY)));
}
kill_button_ = new views::NativeButton(
- this, l10n_util::GetString(IDS_TASK_MANAGER_KILL));
+ this, UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_KILL)));
kill_button_->AddAccelerator(views::Accelerator(app::VKEY_E,
false, false, false));
kill_button_->SetAccessibleKeyboardShortcut(L"E");
- about_memory_link_ = new views::Link(
- l10n_util::GetString(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK));
+ about_memory_link_ = new views::Link(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_TASK_MANAGER_ABOUT_MEMORY_LINK)));
about_memory_link_->SetController(this);
// Makes sure our state is consistent.
@@ -407,7 +408,7 @@
// stat names not in the string table would be filtered out.
// TODO(erikkay): Width is hard-coded right now, so many column
// names are clipped.
- TableColumn col(i, ASCIIToWide(row), TableColumn::RIGHT, 90, 0);
+ TableColumn col(i, ASCIIToUTF16(row), TableColumn::RIGHT, 90, 0);
col.sortable = true;
columns_.push_back(col);
tab_table_->AddColumn(col);
@@ -560,7 +561,7 @@
}
std::wstring TaskManagerView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_TASK_MANAGER_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_TITLE));
}
std::wstring TaskManagerView::GetWindowName() const {
@@ -618,7 +619,7 @@
this, views::Menu::TOPLEFT, source->GetWidget()->GetNativeView()));
for (std::vector<TableColumn>::iterator i =
columns_.begin(); i != columns_.end(); ++i) {
- menu->AppendMenuItem(i->id, l10n_util::GetString(i->id),
+ menu->AppendMenuItem(i->id, l10n_util::GetStringUTF16(i->id),
views::Menu::CHECKBOX);
}
menu->RunMenuAt(p.x(), p.y());
@@ -651,7 +652,8 @@
void TaskManagerView::AddAlwaysOnTopSystemMenuItem() {
// The Win32 API requires that we own the text.
- always_on_top_menu_text_ = l10n_util::GetString(IDS_ALWAYS_ON_TOP);
+ always_on_top_menu_text_ =
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ALWAYS_ON_TOP));
// Let's insert a menu to the window.
HMENU system_menu = ::GetSystemMenu(GetWindow()->GetNativeWindow(), FALSE);
diff --git a/chrome/browser/ui/views/theme_install_bubble_view.cc b/chrome/browser/ui/views/theme_install_bubble_view.cc
index d811774..157e7fd 100644
--- a/chrome/browser/ui/views/theme_install_bubble_view.cc
+++ b/chrome/browser/ui/views/theme_install_bubble_view.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/common/notification_service.h"
#include "gfx/canvas_skia.h"
@@ -32,7 +33,7 @@
if (!tab_contents)
Close();
- text_ = l10n_util::GetString(IDS_THEME_LOADING_TITLE);
+ text_ = l10n_util::GetStringUTF16(IDS_THEME_LOADING_TITLE);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
gfx::Font font(rb.GetFont(ResourceBundle::LargeFont));
SetFont(font);
@@ -134,8 +135,12 @@
body_bounds.set_x(MirroredLeftPointForRect(body_bounds));
SkColor text_color = SK_ColorWHITE;
- canvas->DrawStringInt(text_, views::Label::font(), text_color,
- body_bounds.x(), body_bounds.y(), body_bounds.width(),
+ canvas->DrawStringInt(UTF16ToWideHack(text_),
+ views::Label::font(),
+ text_color,
+ body_bounds.x(),
+ body_bounds.y(),
+ body_bounds.width(),
body_bounds.height());
}
diff --git a/chrome/browser/ui/views/theme_install_bubble_view.h b/chrome/browser/ui/views/theme_install_bubble_view.h
index ca4c827..4bd070f 100644
--- a/chrome/browser/ui/views/theme_install_bubble_view.h
+++ b/chrome/browser/ui/views/theme_install_bubble_view.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,8 +6,7 @@
#define CHROME_BROWSER_UI_VIEWS_THEME_INSTALL_BUBBLE_VIEW_H_
#pragma once
-#include <string>
-
+#include "base/string16.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
#include "gfx/canvas.h"
@@ -66,7 +65,7 @@
views::Widget* popup_;
// Text to show warning that theme is being installed.
- std::wstring text_;
+ string16 text_;
// A scoped container for notification registries.
NotificationRegistrar registrar_;
diff --git a/chrome/browser/ui/views/toolbar_view.cc b/chrome/browser/ui/views/toolbar_view.cc
index 7044ec2..3ebeef9 100644
--- a/chrome/browser/ui/views/toolbar_view.cc
+++ b/chrome/browser/ui/views/toolbar_view.cc
@@ -7,9 +7,11 @@
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
#include "base/i18n/number_formatting.h"
+#include "base/utf_string_conversions.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/accessibility/browser_accessibility_state.h"
#include "chrome/browser/background_page_tracker.h"
+#include "chrome/browser/metrics/user_metrics.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/themes/browser_theme_provider.h"
@@ -21,7 +23,6 @@
#include "chrome/browser/ui/views/event_utils.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/upgrade_detector.h"
-#include "chrome/common/badge_util.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/pref_names.h"
#include "gfx/canvas.h"
@@ -72,10 +73,6 @@
static const int kPopupBottomSpacingNonGlass = 2;
static const int kPopupBottomSpacingGlass = 1;
-// The size of the font to use in the text overlay for the background page
-// badge.
-static const float kBadgeTextFontSize = 9.0;
-
// Top margin for the wrench menu badges (badge is placed in the upper right
// corner of the wrench menu).
static const int kBadgeTopMargin = 2;
@@ -154,16 +151,20 @@
back_->set_tag(IDC_BACK);
back_->SetImageAlignment(views::ImageButton::ALIGN_RIGHT,
views::ImageButton::ALIGN_TOP);
- back_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_BACK));
- back_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_BACK));
+ back_->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_BACK)));
+ back_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_BACK)));
back_->SetID(VIEW_ID_BACK_BUTTON);
forward_ = new views::ButtonDropDown(this, forward_menu_model_.get());
forward_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
views::Event::EF_MIDDLE_BUTTON_DOWN);
forward_->set_tag(IDC_FORWARD);
- forward_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_FORWARD));
- forward_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_FORWARD));
+ forward_->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_FORWARD)));
+ forward_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_FORWARD)));
forward_->SetID(VIEW_ID_FORWARD_BUTTON);
// Have to create this before |reload_| as |reload_|'s constructor needs it.
@@ -175,17 +176,20 @@
reload_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
views::Event::EF_MIDDLE_BUTTON_DOWN);
reload_->set_tag(IDC_RELOAD);
- reload_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_RELOAD));
- reload_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_RELOAD));
+ reload_->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_RELOAD)));
+ reload_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_RELOAD)));
reload_->SetID(VIEW_ID_RELOAD_BUTTON);
#if defined(OS_CHROMEOS)
feedback_ = new views::ImageButton(this);
feedback_->set_tag(IDC_FEEDBACK);
feedback_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
- views::Event::EF_MIDDLE_BUTTON_DOWN);
+ views::Event::EF_MIDDLE_BUTTON_DOWN);
feedback_->set_tag(IDC_FEEDBACK);
- feedback_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_FEEDBACK));
+ feedback_->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_FEEDBACK)));
feedback_->SetID(VIEW_ID_FEEDBACK_BUTTON);
#endif
@@ -193,8 +197,10 @@
home_->set_triggerable_event_flags(views::Event::EF_LEFT_BUTTON_DOWN |
views::Event::EF_MIDDLE_BUTTON_DOWN);
home_->set_tag(IDC_HOME);
- home_->SetTooltipText(l10n_util::GetString(IDS_TOOLTIP_HOME));
- home_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_HOME));
+ home_->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_TOOLTIP_HOME)));
+ home_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_HOME)));
home_->SetID(VIEW_ID_HOME_BUTTON);
browser_actions_ = new BrowserActionsContainer(browser_, this);
@@ -202,9 +208,11 @@
app_menu_ = new views::MenuButton(NULL, std::wstring(), this, false);
app_menu_->set_border(NULL);
app_menu_->EnableCanvasFlippingForRTLUI(true);
- app_menu_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_APP));
- app_menu_->SetTooltipText(l10n_util::GetStringF(IDS_APPMENU_TOOLTIP,
- l10n_util::GetString(IDS_PRODUCT_NAME)));
+ app_menu_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_APP)));
+ app_menu_->SetTooltipText(UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_APPMENU_TOOLTIP,
+ l10n_util::GetStringUTF16(IDS_PRODUCT_NAME))));
app_menu_->SetID(VIEW_ID_APP_MENU);
// Add any necessary badges to the menu item based on the system state.
@@ -234,8 +242,10 @@
// Accessibility specific tooltip text.
if (BrowserAccessibilityState::GetInstance()->IsAccessibleBrowser()) {
- back_->SetTooltipText(l10n_util::GetString(IDS_ACCNAME_TOOLTIP_BACK));
- forward_->SetTooltipText(l10n_util::GetString(IDS_ACCNAME_TOOLTIP_FORWARD));
+ back_->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_BACK)));
+ forward_->SetTooltipText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_TOOLTIP_FORWARD)));
}
}
@@ -723,6 +733,15 @@
}
SkBitmap icon = *tp->GetBitmapNamed(id);
+#if defined(OS_WIN)
+ // Keep track of whether we were showing the badge before, so we don't send
+ // multiple UMA events for example when multiple Chrome windows are open.
+ static bool incompatibility_badge_showing = false;
+ // Save the old value before resetting it.
+ bool was_showing = incompatibility_badge_showing;
+ incompatibility_badge_showing = false;
+#endif
+
bool add_badge = IsUpgradeRecommended() ||
ShouldShowIncompatibilityWarning() ||
ShouldShowBackgroundPageBadge();
@@ -741,10 +760,13 @@
if (IsUpgradeRecommended()) {
badge = *tp->GetBitmapNamed(IDR_UPDATE_BADGE);
} else if (ShouldShowBackgroundPageBadge()) {
- badge = GetBackgroundPageBadge();
+ badge = *tp->GetBitmapNamed(IDR_BACKGROUND_BADGE);
} else if (ShouldShowIncompatibilityWarning()) {
#if defined(OS_WIN)
+ if (!was_showing)
+ UserMetrics::RecordAction(UserMetricsAction("ConflictBadge"), profile_);
badge = *tp->GetBitmapNamed(IDR_CONFLICT_BADGE);
+ incompatibility_badge_showing = true;
#else
NOTREACHED();
#endif
@@ -756,16 +778,3 @@
return canvas->ExtractBitmap();
}
-
-SkBitmap ToolbarView::GetBackgroundPageBadge() {
- ThemeProvider* tp = GetThemeProvider();
- SkBitmap* badge = tp->GetBitmapNamed(IDR_BACKGROUND_BADGE);
- string16 badge_text = base::FormatNumber(
- BackgroundPageTracker::GetInstance()->GetBackgroundPageCount());
- return badge_util::DrawBadgeIconOverlay(
- *badge,
- kBadgeTextFontSize,
- badge_text,
- l10n_util::GetStringUTF16(IDS_BACKGROUND_PAGE_BADGE_OVERFLOW));
-}
-
diff --git a/chrome/browser/ui/views/toolbar_view.h b/chrome/browser/ui/views/toolbar_view.h
index e8c13af..8c07dc2 100644
--- a/chrome/browser/ui/views/toolbar_view.h
+++ b/chrome/browser/ui/views/toolbar_view.h
@@ -9,7 +9,6 @@
#include <vector>
#include "app/menus/accelerator.h"
-#include "app/slide_animation.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "chrome/browser/command_updater.h"
@@ -18,6 +17,7 @@
#include "chrome/browser/ui/views/accessible_pane_view.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "chrome/browser/ui/views/reload_button.h"
+#include "ui/base/animation/slide_animation.h"
#include "views/controls/button/menu_button.h"
#include "views/controls/menu/menu.h"
#include "views/controls/menu/menu_wrapper.h"
diff --git a/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc b/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc
index 9da60ee..bb77b8b 100644
--- a/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc
+++ b/chrome/browser/ui/views/unhandled_keyboard_event_handler.cc
@@ -8,9 +8,7 @@
#include "views/focus/focus_manager.h"
UnhandledKeyboardEventHandler::UnhandledKeyboardEventHandler() {
-#if defined(OS_WIN)
ignore_next_char_event_ = false;
-#endif
}
UnhandledKeyboardEventHandler::~UnhandledKeyboardEventHandler() {
@@ -23,7 +21,6 @@
NOTREACHED();
return;
}
-#if defined(OS_WIN)
// Previous calls to TranslateMessage can generate Char events as well as
// RawKeyDown events, even if the latter triggered an accelerator. In these
// cases, we discard the Char events.
@@ -34,7 +31,6 @@
// It's necessary to reset this flag, because a RawKeyDown event may not
// always generate a Char event.
ignore_next_char_event_ = false;
-#endif
if (event.type == WebKit::WebInputEvent::RawKeyDown) {
views::Accelerator accelerator(
@@ -46,23 +42,19 @@
(event.modifiers & NativeWebKeyboardEvent::AltKey) ==
NativeWebKeyboardEvent::AltKey);
-#if defined(OS_WIN)
// This is tricky: we want to set ignore_next_char_event_ if
// ProcessAccelerator returns true. But ProcessAccelerator might delete
// |this| if the accelerator is a "close tab" one. So we speculatively
// set the flag and fix it if no event was handled.
ignore_next_char_event_ = true;
-#endif
if (focus_manager->ProcessAccelerator(accelerator)) {
return;
}
-#if defined(OS_WIN)
// ProcessAccelerator didn't handle the accelerator, so we know both
// that |this| is still valid, and that we didn't want to set the flag.
ignore_next_char_event_ = false;
-#endif
}
#if defined(OS_WIN)
diff --git a/chrome/browser/ui/views/unhandled_keyboard_event_handler.h b/chrome/browser/ui/views/unhandled_keyboard_event_handler.h
index de82294..111b884 100644
--- a/chrome/browser/ui/views/unhandled_keyboard_event_handler.h
+++ b/chrome/browser/ui/views/unhandled_keyboard_event_handler.h
@@ -24,7 +24,6 @@
views::FocusManager* focus_manager);
private:
-#if defined(OS_WIN)
// Whether to ignore the next Char keyboard event.
// If a RawKeyDown event was handled as a shortcut key, then we're done
// handling it and should eat any Char event that the translate phase may
@@ -32,7 +31,6 @@
// such as a beep if DefWindowProc() has no default handling for the given
// Char.)
bool ignore_next_char_event_;
-#endif
DISALLOW_COPY_AND_ASSIGN(UnhandledKeyboardEventHandler);
};
diff --git a/chrome/browser/ui/views/uninstall_view.cc b/chrome/browser/ui/views/uninstall_view.cc
index ecd2ac7..2217319 100644
--- a/chrome/browser/ui/views/uninstall_view.cc
+++ b/chrome/browser/ui/views/uninstall_view.cc
@@ -47,7 +47,8 @@
column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, column_set_id);
- confirm_label_ = new views::Label(l10n_util::GetString(IDS_UNINSTALL_VERIFY));
+ confirm_label_ = new views::Label(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_UNINSTALL_VERIFY)));
confirm_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
layout->AddView(confirm_label_);
@@ -61,7 +62,7 @@
GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, column_set_id);
delete_profile_ = new views::Checkbox(
- l10n_util::GetString(IDS_UNINSTALL_DELETE_PROFILE));
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_DELETE_PROFILE)));
layout->AddView(delete_profile_);
// Set default browser combo box
@@ -82,8 +83,8 @@
column_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, 0,
GridLayout::USE_PREF, 0, 0);
layout->StartRow(0, column_set_id);
- change_default_browser_ = new views::Checkbox(
- l10n_util::GetString(IDS_UNINSTALL_SET_DEFAULT_BROWSER));
+ change_default_browser_ = new views::Checkbox(UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_UNINSTALL_SET_DEFAULT_BROWSER)));
change_default_browser_->set_listener(this);
layout->AddView(change_default_browser_);
browsers_combo_ = new views::Combobox(this);
@@ -119,7 +120,7 @@
// button remains same.
std::wstring label = L"";
if (button == MessageBoxFlags::DIALOGBUTTON_OK)
- label = l10n_util::GetString(IDS_UNINSTALL_BUTTON_TEXT);
+ label = UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_BUTTON_TEXT));
return label;
}
@@ -133,7 +134,7 @@
}
std::wstring UninstallView::GetWindowTitle() const {
- return l10n_util::GetString(IDS_UNINSTALL_CHROME);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_UNINSTALL_CHROME));
}
views::View* UninstallView::GetContentsView() {
diff --git a/chrome/browser/ui/views/update_recommended_message_box.cc b/chrome/browser/ui/views/update_recommended_message_box.cc
index baf69ab..019846e 100644
--- a/chrome/browser/ui/views/update_recommended_message_box.cc
+++ b/chrome/browser/ui/views/update_recommended_message_box.cc
@@ -6,6 +6,7 @@
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/prefs/pref_service.h"
@@ -55,12 +56,12 @@
DCHECK(button == MessageBoxFlags::DIALOGBUTTON_OK ||
button == MessageBoxFlags::DIALOGBUTTON_CANCEL);
return button == MessageBoxFlags::DIALOGBUTTON_OK ?
- l10n_util::GetString(IDS_RESTART_AND_UPDATE) :
- l10n_util::GetString(IDS_NOT_NOW);
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_RESTART_AND_UPDATE)) :
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_NOT_NOW));
}
std::wstring UpdateRecommendedMessageBox::GetWindowTitle() const {
- return l10n_util::GetString(IDS_PRODUCT_NAME);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_PRODUCT_NAME));
}
void UpdateRecommendedMessageBox::DeleteDelegate() {
@@ -82,14 +83,16 @@
gfx::NativeWindow parent_window) {
const int kDialogWidth = 400;
#if defined(OS_CHROMEOS)
- const std::wstring product_name = l10n_util::GetString(IDS_PRODUCT_OS_NAME);
+ const int kProductNameId = IDS_PRODUCT_OS_NAME;
#else
- const std::wstring product_name = l10n_util::GetString(IDS_PRODUCT_NAME);
+ const int kProductNameId = IDS_PRODUCT_NAME;
#endif
+ const string16 product_name = l10n_util::GetStringUTF16(kProductNameId);
// Also deleted when the window closes.
message_box_view_ = new MessageBoxView(
MessageBoxFlags::kFlagHasMessage | MessageBoxFlags::kFlagHasOKButton,
- l10n_util::GetStringF(IDS_UPDATE_RECOMMENDED, product_name),
+ UTF16ToWide(l10n_util::GetStringFUTF16(IDS_UPDATE_RECOMMENDED,
+ product_name)),
std::wstring(),
kDialogWidth);
browser::CreateViewsWindow(parent_window, gfx::Rect(), this)->Show();
diff --git a/chrome/browser/ui/views/url_picker.cc b/chrome/browser/ui/views/url_picker.cc
index 14a294c..e1977ee 100644
--- a/chrome/browser/ui/views/url_picker.cc
+++ b/chrome/browser/ui/views/url_picker.cc
@@ -88,7 +88,7 @@
layout->StartRow(0, labels_column_set_id);
views::Label* url_label = new views::Label();
url_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- url_label->SetText(l10n_util::GetString(IDS_ASI_URL));
+ url_label->SetText(UTF16ToWide(l10n_util::GetStringUTF16(IDS_ASI_URL)));
layout->AddView(url_label);
url_field_ = new views::Textfield();
@@ -100,7 +100,8 @@
layout->StartRow(0, single_column_view_set_id);
views::Label* description_label = new views::Label();
description_label->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
- description_label->SetText(l10n_util::GetString(IDS_ASI_DESCRIPTION));
+ description_label->SetText(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ASI_DESCRIPTION)));
description_label->SetFont(
description_label->font().DeriveFont(0, gfx::Font::BOLD));
layout->AddView(description_label);
@@ -133,7 +134,7 @@
}
std::wstring UrlPicker::GetWindowTitle() const {
- return l10n_util::GetString(IDS_ASI_ADD_TITLE);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_ASI_ADD_TITLE));
}
bool UrlPicker::IsModal() const {
@@ -143,7 +144,7 @@
std::wstring UrlPicker::GetDialogButtonLabel(
MessageBoxFlags::DialogButton button) const {
if (button == MessageBoxFlags::DIALOGBUTTON_OK)
- return l10n_util::GetString(IDS_ASI_ADD);
+ return UTF16ToWide(l10n_util::GetStringUTF16(IDS_ASI_ADD));
return std::wstring();
}
diff --git a/chrome/browser/ui/views/url_picker.h b/chrome/browser/ui/views/url_picker.h
index 63b9068..42fd747 100644
--- a/chrome/browser/ui/views/url_picker.h
+++ b/chrome/browser/ui/views/url_picker.h
@@ -69,8 +69,8 @@
// TextField::Controller.
virtual void ContentsChanged(views::Textfield* sender,
const std::wstring& new_contents);
- virtual bool HandleKeystroke(views::Textfield* sender,
- const views::Textfield::Keystroke& key) {
+ virtual bool HandleKeyEvent(views::Textfield* sender,
+ const views::KeyEvent& key_event) {
return false;
}
diff --git a/chrome/browser/ui/views/user_data_dir_dialog.cc b/chrome/browser/ui/views/user_data_dir_dialog.cc
index 59a8a8a..9784cd5 100644
--- a/chrome/browser/ui/views/user_data_dir_dialog.cc
+++ b/chrome/browser/ui/views/user_data_dir_dialog.cc
@@ -5,6 +5,7 @@
#include "app/l10n_util.h"
#include "app/message_box_flags.h"
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
#include "chrome/browser/views/user_data_dir_dialog.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -25,8 +26,9 @@
: ALLOW_THIS_IN_INITIALIZER_LIST(
select_file_dialog_(SelectFileDialog::Create(this))),
is_blocking_(true) {
- std::wstring message_text = l10n_util::GetStringF(
- IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY, user_data_dir.ToWStringHack());
+ std::wstring message_text = UTF16ToWide(l10n_util::GetStringFUTF16(
+ IDS_CANT_WRITE_USER_DIRECTORY_SUMMARY,
+ WideToUTF16Hack(user_data_dir.ToWStringHack())));
const int kDialogWidth = 400;
message_box_view_ = new MessageBoxView(MessageBoxFlags::kIsConfirmMessageBox,
message_text.c_str(), std::wstring(), kDialogWidth);
@@ -43,10 +45,11 @@
switch (button) {
case MessageBoxFlags::DIALOGBUTTON_OK:
- return l10n_util::GetString(
- IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON));
case MessageBoxFlags::DIALOGBUTTON_CANCEL:
- return l10n_util::GetString(IDS_CANT_WRITE_USER_DIRECTORY_EXIT_BUTTON);
+ return UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_CANT_WRITE_USER_DIRECTORY_EXIT_BUTTON));
default:
NOTREACHED();
}
@@ -55,7 +58,8 @@
}
std::wstring UserDataDirDialog::GetWindowTitle() const {
- return l10n_util::GetString(IDS_CANT_WRITE_USER_DIRECTORY_TITLE);
+ return UTF16ToWide(
+ l10n_util::GetStringUTF16(IDS_CANT_WRITE_USER_DIRECTORY_TITLE));
}
void UserDataDirDialog::DeleteDelegate() {
@@ -64,8 +68,8 @@
bool UserDataDirDialog::Accept() {
// Directory picker
- std::wstring dialog_title = l10n_util::GetString(
- IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON);
+ std::wstring dialog_title = UTF16ToWide(l10n_util::GetStringUTF16(
+ IDS_CANT_WRITE_USER_DIRECTORY_CHOOSE_DIRECTORY_BUTTON));
HWND owning_hwnd =
GetAncestor(message_box_view_->GetWidget()->GetNativeView(), GA_ROOT);
select_file_dialog_->SelectFile(SelectFileDialog::SELECT_FOLDER,
diff --git a/chrome/browser/ui/views/wrench_menu.cc b/chrome/browser/ui/views/wrench_menu.cc
index 3d86f91..bc10859 100644
--- a/chrome/browser/ui/views/wrench_menu.cc
+++ b/chrome/browser/ui/views/wrench_menu.cc
@@ -246,7 +246,8 @@
std::wstring GetAccessibleNameForWrenchMenuItem(
MenuModel* model, int item_index, int accessible_string_id) {
- std::wstring accessible_name = l10n_util::GetString(accessible_string_id);
+ std::wstring accessible_name =
+ UTF16ToWide(l10n_util::GetStringUTF16(accessible_string_id));
std::wstring accelerator_text;
menus::Accelerator menu_accelerator;
@@ -280,7 +281,7 @@
MenuButtonBackground** background,
int acc_string_id) {
TextButton* button =
- new TextButton(this, l10n_util::GetString(string_id));
+ new TextButton(this, UTF16ToWide(l10n_util::GetStringUTF16(string_id)));
button->SetAccessibleName(
GetAccessibleNameForWrenchMenuItem(menu_model_, index, acc_string_id));
button->SetFocusable(true);
@@ -397,7 +398,8 @@
IDS_ZOOM_MINUS2, MenuButtonBackground::LEFT_BUTTON, decrement_index,
NULL, IDS_ACCNAME_ZOOM_MINUS2);
- zoom_label_ = new Label(l10n_util::GetStringF(IDS_ZOOM_PERCENT, L"100"));
+ zoom_label_ = new Label(
+ UTF16ToWide(l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, 100)));
zoom_label_->SetColor(MenuConfig::instance().text_color);
zoom_label_->SetHorizontalAlignment(Label::ALIGN_RIGHT);
MenuButtonBackground* center_bg =
@@ -502,9 +504,9 @@
zoom = selected_tab->GetZoomPercent(&enable_increment, &enable_decrement);
increment_button_->SetEnabled(enable_increment);
decrement_button_->SetEnabled(enable_decrement);
- zoom_label_->SetText(l10n_util::GetStringF(
- IDS_ZOOM_PERCENT,
- UTF8ToWide(base::IntToString(zoom))));
+ zoom_label_->SetText(UTF16ToWide(l10n_util::GetStringFUTF16Int(
+ IDS_ZOOM_PERCENT,
+ zoom)));
zoom_label_width_ = MaxWidthForZoomLabel();
}
@@ -525,11 +527,13 @@
int step = (max_percent - min_percent) / 10;
for (int i = min_percent; i <= max_percent; i += step) {
- int w = font.GetStringWidth(l10n_util::GetStringF(IDS_ZOOM_PERCENT, i));
+ int w = font.GetStringWidth(
+ l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, i));
max_w = std::max(w, max_w);
}
} else {
- max_w = font.GetStringWidth(l10n_util::GetStringF(IDS_ZOOM_PERCENT, 100));
+ max_w = font.GetStringWidth(
+ l10n_util::GetStringFUTF16Int(IDS_ZOOM_PERCENT, 100));
}
return max_w + insets.width();
@@ -568,7 +572,8 @@
void WrenchMenu::Init(menus::MenuModel* model) {
DCHECK(!root_.get());
root_.reset(new MenuItemView(this));
- root_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_APP));
+ root_->SetAccessibleName(
+ UTF16ToWide(l10n_util::GetStringUTF16(IDS_ACCNAME_APP)));
root_->set_has_icons(true); // We have checks, radios and icons, set this
// so we get the taller menu style.
int next_id = 1;
@@ -661,7 +666,7 @@
DCHECK_LT(i + 2, max);
DCHECK_EQ(IDC_COPY, model->GetCommandIdAt(index + 1));
DCHECK_EQ(IDC_PASTE, model->GetCommandIdAt(index + 2));
- item->SetTitle(l10n_util::GetString(IDS_EDIT2));
+ item->SetTitle(UTF16ToWide(l10n_util::GetStringUTF16(IDS_EDIT2)));
item->AddChildView(
new CutCopyPasteView(this, model, index, index + 1, index + 2));
i += 2;
@@ -669,7 +674,7 @@
DCHECK_EQ(MenuModel::TYPE_COMMAND, model->GetTypeAt(index));
DCHECK_EQ(IDC_ZOOM_PLUS, model->GetCommandIdAt(index + 1));
DCHECK_EQ(IDC_FULLSCREEN, model->GetCommandIdAt(index + 2));
- item->SetTitle(l10n_util::GetString(IDS_ZOOM_MENU2));
+ item->SetTitle(UTF16ToWide(l10n_util::GetStringUTF16(IDS_ZOOM_MENU2)));
item->AddChildView(
new ZoomView(this, model, index, index + 1, index + 2));
i += 2;
diff --git a/chrome/browser/unload_uitest.cc b/chrome/browser/unload_uitest.cc
index bf45ecc..a359e23 100644
--- a/chrome/browser/unload_uitest.cc
+++ b/chrome/browser/unload_uitest.cc
@@ -4,7 +4,6 @@
#include "app/message_box_flags.h"
#include "base/file_util.h"
-#include "base/platform_thread.h"
#include "chrome/browser/net/url_request_mock_http_job.h"
#include "chrome/browser/ui/view_ids.h"
#include "chrome/common/chrome_switches.h"
diff --git a/chrome/browser/visitedlink/visitedlink_master.cc b/chrome/browser/visitedlink/visitedlink_master.cc
index d93ea46..e4b8444 100644
--- a/chrome/browser/visitedlink/visitedlink_master.cc
+++ b/chrome/browser/visitedlink/visitedlink_master.cc
@@ -21,7 +21,7 @@
#include "base/rand_util.h"
#include "base/stack_container.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "chrome/browser/browser_thread.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/profiles/profile.h"
diff --git a/chrome/browser/web_applications/web_app.cc b/chrome/browser/web_applications/web_app.cc
index 05d6c9f..2c619e2 100644
--- a/chrome/browser/web_applications/web_app.cc
+++ b/chrome/browser/web_applications/web_app.cc
@@ -18,7 +18,7 @@
#include "base/md5.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/scoped_ptr.h"
#include "base/utf_string_conversions.h"
#include "base/win/windows_version.h"
@@ -38,7 +38,7 @@
#endif // defined(OS_LINUX)
#if defined(OS_WIN)
-#include "base/win_util.h"
+#include "base/win/win_util.h"
#include "chrome/common/notification_details.h"
#include "chrome/common/notification_source.h"
#include "gfx/icon_util.h"
diff --git a/chrome/browser/webdata/web_data_service.cc b/chrome/browser/webdata/web_data_service.cc
index d5ecd0f..b359ef5 100644
--- a/chrome/browser/webdata/web_data_service.cc
+++ b/chrome/browser/webdata/web_data_service.cc
@@ -7,7 +7,7 @@
#include "base/message_loop.h"
#include "base/stl_util-inl.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/search_engines/template_url.h"
diff --git a/chrome/browser/webdata/web_data_service_unittest.cc b/chrome/browser/webdata/web_data_service_unittest.cc
index d56aebf..98a277c 100644
--- a/chrome/browser/webdata/web_data_service_unittest.cc
+++ b/chrome/browser/webdata/web_data_service_unittest.cc
@@ -17,7 +17,7 @@
#include "base/string_util.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "chrome/browser/autofill/autofill_profile.h"
#include "chrome/browser/autofill/credit_card.h"
#include "chrome/browser/browser_thread.h"
diff --git a/chrome/browser/worker_host/worker_service.cc b/chrome/browser/worker_host/worker_service.cc
index cea298d..ade5db0 100644
--- a/chrome/browser/worker_host/worker_service.cc
+++ b/chrome/browser/worker_host/worker_service.cc
@@ -9,7 +9,7 @@
#include "base/command_line.h"
#include "base/singleton.h"
#include "base/sys_info.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/browser/content_settings/host_content_settings_map.h"
#include "chrome/browser/worker_host/worker_message_filter.h"
#include "chrome/browser/worker_host/worker_process_host.h"
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index c0ba88c..7199e14 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -42,6 +42,7 @@
#include "chrome/common/process_watcher.h"
#include "chrome/common/result_codes.h"
#include "chrome/common/sandbox_methods_linux.h"
+#include "chrome/common/set_process_title.h"
#include "chrome/common/unix_domain_socket_posix.h"
#include "media/base/media.h"
#include "seccompsandbox/sandbox.h"
@@ -394,7 +395,12 @@
CommandLine::Reset();
CommandLine::Init(0, NULL);
CommandLine::ForCurrentProcess()->InitFromArgv(args);
- CommandLine::SetProcTitle();
+
+ // Update the process title. The argv was already cached by the call to
+ // SetProcessTitleFromCommandLine in ChromeMain, so we can pass NULL here
+ // (we don't have the original argv at this point).
+ SetProcessTitleFromCommandLine(NULL);
+
// The fork() request is handled further up the call stack.
return true;
} else if (child < 0) {
diff --git a/chrome/common/DEPS b/chrome/common/DEPS
index a4256b3..cd9bd3f 100644
--- a/chrome/common/DEPS
+++ b/chrome/common/DEPS
@@ -5,6 +5,7 @@
"+libxml",
"+media/audio",
"+media/base",
+ "+ppapi/c", # For various types.
"+remoting/client/plugin",
"+sandbox/src",
"+skia",
diff --git a/chrome/common/child_process.cc b/chrome/common/child_process.cc
index af05a65..e32bb1b 100644
--- a/chrome/common/child_process.cc
+++ b/chrome/common/child_process.cc
@@ -11,7 +11,7 @@
#include "base/message_loop.h"
#include "base/process_util.h"
#include "base/string_number_conversions.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/child_thread.h"
#include "grit/chromium_strings.h"
diff --git a/chrome/common/child_process.h b/chrome/common/child_process.h
index bc878de..c656317 100644
--- a/chrome/common/child_process.h
+++ b/chrome/common/child_process.h
@@ -8,8 +8,8 @@
#include "base/basictypes.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
class ChildThread;
diff --git a/chrome/common/child_process_info.cc b/chrome/common/child_process_info.cc
index 8774578..69122cc 100644
--- a/chrome/common/child_process_info.cc
+++ b/chrome/common/child_process_info.cc
@@ -16,8 +16,18 @@
#include "base/utf_string_conversions.h"
#include "grit/generated_resources.h"
+ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) :
+ type_(type),
+ renderer_type_(RENDERER_UNKNOWN) {
+ if (id == -1)
+ id_ = GenerateChildProcessUniqueId();
+ else
+ id_ = id;
+}
+
ChildProcessInfo::ChildProcessInfo(const ChildProcessInfo& original)
: type_(original.type_),
+ renderer_type_(original.renderer_type_),
name_(original.name_),
version_(original.version_),
id_(original.id_),
@@ -31,6 +41,7 @@
const ChildProcessInfo& original) {
if (&original != this) {
type_ = original.type_;
+ renderer_type_ = original.renderer_type_;
name_ = original.name_;
version_ = original.version_;
id_ = original.id_;
@@ -39,6 +50,7 @@
return *this;
}
+// static
std::string ChildProcessInfo::GetTypeNameInEnglish(
ChildProcessInfo::ProcessType type) {
switch (type) {
@@ -73,6 +85,41 @@
}
}
+// static
+std::string ChildProcessInfo::GetRendererTypeNameInEnglish(
+ ChildProcessInfo::RendererProcessType type) {
+ switch (type) {
+ case RENDERER_NORMAL:
+ return "Tab";
+ case RENDERER_CHROME:
+ return "Tab (Chrome)";
+ case RENDERER_EXTENSION:
+ return "Extension";
+ case RENDERER_DEVTOOLS:
+ return "Devtools";
+ case RENDERER_INTERSTITIAL:
+ return "Interstitial";
+ case RENDERER_NOTIFICATION:
+ return "Notification";
+ case RENDERER_BACKGROUND_APP:
+ return "Background App";
+ case RENDERER_UNKNOWN:
+ default:
+ NOTREACHED() << "Unknown renderer process type!";
+ return "Unknown";
+ }
+}
+
+// static
+std::string ChildProcessInfo::GetFullTypeNameInEnglish(
+ ChildProcessInfo::ProcessType type,
+ ChildProcessInfo::RendererProcessType rtype) {
+ if (type == RENDER_PROCESS)
+ return GetRendererTypeNameInEnglish(rtype);
+ return GetTypeNameInEnglish(type);
+}
+
+
string16 ChildProcessInfo::GetLocalizedTitle() const {
string16 title = WideToUTF16Hack(name_);
if (type_ == ChildProcessInfo::PLUGIN_PROCESS && title.empty())
@@ -124,13 +171,6 @@
return title;
}
-ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) : type_(type) {
- if (id == -1)
- id_ = GenerateChildProcessUniqueId();
- else
- id_ = id;
-}
-
std::string ChildProcessInfo::GenerateRandomChannelID(void* instance) {
// Note: the string must start with the current process id, this is how
// child processes determine the pid of the parent.
diff --git a/chrome/common/child_process_info.h b/chrome/common/child_process_info.h
index 651978f..4d5b721 100644
--- a/chrome/common/child_process_info.h
+++ b/chrome/common/child_process_info.h
@@ -32,6 +32,19 @@
PPAPI_PLUGIN_PROCESS
};
+ // NOTE: Do not remove or reorder the elements in this enum, and only add new
+ // items at the end. We depend on these specific values in a histogram.
+ enum RendererProcessType {
+ RENDERER_UNKNOWN = 0,
+ RENDERER_NORMAL,
+ RENDERER_CHROME, // DOMUI (chrome:// URL)
+ RENDERER_EXTENSION, // chrome-extension://
+ RENDERER_DEVTOOLS, // Web inspector
+ RENDERER_INTERSTITIAL, // malware/phishing interstitial
+ RENDERER_NOTIFICATION, // HTML notification bubble
+ RENDERER_BACKGROUND_APP // hosted app background page
+ };
+
ChildProcessInfo(const ChildProcessInfo& original);
virtual ~ChildProcessInfo();
@@ -40,6 +53,10 @@
// Returns the type of the process.
ProcessType type() const { return type_; }
+ // Returns the renderer subtype of this process.
+ // Only valid if the type() is RENDER_PROCESS.
+ RendererProcessType renderer_type() const { return renderer_type_; }
+
// Returns the name of the process. i.e. for plugins it might be Flash, while
// for workers it might be the domain that it's from.
std::wstring name() const { return name_; }
@@ -60,7 +77,10 @@
// Returns an English name of the process type, should only be used for non
// user-visible strings, or debugging pages like about:memory.
+ static std::string GetFullTypeNameInEnglish(ProcessType type,
+ RendererProcessType rtype);
static std::string GetTypeNameInEnglish(ProcessType type);
+ static std::string GetRendererTypeNameInEnglish(RendererProcessType type);
// Returns a localized title for the child process. For example, a plugin
// process would be "Plug-in: Flash" when name is "Flash".
@@ -99,12 +119,14 @@
ChildProcessInfo(ProcessType type, int id);
void set_type(ProcessType type) { type_ = type; }
+ void set_renderer_type(RendererProcessType type) { renderer_type_ = type; }
void set_name(const std::wstring& name) { name_ = name; }
void set_version(const std::wstring& ver) { version_ = ver; }
void set_handle(base::ProcessHandle handle) { process_.set_handle(handle); }
private:
ProcessType type_;
+ RendererProcessType renderer_type_;
std::wstring name_;
std::wstring version_;
int id_;
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index 1b8e612..344db91 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -15,7 +15,7 @@
#include "chrome/common/chrome_switches.h"
#if defined(OS_MACOSX)
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#endif
namespace {
@@ -39,7 +39,7 @@
#if defined(OS_MACOSX)
// If called from Chrome, get internal plugins from a subdirectory of the
// framework.
- if (mac_util::AmIBundled()) {
+ if (base::mac::AmIBundled()) {
*result = chrome::GetFrameworkBundlePath();
DCHECK(!result->empty());
*result = result->Append("Internet Plug-Ins");
@@ -79,7 +79,7 @@
#if defined(OS_MACOSX)
if (!PathService::Get(base::DIR_EXE, result))
return false;
- if (mac_util::AmIBundled()) {
+ if (base::mac::AmIBundled()) {
// If we're called from chrome, dump it beside the app (outside the
// app bundle), if we're called from a unittest, we'll already
// outside the bundle so use the exe dir.
@@ -145,7 +145,7 @@
break;
case chrome::DIR_RESOURCES:
#if defined(OS_MACOSX)
- cur = mac_util::MainAppBundlePath();
+ cur = base::mac::MainAppBundlePath();
cur = cur.Append(FILE_PATH_LITERAL("Resources"));
#else
if (!PathService::Get(chrome::DIR_APP, &cur))
@@ -253,8 +253,8 @@
break;
case chrome::FILE_RESOURCES_PACK:
#if defined(OS_MACOSX)
- if (mac_util::AmIBundled()) {
- cur = mac_util::MainAppBundlePath();
+ if (base::mac::AmIBundled()) {
+ cur = base::mac::MainAppBundlePath();
cur = cur.Append(FILE_PATH_LITERAL("Resources"))
.Append(FILE_PATH_LITERAL("resources.pak"));
break;
diff --git a/chrome/common/chrome_paths_mac.mm b/chrome/common/chrome_paths_mac.mm
index 57ed3bd..fc76b53 100644
--- a/chrome/common/chrome_paths_mac.mm
+++ b/chrome/common/chrome_paths_mac.mm
@@ -8,7 +8,7 @@
#include "base/base_paths.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/path_service.h"
#include "chrome/common/chrome_constants.h"
@@ -45,7 +45,7 @@
}
bool GetUserDocumentsDirectory(FilePath* result) {
- return mac_util::GetUserDirectory(NSDocumentDirectory, result);
+ return base::mac::GetUserDirectory(NSDocumentDirectory, result);
}
void GetUserCacheDirectory(const FilePath& profile_dir, FilePath* result) {
@@ -71,11 +71,11 @@
}
bool GetUserDownloadsDirectory(FilePath* result) {
- return mac_util::GetUserDirectory(NSDownloadsDirectory, result);
+ return base::mac::GetUserDirectory(NSDownloadsDirectory, result);
}
bool GetUserDesktop(FilePath* result) {
- return mac_util::GetUserDirectory(NSDesktopDirectory, result);
+ return base::mac::GetUserDirectory(NSDesktopDirectory, result);
}
FilePath GetVersionedDirectory() {
@@ -90,7 +90,7 @@
path = path.DirName().DirName();
DCHECK_EQ(path.BaseName().value(), "Contents");
- if (mac_util::IsBackgroundOnlyProcess()) {
+ if (base::mac::IsBackgroundOnlyProcess()) {
// path identifies the helper .app's Contents directory in the browser
// .app's versioned directory. Go up two steps to get to the browser
// .app's versioned directory.
@@ -128,7 +128,7 @@
}
bool GetLocalLibraryDirectory(FilePath* result) {
- return mac_util::GetLocalDirectory(NSLibraryDirectory, result);
+ return base::mac::GetLocalDirectory(NSLibraryDirectory, result);
}
} // namespace chrome
diff --git a/chrome/common/chrome_paths_win.cc b/chrome/common/chrome_paths_win.cc
index 8207db6..062c43b 100644
--- a/chrome/common/chrome_paths_win.cc
+++ b/chrome/common/chrome_paths_win.cc
@@ -10,7 +10,7 @@
#include <shlobj.h>
#include <shobjidl.h>
-#include "app/win_util.h"
+#include "app/win/scoped_co_mem.h"
#include "base/file_path.h"
#include "base/path_service.h"
#include "chrome/common/chrome_constants.h"
@@ -73,7 +73,7 @@
REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR*);
GetKnownFolderPath f = reinterpret_cast<GetKnownFolderPath>(
GetProcAddress(GetModuleHandle(L"shell32.dll"), "SHGetKnownFolderPath"));
- win_util::CoMemReleaser<wchar_t> path_buf;
+ app::win::ScopedCoMem<wchar_t> path_buf;
if (f && SUCCEEDED(f(FOLDERID_Downloads, 0, NULL, &path_buf))) {
*result = FilePath(std::wstring(path_buf));
return true;
diff --git a/chrome/common/chrome_plugin_lib.cc b/chrome/common/chrome_plugin_lib.cc
index 1bd118b..fb4ac83 100644
--- a/chrome/common/chrome_plugin_lib.cc
+++ b/chrome/common/chrome_plugin_lib.cc
@@ -10,17 +10,19 @@
#include "base/metrics/histogram.h"
#include "base/path_service.h"
#include "base/perftimer.h"
-#include "base/thread.h"
-#if defined(OS_WIN)
-#include "base/win/registry.h"
-#endif
#include "base/string_util.h"
+#include "base/threading/thread.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/chrome_counters.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/notification_service.h"
#include "chrome/common/chrome_paths.h"
#include "webkit/plugins/npapi/plugin_list.h"
+#if defined(OS_WIN)
+#include "base/win/registry.h"
+#endif
+
using base::TimeDelta;
// TODO(port): revisit when plugins happier
@@ -39,7 +41,7 @@
// The thread plugins are loaded and used in, lazily initialized upon
// the first creation call.
-static PlatformThreadId g_plugin_thread_id = 0;
+static base::PlatformThreadId g_plugin_thread_id = 0;
static MessageLoop* g_plugin_thread_loop = NULL;
static bool IsSingleProcessMode() {
@@ -58,7 +60,7 @@
// Keep a map of loaded plugins to ensure we only load each library once.
if (!g_loaded_libs) {
g_loaded_libs = new PluginMap();
- g_plugin_thread_id = PlatformThread::CurrentId();
+ g_plugin_thread_id = base::PlatformThread::CurrentId();
g_plugin_thread_loop = MessageLoop::current();
}
DCHECK(IsPluginThread());
@@ -97,7 +99,7 @@
// static
bool ChromePluginLib::IsPluginThread() {
- return PlatformThread::CurrentId() == g_plugin_thread_id;
+ return base::PlatformThread::CurrentId() == g_plugin_thread_id;
}
// static
diff --git a/chrome/common/chrome_plugin_util.h b/chrome/common/chrome_plugin_util.h
index 5e78245..9769a76 100644
--- a/chrome/common/chrome_plugin_util.h
+++ b/chrome/common/chrome_plugin_util.h
@@ -9,8 +9,8 @@
#include <string>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "chrome/common/chrome_plugin_api.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"
@@ -41,7 +41,7 @@
// the plugin unloads. This object also verifies that it is created and
// destroyed on the same thread.
class PluginHelper : public NotificationObserver,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
static void DestroyAllHelpersForPlugin(ChromePluginLib* plugin);
diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc
index df8e12c..935a711 100644
--- a/chrome/common/chrome_switches.cc
+++ b/chrome/common/chrome_switches.cc
@@ -146,6 +146,9 @@
const char kDisableAcceleratedCompositing[] =
"disable-accelerated-compositing";
+// Disables GPU accelerated video display.
+const char kDisableAcceleratedVideo[] = "disable-accelerated-video";
+
// Disables the alternate window station for the renderer.
const char kDisableAltWinstation[] = "disable-winsta";
@@ -167,8 +170,7 @@
"disable-auth-negotiate-cname-lookup";
// Disable background mode (background apps will not keep chrome running in the
-// background). This has priority over the kEnableBackgroundMode flag which is
-// settable via about:labs.
+// background).
const char kDisableBackgroundMode[] = "disable-background-mode";
// Disable several subsystems which run network requests in the background.
@@ -180,6 +182,11 @@
// users with many windows/tabs and lots of memory.
const char kDisableBackingStoreLimit[] = "disable-backing-store-limit";
+// Disables blocked content warning animation. Currently shows animation for
+// blocked pop-ups only.
+const char kDisableBlockContentAnimation[] =
+ "disable-blocked-content-animation";
+
// Disables establishing a backup TCP connection if a specified timeout is
// exceeded.
const char kDisableConnectBackupJobs[] = "disable-connect-backup-jobs";
@@ -346,6 +353,9 @@
const char kEnableSyncNewAutofill[] =
"enable-sync-new-autofill-data-type";
+// Disable tabbed options, i.e., DOMUI version of options window.
+const char kDisableTabbedOptions[] = "disable-tabbed-options";
+
// TabCloseableStateWatcher disallows closing of tabs and browsers under certain
// situations on ChromeOS. Some tests expect tabs or browsers to close, so we
// need a switch to disable the watcher.
@@ -399,7 +409,7 @@
// Enable gpu-accelerated 2d canvas.
const char kEnableAccelerated2dCanvas[] = "enable-accelerated-2d-canvas";
-// Enables the hardware acceleration of 3D CSS, Video and animation.
+// Enables the hardware acceleration of 3D CSS and animation.
const char kEnableAcceleratedLayers[] = "enable-accelerated-layers";
// Enables WebKit accessibility within the renderer process.
@@ -413,18 +423,9 @@
// for more background.
const char kEnableAuthNegotiatePort[] = "enable-auth-negotiate-port";
-// Enable background mode (background apps will keep chrome running in the
-// background and allow chrome to launch on startup). Has no effect on Windows
-// because background mode is enabled there by default.
-const char kEnableBackgroundMode[] = "enable-background-mode";
-
// Enables the benchmarking extensions.
const char kEnableBenchmarking[] = "enable-benchmarking";
-// Enables blocked content warning animation. Currently shows animation for
-// blocked pop-ups only.
-const char kEnableBlockContentAnimation[] = "enable-blocked-content-animation";
-
// In the browser process this switch is used to enable or disable the
// client-side phishing detection. In the renderer this switch is only enabled
// if this switch is enabled in the browser and the user has opted in to UMA
@@ -571,9 +572,6 @@
// Enable syncing browser typed urls.
const char kEnableSyncTypedUrls[] = "enable-sync-typed-urls";
-// Enable tabbed options, ie: dom-ui version of options window.
-const char kEnableTabbedOptions[] = "enable-tabbed-options";
-
// Enable use of experimental TCP sockets API for sending data in the
// SYN packet.
const char kEnableTcpFastOpen[] = "enable-tcp-fastopen";
diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h
index 1270ac4..9a24f9f 100644
--- a/chrome/common/chrome_switches.h
+++ b/chrome/common/chrome_switches.h
@@ -53,6 +53,7 @@
extern const char kDiagnostics[];
extern const char kDisable3DAPIs[];
extern const char kDisableAcceleratedCompositing[];
+extern const char kDisableAcceleratedVideo[];
extern const char kDisableAltWinstation[];
extern const char kDisableApplicationCache[];
extern const char kDisableAudio[];
@@ -60,6 +61,7 @@
extern const char kDisableBackgroundMode[];
extern const char kDisableBackgroundNetworking[];
extern const char kDisableBackingStoreLimit[];
+extern const char kDisableBlockContentAnimation[];
extern const char kDisableConnectBackupJobs[];
extern const char kDisableContentPrefetch[];
extern const char kDisableCustomJumpList[];
@@ -107,6 +109,7 @@
extern const char kDisableSyncExtensions[];
extern const char kDisableSyncPreferences[];
extern const char kDisableSyncThemes[];
+extern const char kDisableTabbedOptions[];
extern const char kDisableTabCloseableStateWatcher[];
extern const char kDisableTranslate[];
extern const char kDisableWebResources[];
@@ -124,9 +127,7 @@
extern const char kEnableAccessibility[];
extern const char kEnableAeroPeekTabs[];
extern const char kEnableAuthNegotiatePort[];
-extern const char kEnableBackgroundMode[];
extern const char kEnableBenchmarking[];
-extern const char kEnableBlockContentAnimation[];
extern const char kEnableClientSidePhishingDetection[];
extern const char kEnableClearServerData[];
extern const char kEnableClickToPlay[];
@@ -170,7 +171,6 @@
extern const char kEnableSyncPreferences[];
extern const char kEnableSyncSessions[];
extern const char kEnableSyncTypedUrls[];
-extern const char kEnableTabbedOptions[];
extern const char kEnableTcpFastOpen[];
extern const char kEnableTopSites[];
extern const char kEnableTouch[];
diff --git a/chrome/common/chrome_version_info.cc b/chrome/common/chrome_version_info.cc
index 7bca883..ec1012c 100644
--- a/chrome/common/chrome_version_info.cc
+++ b/chrome/common/chrome_version_info.cc
@@ -7,7 +7,7 @@
#include "base/basictypes.h"
#include "base/file_version_info.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
namespace chrome {
diff --git a/chrome/common/common_param_traits.h b/chrome/common/common_param_traits.h
index 3638443..ad9c05a 100644
--- a/chrome/common/common_param_traits.h
+++ b/chrome/common/common_param_traits.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -40,7 +40,6 @@
class DictionaryValue;
class ListValue;
struct ThumbnailScore;
-class URLRequestStatus;
struct WebApplicationInfo;
class WebCursor;
@@ -52,6 +51,7 @@
namespace net {
class UploadData;
+class URLRequestStatus;
}
namespace printing {
diff --git a/chrome/common/content_settings_helper.cc b/chrome/common/content_settings_helper.cc
index 482a759..18997c7 100644
--- a/chrome/common/content_settings_helper.cc
+++ b/chrome/common/content_settings_helper.cc
@@ -19,8 +19,8 @@
return scheme_component + origin.host() + port_component;
}
-std::wstring OriginToWString(const GURL& origin) {
- return UTF8ToWide(OriginToString(origin));
+string16 OriginToString16(const GURL& origin) {
+ return UTF8ToUTF16(OriginToString(origin));
}
} // namespace content_settings_helper
diff --git a/chrome/common/content_settings_helper.h b/chrome/common/content_settings_helper.h
index ab1c603..f361121 100644
--- a/chrome/common/content_settings_helper.h
+++ b/chrome/common/content_settings_helper.h
@@ -8,6 +8,8 @@
#include <string>
+#include "base/string16.h"
+
class GURL;
namespace content_settings_helper {
@@ -15,7 +17,7 @@
// Return simplified string representing origin. If origin is using http or
// the standard port, those parts are not included in the output.
std::string OriginToString(const GURL& origin);
-std::wstring OriginToWString(const GURL& origin);
+string16 OriginToString16(const GURL& origin);
} // namespace content_settings_helper
diff --git a/chrome/common/content_settings_helper_unittest.cc b/chrome/common/content_settings_helper_unittest.cc
index d46eda6..f20a1a2 100644
--- a/chrome/common/content_settings_helper_unittest.cc
+++ b/chrome/common/content_settings_helper_unittest.cc
@@ -4,10 +4,11 @@
#include "chrome/common/content_settings_helper.h"
+#include "base/utf_string_conversions.h"
#include "googleurl/src/gurl.h"
#include "testing/gtest/include/gtest/gtest.h"
-TEST(ContentSettingsHelperTest, OriginToWString) {
+TEST(ContentSettingsHelperTest, OriginToString16) {
// Urls with "http":
const GURL kUrl0("http://www.foo.com/bar");
const GURL kUrl1("http://foo.com/bar");
@@ -23,20 +24,24 @@
const GURL kUrl7("https://foo.com:81/bar");
// Now check the first group of urls with just "http":
- EXPECT_EQ(L"www.foo.com", content_settings_helper::OriginToWString(kUrl0));
- EXPECT_EQ(L"foo.com", content_settings_helper::OriginToWString(kUrl1));
+ EXPECT_EQ(ASCIIToUTF16("www.foo.com"),
+ content_settings_helper::OriginToString16(kUrl0));
+ EXPECT_EQ(ASCIIToUTF16("foo.com"),
+ content_settings_helper::OriginToString16(kUrl1));
- EXPECT_EQ(L"www.foo.com:81", content_settings_helper::OriginToWString(kUrl2));
- EXPECT_EQ(L"foo.com:81", content_settings_helper::OriginToWString(kUrl3));
+ EXPECT_EQ(ASCIIToUTF16("www.foo.com:81"),
+ content_settings_helper::OriginToString16(kUrl2));
+ EXPECT_EQ(ASCIIToUTF16("foo.com:81"),
+ content_settings_helper::OriginToString16(kUrl3));
// Now check the second group of urls with "https":
- EXPECT_EQ(L"https://www.foo.com",
- content_settings_helper::OriginToWString(kUrl4));
- EXPECT_EQ(L"https://foo.com",
- content_settings_helper::OriginToWString(kUrl5));
+ EXPECT_EQ(ASCIIToUTF16("https://www.foo.com"),
+ content_settings_helper::OriginToString16(kUrl4));
+ EXPECT_EQ(ASCIIToUTF16("https://foo.com"),
+ content_settings_helper::OriginToString16(kUrl5));
- EXPECT_EQ(L"https://www.foo.com:81",
- content_settings_helper::OriginToWString(kUrl6));
- EXPECT_EQ(L"https://foo.com:81",
- content_settings_helper::OriginToWString(kUrl7));
+ EXPECT_EQ(ASCIIToUTF16("https://www.foo.com:81"),
+ content_settings_helper::OriginToString16(kUrl6));
+ EXPECT_EQ(ASCIIToUTF16("https://foo.com:81"),
+ content_settings_helper::OriginToString16(kUrl7));
}
diff --git a/chrome/common/deprecated/event_sys-inl.h b/chrome/common/deprecated/event_sys-inl.h
index 835eabe..c92de62 100644
--- a/chrome/common/deprecated/event_sys-inl.h
+++ b/chrome/common/deprecated/event_sys-inl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -9,11 +9,11 @@
#include <map>
#include "base/basictypes.h"
-#include "base/condition_variable.h"
-#include "base/lock.h"
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/port.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/synchronization/lock.h"
#include "chrome/common/deprecated/event_sys.h"
// How to use Channels:
@@ -65,9 +65,9 @@
~CallbackWaiters() {
DCHECK_EQ(0, waiter_count_);
}
- void WaitForCallbackToComplete(Lock* listeners_mutex) {
+ void WaitForCallbackToComplete(base::Lock* listeners_mutex) {
{
- AutoLock lock(mutex_);
+ base::AutoLock lock(mutex_);
waiter_count_ += 1;
listeners_mutex->Release();
while (!callback_done_)
@@ -80,7 +80,7 @@
}
void Signal() {
- AutoLock lock(mutex_);
+ base::AutoLock lock(mutex_);
callback_done_ = true;
condvar_.Broadcast();
}
@@ -88,8 +88,8 @@
protected:
int waiter_count_;
bool callback_done_;
- Lock mutex_;
- ConditionVariable condvar_;
+ base::Lock mutex_;
+ base::ConditionVariable condvar_;
};
template <typename EventTraitsType, typename NotifyLock,
@@ -119,7 +119,7 @@
// Make sure all the listeners have been disconnected. Otherwise, they
// will try to call RemoveListener() at a later date.
#if defined(DEBUG)
- AutoLock lock(listeners_mutex_);
+ base::AutoLock lock(listeners_mutex_);
for (typename Listeners::iterator i = listeners_.begin();
i != listeners_.end(); ++i) {
DCHECK(i->second) << "Listener not disconnected";
@@ -131,7 +131,7 @@
//
// Thread safe.
void AddListener(Listener* listener) {
- AutoLock lock(listeners_mutex_);
+ base::AutoLock lock(listeners_mutex_);
typename Listeners::iterator found = listeners_.find(listener);
if (found == listeners_.end()) {
listeners_.insert(std::make_pair(listener,
@@ -209,7 +209,7 @@
// Remove while in callback. Owned and closed by the thread calling Remove().
CallbackWaiters* callback_waiters_;
- Lock listeners_mutex_; // Protects all members above.
+ base::Lock listeners_mutex_; // Protects all members above.
const EventType shutdown_event_;
NotifyLock notify_lock_;
diff --git a/chrome/common/deprecated/event_sys.h b/chrome/common/deprecated/event_sys.h
index 6e34eb7..944ef1f 100644
--- a/chrome/common/deprecated/event_sys.h
+++ b/chrome/common/deprecated/event_sys.h
@@ -9,8 +9,10 @@
// TODO: This class should be removed or moved to Notifier code.
// See Bug 42450 (http://code.google.com/p/chromium/issues/detail?id=42450).
+namespace base {
class AutoLock;
class Lock;
+}
// An abstract base class for listening to events.
//
@@ -27,8 +29,8 @@
// See the -inl.h for details about the following.
-template <typename EventTraits, typename NotifyLock = Lock,
- typename ScopedNotifyLocker = AutoLock>
+template <typename EventTraits, typename NotifyLock = base::Lock,
+ typename ScopedNotifyLocker = base::AutoLock>
class EventChannel;
class EventListenerHookup;
diff --git a/chrome/common/deprecated/event_sys_unittest.cc b/chrome/common/deprecated/event_sys_unittest.cc
index 3e7957e..941543a 100644
--- a/chrome/common/deprecated/event_sys_unittest.cc
+++ b/chrome/common/deprecated/event_sys_unittest.cc
@@ -9,8 +9,8 @@
#include "base/basictypes.h"
#include "base/message_loop.h"
-#include "base/platform_thread.h"
#include "base/port.h"
+#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "chrome/common/deprecated/event_sys-inl.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -140,7 +140,7 @@
// This goes pretty far beyond the normal use pattern, so don't use
// ThreadTester as an example of what to do.
class ThreadTester : public EventListener<TestEvent>,
- public PlatformThread::Delegate {
+ public base::PlatformThread::Delegate {
public:
explicit ThreadTester(Pair* pair)
: pair_(pair), remove_event_(&remove_event_mutex_),
@@ -150,30 +150,30 @@
~ThreadTester() {
pair_->event_channel()->RemoveListener(this);
for (size_t i = 0; i < threads_.size(); i++) {
- PlatformThread::Join(threads_[i].thread);
+ base::PlatformThread::Join(threads_[i].thread);
}
}
struct ThreadInfo {
- PlatformThreadHandle thread;
+ base::PlatformThreadHandle thread;
};
struct ThreadArgs {
- ConditionVariable* thread_running_cond;
- Lock* thread_running_mutex;
+ base::ConditionVariable* thread_running_cond;
+ base::Lock* thread_running_mutex;
bool thread_running;
};
void Go() {
- Lock thread_running_mutex;
- ConditionVariable thread_running_cond(&thread_running_mutex);
+ base::Lock thread_running_mutex;
+ base::ConditionVariable thread_running_cond(&thread_running_mutex);
ThreadArgs args;
ThreadInfo info;
args.thread_running_cond = &(thread_running_cond);
args.thread_running_mutex = &(thread_running_mutex);
args.thread_running = false;
args_ = args;
- ASSERT_TRUE(PlatformThread::Create(0, this, &info.thread));
+ ASSERT_TRUE(base::PlatformThread::Create(0, this, &info.thread));
thread_running_mutex.Acquire();
while ((args_.thread_running) == false) {
thread_running_cond.Wait();
@@ -216,7 +216,7 @@
remove_event_.Broadcast();
remove_event_mutex_.Release();
- PlatformThread::YieldCurrentThread();
+ base::PlatformThread::YieldCurrentThread();
completed_mutex_.Acquire();
if (completed_)
@@ -225,10 +225,10 @@
}
Pair* pair_;
- ConditionVariable remove_event_;
- Lock remove_event_mutex_;
+ base::ConditionVariable remove_event_;
+ base::Lock remove_event_mutex_;
bool remove_event_bool_;
- Lock completed_mutex_;
+ base::Lock completed_mutex_;
bool completed_;
std::vector<ThreadInfo> threads_;
ThreadArgs args_;
diff --git a/chrome/common/extensions/api/extension_api.json b/chrome/common/extensions/api/extension_api.json
index 8dac7c4..7709ec2 100644
--- a/chrome/common/extensions/api/extension_api.json
+++ b/chrome/common/extensions/api/extension_api.json
@@ -1318,7 +1318,7 @@
{
"name": "onCreated",
"type": "function",
- "description": "Fires when a tab is created.",
+ "description": "Fires when a tab is created. Note that the tab's URL may not be set at the time this event fires, but you can listen to onUpdated events to be notified when a URL is set.",
"parameters": [
{
"$ref": "Tab",
diff --git a/chrome/common/extensions/docs/a11y.html b/chrome/common/extensions/docs/a11y.html
index 721b93a..d18f6f7 100644
--- a/chrome/common/extensions/docs/a11y.html
+++ b/chrome/common/extensions/docs/a11y.html
@@ -956,7 +956,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/api_index.html b/chrome/common/extensions/docs/api_index.html
index 5480998..af8e72b 100644
--- a/chrome/common/extensions/docs/api_index.html
+++ b/chrome/common/extensions/docs/api_index.html
@@ -523,7 +523,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/api_other.html b/chrome/common/extensions/docs/api_other.html
index baa17f2..7a0077e 100644
--- a/chrome/common/extensions/docs/api_other.html
+++ b/chrome/common/extensions/docs/api_other.html
@@ -555,7 +555,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/apps.html b/chrome/common/extensions/docs/apps.html
index 53634d6..7a79f45 100644
--- a/chrome/common/extensions/docs/apps.html
+++ b/chrome/common/extensions/docs/apps.html
@@ -653,7 +653,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/autoupdate.html b/chrome/common/extensions/docs/autoupdate.html
index b65e2a8..d3aaf51 100644
--- a/chrome/common/extensions/docs/autoupdate.html
+++ b/chrome/common/extensions/docs/autoupdate.html
@@ -612,7 +612,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/background_pages.html b/chrome/common/extensions/docs/background_pages.html
index 68dfa2d..85d9b99 100644
--- a/chrome/common/extensions/docs/background_pages.html
+++ b/chrome/common/extensions/docs/background_pages.html
@@ -605,7 +605,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/bookmarks.html b/chrome/common/extensions/docs/bookmarks.html
index 1f31c7b..33dd392 100644
--- a/chrome/common/extensions/docs/bookmarks.html
+++ b/chrome/common/extensions/docs/bookmarks.html
@@ -5323,7 +5323,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/browserAction.html b/chrome/common/extensions/docs/browserAction.html
index 639fd88..f8b505f 100644
--- a/chrome/common/extensions/docs/browserAction.html
+++ b/chrome/common/extensions/docs/browserAction.html
@@ -1909,7 +1909,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/build/directory.py b/chrome/common/extensions/docs/build/directory.py
index f95344f..04c748f 100644
--- a/chrome/common/extensions/docs/build/directory.py
+++ b/chrome/common/extensions/docs/build/directory.py
@@ -640,6 +640,8 @@
old_zip_file = zipfile.ZipFile(zip_path, 'r')
except IOError, msg:
raise Exception("Could not read zip at %s: %s" % (zip_path, msg))
+ except zipfile.BadZipfile, msg:
+ raise Exception("File at %s is not a zip file: %s" % (zip_path, msg))
try:
info = old_zip_file.getinfo(zip_manifest_path)
diff --git a/chrome/common/extensions/docs/content_scripts.html b/chrome/common/extensions/docs/content_scripts.html
index 3e529d2..e64f704 100644
--- a/chrome/common/extensions/docs/content_scripts.html
+++ b/chrome/common/extensions/docs/content_scripts.html
@@ -961,7 +961,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/contextMenus.html b/chrome/common/extensions/docs/contextMenus.html
index 1265b34..981c17d 100644
--- a/chrome/common/extensions/docs/contextMenus.html
+++ b/chrome/common/extensions/docs/contextMenus.html
@@ -2933,7 +2933,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/cookies.html b/chrome/common/extensions/docs/cookies.html
index 582afa1..f45e8ef 100644
--- a/chrome/common/extensions/docs/cookies.html
+++ b/chrome/common/extensions/docs/cookies.html
@@ -3611,7 +3611,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/crx.html b/chrome/common/extensions/docs/crx.html
index b1b2df7..9a72d60 100644
--- a/chrome/common/extensions/docs/crx.html
+++ b/chrome/common/extensions/docs/crx.html
@@ -638,7 +638,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/devguide.html b/chrome/common/extensions/docs/devguide.html
index a806b4b..8e489a6 100644
--- a/chrome/common/extensions/docs/devguide.html
+++ b/chrome/common/extensions/docs/devguide.html
@@ -607,7 +607,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/docs.html b/chrome/common/extensions/docs/docs.html
index aa629a7..baab851 100644
--- a/chrome/common/extensions/docs/docs.html
+++ b/chrome/common/extensions/docs/docs.html
@@ -610,7 +610,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/events.html b/chrome/common/extensions/docs/events.html
index e6a3bb2..3136703 100644
--- a/chrome/common/extensions/docs/events.html
+++ b/chrome/common/extensions/docs/events.html
@@ -515,7 +515,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/examples/apps/hello-php/main.css b/chrome/common/extensions/docs/examples/apps/hello-php/main.css
index 26f8eb4..109547d 100644
--- a/chrome/common/extensions/docs/examples/apps/hello-php/main.css
+++ b/chrome/common/extensions/docs/examples/apps/hello-php/main.css
@@ -11,8 +11,8 @@
margin-bottom: 10px;
padding: 10px;
border-bottom: 1px solid #C6D2EB;
- background: -moz-linear-gradient(top, #fff, #EEF1F9 60%, #EEF1F9);
- background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#EEF1F9), color-stop(.6, #EEF1F9));
+ background: -moz-linear-gradient(#fff, #EEF1F9 60%, #EEF1F9);
+ background: -webkit-linear-gradient(#fff, #EEF1F9 60%, #EEF1F9);
text-shadow: 1px 1px 1px #fff;
}
@@ -87,4 +87,3 @@
#license-server-response span.no {
color: red;
}
-
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot.zip b/chrome/common/extensions/docs/examples/extensions/buildbot.zip
index 9e7ad86..472d88e 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot.zip
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
index f89511a..8c82c45 100644
--- a/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
+++ b/chrome/common/extensions/docs/examples/extensions/buildbot/popup.html
@@ -1,7 +1,6 @@
<head>
<script>
-var botRoot = "http://build.chromium.org/buildbot";
-//var botRoot = "http://chrome-buildbot.corp.google.com:8010";
+var botRoot = "http://build.chromium.org/p/chromium";
var waterfallURL = botRoot + "/waterfall/bot_status.json?json=1";
var botList;
var checkinResults;
diff --git a/chrome/common/extensions/docs/examples/extensions/chrome_search.zip b/chrome/common/extensions/docs/examples/extensions/chrome_search.zip
index a38e561..81693c0 100644
--- a/chrome/common/extensions/docs/examples/extensions/chrome_search.zip
+++ b/chrome/common/extensions/docs/examples/extensions/chrome_search.zip
Binary files differ
diff --git a/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json b/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json
index 3254391..54de17c 100644
--- a/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json
+++ b/chrome/common/extensions/docs/examples/extensions/chrome_search/manifest.json
@@ -1,9 +1,9 @@
{
"background_page": "background.html",
"description": "Add support to the omnibox to search the Chromium source code.",
- "key": "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDRx0y4f/CuomPPeGxcVMo7yfYZ1apxD+9e3ItNtPRBi8WMmzG0xhjnqvm03LTfTljbzA1L93s31HkjS5Bd12qM8SSZxOOizsZveK1tdpX0QelikSUaz1wwIyjatoC/jJy7vuuk0j5kPeLkNAhYGJTqN3H/Pqt0lFF1VFX4+fCEvQIDAQAB",
"name": "Chromium Search",
"omnibox": { "keyword" : "src" },
"permissions": [ "tabs", "http://www.google.com/" ],
- "version": "4"
+ "version": "5",
+ "minimum_chrome_version": "9"
}
diff --git a/chrome/common/extensions/docs/examples/extensions/irc/servlet/styles.css b/chrome/common/extensions/docs/examples/extensions/irc/servlet/styles.css
index 6d1dbc3..a1efa37 100644
--- a/chrome/common/extensions/docs/examples/extensions/irc/servlet/styles.css
+++ b/chrome/common/extensions/docs/examples/extensions/irc/servlet/styles.css
@@ -11,14 +11,14 @@
height: 100%;
width: 100%;
}
-
+
#headerContainer {
display: -webkit-box;
height: 32px;
-webkit-box-orient: horizontal;
-webkit-box-align: stretch;
}
-
+
#pageControls {
position: absolute;
right: 0px;
@@ -57,9 +57,8 @@
position: absolute;
width: 80%;
height: 100%;
- background: -webkit-gradient(linear, left top, left bottom,
- from(#aaaaaa), to(white));
- -webkit-transition: margin 0.25s ease-in-out;
+ background: -webkit-linear-gradient(#aaa, white);
+ -webkit-transition: margin 0.25s ease-in-out;
}
.channelSlide.far-left {
@@ -98,7 +97,7 @@
background-color: white;
color: #999999;
padding: 0px 6px 4px 6px;
- height:
+ height:
}
.channelSlideContainer {
@@ -144,7 +143,7 @@
margin: 10px;
margin-left: 10%;
bottom: 0px;
- -webkit-box-shadow: 3px 3px 5px #888;
+ -webkit-box-shadow: 3px 3px 5px #888;
}
#entryText {
@@ -156,6 +155,5 @@
font-family: "Lucida Console", Monospace;
color: white;
border: 0px;
- background: #777777;
+ background: #777777;
}
-
diff --git a/chrome/common/extensions/docs/experimental.clipboard.html b/chrome/common/extensions/docs/experimental.clipboard.html
index 4852c75..24287e0 100644
--- a/chrome/common/extensions/docs/experimental.clipboard.html
+++ b/chrome/common/extensions/docs/experimental.clipboard.html
@@ -966,7 +966,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.contextMenus.html b/chrome/common/extensions/docs/experimental.contextMenus.html
index 5f246fd..aa7a362 100644
--- a/chrome/common/extensions/docs/experimental.contextMenus.html
+++ b/chrome/common/extensions/docs/experimental.contextMenus.html
@@ -480,7 +480,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.cookies.html b/chrome/common/extensions/docs/experimental.cookies.html
index b179e08..5fdcdcc 100644
--- a/chrome/common/extensions/docs/experimental.cookies.html
+++ b/chrome/common/extensions/docs/experimental.cookies.html
@@ -480,7 +480,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.history.html b/chrome/common/extensions/docs/experimental.history.html
index b839162..0e45ec7 100644
--- a/chrome/common/extensions/docs/experimental.history.html
+++ b/chrome/common/extensions/docs/experimental.history.html
@@ -480,7 +480,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.html b/chrome/common/extensions/docs/experimental.html
index fd600a2..1c9ebe1 100644
--- a/chrome/common/extensions/docs/experimental.html
+++ b/chrome/common/extensions/docs/experimental.html
@@ -547,7 +547,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.idle.html b/chrome/common/extensions/docs/experimental.idle.html
index 6f709ae..6d1ae19 100644
--- a/chrome/common/extensions/docs/experimental.idle.html
+++ b/chrome/common/extensions/docs/experimental.idle.html
@@ -480,7 +480,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.infobars.html b/chrome/common/extensions/docs/experimental.infobars.html
index 59e642d..f542b7a 100644
--- a/chrome/common/extensions/docs/experimental.infobars.html
+++ b/chrome/common/extensions/docs/experimental.infobars.html
@@ -800,7 +800,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.processes.html b/chrome/common/extensions/docs/experimental.processes.html
index a41a1c6..f2a289e 100644
--- a/chrome/common/extensions/docs/experimental.processes.html
+++ b/chrome/common/extensions/docs/experimental.processes.html
@@ -1107,7 +1107,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.proxy.html b/chrome/common/extensions/docs/experimental.proxy.html
index a13ce9e..07ba013 100644
--- a/chrome/common/extensions/docs/experimental.proxy.html
+++ b/chrome/common/extensions/docs/experimental.proxy.html
@@ -1455,7 +1455,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.sidebar.html b/chrome/common/extensions/docs/experimental.sidebar.html
index 727bf89..148de03 100644
--- a/chrome/common/extensions/docs/experimental.sidebar.html
+++ b/chrome/common/extensions/docs/experimental.sidebar.html
@@ -2583,7 +2583,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.webNavigation.html b/chrome/common/extensions/docs/experimental.webNavigation.html
index 237ee23..52a04af 100644
--- a/chrome/common/extensions/docs/experimental.webNavigation.html
+++ b/chrome/common/extensions/docs/experimental.webNavigation.html
@@ -2555,7 +2555,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/experimental.webRequest.html b/chrome/common/extensions/docs/experimental.webRequest.html
index 14346ff..71769af 100644
--- a/chrome/common/extensions/docs/experimental.webRequest.html
+++ b/chrome/common/extensions/docs/experimental.webRequest.html
@@ -2493,7 +2493,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/extension.html b/chrome/common/extensions/docs/extension.html
index e7bb9e7..a0e11fd 100644
--- a/chrome/common/extensions/docs/extension.html
+++ b/chrome/common/extensions/docs/extension.html
@@ -3556,7 +3556,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/external_extensions.html b/chrome/common/extensions/docs/external_extensions.html
index 39c1540..0ee2ed5 100644
--- a/chrome/common/extensions/docs/external_extensions.html
+++ b/chrome/common/extensions/docs/external_extensions.html
@@ -768,7 +768,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/faq.html b/chrome/common/extensions/docs/faq.html
index 66cc1b4..0e17982 100644
--- a/chrome/common/extensions/docs/faq.html
+++ b/chrome/common/extensions/docs/faq.html
@@ -872,7 +872,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/getstarted.html b/chrome/common/extensions/docs/getstarted.html
index d7e94c8..3adba4e 100644
--- a/chrome/common/extensions/docs/getstarted.html
+++ b/chrome/common/extensions/docs/getstarted.html
@@ -656,7 +656,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/history.html b/chrome/common/extensions/docs/history.html
index ce1c49e..e6be466 100644
--- a/chrome/common/extensions/docs/history.html
+++ b/chrome/common/extensions/docs/history.html
@@ -3150,7 +3150,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/hosting.html b/chrome/common/extensions/docs/hosting.html
index e852619..0a688fb 100644
--- a/chrome/common/extensions/docs/hosting.html
+++ b/chrome/common/extensions/docs/hosting.html
@@ -560,7 +560,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/i18n-messages.html b/chrome/common/extensions/docs/i18n-messages.html
index cf07efd..3c85b6b 100644
--- a/chrome/common/extensions/docs/i18n-messages.html
+++ b/chrome/common/extensions/docs/i18n-messages.html
@@ -814,7 +814,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/i18n.html b/chrome/common/extensions/docs/i18n.html
index 39d0f83..d5e3bb9 100644
--- a/chrome/common/extensions/docs/i18n.html
+++ b/chrome/common/extensions/docs/i18n.html
@@ -1421,7 +1421,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/idle.html b/chrome/common/extensions/docs/idle.html
index 6b3aa54..1ab1b64 100644
--- a/chrome/common/extensions/docs/idle.html
+++ b/chrome/common/extensions/docs/idle.html
@@ -713,7 +713,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/images/perms-hw1.png b/chrome/common/extensions/docs/images/perms-hw1.png
index eb6a79e..224bd2d 100644
--- a/chrome/common/extensions/docs/images/perms-hw1.png
+++ b/chrome/common/extensions/docs/images/perms-hw1.png
Binary files differ
diff --git a/chrome/common/extensions/docs/images/perms-hw2.png b/chrome/common/extensions/docs/images/perms-hw2.png
index 8fd5c47..644a276 100644
--- a/chrome/common/extensions/docs/images/perms-hw2.png
+++ b/chrome/common/extensions/docs/images/perms-hw2.png
Binary files differ
diff --git a/chrome/common/extensions/docs/index.html b/chrome/common/extensions/docs/index.html
index 7e89cfc..54cd32f 100644
--- a/chrome/common/extensions/docs/index.html
+++ b/chrome/common/extensions/docs/index.html
@@ -582,7 +582,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/js/sample_search.js b/chrome/common/extensions/docs/js/sample_search.js
index 3b95094..5d8737b 100644
--- a/chrome/common/extensions/docs/js/sample_search.js
+++ b/chrome/common/extensions/docs/js/sample_search.js
@@ -25,6 +25,7 @@
return;
} else {
currentfilter = searchtext;
+ window.location.hash = searchinput.value;
}
noresults.style.display = 'none';
@@ -77,7 +78,13 @@
}
if (window.location.hash.length > 1) {
- setFilter(window.location.hash.substring(1));
+ var hash = window.location.hash.substring(1);
+ var elem = document.getElementById(hash);
+ if (elem) {
+ elem.scrollIntoView();
+ } else {
+ setFilter(hash);
+ }
}
};
diff --git a/chrome/common/extensions/docs/management.html b/chrome/common/extensions/docs/management.html
index 7efee0e..149e27e 100644
--- a/chrome/common/extensions/docs/management.html
+++ b/chrome/common/extensions/docs/management.html
@@ -2661,7 +2661,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/manifest.html b/chrome/common/extensions/docs/manifest.html
index c043355..7f477f9 100644
--- a/chrome/common/extensions/docs/manifest.html
+++ b/chrome/common/extensions/docs/manifest.html
@@ -949,7 +949,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/match_patterns.html b/chrome/common/extensions/docs/match_patterns.html
index c9aa23c..ddbc56b 100644
--- a/chrome/common/extensions/docs/match_patterns.html
+++ b/chrome/common/extensions/docs/match_patterns.html
@@ -702,7 +702,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/messaging.html b/chrome/common/extensions/docs/messaging.html
index 4d7d884..19e683d 100644
--- a/chrome/common/extensions/docs/messaging.html
+++ b/chrome/common/extensions/docs/messaging.html
@@ -768,7 +768,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/notifications.html b/chrome/common/extensions/docs/notifications.html
index 3afbd73..82c5e07 100644
--- a/chrome/common/extensions/docs/notifications.html
+++ b/chrome/common/extensions/docs/notifications.html
@@ -609,7 +609,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/npapi.html b/chrome/common/extensions/docs/npapi.html
index 904bff2..8aad2ea 100644
--- a/chrome/common/extensions/docs/npapi.html
+++ b/chrome/common/extensions/docs/npapi.html
@@ -567,7 +567,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/omnibox.html b/chrome/common/extensions/docs/omnibox.html
index 24fad5e..6f7afa7 100644
--- a/chrome/common/extensions/docs/omnibox.html
+++ b/chrome/common/extensions/docs/omnibox.html
@@ -1217,7 +1217,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/options.html b/chrome/common/extensions/docs/options.html
index 701630a..982032f 100644
--- a/chrome/common/extensions/docs/options.html
+++ b/chrome/common/extensions/docs/options.html
@@ -558,7 +558,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/override.html b/chrome/common/extensions/docs/override.html
index 6d03561..bfa7e7d 100644
--- a/chrome/common/extensions/docs/override.html
+++ b/chrome/common/extensions/docs/override.html
@@ -663,7 +663,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/overview.html b/chrome/common/extensions/docs/overview.html
index 2d5760f..49e7d8c 100644
--- a/chrome/common/extensions/docs/overview.html
+++ b/chrome/common/extensions/docs/overview.html
@@ -937,7 +937,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/packaging.html b/chrome/common/extensions/docs/packaging.html
index 4939c6c..ccfa542 100644
--- a/chrome/common/extensions/docs/packaging.html
+++ b/chrome/common/extensions/docs/packaging.html
@@ -649,7 +649,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/pageAction.html b/chrome/common/extensions/docs/pageAction.html
index b086ab8..f6d0ac4 100644
--- a/chrome/common/extensions/docs/pageAction.html
+++ b/chrome/common/extensions/docs/pageAction.html
@@ -1664,7 +1664,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/permission_warnings.html b/chrome/common/extensions/docs/permission_warnings.html
index 1c6ed92..eb062e3 100644
--- a/chrome/common/extensions/docs/permission_warnings.html
+++ b/chrome/common/extensions/docs/permission_warnings.html
@@ -326,9 +326,21 @@
<div id="static"><div id="pageData-name" class="pageData">Permission Warnings</div>
<div id="pageData-showTOC" class="pageData">true</div>
+<!--
+NOTE: When this doc is updated, the online help should also be updated:
+http://www.google.com/support/chrome/bin/answer.py?hl=en&answer=186213
+
+We should periodically look at
+http://src.chromium.org/viewvc/chrome/trunk/src/chrome/app/generated_resources.grd?view=markup
+to make sure that we're covering all messages. Search for
+IDS_EXTENSION_PROMPT_WARNING
+(e.g. IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY).
+-->
+
<p>
To use most chrome.* APIs and extension capabilities,
-your extension must declare its intent in the manifest,
+your extension must declare its intent in the
+<a href="manifest.html">manifest</a>,
often in the "permissions" field.
Some of these declarations
result in a warning when
@@ -352,7 +364,7 @@
that a user might see when installing an extension:
</p>
-<img src="images/perms-hw1.png" width="387" height="162" alt="Permission warning: 'This extension can access: Your data on api.flickr.com'">
+<img src="images/perms-hw1.png" width="410" height="193" alt="Permission warning: 'It can access: Your data on api.flickr.com'">
<p>
The warning about access to data on api.flickr.com
@@ -403,7 +415,7 @@
brings up the following warning:
</p>
-<img src="images/perms-hw2.png" width="387" height="190" alt="Permission warning: 'This extension can access: Your data on api.flickr.com and flickr.com; Your browsing history'">
+<img src="images/perms-hw2.png" width="412" height="220" alt="Permission warning: 'It can access: Your data on api.flickr.com and flickr.com; Your browsing history'">
<h2 id="warnings"> Warnings and their triggers </h2>
@@ -414,8 +426,7 @@
that the extension can access your browsing history.
The reason for the warning is that
although the <code>chrome.tabs</code> API
-might be used only to open new tabs
-(<a href="tabs.html#method-create"><code>chrome.tabs.create()</code></a>),
+might be used only to open new tabs,
it can also be used to see the URL that's associated
with every newly opened tab
(using their <a href="tabs.html#type-Tab">Tab</a> objects).
@@ -425,13 +436,14 @@
<b>Note:</b>
As of Google Chrome 7,
you no longer need to specify the "tabs" permission
-just to call <code>chrome.tabs.create()</code>.
+just to call <code>chrome.tabs.create()</code>
+or <code>chrome.tabs.update()</code>.
</p>
<p>
The following table lists the warning messages
that users can see,
-along with the <a href="manifest.html">manifest</a> entries
+along with the manifest entries
that trigger them.
</p>
@@ -443,7 +455,7 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_FULL_ACCESS -->
All data on your computer and the websites you visit
</td>
<td>
@@ -457,7 +469,7 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_BOOKMARKS -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_BOOKMARKS -->
Your bookmarks
</td>
<td>
@@ -471,7 +483,7 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_BROWSING_HISTORY -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY -->
Your browsing history
</td>
<td>
@@ -498,7 +510,7 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS -->
Your data on all websites
</td>
<td>
@@ -531,8 +543,8 @@
</tr>
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_?_HOST -->
- <!-- IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_?_HOST -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_4_OR_MORE_HOSTS -->
Your data on <em>{list of websites}</em>
</td>
<td>
@@ -565,7 +577,29 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_GEOLOCATION -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_MANAGEMENT -->
+ Your list of installed apps, extensions, and themes
+ <br>
+ <span style="font-weight:normal; font-style:italic">or</span>
+ <br>
+ Manage themes, extensions, and apps
+
+ <!-- PENDING: remove "Manage...apps" alternative message
+ once the fix is out on stable channel -->
+ <!-- See http://crbug.com/67859 -->
+ </td>
+ <td>
+ "management" permission
+ </td>
+ <td>
+ The "management" permission is required by the
+ <a href="management.html"><code>chrome.management</code></a> module.
+ </td>
+</tr>
+
+<tr>
+ <td style="font-weight:bold">
+ <!-- IDS_EXTENSION_PROMPT_WARNING_GEOLOCATION -->
Your physical location
</td>
<td>
@@ -791,7 +825,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/samples.html b/chrome/common/extensions/docs/samples.html
index 85ae945..f51faa5 100644
--- a/chrome/common/extensions/docs/samples.html
+++ b/chrome/common/extensions/docs/samples.html
@@ -355,7 +355,7 @@
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/browserAction/set_icon_path/">A browser action which changes its icon when clicked.</a>
+ <a href="#0262260daf0c8f7b28feff2ef23b05e7abf9d1e0">A browser action which changes its icon when clicked.</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -388,12 +388,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/browserAction/set_icon_path.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/browserAction/set_icon_path/">Browse source</a>
+ - <a href="examples/api/browserAction/set_icon_path.zip">Download source</a>
+ </div>
</div><div class="sample" id="ea2894c41cb8e80a4433a3e6c5772dadce9be90d">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/browserAction/set_page_color/">A browser action with a popup that changes the page color.</a>
+ <a href="#ea2894c41cb8e80a4433a3e6c5772dadce9be90d">A browser action with a popup that changes the page color.</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -424,12 +427,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/browserAction/set_page_color.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/browserAction/set_page_color/">Browse source</a>
+ - <a href="examples/api/browserAction/set_page_color.zip">Download source</a>
+ </div>
</div><div class="sample" id="ede3c47b7757245be42ec33fd5ca63df4b490066">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/browserAction/make_page_red/">A browser action with no icon that makes the page red</a>
+ <a href="#ede3c47b7757245be42ec33fd5ca63df4b490066">A browser action with no icon that makes the page red</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -466,12 +472,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/browserAction/make_page_red.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/browserAction/make_page_red/">Browse source</a>
+ - <a href="examples/api/browserAction/make_page_red.zip">Download source</a>
+ </div>
</div><div class="sample" id="fbf0aa1a09a15ff8cc4fc7de4fd176d6c663d07a">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/i18n/getMessage/">AcceptLanguage</a>
+ <a href="#fbf0aa1a09a15ff8cc4fc7de4fd176d6c663d07a">AcceptLanguage</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -507,12 +516,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/i18n/getMessage.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/i18n/getMessage/">Browse source</a>
+ - <a href="examples/api/i18n/getMessage.zip">Download source</a>
+ </div>
</div><div class="sample" id="9a6e4ec46997fb92b324974afa08a3d007e2537f">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/pageAction/set_icon/">Animated Page Action</a>
+ <a href="#9a6e4ec46997fb92b324974afa08a3d007e2537f">Animated Page Action</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -557,12 +569,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/pageAction/set_icon.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/pageAction/set_icon/">Browse source</a>
+ - <a href="examples/api/pageAction/set_icon.zip">Download source</a>
+ </div>
</div><div class="sample" id="a1f7cf79dd555b04fa8d603247a040e644996293">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/app_launcher/">App Launcher</a>
+ <a href="#a1f7cf79dd555b04fa8d603247a040e644996293">App Launcher</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -602,12 +617,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/app_launcher.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/app_launcher/">Browse source</a>
+ - <a href="examples/extensions/app_launcher.zip">Download source</a>
+ </div>
</div><div class="sample" id="9747e3d6a3eab39bc7c17f11a80573c62d44c7e5">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/override/blank_ntp/">Blank new tab page</a>
+ <a href="#9747e3d6a3eab39bc7c17f11a80573c62d44c7e5">Blank new tab page</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -632,12 +650,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/override/blank_ntp.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/override/blank_ntp/">Browse source</a>
+ - <a href="examples/api/override/blank_ntp.zip">Download source</a>
+ </div>
</div><div class="sample" id="903e7277139e1e6caec123d3319cab295d8d1b3a">
<img class="icon" src="examples/extensions/fx/icon.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/fx/">Chrome Sounds</a>
+ <a href="#903e7277139e1e6caec123d3319cab295d8d1b3a">Chrome Sounds</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -709,12 +730,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/fx.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/fx/">Browse source</a>
+ - <a href="examples/extensions/fx.zip">Download source</a>
+ </div>
</div><div class="sample" id="0e790e035a4a00b6f1def5ef9a7d7be1bce95ab5">
<img class="icon" src="examples/extensions/buildbot/icon.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/buildbot/">Chromium Buildbot Monitor</a>
+ <a href="#0e790e035a4a00b6f1def5ef9a7d7be1bce95ab5">Chromium Buildbot Monitor</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -761,12 +785,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/buildbot.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/buildbot/">Browse source</a>
+ - <a href="examples/extensions/buildbot.zip">Download source</a>
+ </div>
</div><div class="sample" id="ac31228200b41a87982e386cc90d3a6eee4ad885">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/chrome_search/">Chromium Search</a>
+ <a href="#ac31228200b41a87982e386cc90d3a6eee4ad885">Chromium Search</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -808,12 +835,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/chrome_search.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/chrome_search/">Browse source</a>
+ - <a href="examples/extensions/chrome_search.zip">Download source</a>
+ </div>
</div><div class="sample" id="7d5d6cf195bc25480256618e360aa38c6e6fba82">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/i18n/cld/">CLD</a>
+ <a href="#7d5d6cf195bc25480256618e360aa38c6e6fba82">CLD</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -854,12 +884,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/i18n/cld.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/i18n/cld/">Browse source</a>
+ - <a href="examples/api/i18n/cld.zip">Download source</a>
+ </div>
</div><div class="sample" id="5d81304a17cf7ac2887484f730fbd2b01e51e166">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/contextMenus/basic/">Context Menus Sample</a>
+ <a href="#5d81304a17cf7ac2887484f730fbd2b01e51e166">Context Menus Sample</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -889,12 +922,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/contextMenus/basic.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/contextMenus/basic/">Browse source</a>
+ - <a href="examples/api/contextMenus/basic.zip">Download source</a>
+ </div>
</div><div class="sample" id="4daa6becd0899a54776d9cf7f09613ed1a9f4d77">
<img class="icon" src="examples/api/cookies/cookie.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/cookies/">Cookie API Test Extension</a>
+ <a href="#4daa6becd0899a54776d9cf7f09613ed1a9f4d77">Cookie API Test Extension</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -948,12 +984,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/cookies.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/cookies/">Browse source</a>
+ - <a href="examples/api/cookies.zip">Download source</a>
+ </div>
</div><div class="sample" id="6871d09f4a96bf9d4b6cc724d00e909cee0f3902">
<img class="icon" src="examples/howto/contentscript_xhr/sample-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/howto/contentscript_xhr/">Cross-domain XMLHttpRequest from a content script</a>
+ <a href="#6871d09f4a96bf9d4b6cc724d00e909cee0f3902">Cross-domain XMLHttpRequest from a content script</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -982,12 +1021,15 @@
</li>
</ul>
</div>
- <div><a href="examples/howto/contentscript_xhr.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/howto/contentscript_xhr/">Browse source</a>
+ - <a href="examples/howto/contentscript_xhr.zip">Download source</a>
+ </div>
</div><div class="sample" id="028eb5364924344029bcbe1d527f132fc72b34e5">
<img class="icon" src="examples/extensions/email_this_page/mail_128x128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/email_this_page/">Email this page (by Google)</a>
+ <a href="#028eb5364924344029bcbe1d527f132fc72b34e5">Email this page (by Google)</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1035,12 +1077,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/email_this_page.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/email_this_page/">Browse source</a>
+ - <a href="examples/extensions/email_this_page.zip">Download source</a>
+ </div>
</div><div class="sample" id="763a08e9b06595d785568a8d392b95a2f3700258">
<img class="icon" src="examples/tutorials/analytics/analytics-extension-icon-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/tutorials/analytics/">Event Tracking with Google Analytics</a>
+ <a href="#763a08e9b06595d785568a8d392b95a2f3700258">Event Tracking with Google Analytics</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1075,12 +1120,15 @@
</li>
</ul>
</div>
- <div><a href="examples/tutorials/analytics.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/tutorials/analytics/">Browse source</a>
+ - <a href="examples/tutorials/analytics.zip">Download source</a>
+ </div>
</div><div class="sample" id="e3df888a89e35bdeb9c8bc8d03be5e1851b97c68">
<img class="icon" src="examples/api/omnibox/extension-docs/icon-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/omnibox/extension-docs/">Extension Docs Search</a>
+ <a href="#e3df888a89e35bdeb9c8bc8d03be5e1851b97c68">Extension Docs Search</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1118,12 +1166,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/omnibox/extension-docs.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/omnibox/extension-docs/">Browse source</a>
+ - <a href="examples/api/omnibox/extension-docs.zip">Download source</a>
+ </div>
</div><div class="sample" id="8b0dd31216235941bdd8eb33fda915ef5cf79a82">
<img class="icon" src="examples/extensions/calendar/images/icon-128.gif">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/calendar/">Google Calendar Checker (by Google)</a>
+ <a href="#8b0dd31216235941bdd8eb33fda915ef5cf79a82">Google Calendar Checker (by Google)</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1193,12 +1244,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/calendar.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/calendar/">Browse source</a>
+ - <a href="examples/extensions/calendar.zip">Download source</a>
+ </div>
</div><div class="sample" id="4e35caa9742fb82dbd628892d23a781614f6eff6">
<img class="icon" src="examples/extensions/gdocs/img/docs_spreadsheets-128.gif">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/gdocs/">Google Document List Viewer</a>
+ <a href="#4e35caa9742fb82dbd628892d23a781614f6eff6">Google Document List Viewer</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1261,12 +1315,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/gdocs.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/gdocs/">Browse source</a>
+ - <a href="examples/extensions/gdocs.zip">Download source</a>
+ </div>
</div><div class="sample" id="bb57f7a0132cbeb36ad7e7bb0ab75c21704234ca">
<img class="icon" src="examples/extensions/gmail/icon_128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/gmail/">Google Mail Checker</a>
+ <a href="#bb57f7a0132cbeb36ad7e7bb0ab75c21704234ca">Google Mail Checker</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1406,12 +1463,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/gmail.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/gmail/">Browse source</a>
+ - <a href="examples/extensions/gmail.zip">Download source</a>
+ </div>
</div><div class="sample" id="1682e05ea9a1bde985123b04f6f8ac50a8a64033">
<img class="icon" src="examples/extensions/wave/128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/wave/">Google Wave Notifier</a>
+ <a href="#1682e05ea9a1bde985123b04f6f8ac50a8a64033">Google Wave Notifier</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1472,12 +1532,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/wave.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/wave/">Browse source</a>
+ - <a href="examples/extensions/wave.zip">Download source</a>
+ </div>
</div><div class="sample" id="14b9651fda4e57b2a5914ba73a779812201b750a">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/tutorials/getstarted/">Hello World</a>
+ <a href="#14b9651fda4e57b2a5914ba73a779812201b750a">Hello World</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1505,12 +1568,15 @@
</li>
</ul>
</div>
- <div><a href="examples/tutorials/getstarted.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/tutorials/getstarted/">Browse source</a>
+ - <a href="examples/tutorials/getstarted.zip">Download source</a>
+ </div>
</div><div class="sample" id="2020d72f2577f53caf8e94e3dbac0fb849ceaa4d">
<img class="icon" src="examples/api/idle/idle_simple/sample-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/idle/idle_simple/">Idle - Simple Example</a>
+ <a href="#2020d72f2577f53caf8e94e3dbac0fb849ceaa4d">Idle - Simple Example</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1549,12 +1615,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/idle/idle_simple.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/idle/idle_simple/">Browse source</a>
+ - <a href="examples/api/idle/idle_simple.zip">Download source</a>
+ </div>
</div><div class="sample" id="0ea1588bd07b20338fc21f725de1542a5fdf9726">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/override/override_igoogle/">iGoogle new tab page</a>
+ <a href="#0ea1588bd07b20338fc21f725de1542a5fdf9726">iGoogle new tab page</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1579,12 +1648,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/override/override_igoogle.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/override/override_igoogle/">Browse source</a>
+ - <a href="examples/api/override/override_igoogle.zip">Download source</a>
+ </div>
</div><div class="sample" id="646325c25f572a1d15edc73d057f821d847a4fbe">
<img class="icon" src="examples/extensions/imageinfo/imageinfo-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/imageinfo/">Imageinfo</a>
+ <a href="#646325c25f572a1d15edc73d057f821d847a4fbe">Imageinfo</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1631,12 +1703,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/imageinfo.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/imageinfo/">Browse source</a>
+ - <a href="examples/extensions/imageinfo.zip">Download source</a>
+ </div>
</div><div class="sample" id="ec97ec20ca2f095d081e39f1565fc12af09ef067">
<img class="icon" src="examples/extensions/mappy/icon.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/mappy/">Mappy</a>
+ <a href="#ec97ec20ca2f095d081e39f1565fc12af09ef067">Mappy</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1692,12 +1767,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/mappy.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/mappy/">Browse source</a>
+ - <a href="examples/extensions/mappy.zip">Download source</a>
+ </div>
</div><div class="sample" id="b2f5f8a790e16f091a7e4e0a39b2d0a6d32e3a6d">
<img class="icon" src="examples/api/windows/merge_windows/merge_windows_128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/windows/merge_windows/">Merge Windows</a>
+ <a href="#b2f5f8a790e16f091a7e4e0a39b2d0a6d32e3a6d">Merge Windows</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1740,12 +1818,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/windows/merge_windows.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/windows/merge_windows/">Browse source</a>
+ - <a href="examples/api/windows/merge_windows.zip">Download source</a>
+ </div>
</div><div class="sample" id="51a83d2ba3a32e3ff1bdb624d4e18ccec4c4038e">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/messaging/timer/">Message Timer</a>
+ <a href="#51a83d2ba3a32e3ff1bdb624d4e18ccec4c4038e">Message Timer</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1788,12 +1869,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/messaging/timer.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/messaging/timer/">Browse source</a>
+ - <a href="examples/api/messaging/timer.zip">Download source</a>
+ </div>
</div><div class="sample" id="4f6785ec4f937add6728615682dd37c9a42d9548">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/bookmarks/basic/">My Bookmarks</a>
+ <a href="#4f6785ec4f937add6728615682dd37c9a42d9548">My Bookmarks</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1837,12 +1921,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/bookmarks/basic.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/bookmarks/basic/">Browse source</a>
+ - <a href="examples/api/bookmarks/basic.zip">Download source</a>
+ </div>
</div><div class="sample" id="597015d3bcce3da693b02314afd607bec4f55291">
<img class="icon" src="examples/extensions/news_a11y/news_icon.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/news_a11y/">News Reader</a>
+ <a href="#597015d3bcce3da693b02314afd607bec4f55291">News Reader</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1873,12 +1960,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/news_a11y.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/news_a11y/">Browse source</a>
+ - <a href="examples/extensions/news_a11y.zip">Download source</a>
+ </div>
</div><div class="sample" id="6444e5c8ae112a6a433909c5e770669cd16e2e5f">
<img class="icon" src="examples/extensions/news_i18n/news_icon.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/news_i18n/">News Reader</a>
+ <a href="#6444e5c8ae112a6a433909c5e770669cd16e2e5f">News Reader</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1917,12 +2007,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/news_i18n.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/news_i18n/">Browse source</a>
+ - <a href="examples/extensions/news_i18n.zip">Download source</a>
+ </div>
</div><div class="sample" id="3aea027164cb9b732ba4a8c51cb93708891726ef">
<img class="icon" src="examples/extensions/news/images/news_icon.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/news/">News Reader (by Google)</a>
+ <a href="#3aea027164cb9b732ba4a8c51cb93708891726ef">News Reader (by Google)</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -1979,12 +2072,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/news.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/news/">Browse source</a>
+ - <a href="examples/extensions/news.zip">Download source</a>
+ </div>
</div><div class="sample" id="f799e26ceef2367cf836f24bcb47df4398b0df58">
<img class="icon" src="examples/api/notifications/128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/notifications/">Notification Demo</a>
+ <a href="#f799e26ceef2367cf836f24bcb47df4398b0df58">Notification Demo</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2022,12 +2118,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/notifications.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/notifications/">Browse source</a>
+ - <a href="examples/api/notifications.zip">Download source</a>
+ </div>
</div><div class="sample" id="e787b322bddbc6289bb31b7d7550b1bf6456a80b">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/omnibox/simple-example/">Omnibox Example</a>
+ <a href="#e787b322bddbc6289bb31b7d7550b1bf6456a80b">Omnibox Example</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2054,12 +2153,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/omnibox/simple-example.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/omnibox/simple-example/">Browse source</a>
+ - <a href="examples/api/omnibox/simple-example.zip">Download source</a>
+ </div>
</div><div class="sample" id="8d0a50b57c26bb498be592e871001ffed91541b4">
<img class="icon" src="examples/api/pageAction/pageaction_by_content/sandwich-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/pageAction/pageaction_by_content/">Page action by content</a>
+ <a href="#8d0a50b57c26bb498be592e871001ffed91541b4">Page action by content</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2093,12 +2195,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/pageAction/pageaction_by_content.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/pageAction/pageaction_by_content/">Browse source</a>
+ - <a href="examples/api/pageAction/pageaction_by_content.zip">Download source</a>
+ </div>
</div><div class="sample" id="80b86ccc6e8520660fa591caa565826f0ed1b12c">
<img class="icon" src="examples/api/pageAction/pageaction_by_url/icon-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/pageAction/pageaction_by_url/">Page action by URL</a>
+ <a href="#80b86ccc6e8520660fa591caa565826f0ed1b12c">Page action by URL</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2131,12 +2236,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/pageAction/pageaction_by_url.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/pageAction/pageaction_by_url/">Browse source</a>
+ - <a href="examples/api/pageAction/pageaction_by_url.zip">Download source</a>
+ </div>
</div><div class="sample" id="d74c3c18a1c1dd18b035149105a306f837c8823e">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/benchmark/">Page Benchmarker</a>
+ <a href="#d74c3c18a1c1dd18b035149105a306f837c8823e">Page Benchmarker</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2236,12 +2344,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/benchmark.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/benchmark/">Browse source</a>
+ - <a href="examples/extensions/benchmark.zip">Download source</a>
+ </div>
</div><div class="sample" id="e6ae17ab4ccfd7e059c8c01f25760ca5d894c7fd">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/browserAction/print/">Print this page</a>
+ <a href="#e6ae17ab4ccfd7e059c8c01f25760ca5d894c7fd">Print this page</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2274,12 +2385,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/browserAction/print.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/browserAction/print/">Browse source</a>
+ - <a href="examples/api/browserAction/print.zip">Download source</a>
+ </div>
</div><div class="sample" id="beff6ecd9677dea0a7c648c5042165b48bb66f09">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/processes/process_monitor/">Process Monitor</a>
+ <a href="#beff6ecd9677dea0a7c648c5042165b48bb66f09">Process Monitor</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2313,12 +2427,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/processes/process_monitor.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/processes/process_monitor/">Browse source</a>
+ - <a href="examples/api/processes/process_monitor.zip">Download source</a>
+ </div>
</div><div class="sample" id="56a8d2ac24ca7bba78fd88ad57f43fc13c784497">
<img class="icon" src="examples/extensions/oauth_contacts/img/icon-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/oauth_contacts/">Sample - OAuth Contacts</a>
+ <a href="#56a8d2ac24ca7bba78fd88ad57f43fc13c784497">Sample - OAuth Contacts</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2373,12 +2490,15 @@
</li>
</ul>
</div>
- <div><a href="examples/extensions/oauth_contacts.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/extensions/oauth_contacts/">Browse source</a>
+ - <a href="examples/extensions/oauth_contacts.zip">Download source</a>
+ </div>
</div><div class="sample" id="38f6e1e17756ede38b1364c7114a738ca717dcbb">
<img class="icon" src="examples/api/infobars/sandwichbar/sandwich-128.png">
<img class="icon" src="images/sample-default-icon.png" style="display: none; ">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/infobars/sandwichbar/">SandwichBar</a>
+ <a href="#38f6e1e17756ede38b1364c7114a738ca717dcbb">SandwichBar</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2414,12 +2534,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/infobars/sandwichbar.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/infobars/sandwichbar/">Browse source</a>
+ - <a href="examples/api/infobars/sandwichbar.zip">Download source</a>
+ </div>
</div><div class="sample" id="fc89b35755483af30b66cd72cefa34a43a3e8312">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/processes/show_tabs/">Show Tabs in Process</a>
+ <a href="#fc89b35755483af30b66cd72cefa34a43a3e8312">Show Tabs in Process</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2467,12 +2590,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/processes/show_tabs.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/processes/show_tabs/">Browse source</a>
+ - <a href="examples/api/processes/show_tabs.zip">Download source</a>
+ </div>
</div><div class="sample" id="230463f2d5c3d4d0ca13c230e1f00f2aae0a8a64">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/tabs/inspector/">Tab Inspector</a>
+ <a href="#230463f2d5c3d4d0ca13c230e1f00f2aae0a8a64">Tab Inspector</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2557,12 +2683,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/tabs/inspector.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/tabs/inspector/">Browse source</a>
+ - <a href="examples/api/tabs/inspector.zip">Download source</a>
+ </div>
</div><div class="sample" id="e1697cacebad05218798bf3e8a0f724517f0e8c3">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/tabs/screenshot/">Test Screenshot Extension</a>
+ <a href="#e1697cacebad05218798bf3e8a0f724517f0e8c3">Test Screenshot Extension</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2607,12 +2736,15 @@
</li>
</ul>
</div>
- <div><a href="examples/api/tabs/screenshot.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/tabs/screenshot/">Browse source</a>
+ - <a href="examples/api/tabs/screenshot.zip">Download source</a>
+ </div>
</div><div class="sample" id="b3de91ab04b7d7a2670ca7ee9d740eb42cead0b6">
<img class="icon" style="display: none; ">
<img class="icon" src="images/sample-default-icon.png">
<h2 class="name">
- <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/history/showHistory/">Typed URL History</a>
+ <a href="#b3de91ab04b7d7a2670ca7ee9d740eb42cead0b6">Typed URL History</a>
</h2>
<p class="metadata features">Uses
<span>
@@ -2649,7 +2781,10 @@
</li>
</ul>
</div>
- <div><a href="examples/api/history/showHistory.zip">Download .zip</a></div>
+ <div>
+ <a target="_blank" href="http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/history/showHistory/">Browse source</a>
+ - <a href="examples/api/history/showHistory.zip">Download source</a>
+ </div>
</div>
<div id="noresults" style="display:none">
@@ -2822,7 +2957,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/samples.json b/chrome/common/extensions/docs/samples.json
index 9e70b0c..b060a44 100644
--- a/chrome/common/extensions/docs/samples.json
+++ b/chrome/common/extensions/docs/samples.json
@@ -401,7 +401,7 @@
"options.html",
"popup.html"
],
- "source_hash": "a6ad5cd2a77ef54c0d96b4c5da014cfac34487db",
+ "source_hash": "ad985dc5b3e2b40826042be1d7b77c07fadfcc68",
"zip_path": "examples/extensions/buildbot.zip"
},
{
@@ -432,7 +432,7 @@
"background.html",
"manifest.json"
],
- "source_hash": "027409688a677867e3f2fcbc530ceac904ccedea",
+ "source_hash": "37dd43080094bbe459b0429f1a2b995c33bab7c3",
"zip_path": "examples/extensions/chrome_search.zip"
},
{
diff --git a/chrome/common/extensions/docs/static/permission_warnings.html b/chrome/common/extensions/docs/static/permission_warnings.html
index eea6558..4671f58 100644
--- a/chrome/common/extensions/docs/static/permission_warnings.html
+++ b/chrome/common/extensions/docs/static/permission_warnings.html
@@ -1,9 +1,21 @@
<div id="pageData-name" class="pageData">Permission Warnings</div>
<div id="pageData-showTOC" class="pageData">true</div>
+<!--
+NOTE: When this doc is updated, the online help should also be updated:
+http://www.google.com/support/chrome/bin/answer.py?hl=en&answer=186213
+
+We should periodically look at
+http://src.chromium.org/viewvc/chrome/trunk/src/chrome/app/generated_resources.grd?view=markup
+to make sure that we're covering all messages. Search for
+IDS_EXTENSION_PROMPT_WARNING
+(e.g. IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY).
+-->
+
<p>
To use most chrome.* APIs and extension capabilities,
-your extension must declare its intent in the manifest,
+your extension must declare its intent in the
+<a href="manifest.html">manifest</a>,
often in the "permissions" field.
Some of these declarations
result in a warning when
@@ -28,8 +40,8 @@
</p>
<img src="images/perms-hw1.png"
- width="387" height="162"
- alt="Permission warning: 'This extension can access: Your data on api.flickr.com'"
+ width="410" height="193"
+ alt="Permission warning: 'It can access: Your data on api.flickr.com'"
/>
<p>
@@ -87,8 +99,8 @@
</p>
<img src="images/perms-hw2.png"
- width="387" height="190"
- alt="Permission warning: 'This extension can access: Your data on api.flickr.com and flickr.com; Your browsing history'"
+ width="412" height="220"
+ alt="Permission warning: 'It can access: Your data on api.flickr.com and flickr.com; Your browsing history'"
/>
@@ -100,8 +112,7 @@
that the extension can access your browsing history.
The reason for the warning is that
although the <code>chrome.tabs</code> API
-might be used only to open new tabs
-(<a href="tabs.html#method-create"><code>chrome.tabs.create()</code></a>),
+might be used only to open new tabs,
it can also be used to see the URL that's associated
with every newly opened tab
(using their <a href="tabs.html#type-Tab">Tab</a> objects).
@@ -111,13 +122,14 @@
<b>Note:</b>
As of Google Chrome 7,
you no longer need to specify the "tabs" permission
-just to call <code>chrome.tabs.create()</code>.
+just to call <code>chrome.tabs.create()</code>
+or <code>chrome.tabs.update()</code>.
</p>
<p>
The following table lists the warning messages
that users can see,
-along with the <a href="manifest.html">manifest</a> entries
+along with the manifest entries
that trigger them.
</p>
@@ -129,7 +141,7 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_FULL_ACCESS -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_FULL_ACCESS -->
All data on your computer and the websites you visit
</td>
<td>
@@ -143,7 +155,7 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_BOOKMARKS -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_BOOKMARKS -->
Your bookmarks
</td>
<td>
@@ -157,7 +169,7 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_BROWSING_HISTORY -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_BROWSING_HISTORY -->
Your browsing history
</td>
<td>
@@ -184,7 +196,7 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_ALL_HOSTS -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_ALL_HOSTS -->
Your data on all websites
</td>
<td>
@@ -217,8 +229,8 @@
</tr>
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_?_HOST -->
- <!-- IDS_EXTENSION_PROMPT2_WARNING_4_OR_MORE_HOSTS -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_?_HOST -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_4_OR_MORE_HOSTS -->
Your data on <em>{list of websites}</em>
</td>
<td>
@@ -251,7 +263,29 @@
<tr>
<td style="font-weight:bold">
- <!-- IDS_EXTENSION_PROMPT2_WARNING_GEOLOCATION -->
+ <!-- IDS_EXTENSION_PROMPT_WARNING_MANAGEMENT -->
+ Your list of installed apps, extensions, and themes
+ <br />
+ <span style="font-weight:normal; font-style:italic">or</span>
+ <br />
+ Manage themes, extensions, and apps
+
+ <!-- PENDING: remove "Manage...apps" alternative message
+ once the fix is out on stable channel -->
+ <!-- See http://crbug.com/67859 -->
+ </td>
+ <td>
+ "management" permission
+ </td>
+ <td>
+ The "management" permission is required by the
+ <a href="management.html"><code>chrome.management</code></a> module.
+ </td>
+</tr>
+
+<tr>
+ <td style="font-weight:bold">
+ <!-- IDS_EXTENSION_PROMPT_WARNING_GEOLOCATION -->
Your physical location
</td>
<td>
diff --git a/chrome/common/extensions/docs/static/samples.html b/chrome/common/extensions/docs/static/samples.html
index 637c491..5e0df08 100644
--- a/chrome/common/extensions/docs/static/samples.html
+++ b/chrome/common/extensions/docs/static/samples.html
@@ -83,7 +83,7 @@
<img jsdisplay="icon != null" class="icon" jsvalues="src:path + icon" />
<img jsdisplay="icon == null" class="icon" src="images/sample-default-icon.png" />
<h2 class="name">
- <a jscontent="name" jsvalues="href:'http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/' + path" target="_blank"></a>
+ <a jscontent="name" jsvalues="href:'#'+$this.id"></a>
</h2>
<p jsdisplay="features.length > 0" class="metadata features" jseval="$total=features.length">Uses
<span jsselect="features">
@@ -106,7 +106,10 @@
</li>
</ul>
</div>
- <div><a jsvalues="href:$this.zip_path">Download .zip</a></li></div>
+ <div>
+ <a jsvalues="href:'http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/' + path" target="_blank">Browse source</a>
+ - <a jsvalues="href:$this.zip_path">Download source</a>
+ </div>
</div>
<div id="noresults" style="display:none">
diff --git a/chrome/common/extensions/docs/tabs.html b/chrome/common/extensions/docs/tabs.html
index cf7d2f6..91e75e6 100644
--- a/chrome/common/extensions/docs/tabs.html
+++ b/chrome/common/extensions/docs/tabs.html
@@ -5303,7 +5303,7 @@
<div class="description">
<p class="todo" style="display: none; ">Undocumented.</p>
- <p>Fires when a tab is created.</p>
+ <p>Fires when a tab is created. Note that the tab's URL may not be set at the time this event fires, but you can listen to onUpdated events to be notified when a URL is set.</p>
<!-- PARAMETERS -->
<h4>Parameters</h4>
@@ -7373,7 +7373,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/template/api_template.html b/chrome/common/extensions/docs/template/api_template.html
index b495e8d..1b47011 100644
--- a/chrome/common/extensions/docs/template/api_template.html
+++ b/chrome/common/extensions/docs/template/api_template.html
@@ -471,7 +471,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/themes.html b/chrome/common/extensions/docs/themes.html
index b488a9d..56c5cf0 100644
--- a/chrome/common/extensions/docs/themes.html
+++ b/chrome/common/extensions/docs/themes.html
@@ -627,7 +627,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/tut_analytics.html b/chrome/common/extensions/docs/tut_analytics.html
index d6a070f..4c695ff 100644
--- a/chrome/common/extensions/docs/tut_analytics.html
+++ b/chrome/common/extensions/docs/tut_analytics.html
@@ -695,7 +695,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/tut_debugging.html b/chrome/common/extensions/docs/tut_debugging.html
index 64a4ae1..3111f76 100644
--- a/chrome/common/extensions/docs/tut_debugging.html
+++ b/chrome/common/extensions/docs/tut_debugging.html
@@ -743,7 +743,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/tut_oauth.html b/chrome/common/extensions/docs/tut_oauth.html
index 1783eda..1d21c96 100644
--- a/chrome/common/extensions/docs/tut_oauth.html
+++ b/chrome/common/extensions/docs/tut_oauth.html
@@ -685,7 +685,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/tutorials.html b/chrome/common/extensions/docs/tutorials.html
index b88a9cf..8657aed 100644
--- a/chrome/common/extensions/docs/tutorials.html
+++ b/chrome/common/extensions/docs/tutorials.html
@@ -498,7 +498,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/whats_new.html b/chrome/common/extensions/docs/whats_new.html
index 79d6835..9e2b8ed 100644
--- a/chrome/common/extensions/docs/whats_new.html
+++ b/chrome/common/extensions/docs/whats_new.html
@@ -610,7 +610,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/windows.html b/chrome/common/extensions/docs/windows.html
index 1332caf..6de42ce 100644
--- a/chrome/common/extensions/docs/windows.html
+++ b/chrome/common/extensions/docs/windows.html
@@ -3726,7 +3726,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/docs/xhr.html b/chrome/common/extensions/docs/xhr.html
index b76acc5..4710c3e 100644
--- a/chrome/common/extensions/docs/xhr.html
+++ b/chrome/common/extensions/docs/xhr.html
@@ -628,7 +628,7 @@
<a rel="license" href="http://code.google.com/google_bsd_license.html">BSD License</a>.
</p>
<p>
- ©2010 Google
+ ©2011 Google
</p>
<!-- begin analytics -->
diff --git a/chrome/common/extensions/extension_localization_peer.h b/chrome/common/extensions/extension_localization_peer.h
index 1274421..49881f2 100644
--- a/chrome/common/extensions/extension_localization_peer.h
+++ b/chrome/common/extensions/extension_localization_peer.h
@@ -1,8 +1,7 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
-
#ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_LOCALIZATION_PEER_H_
#define CHROME_COMMON_EXTENSIONS_EXTENSION_LOCALIZATION_PEER_H_
#pragma once
@@ -42,7 +41,7 @@
bool content_filtered);
virtual void OnDownloadedData(int len) {}
virtual void OnReceivedData(const char* data, int len);
- virtual void OnCompletedRequest(const URLRequestStatus& status,
+ virtual void OnCompletedRequest(const net::URLRequestStatus& status,
const std::string& security_info,
const base::Time& completion_time);
diff --git a/chrome/common/extensions/extension_resource.cc b/chrome/common/extensions/extension_resource.cc
index 258b537..e2a5e24 100644
--- a/chrome/common/extensions/extension_resource.cc
+++ b/chrome/common/extensions/extension_resource.cc
@@ -6,7 +6,7 @@
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
ExtensionResource::ExtensionResource() {
}
diff --git a/chrome/common/extensions/extension_resource.h b/chrome/common/extensions/extension_resource.h
index c680345..86705a8 100644
--- a/chrome/common/extensions/extension_resource.h
+++ b/chrome/common/extensions/extension_resource.h
@@ -9,7 +9,6 @@
#include <string>
#include "base/file_path.h"
-#include "base/platform_thread.h"
// Represents a resource inside an extension. For example, an image, or a
// JavaScript file. This is more complicated than just a simple FilePath
diff --git a/chrome/common/extensions/extension_unpacker.cc b/chrome/common/extensions/extension_unpacker.cc
index 1ff4342..e001911 100644
--- a/chrome/common/extensions/extension_unpacker.cc
+++ b/chrome/common/extensions/extension_unpacker.cc
@@ -10,7 +10,7 @@
#include "base/scoped_handle.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "net/base/file_stream.h"
diff --git a/chrome/common/font_loader_mac.mm b/chrome/common/font_loader_mac.mm
index 3ab57c4..b910eb0 100644
--- a/chrome/common/font_loader_mac.mm
+++ b/chrome/common/font_loader_mac.mm
@@ -10,7 +10,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
// static
@@ -50,7 +50,7 @@
LOG(ERROR) << "Failed to find font file for " << font_name;
return false;
}
- FilePath font_path = FilePath(mac_util::PathFromFSRef(font_fsref));
+ FilePath font_path = FilePath(base::mac::PathFromFSRef(font_fsref));
// Load file into shared memory buffer.
int64 font_file_size_64 = -1;
diff --git a/chrome/common/gpu_messages_internal.h b/chrome/common/gpu_messages_internal.h
index 22f2f9d..22da39a 100644
--- a/chrome/common/gpu_messages_internal.h
+++ b/chrome/common/gpu_messages_internal.h
@@ -25,6 +25,14 @@
//------------------------------------------------------------------------------
// GPU Messages
// These are messages from the browser to the GPU process.
+
+// Tells the GPU process to initialize itself. The browser explicitly
+// requests this be done so that we are guaranteed that the channel is set
+// up between the browser and GPU process before doing any work that might
+// potentially crash the GPU process. Detection of the child process
+// exiting abruptly is predicated on having the IPC channel set up.
+IPC_MESSAGE_CONTROL0(GpuMsg_Initialize)
+
// Tells the GPU process to create a new channel for communication with a
// given renderer. The channel name is returned in a
// GpuHostMsg_ChannelEstablished message. The renderer ID is passed so that
diff --git a/chrome/common/important_file_writer.cc b/chrome/common/important_file_writer.cc
index 94a8e57..ceac3fd 100644
--- a/chrome/common/important_file_writer.cc
+++ b/chrome/common/important_file_writer.cc
@@ -14,7 +14,7 @@
#include "base/message_loop_proxy.h"
#include "base/string_number_conversions.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
using base::TimeDelta;
diff --git a/chrome/common/important_file_writer.h b/chrome/common/important_file_writer.h
index 5fdabce..34c6067 100644
--- a/chrome/common/important_file_writer.h
+++ b/chrome/common/important_file_writer.h
@@ -10,8 +10,8 @@
#include "base/basictypes.h"
#include "base/file_path.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "base/time.h"
#include "base/timer.h"
@@ -36,7 +36,7 @@
//
// If you want to know more about this approach and ext3/ext4 fsync issues, see
// http://valhenson.livejournal.com/37921.html
-class ImportantFileWriter : public NonThreadSafe {
+class ImportantFileWriter : public base::NonThreadSafe {
public:
// Used by ScheduleSave to lazily provide the data to be saved. Allows us
// to also batch data serializations.
diff --git a/chrome/common/important_file_writer_unittest.cc b/chrome/common/important_file_writer_unittest.cc
index 3d44ae0..c652841 100644
--- a/chrome/common/important_file_writer_unittest.cc
+++ b/chrome/common/important_file_writer_unittest.cc
@@ -10,7 +10,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/scoped_temp_dir.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/chrome/common/ipc_test_sink.cc b/chrome/common/ipc_test_sink.cc
index 45db8f5..69d328c 100644
--- a/chrome/common/ipc_test_sink.cc
+++ b/chrome/common/ipc_test_sink.cc
@@ -19,8 +19,9 @@
return true;
}
-void TestSink::OnMessageReceived(const Message& msg) {
+bool TestSink::OnMessageReceived(const Message& msg) {
messages_.push_back(Message(msg));
+ return true;
}
void TestSink::ClearMessages() {
diff --git a/chrome/common/ipc_test_sink.h b/chrome/common/ipc_test_sink.h
index caf6276..05720d4 100644
--- a/chrome/common/ipc_test_sink.h
+++ b/chrome/common/ipc_test_sink.h
@@ -54,7 +54,7 @@
// Used by the source of the messages to send the message to the sink. This
// will make a copy of the message and store it in the list.
- void OnMessageReceived(const Message& msg);
+ bool OnMessageReceived(const Message& msg);
// Returns the number of messages in the queue.
size_t message_count() const { return messages_.size(); }
diff --git a/chrome/common/json_pref_store_unittest.cc b/chrome/common/json_pref_store_unittest.cc
index 326e32d..2d1e1df 100644
--- a/chrome/common/json_pref_store_unittest.cc
+++ b/chrome/common/json_pref_store_unittest.cc
@@ -9,7 +9,7 @@
#include "base/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/common/json_pref_store.h"
diff --git a/chrome/common/logging_chrome_uitest.cc b/chrome/common/logging_chrome_uitest.cc
index 96e3205..5d4236a 100644
--- a/chrome/common/logging_chrome_uitest.cc
+++ b/chrome/common/logging_chrome_uitest.cc
@@ -98,7 +98,7 @@
#define Assertion DISABLED_Assertion
#endif
TEST_F(AssertionTest, Assertion) {
- if (UITest::in_process_renderer()) {
+ if (ProxyLauncher::in_process_renderer()) {
// in process mode doesn't do the crashing.
expected_errors_ = 0;
expected_crashes_ = 0;
@@ -133,7 +133,7 @@
#endif
// Launch the app in assertion test mode, then close the app.
TEST_F(CheckFalseTest, CheckFails) {
- if (UITest::in_process_renderer()) {
+ if (ProxyLauncher::in_process_renderer()) {
// in process mode doesn't do the crashing.
expected_errors_ = 0;
expected_crashes_ = 0;
@@ -171,7 +171,7 @@
#endif
// Launch the app in renderer crash test mode, then close the app.
TEST_F(RendererCrashTest, Crash) {
- if (UITest::in_process_renderer()) {
+ if (ProxyLauncher::in_process_renderer()) {
// in process mode doesn't do the crashing.
expected_crashes_ = 0;
} else {
diff --git a/chrome/common/net/gaia/gaia_auth_fetcher.h b/chrome/common/net/gaia/gaia_auth_fetcher.h
index 1a1602d..4fde132 100644
--- a/chrome/common/net/gaia/gaia_auth_fetcher.h
+++ b/chrome/common/net/gaia/gaia_auth_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -76,7 +76,7 @@
// Implementation of URLFetcher::Delegate
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data);
@@ -116,15 +116,15 @@
// Process the results of a ClientLogin fetch.
void OnClientLoginFetched(const std::string& data,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code);
void OnIssueAuthTokenFetched(const std::string& data,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code);
void OnGetUserInfoFetched(const std::string& data,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code);
// Tokenize the results of a ClientLogin fetch.
@@ -144,7 +144,7 @@
// the same error returns.
static GoogleServiceAuthError GenerateAuthError(
const std::string& data,
- const URLRequestStatus& status);
+ const net::URLRequestStatus& status);
// Is this a special case Gaia error for TwoFactor auth?
static bool IsSecondFactorSuccess(const std::string& alleged_error);
diff --git a/chrome/common/net/url_fetcher.cc b/chrome/common/net/url_fetcher.cc
index 81b47cf..53112f3 100644
--- a/chrome/common/net/url_fetcher.cc
+++ b/chrome/common/net/url_fetcher.cc
@@ -13,7 +13,7 @@
#include "base/scoped_ptr.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "chrome/common/net/url_request_context_getter.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_flags.h"
diff --git a/chrome/common/net/url_fetcher.h b/chrome/common/net/url_fetcher.h
index 87eef4e..8c42398 100644
--- a/chrome/common/net/url_fetcher.h
+++ b/chrome/common/net/url_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -26,11 +26,11 @@
typedef std::vector<std::string> ResponseCookies;
class URLFetcher;
class URLRequestContextGetter;
-class URLRequestStatus;
namespace net {
class HttpResponseHeaders;
-}
+class URLRequestStatus;
+} // namespace net
// To use this class, create an instance with the desired URL and a pointer to
// the object to be notified when the URL has been loaded:
@@ -75,7 +75,7 @@
// URLFetcher instance is destroyed.
virtual void OnURLFetchComplete(const URLFetcher* source,
const GURL& url,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
int response_code,
const ResponseCookies& cookies,
const std::string& data) = 0;
diff --git a/chrome/common/net/url_fetcher_unittest.cc b/chrome/common/net/url_fetcher_unittest.cc
index d1f7ef3..1618892 100644
--- a/chrome/common/net/url_fetcher_unittest.cc
+++ b/chrome/common/net/url_fetcher_unittest.cc
@@ -3,8 +3,8 @@
// found in the LICENSE file.
#include "base/message_loop_proxy.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
#include "build/build_config.h"
#include "chrome/common/chrome_plugin_lib.h"
#include "chrome/common/net/url_fetcher.h"
diff --git a/chrome/common/net/url_request_context_getter.h b/chrome/common/net/url_request_context_getter.h
index ade5e1a..0c060e5 100644
--- a/chrome/common/net/url_request_context_getter.h
+++ b/chrome/common/net/url_request_context_getter.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -15,9 +15,9 @@
namespace net {
class CookieStore;
+class URLRequestContext;
}
-class URLRequestContext;
struct URLRequestContextGetterTraits;
// Interface for retrieving an URLRequestContext.
@@ -25,7 +25,7 @@
: public base::RefCountedThreadSafe<URLRequestContextGetter,
URLRequestContextGetterTraits> {
public:
- virtual URLRequestContext* GetURLRequestContext() = 0;
+ virtual net::URLRequestContext* GetURLRequestContext() = 0;
// Defaults to GetURLRequestContext()->cookie_store(), but
// implementations can override it.
diff --git a/chrome/common/notification_observer_mock.cc b/chrome/common/notification_observer_mock.cc
new file mode 100644
index 0000000..634afa5
--- /dev/null
+++ b/chrome/common/notification_observer_mock.cc
@@ -0,0 +1,12 @@
+// 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 "chrome/common/notification_observer_mock.h"
+
+#include "chrome/common/notification_details.h"
+#include "chrome/common/notification_source.h"
+
+NotificationObserverMock::NotificationObserverMock() {}
+
+NotificationObserverMock::~NotificationObserverMock() {}
diff --git a/chrome/common/notification_observer_mock.h b/chrome/common/notification_observer_mock.h
index 0385f26..e232928 100644
--- a/chrome/common/notification_observer_mock.h
+++ b/chrome/common/notification_observer_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -15,8 +15,8 @@
class NotificationObserverMock : public NotificationObserver {
public:
- NotificationObserverMock() {}
- virtual ~NotificationObserverMock() {}
+ NotificationObserverMock();
+ virtual ~NotificationObserverMock();
MOCK_METHOD3(Observe, void(NotificationType type,
const NotificationSource& source,
diff --git a/chrome/common/notification_registrar.cc b/chrome/common/notification_registrar.cc
index d413585..841d5d7 100644
--- a/chrome/common/notification_registrar.cc
+++ b/chrome/common/notification_registrar.cc
@@ -7,13 +7,13 @@
#include <algorithm>
#include "base/logging.h"
+#include "base/threading/platform_thread.h"
#include "chrome/common/notification_service.h"
-#include "base/platform_thread.h"
namespace {
-void CheckCalledOnValidThread(PlatformThreadId thread_id) {
- PlatformThreadId current_thread_id = PlatformThread::CurrentId();
+void CheckCalledOnValidThread(base::PlatformThreadId thread_id) {
+ base::PlatformThreadId current_thread_id = base::PlatformThread::CurrentId();
CHECK(current_thread_id == thread_id) << "called on invalid thread: "
<< thread_id << " vs. "
<< current_thread_id;
@@ -27,7 +27,7 @@
NotificationObserver* observer;
NotificationType type;
NotificationSource source;
- PlatformThreadId thread_id;
+ base::PlatformThreadId thread_id;
};
bool NotificationRegistrar::Record::operator==(const Record& other) const {
@@ -49,7 +49,7 @@
const NotificationSource& source) {
DCHECK(!IsRegistered(observer, type, source)) << "Duplicate registration.";
- Record record = { observer, type, source, PlatformThread::CurrentId() };
+ Record record = { observer, type, source, base::PlatformThread::CurrentId() };
registered_.push_back(record);
NotificationService::current()->AddObserver(observer, type, source);
diff --git a/chrome/common/notification_service.cc b/chrome/common/notification_service.cc
index b3c2768..4414cc6 100644
--- a/chrome/common/notification_service.cc
+++ b/chrome/common/notification_service.cc
@@ -5,7 +5,7 @@
#include "chrome/common/notification_service.h"
#include "base/lazy_instance.h"
-#include "base/thread_local.h"
+#include "base/threading/thread_local.h"
#include "chrome/common/notification_observer.h"
static base::LazyInstance<base::ThreadLocalPointer<NotificationService> >
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index e7484aa..8dbc2a3 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -138,13 +138,13 @@
FAIL_PROVISIONAL_LOAD_WITH_ERROR,
// A response has been received for a resource request. The source will be
- // a Source<NavigationController> corresponding to the tab in which the
+ // a Source<RenderViewHostDelegate> corresponding to the tab in which the
// request was issued. Details in the form of a ResourceRequestDetails
// object are provided.
RESOURCE_RESPONSE_STARTED,
// A redirect was received while requesting a resource. The source will be
- // a Source<NavigationController> corresponding to the tab in which the
+ // a Source<RenderViewHostDelegate> corresponding to the tab in which the
// request was issued. Details in the form of a ResourceRedirectDetails
// are provided.
RESOURCE_RECEIVED_REDIRECT,
diff --git a/chrome/common/pepper_plugin_registry.cc b/chrome/common/pepper_plugin_registry.cc
index 5223e55..343a646 100644
--- a/chrome/common/pepper_plugin_registry.cc
+++ b/chrome/common/pepper_plugin_registry.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -221,14 +221,41 @@
}
webkit::ppapi::PluginModule* PepperPluginRegistry::GetModule(
- const FilePath& path) const {
- ModuleMap::const_iterator it = modules_.find(path);
- if (it == modules_.end())
+ const FilePath& path) {
+ NonOwningModuleMap::iterator it = live_modules_.find(path);
+ if (it == live_modules_.end())
return NULL;
return it->second;
}
-PepperPluginRegistry::~PepperPluginRegistry() {}
+void PepperPluginRegistry::AddLiveModule(const FilePath& path,
+ webkit::ppapi::PluginModule* module) {
+ DCHECK(live_modules_.find(path) == live_modules_.end());
+ live_modules_[path] = module;
+}
+
+void PepperPluginRegistry::PluginModuleDestroyed(
+ webkit::ppapi::PluginModule* destroyed_module) {
+ // Modules aren't destroyed very often and there are normally at most a
+ // couple of them. So for now we just do a brute-force search.
+ for (NonOwningModuleMap::iterator i = live_modules_.begin();
+ i != live_modules_.end(); ++i) {
+ if (i->second == destroyed_module) {
+ live_modules_.erase(i);
+ return;
+ }
+ }
+ NOTREACHED(); // Should have always found the module above.
+}
+
+PepperPluginRegistry::~PepperPluginRegistry() {
+ // Explicitly clear all preloaded modules first. This will cause callbacks
+ // to erase these modules from the live_modules_ list, and we don't want
+ // that to happen implicitly out-of-order.
+ preloaded_modules_.clear();
+
+ DCHECK(live_modules_.empty());
+}
PepperPluginRegistry::PepperPluginRegistry() {
InternalPluginInfoList internal_plugin_info;
@@ -240,13 +267,15 @@
it != internal_plugin_info.end();
++it) {
const FilePath& path = it->path;
- ModuleHandle module(new webkit::ppapi::PluginModule);
+ scoped_refptr<webkit::ppapi::PluginModule> module(
+ new webkit::ppapi::PluginModule(this));
if (!module->InitAsInternalPlugin(it->entry_points)) {
DLOG(ERROR) << "Failed to load pepper module: " << path.value();
continue;
}
module->set_name(it->name);
- modules_[path] = module;
+ preloaded_modules_[path] = module;
+ AddLiveModule(path, module);
}
// Add the modules specified on the command line last so that they can
@@ -259,12 +288,14 @@
continue; // Only preload in-process plugins.
const FilePath& path = plugins[i].path;
- ModuleHandle module(new webkit::ppapi::PluginModule);
+ scoped_refptr<webkit::ppapi::PluginModule> module(
+ new webkit::ppapi::PluginModule(this));
if (!module->InitAsLibrary(path)) {
DLOG(ERROR) << "Failed to load pepper module: " << path.value();
continue;
}
module->set_name(plugins[i].name);
- modules_[path] = module;
+ preloaded_modules_[path] = module;
+ AddLiveModule(path, module);
}
}
diff --git a/chrome/common/pepper_plugin_registry.h b/chrome/common/pepper_plugin_registry.h
index 424ed1a..0dd8b15 100644
--- a/chrome/common/pepper_plugin_registry.h
+++ b/chrome/common/pepper_plugin_registry.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,6 +11,7 @@
#include <vector>
#include "base/file_path.h"
+#include "webkit/plugins/ppapi/plugin_delegate.h"
#include "webkit/plugins/ppapi/plugin_module.h"
struct PepperPluginInfo {
@@ -33,8 +34,15 @@
};
// This class holds references to all of the known pepper plugin modules.
-class PepperPluginRegistry {
+//
+// It keeps two lists. One list of preloaded in-process modules, and one list
+// is a list of all live modules (some of which may be out-of-process and hence
+// not preloaded).
+class PepperPluginRegistry
+ : public webkit::ppapi::PluginDelegate::ModuleLifetime {
public:
+ ~PepperPluginRegistry();
+
static const char* kPDFPluginName;
static const char* kPDFPluginMimeType;
static const char* kPDFPluginExtension;
@@ -61,12 +69,20 @@
// out of process.
bool RunOutOfProcessForPlugin(const FilePath& path) const;
- // Returns a preloaded module for the given path. This only works for
- // non-out-of-process plugins since we preload them so they will run in the
- // sandbox. Returns NULL if the plugin hasn't been preloaded.
- webkit::ppapi::PluginModule* GetModule(const FilePath& path) const;
+ // Returns an existing loaded module for the given path. It will search for
+ // both preloaded in-process or currently active out-of-process plugins
+ // matching the given name. Returns NULL if the plugin hasn't been loaded.
+ webkit::ppapi::PluginModule* GetModule(const FilePath& path);
- ~PepperPluginRegistry();
+ // Notifies the registry that a new non-preloaded module has been created.
+ // This is normally called for out-of-process plugins. Once this is called,
+ // the module is available to be returned by GetModule(). The module will
+ // automatically unregister itself by calling PluginModuleDestroyed().
+ void AddLiveModule(const FilePath& path, webkit::ppapi::PluginModule* module);
+
+ // ModuleLifetime implementation.
+ virtual void PluginModuleDestroyed(
+ webkit::ppapi::PluginModule* destroyed_module);
private:
static void GetPluginInfoFromSwitch(std::vector<PepperPluginInfo>* plugins);
@@ -81,9 +97,15 @@
PepperPluginRegistry();
- typedef scoped_refptr<webkit::ppapi::PluginModule> ModuleHandle;
- typedef std::map<FilePath, ModuleHandle> ModuleMap;
- ModuleMap modules_;
+ typedef std::map<FilePath, scoped_refptr<webkit::ppapi::PluginModule> >
+ OwningModuleMap;
+ OwningModuleMap preloaded_modules_;
+
+ // A list of non-owning pointers to all currently-live plugin modules. This
+ // includes both preloaded ones in preloaded_modules_, and out-of-process
+ // modules whose lifetime is managed externally.
+ typedef std::map<FilePath, webkit::ppapi::PluginModule*> NonOwningModuleMap;
+ NonOwningModuleMap live_modules_;
};
#endif // CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index 3da0b2c..502afd9 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -556,6 +556,10 @@
const char kDesktopNotificationDeniedOrigins[] =
"profile.notification_denied_sites";
+// The preferred position (which corner of screen) for desktop notifications.
+const char kDesktopNotificationPosition[] =
+ "browser.desktop_notification_position";
+
// Dictionary of content settings applied to all hosts by default.
const char kDefaultContentSettings[] = "profile.default_content_settings";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 0450a21..29766a1 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -211,6 +211,7 @@
extern const char kDesktopNotificationDefaultContentSetting[];
extern const char kDesktopNotificationAllowedOrigins[];
extern const char kDesktopNotificationDeniedOrigins[];
+extern const char kDesktopNotificationPosition[];
extern const char kDefaultContentSettings[];
extern const char kPerHostContentSettings[]; // OBSOLETE
extern const char kContentSettingsVersion[];
diff --git a/chrome/common/pref_store_observer_mock.cc b/chrome/common/pref_store_observer_mock.cc
new file mode 100644
index 0000000..8d11872
--- /dev/null
+++ b/chrome/common/pref_store_observer_mock.cc
@@ -0,0 +1,9 @@
+// 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 "chrome/common/pref_store_observer_mock.h"
+
+PrefStoreObserverMock::PrefStoreObserverMock() {}
+
+PrefStoreObserverMock::~PrefStoreObserverMock() {}
diff --git a/chrome/common/pref_store_observer_mock.h b/chrome/common/pref_store_observer_mock.h
index 2a49284..3aadf34 100644
--- a/chrome/common/pref_store_observer_mock.h
+++ b/chrome/common/pref_store_observer_mock.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,8 +13,8 @@
// A gmock-ified implementation of PrefStore::Observer.
class PrefStoreObserverMock : public PrefStore::Observer {
public:
- PrefStoreObserverMock() {}
- virtual ~PrefStoreObserverMock() {}
+ PrefStoreObserverMock();
+ virtual ~PrefStoreObserverMock();
MOCK_METHOD1(OnPrefValueChanged, void(const std::string&));
MOCK_METHOD0(OnInitializationCompleted, void());
diff --git a/chrome/common/process_watcher_posix.cc b/chrome/common/process_watcher_posix.cc
index 4b13c32..38a4e1b 100644
--- a/chrome/common/process_watcher_posix.cc
+++ b/chrome/common/process_watcher_posix.cc
@@ -11,7 +11,7 @@
#include "base/eintr_wrapper.h"
#include "base/logging.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
// Return true if the given child is dead. This will also reap the process.
// Doesn't block.
@@ -30,7 +30,7 @@
// A thread class which waits for the given child to exit and reaps it.
// If the child doesn't exit within a couple of seconds, kill it.
-class BackgroundReaper : public PlatformThread::Delegate {
+class BackgroundReaper : public base::PlatformThread::Delegate {
public:
explicit BackgroundReaper(pid_t child, unsigned timeout)
: child_(child),
@@ -58,7 +58,7 @@
// Wait for 2 * timeout_ 500 milliseconds intervals.
for (unsigned i = 0; i < 2 * timeout_; ++i) {
- PlatformThread::Sleep(500); // 0.5 seconds
+ base::PlatformThread::Sleep(500); // 0.5 seconds
if (IsChildDead(child_))
return;
}
@@ -91,7 +91,7 @@
const unsigned timeout = 2; // seconds
BackgroundReaper* reaper = new BackgroundReaper(process, timeout);
- PlatformThread::CreateNonJoinable(0, reaper);
+ base::PlatformThread::CreateNonJoinable(0, reaper);
}
// static
@@ -101,5 +101,5 @@
return;
BackgroundReaper* reaper = new BackgroundReaper(process, 0);
- PlatformThread::CreateNonJoinable(0, reaper);
+ base::PlatformThread::CreateNonJoinable(0, reaper);
}
diff --git a/chrome/common/process_watcher_win.cc b/chrome/common/process_watcher_win.cc
index 210b3d5..3378960 100644
--- a/chrome/common/process_watcher_win.cc
+++ b/chrome/common/process_watcher_win.cc
@@ -7,7 +7,7 @@
#include "base/scoped_ptr.h"
#include "base/environment.h"
#include "base/message_loop.h"
-#include "base/object_watcher.h"
+#include "base/win/object_watcher.h"
#include "chrome/common/env_vars.h"
#include "chrome/common/result_codes.h"
@@ -16,7 +16,8 @@
namespace {
-class TimerExpiredTask : public Task, public base::ObjectWatcher::Delegate {
+class TimerExpiredTask : public Task,
+ public base::win::ObjectWatcher::Delegate {
public:
explicit TimerExpiredTask(base::ProcessHandle process) : process_(process) {
watcher_.StartWatching(process_, this);
@@ -72,7 +73,7 @@
// The process that we are watching.
base::ProcessHandle process_;
- base::ObjectWatcher watcher_;
+ base::win::ObjectWatcher watcher_;
DISALLOW_COPY_AND_ASSIGN(TimerExpiredTask);
};
diff --git a/chrome/common/render_messages.cc b/chrome/common/render_messages.cc
index c865a68..69b73be 100644
--- a/chrome/common/render_messages.cc
+++ b/chrome/common/render_messages.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -17,6 +17,7 @@
#include "media/audio/audio_buffers_state.h"
#include "net/base/upload_data.h"
#include "net/http/http_response_headers.h"
+#include "ppapi/c/private/ppb_flash.h"
#include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "webkit/appcache/appcache_interfaces.h"
@@ -39,7 +40,6 @@
namespace IPC {
-
template<>
struct ParamTraits<WebMenuItem::Type> {
typedef WebMenuItem::Type param_type;
@@ -729,6 +729,7 @@
WriteParam(m, p.accelerated_compositing_enabled);
WriteParam(m, p.accelerated_2d_canvas_enabled);
WriteParam(m, p.accelerated_layers_enabled);
+ WriteParam(m, p.accelerated_video_enabled);
WriteParam(m, p.memory_info_enabled);
}
@@ -780,6 +781,7 @@
ReadParam(m, iter, &p->accelerated_compositing_enabled) &&
ReadParam(m, iter, &p->accelerated_2d_canvas_enabled) &&
ReadParam(m, iter, &p->accelerated_layers_enabled) &&
+ ReadParam(m, iter, &p->accelerated_video_enabled) &&
ReadParam(m, iter, &p->memory_info_enabled);
}
@@ -1236,4 +1238,33 @@
l->append(")");
}
+void ParamTraits<PP_Flash_NetAddress>::Write(Message* m, const param_type& p) {
+ WriteParam(m, p.size);
+ m->WriteBytes(p.data, p.size);
+}
+
+bool ParamTraits<PP_Flash_NetAddress>::Read(const Message* m,
+ void** iter,
+ param_type* p) {
+ uint16 size;
+ if (!ReadParam(m, iter, &size))
+ return false;
+ if (size > sizeof(p->data))
+ return false;
+ p->size = size;
+
+ const char* data;
+ if (!m->ReadBytes(iter, &data, size))
+ return false;
+ memcpy(p->data, data, size);
+ return true;
+}
+
+void ParamTraits<PP_Flash_NetAddress>::Log(const param_type& p,
+ std::string* l) {
+ l->append("<PP_Flash_NetAddress (");
+ LogParam(p.size, l);
+ l->append(" bytes)>");
+}
+
} // namespace IPC
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h
index e06a667..258734a 100644
--- a/chrome/common/render_messages.h
+++ b/chrome/common/render_messages.h
@@ -61,7 +61,6 @@
struct ResourceResponseInfo;
struct WebAccessibility;
struct WebCookie;
-struct WebAccessibility;
}
namespace webkit {
@@ -79,6 +78,7 @@
class URLPattern;
struct ContextMenuParams;
struct EditCommand;
+struct PP_Flash_NetAddress;
struct ResourceResponseHead;
struct SyncLoadResult;
struct RendererPreferences;
@@ -552,6 +552,14 @@
static void Log(const param_type& p, std::string* l);
};
+template <>
+struct ParamTraits<PP_Flash_NetAddress> {
+ typedef PP_Flash_NetAddress param_type;
+ static void Write(Message* m, const param_type& p);
+ static bool Read(const Message* m, void** iter, param_type* p);
+ static void Log(const param_type& p, std::string* l);
+};
+
} // namespace IPC
#include "chrome/common/render_messages_internal.h"
diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h
index f94f1ed..9436e1a 100644
--- a/chrome/common/render_messages_internal.h
+++ b/chrome/common/render_messages_internal.h
@@ -51,6 +51,7 @@
class Value;
class GPUInfo;
+struct PP_Flash_NetAddress;
class SkBitmap;
struct ThumbnailScore;
class WebCursor;
@@ -530,7 +531,8 @@
int /* selection_end */)
// This message confirms an ongoing composition.
-IPC_MESSAGE_ROUTED0(ViewMsg_ImeConfirmComposition)
+IPC_MESSAGE_ROUTED1(ViewMsg_ImeConfirmComposition,
+ string16 /* text */)
// This passes a set of webkit preferences down to the renderer.
IPC_MESSAGE_ROUTED1(ViewMsg_UpdateWebPreferences, WebPreferences)
@@ -1074,6 +1076,13 @@
IPC_MESSAGE_CONTROL1(ViewMsg_SpeechInput_SetFeatureEnabled,
bool /* enabled */)
+// The response to ViewHostMsg_PepperConnectTcp(Address).
+IPC_MESSAGE_ROUTED4(ViewMsg_PepperConnectTcpACK,
+ int /* request_id */,
+ IPC::PlatformFileForTransit /* socket */,
+ PP_Flash_NetAddress /* local_addr */,
+ PP_Flash_NetAddress /* remote_addr */)
+
//-----------------------------------------------------------------------------
// TabContents messages
// These are messages sent from the renderer to the browser process.
@@ -2401,17 +2410,6 @@
//---------------------------------------------------------------------------
// Geolocation services messages
-// A GeolocationServiceBridgeImpl in the renderer process has been created.
-// This is used to lazily initialize the host dispatchers and related
-// Geolocation infrastructure in the browser process.
-IPC_MESSAGE_CONTROL1(ViewHostMsg_Geolocation_RegisterDispatcher,
- int /* render_view_id */)
-
-// A GeolocationServiceBridgeImpl has been destroyed.
-// This is used to let the Geolocation infrastructure do its cleanup.
-IPC_MESSAGE_CONTROL1(ViewHostMsg_Geolocation_UnregisterDispatcher,
- int /* render_view_id */)
-
// The |render_view_id| and |bridge_id| representing |host| is requesting
// permission to access geolocation position.
// This will be replied by ViewMsg_Geolocation_PermissionSet.
@@ -2427,38 +2425,20 @@
int /* bridge_id */,
GURL /* GURL of the frame */)
-// The |render_view_id| and |bridge_id| requests Geolocation service to start
-// updating.
+// The |render_view_id| requests Geolocation service to start updating.
// This is an asynchronous call, and the browser process may eventually reply
// with the updated geoposition, or an error (access denied, location
// unavailable, etc.)
-IPC_MESSAGE_CONTROL4(ViewHostMsg_Geolocation_StartUpdating,
+IPC_MESSAGE_CONTROL3(ViewHostMsg_Geolocation_StartUpdating,
int /* render_view_id */,
- int /* bridge_id */,
GURL /* GURL of the frame requesting geolocation */,
bool /* enable_high_accuracy */)
-// The |render_view_id| and |bridge_id| requests Geolocation service to stop
-// updating.
+// The |render_view_id| requests Geolocation service to stop updating.
// Note that the geolocation service may continue to fetch geolocation data
// for other origins.
-IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_StopUpdating,
- int /* render_view_id */,
- int /* bridge_id */)
-
-// The |render_view_id| and |bridge_id| requests Geolocation service to
-// suspend.
-// Note that the geolocation service may continue to fetch geolocation data
-// for other origins.
-IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_Suspend,
- int /* render_view_id */,
- int /* bridge_id */)
-
-// The |render_view_id| and |bridge_id| requests Geolocation service to
-// resume.
-IPC_MESSAGE_CONTROL2(ViewHostMsg_Geolocation_Resume,
- int /* render_view_id */,
- int /* bridge_id */)
+IPC_MESSAGE_CONTROL1(ViewHostMsg_Geolocation_StopUpdating,
+ int /* render_view_id */)
// Updates the minimum/maximum allowed zoom percent for this tab from the
// default values. If |remember| is true, then the zoom setting is applied to
@@ -2629,3 +2609,16 @@
// Updates the content restrictions, i.e. to disable print/copy.
IPC_MESSAGE_ROUTED1(ViewHostMsg_UpdateContentRestrictions,
int /* restrictions */)
+
+// Pepper-related messages -----------------------------------------------------
+
+IPC_MESSAGE_CONTROL4(ViewHostMsg_PepperConnectTcp,
+ int /* routing_id */,
+ int /* request_id */,
+ std::string /* host */,
+ uint16 /* port */)
+
+IPC_MESSAGE_CONTROL3(ViewHostMsg_PepperConnectTcpAddress,
+ int /* routing_id */,
+ int /* request_id */,
+ PP_Flash_NetAddress /* addr */)
diff --git a/chrome/common/resource_dispatcher.h b/chrome/common/resource_dispatcher.h
index 52c6589..823af81 100644
--- a/chrome/common/resource_dispatcher.h
+++ b/chrome/common/resource_dispatcher.h
@@ -1,11 +1,11 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
// See http://dev.chromium.org/developers/design-documents/multi-process-resource-loading
-#ifndef CHROME_COMMON_RESOURCE_DISPATCHER_H__
-#define CHROME_COMMON_RESOURCE_DISPATCHER_H__
+#ifndef CHROME_COMMON_RESOURCE_DISPATCHER_H_
+#define CHROME_COMMON_RESOURCE_DISPATCHER_H_
#pragma once
#include <deque>
@@ -114,7 +114,7 @@
int data_len);
void OnRequestComplete(
int request_id,
- const URLRequestStatus& status,
+ const net::URLRequestStatus& status,
const std::string& security_info,
const base::Time& completion_time);
@@ -149,4 +149,4 @@
DISALLOW_COPY_AND_ASSIGN(ResourceDispatcher);
};
-#endif // CHROME_COMMON_RESOURCE_DISPATCHER_H__
+#endif // CHROME_COMMON_RESOURCE_DISPATCHER_H_
diff --git a/chrome/common/sandbox_mac.mm b/chrome/common/sandbox_mac.mm
index b5f9d22..78941e8 100644
--- a/chrome/common/sandbox_mac.mm
+++ b/chrome/common/sandbox_mac.mm
@@ -4,8 +4,6 @@
#include "chrome/common/sandbox_mac.h"
-#include "base/debug_util.h"
-
#import <Cocoa/Cocoa.h>
#import <OpenGL/OpenGL.h>
@@ -19,7 +17,7 @@
#include "base/basictypes.h"
#include "base/command_line.h"
#include "base/file_util.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/rand_util_c.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/mac/scoped_nsautorelease_pool.h"
@@ -198,8 +196,8 @@
kCGBitmapByteOrder32Host));
// Load in the color profiles we'll need (as a side effect).
- (void) mac_util::GetSRGBColorSpace();
- (void) mac_util::GetSystemColorSpace();
+ (void) base::mac::GetSRGBColorSpace();
+ (void) base::mac::GetSystemColorSpace();
// CGColorSpaceCreateSystemDefaultCMYK - 10.6
base::mac::ScopedCFTypeRef<CGColorSpaceRef> cmyk_colorspace(
@@ -362,7 +360,7 @@
// Read in the sandbox profile and the common prefix file.
NSString* common_sandbox_prefix_path =
- [mac_util::MainAppBundle() pathForResource:@"common"
+ [base::mac::MainAppBundle() pathForResource:@"common"
ofType:@"sb"];
NSString* common_sandbox_prefix_data =
[NSString stringWithContentsOfFile:common_sandbox_prefix_path
@@ -376,7 +374,7 @@
}
NSString* sandbox_profile_path =
- [mac_util::MainAppBundle() pathForResource:sandbox_config_filename
+ [base::mac::MainAppBundle() pathForResource:sandbox_config_filename
ofType:@"sb"];
NSString* sandbox_data =
[NSString stringWithContentsOfFile:sandbox_profile_path
diff --git a/chrome/common/sandbox_policy.cc b/chrome/common/sandbox_policy.cc
index 2667cf9..7436ad2 100644
--- a/chrome/common/sandbox_policy.cc
+++ b/chrome/common/sandbox_policy.cc
@@ -6,7 +6,7 @@
#include <string>
-#include "app/win_util.h"
+#include "app/win/win_util.h"
#include "base/command_line.h"
#include "base/debug/debugger.h"
#include "base/debug/trace_event.h"
@@ -200,9 +200,15 @@
FilePath app_dir;
if (!PathService::Get(chrome::DIR_APP, &app_dir))
return false;
- std::wstring debug_message;
- if (!win_util::ConvertToLongPath(app_dir.value(), &debug_message))
+
+ wchar_t long_path_buf[MAX_PATH];
+ DWORD long_path_return_value = GetLongPathName(app_dir.value().c_str(),
+ long_path_buf,
+ MAX_PATH);
+ if (long_path_return_value == 0 || long_path_return_value >= MAX_PATH)
return false;
+
+ string16 debug_message(long_path_buf);
file_util::AppendToPath(&debug_message, L"debug_message.exe");
result = policy->AddRule(sandbox::TargetPolicy::SUBSYS_PROCESS,
sandbox::TargetPolicy::PROCESS_MIN_EXEC,
@@ -532,6 +538,7 @@
if (!in_sandbox && (type == ChildProcessInfo::PLUGIN_PROCESS)) {
in_sandbox = browser_command_line.HasSwitch(switches::kSafePlugins) ||
(IsBuiltInFlash(cmd_line, NULL) &&
+ (base::win::GetVersion() > base::win::VERSION_XP) &&
!browser_command_line.HasSwitch(switches::kDisableFlashSandbox));
}
diff --git a/chrome/common/security_filter_peer.h b/chrome/common/security_filter_peer.h
index e82f748..53d0559 100644
--- a/chrome/common/security_filter_peer.h
+++ b/chrome/common/security_filter_peer.h
@@ -1,10 +1,9 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
-
-#ifndef CHROME_COMMON_SECURITY_FILTER_PEER_H__
-#define CHROME_COMMON_SECURITY_FILTER_PEER_H__
+#ifndef CHROME_COMMON_SECURITY_FILTER_PEER_H_
+#define CHROME_COMMON_SECURITY_FILTER_PEER_H_
#pragma once
#include "webkit/glue/resource_loader_bridge.h"
@@ -41,7 +40,7 @@
bool content_filtered);
virtual void OnDownloadedData(int len) {}
virtual void OnReceivedData(const char* data, int len);
- virtual void OnCompletedRequest(const URLRequestStatus& status,
+ virtual void OnCompletedRequest(const net::URLRequestStatus& status,
const std::string& security_info,
const base::Time& completion_time);
@@ -70,7 +69,7 @@
const webkit_glue::ResourceResponseInfo& info,
bool content_filtered);
virtual void OnReceivedData(const char* data, int len);
- virtual void OnCompletedRequest(const URLRequestStatus& status,
+ virtual void OnCompletedRequest(const net::URLRequestStatus& status,
const std::string& security_info,
const base::Time& completion_time);
@@ -111,7 +110,7 @@
const webkit_glue::ResourceResponseInfo& info,
bool content_filtered);
virtual void OnReceivedData(const char* data, int len);
- virtual void OnCompletedRequest(const URLRequestStatus& status,
+ virtual void OnCompletedRequest(const net::URLRequestStatus& status,
const std::string& security_info,
const base::Time& completion_time);
@@ -123,4 +122,4 @@
DISALLOW_COPY_AND_ASSIGN(ReplaceContentPeer);
};
-#endif // CHROME_COMMON_SECURITY_FILTER_PEER_H__
+#endif // CHROME_COMMON_SECURITY_FILTER_PEER_H_
diff --git a/chrome/common/service_messages_internal.h b/chrome/common/service_messages_internal.h
index 94a0215..5c35def 100644
--- a/chrome/common/service_messages_internal.h
+++ b/chrome/common/service_messages_internal.h
@@ -29,9 +29,6 @@
// enabled.
IPC_MESSAGE_CONTROL0(ServiceMsg_IsCloudPrintProxyEnabled)
-// This message is for testing purpose.
-IPC_MESSAGE_CONTROL0(ServiceMsg_Hello)
-
// Set credentials used by the RemotingHost.
IPC_MESSAGE_CONTROL2(ServiceMsg_SetRemotingHostCredentials,
std::string, /* username */
@@ -65,6 +62,3 @@
IPC_MESSAGE_CONTROL1(ServiceHostMsg_RemotingHost_HostInfo,
remoting::ChromotingHostInfo /* host_info */)
-
-// Sent from the service process in response to a Hello message.
-IPC_MESSAGE_CONTROL0(ServiceHostMsg_GoodDay)
diff --git a/chrome/common/service_process_util_win.cc b/chrome/common/service_process_util_win.cc
index 6d233e9..eb784a5 100644
--- a/chrome/common/service_process_util_win.cc
+++ b/chrome/common/service_process_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,12 +7,12 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/logging.h"
-#include "base/object_watcher.h"
#include "base/path_service.h"
-#include "base/scoped_handle_win.h"
#include "base/string16.h"
#include "base/utf_string_conversions.h"
-#include "base/win_util.h"
+#include "base/win/object_watcher.h"
+#include "base/win/scoped_handle.h"
+#include "base/win/win_util.h"
#include "chrome/common/chrome_switches.h"
namespace {
@@ -27,7 +27,8 @@
GetServiceProcessScopedVersionedName("_service_shutdown_evt"));
}
-class ServiceProcessShutdownMonitor : public base::ObjectWatcher::Delegate {
+class ServiceProcessShutdownMonitor
+ : public base::win::ObjectWatcher::Delegate {
public:
explicit ServiceProcessShutdownMonitor(Task* shutdown_task)
: shutdown_task_(shutdown_task) {
@@ -46,15 +47,15 @@
}
private:
- ScopedHandle shutdown_event_;
- base::ObjectWatcher watcher_;
+ base::win::ScopedHandle shutdown_event_;
+ base::win::ObjectWatcher watcher_;
scoped_ptr<Task> shutdown_task_;
};
} // namespace
bool ForceServiceProcessShutdown(const std::string& version) {
- ScopedHandle shutdown_event;
+ base::win::ScopedHandle shutdown_event;
std::string versioned_name = version;
versioned_name.append("_service_shutdown_evt");
string16 event_name =
@@ -68,7 +69,7 @@
bool CheckServiceProcessReady() {
string16 event_name = GetServiceProcessReadyEventName();
- ScopedHandle event(
+ base::win::ScopedHandle event(
OpenEvent(SYNCHRONIZE | READ_CONTROL, false, event_name.c_str()));
if (!event.IsValid())
return false;
@@ -78,7 +79,7 @@
struct ServiceProcessState::StateData {
// An event that is signaled when a service process is ready.
- ScopedHandle ready_event;
+ base::win::ScopedHandle ready_event;
scoped_ptr<ServiceProcessShutdownMonitor> shutdown_monitor;
};
@@ -86,7 +87,7 @@
DCHECK(!state_);
string16 event_name = GetServiceProcessReadyEventName();
CHECK(event_name.length() <= MAX_PATH);
- ScopedHandle service_process_ready_event;
+ base::win::ScopedHandle service_process_ready_event;
service_process_ready_event.Set(
CreateEvent(NULL, TRUE, FALSE, event_name.c_str()));
DWORD error = GetLastError();
@@ -122,7 +123,7 @@
switches::kServiceProcess);
// We need a unique name for the command per user-date-dir. Just use the
// channel name.
- return win_util::AddCommandToAutoRun(
+ return base::win::AddCommandToAutoRun(
HKEY_CURRENT_USER,
UTF8ToWide(GetAutoRunKey()),
cmd_line.command_line_string());
@@ -131,7 +132,7 @@
}
bool ServiceProcessState::RemoveFromAutoRun() {
- return win_util::RemoveCommandFromAutoRun(
+ return base::win::RemoveCommandFromAutoRun(
HKEY_CURRENT_USER, UTF8ToWide(GetAutoRunKey()));
}
diff --git a/chrome/common/set_process_title.cc b/chrome/common/set_process_title.cc
new file mode 100644
index 0000000..2a772db
--- /dev/null
+++ b/chrome/common/set_process_title.cc
@@ -0,0 +1,81 @@
+// 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.
+
+#include "chrome/common/set_process_title.h"
+
+#include "base/command_line.h"
+#include "base/file_path.h"
+#include "base/file_util.h"
+#include "base/string_util.h"
+#include "build/build_config.h"
+
+#if defined(OS_POSIX)
+#include <limits.h>
+#include <stdlib.h>
+#include <unistd.h>
+#endif
+
+#if defined(OS_LINUX)
+#include <sys/prctl.h>
+
+// Linux/glibc doesn't natively have setproctitle().
+#include "chrome/common/set_process_title_linux.h"
+#endif
+
+#if defined(OS_POSIX) && !defined(OS_MACOSX)
+
+void SetProcessTitleFromCommandLine(char** main_argv) {
+ // Build a single string which consists of all the arguments separated
+ // by spaces. We can't actually keep them separate due to the way the
+ // setproctitle() function works.
+ std::string title;
+ bool have_argv0 = false;
+
+#if defined(OS_LINUX)
+ if (main_argv)
+ setproctitle_init(main_argv);
+
+ // In Linux we sometimes exec ourselves from /proc/self/exe, but this makes us
+ // show up as "exe" in process listings. Read the symlink /proc/self/exe and
+ // use the path it points at for our process title. Note that this is only for
+ // display purposes and has no TOCTTOU security implications.
+ FilePath target;
+ FilePath self_exe("/proc/self/exe");
+ if (file_util::ReadSymbolicLink(self_exe, &target)) {
+ have_argv0 = true;
+ title = target.value();
+ // If the binary has since been deleted, Linux appends " (deleted)" to the
+ // symlink target. Remove it, since this is not really part of our name.
+ const std::string kDeletedSuffix = " (deleted)";
+ if (EndsWith(title, kDeletedSuffix, true))
+ title.resize(title.size() - kDeletedSuffix.size());
+#if defined(PR_SET_NAME)
+ // If PR_SET_NAME is available at compile time, we try using it. We ignore
+ // any errors if the kernel does not support it at runtime though. When
+ // available, this lets us set the short process name that shows when the
+ // full command line is not being displayed in most process listings.
+ prctl(PR_SET_NAME, FilePath(title).BaseName().value().c_str());
+#endif
+ }
+#endif
+
+ const CommandLine* command_line = CommandLine::ForCurrentProcess();
+ for (size_t i = 1; i < command_line->argv().size(); ++i) {
+ if (!title.empty())
+ title += " ";
+ title += command_line->argv()[i];
+ }
+ // Disable prepending argv[0] with '-' if we prepended it ourselves above.
+ setproctitle(have_argv0 ? "-%s" : "%s", title.c_str());
+}
+
+#else
+
+// All other systems (basically Windows & Mac) have no need or way to implement
+// this function.
+void SetProcessTitleFromCommandLine(char** /* main_argv */) {
+}
+
+#endif
+
diff --git a/chrome/common/set_process_title.h b/chrome/common/set_process_title.h
new file mode 100644
index 0000000..95defe8
--- /dev/null
+++ b/chrome/common/set_process_title.h
@@ -0,0 +1,25 @@
+// 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.
+
+#ifndef CHROME_COMMON_SET_PROCESS_TITLE_H_
+#define CHROME_COMMON_SET_PROCESS_TITLE_H_
+
+// Sets OS-specific process title information based on the command line. This
+// does nothing if the OS doesn't support or need this capability.
+//
+// Pass in the argv from main(). On Windows, where there is no argv, you can
+// pass NULL or just don't call this function, since it does nothing. This
+// argv pointer will be cached so if you call this function again, you can pass
+// NULL in the second call. This is to support the case where it's called once
+// at startup, and later when a zygote is fork()ed. The later call doesn't have
+// easy access to main's argv.
+//
+// On non-Mac Unix platforms, we exec ourselves from /proc/self/exe, but that
+// makes the process name that shows up in "ps" etc. for the child processes
+// show as "exe" instead of "chrome" or something reasonable. This function
+// will try to fix it so the "effective" command line shows up instead.
+void SetProcessTitleFromCommandLine(char** main_argv);
+
+#endif // CHROME_COMMON_SET_PROCESS_TITLE_H_
+
diff --git a/base/setproctitle_linux.c b/chrome/common/set_process_title_linux.cc
similarity index 98%
rename from base/setproctitle_linux.c
rename to chrome/common/set_process_title_linux.cc
index 9924c99..837eb2a 100644
--- a/base/setproctitle_linux.c
+++ b/chrome/common/set_process_title_linux.cc
@@ -37,7 +37,7 @@
// this position within the glibc project, leaving applications caught in the
// middle. (Also, only a very few applications need or want this anyway.)
-#include "base/setproctitle_linux.h"
+#include "chrome/common/set_process_title_linux.h"
#include <stdarg.h>
#include <stdint.h>
diff --git a/base/setproctitle_linux.h b/chrome/common/set_process_title_linux.h
similarity index 74%
rename from base/setproctitle_linux.h
rename to chrome/common/set_process_title_linux.h
index 769338c..92fbf70 100644
--- a/base/setproctitle_linux.h
+++ b/chrome/common/set_process_title_linux.h
@@ -2,27 +2,22 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_SETPROCTITLE_LINUX_H_
-#define BASE_SETPROCTITLE_LINUX_H_
+#ifndef CHROME_COMMON_SET_PROCESS_TITLE_LINUX_H_
+#define CHROME_COMMON_SET_PROCESS_TITLE_LINUX_H_
#pragma once
-#ifdef __cplusplus
-extern "C" {
-#endif
-
// Set the process title that will show in "ps" and similar tools. Takes
// printf-style format string and arguments. After calling setproctitle()
// the original main() argv[] array should not be used. By default, the
// original argv[0] is prepended to the format; this can be disabled by
// including a '-' as the first character of the format string.
+//
+// This signature and naming is to be compatible with most other Unix
+// implementations of setproctitle().
void setproctitle(const char* fmt, ...);
// Initialize state needed for setproctitle() on Linux. Pass the argv pointer
// from main() to setproctitle_init() before calling setproctitle().
void setproctitle_init(char** main_argv);
-#ifdef __cplusplus
-}
-#endif
-
-#endif // BASE_SETPROCTITLE_LINUX_H_
+#endif // CHROME_COMMON_SET_PROCESS_TITLE_LINUX_H_
diff --git a/chrome/common/url_constants.cc b/chrome/common/url_constants.cc
index 12ab2de..e4c56fc 100644
--- a/chrome/common/url_constants.cc
+++ b/chrome/common/url_constants.cc
@@ -72,6 +72,7 @@
const char kAboutBrowserCrash[] = "about:inducebrowsercrashforrealz";
const char kChromeUIAboutAboutURL[] = "chrome://about/about";
+const char kChromeUIAboutCreditsURL[] = "chrome://about/credits";
const char kChromeUIAboutURL[] = "chrome://settings/about";
const char kChromeUIAppLauncherURL[] = "chrome://newtab/#mode=app-launcher";
const char kChromeUIBookmarksURL[] = "chrome://bookmarks/";
@@ -94,6 +95,7 @@
const char kChromeUITextfieldsURL[] = "chrome://textfields/";
#if defined(OS_CHROMEOS)
+const char kChromeUIAboutOSCreditsURL[] = "chrome://about/os-credits";
const char kChromeUIFileBrowseURL[] = "chrome://filebrowse/";
const char kChromeUIImageBurnerURL[] = "chrome://imageburner/";
const char kChromeUIKeyboardOverlayURL[] = "chrome://keyboardoverlay/";
@@ -209,6 +211,11 @@
"http://www.google.com/support/chrome/bin/answer.py?answer=114836";
#endif
+const char kChromiumProjectURL[] = "http://code.google.com/chromium/";
+
+const char kLearnMoreReportingURL[] =
+ "http://www.google.com/support/chrome/bin/answer.py?answer=96817&";
+
void RegisterChromeSchemes() {
// Don't need "chrome-internal" which was used in old versions of Chrome for
// the new tab page.
diff --git a/chrome/common/url_constants.h b/chrome/common/url_constants.h
index 9b7c519..50d1a5c 100644
--- a/chrome/common/url_constants.h
+++ b/chrome/common/url_constants.h
@@ -63,6 +63,7 @@
// chrome: URLs (including schemes). Should be kept in sync with the
// components below.
extern const char kChromeUIAboutAboutURL[];
+extern const char kChromeUIAboutCreditsURL[];
extern const char kChromeUIAboutURL[];
extern const char kChromeUIAppLauncherURL[];
extern const char kChromeUIBookmarksURL[];
@@ -85,6 +86,7 @@
extern const char kChromeUITextfieldsURL[];
#if defined(OS_CHROMEOS)
+extern const char kChromeUIAboutOSCreditsURL[];
extern const char kChromeUIFileBrowseURL[];
extern const char kChromeUIImageBurnerURL[];
extern const char kChromeUIKeyboardOverlayURL[];
@@ -189,6 +191,13 @@
// "Learn more" URL for the Privacy section under Options.
extern const char kPrivacyLearnMoreURL[];
+// The URL for the Chromium project used in the About dialog.
+extern const char kChromiumProjectURL[];
+
+// The URL for the "Learn more" page for the usage/crash reporting option in the
+// first run dialog.
+extern const char kLearnMoreReportingURL[];
+
// Call near the beginning of startup to register Chrome's internal URLs that
// should be parsed as "standard" with the googleurl library.
void RegisterChromeSchemes();
diff --git a/chrome/common/win_safe_util.cc b/chrome/common/win_safe_util.cc
index dc5cc25..37cb0a7 100644
--- a/chrome/common/win_safe_util.cc
+++ b/chrome/common/win_safe_util.cc
@@ -7,7 +7,7 @@
#include "chrome/common/win_safe_util.h"
-#include "app/win_util.h"
+#include "app/win/shell.h"
#include "base/file_path.h"
#include "base/logging.h"
#include "base/path_service.h"
@@ -33,7 +33,7 @@
NOTREACHED();
return false;
}
- return OpenItemViaShell(full_path);
+ return app::win::OpenItemViaShell(full_path);
}
// This GUID is associated with any 'don't ask me again' settings that the
@@ -81,7 +81,7 @@
return false;
}
}
- return OpenItemViaShellNoZoneCheck(full_path);
+ return app::win::OpenItemViaShellNoZoneCheck(full_path);
}
bool SetInternetZoneIdentifier(const FilePath& full_path) {
diff --git a/chrome/common/worker_thread_ticker.cc b/chrome/common/worker_thread_ticker.cc
index 452a9ff..909cc8d 100644
--- a/chrome/common/worker_thread_ticker.cc
+++ b/chrome/common/worker_thread_ticker.cc
@@ -9,7 +9,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
class WorkerThreadTicker::TimerTask : public Task {
public:
diff --git a/chrome/common/worker_thread_ticker.h b/chrome/common/worker_thread_ticker.h
index d392749..d18feec 100644
--- a/chrome/common/worker_thread_ticker.h
+++ b/chrome/common/worker_thread_ticker.h
@@ -9,7 +9,7 @@
#include <vector>
#include "base/lock.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
// This class provides the following functionality:
// It invokes a set of registered handlers at periodic intervals in
diff --git a/chrome/common/worker_thread_ticker_unittest.cc b/chrome/common/worker_thread_ticker_unittest.cc
index 71b74c8..b3e1f08 100644
--- a/chrome/common/worker_thread_ticker_unittest.cc
+++ b/chrome/common/worker_thread_ticker_unittest.cc
@@ -5,7 +5,7 @@
#include "chrome/common/worker_thread_ticker.h"
#include "base/message_loop.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
@@ -32,7 +32,7 @@
class LongCallback : public WorkerThreadTicker::Callback {
public:
virtual void OnTick() {
- PlatformThread::Sleep(1500);
+ base::PlatformThread::Sleep(1500);
}
};
diff --git a/net/base/capturing_net_log.cc b/net/base/capturing_net_log.cc
index fccd5ae..c6d3424 100644
--- a/net/base/capturing_net_log.cc
+++ b/net/base/capturing_net_log.cc
@@ -18,7 +18,9 @@
CapturingNetLog::Entry::~Entry() {}
CapturingNetLog::CapturingNetLog(size_t max_num_entries)
- : last_id_(-1), max_num_entries_(max_num_entries) {
+ : last_id_(-1),
+ max_num_entries_(max_num_entries),
+ log_level_(LOG_ALL_BUT_BYTES) {
}
CapturingNetLog::~CapturingNetLog() {}
@@ -39,7 +41,8 @@
}
NetLog::LogLevel CapturingNetLog::GetLogLevel() const {
- return LOG_ALL_BUT_BYTES;
+ AutoLock lock(lock_);
+ return log_level_;
}
void CapturingNetLog::GetEntries(EntryList* entry_list) const {
@@ -52,6 +55,11 @@
entries_.clear();
}
+void CapturingNetLog::SetLogLevel(NetLog::LogLevel log_level) {
+ AutoLock lock(lock_);
+ log_level_ = log_level;
+}
+
CapturingBoundNetLog::CapturingBoundNetLog(const NetLog::Source& source,
CapturingNetLog* net_log)
: source_(source), capturing_net_log_(net_log) {
@@ -71,4 +79,8 @@
capturing_net_log_->Clear();
}
+void CapturingBoundNetLog::SetLogLevel(NetLog::LogLevel log_level) {
+ capturing_net_log_->SetLogLevel(log_level);
+}
+
} // namespace net
diff --git a/net/base/capturing_net_log.h b/net/base/capturing_net_log.h
index 9254725..193d641 100644
--- a/net/base/capturing_net_log.h
+++ b/net/base/capturing_net_log.h
@@ -61,6 +61,8 @@
void Clear();
+ void SetLogLevel(NetLog::LogLevel log_level);
+
private:
// Needs to be "mutable" so can use it in GetEntries().
mutable Lock lock_;
@@ -71,6 +73,8 @@
size_t max_num_entries_;
EntryList entries_;
+ NetLog::LogLevel log_level_;
+
DISALLOW_COPY_AND_ASSIGN(CapturingNetLog);
};
@@ -97,6 +101,9 @@
void Clear();
+ // Sets the log level of the underlying CapturingNetLog.
+ void SetLogLevel(NetLog::LogLevel log_level);
+
private:
NetLog::Source source_;
scoped_ptr<CapturingNetLog> capturing_net_log_;
diff --git a/net/base/cert_database.h b/net/base/cert_database.h
index 7915cc6..5ffb6a2 100644
--- a/net/base/cert_database.h
+++ b/net/base/cert_database.h
@@ -29,6 +29,17 @@
class CertDatabase {
public:
+ // Stores per-certificate error codes for import failures.
+ struct ImportCertFailure {
+ public:
+ ImportCertFailure(X509Certificate* cert, int err);
+ ~ImportCertFailure();
+
+ scoped_refptr<X509Certificate> certificate;
+ int net_error;
+ };
+ typedef std::vector<ImportCertFailure> ImportCertFailureList;
+
// Constants that define which usages a certificate is trusted for.
// They are used in combination with CertType to specify trust for each type
// of certificate.
@@ -45,17 +56,6 @@
TRUSTED_OBJ_SIGN = 1 << 2,
};
- // Stores per-certificate error codes for import failures.
- struct ImportCertFailure {
- public:
- ImportCertFailure(X509Certificate* cert, int err);
- ~ImportCertFailure();
-
- scoped_refptr<X509Certificate> certificate;
- int net_error;
- };
- typedef std::vector<ImportCertFailure> ImportCertFailureList;
-
CertDatabase();
// Check whether this is a valid user cert that we have the private key for.
diff --git a/net/base/cert_verifier.cc b/net/base/cert_verifier.cc
index 4b3d904..3d22dec 100644
--- a/net/base/cert_verifier.cc
+++ b/net/base/cert_verifier.cc
@@ -8,7 +8,7 @@
#include "base/lock.h"
#include "base/message_loop.h"
#include "base/stl_util-inl.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/base/net_errors.h"
#include "net/base/x509_certificate.h"
@@ -136,9 +136,9 @@
bool Start() {
DCHECK_EQ(MessageLoop::current(), origin_loop_);
- return WorkerPool::PostTask(
- FROM_HERE, NewRunnableMethod(this, &CertVerifierWorker::Run),
- true /* task is slow */);
+ return base::WorkerPool::PostTask(
+ FROM_HERE, NewRunnableMethod(this, &CertVerifierWorker::Run),
+ true /* task is slow */);
}
// Cancel is called from the origin loop when the CertVerifier is getting
diff --git a/net/base/cert_verifier.h b/net/base/cert_verifier.h
index 3d19abb..f0df67a 100644
--- a/net/base/cert_verifier.h
+++ b/net/base/cert_verifier.h
@@ -10,8 +10,8 @@
#include <string>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "base/time.h"
#include "net/base/cert_verify_result.h"
#include "net/base/completion_callback.h"
@@ -46,7 +46,7 @@
// request at a time is to create a SingleRequestCertVerifier wrapper around
// CertVerifier (which will automatically cancel the single request when it
// goes out of scope).
-class CertVerifier : public NonThreadSafe {
+class CertVerifier : public base::NonThreadSafe {
public:
// Opaque type used to cancel a request.
typedef void* RequestHandle;
diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc
index a0c16ea..f431674 100644
--- a/net/base/cookie_monster_unittest.cc
+++ b/net/base/cookie_monster_unittest.cc
@@ -7,11 +7,11 @@
#include <string>
#include "base/basictypes.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "net/base/cookie_monster.h"
@@ -1023,7 +1023,7 @@
EXPECT_TRUE(last_access_date == GetFirstCookieAccessDate(cm));
// Reading after a short wait should update the access date.
- PlatformThread::Sleep(kLastAccessThresholdMilliseconds + 20);
+ base::PlatformThread::Sleep(kLastAccessThresholdMilliseconds + 20);
EXPECT_EQ("A=B", cm->GetCookies(url_google));
EXPECT_FALSE(last_access_date == GetFirstCookieAccessDate(cm));
}
@@ -1201,7 +1201,7 @@
const Time last_access_date(GetFirstCookieAccessDate(cm));
- PlatformThread::Sleep(kLastAccessThresholdMilliseconds + 20);
+ base::PlatformThread::Sleep(kLastAccessThresholdMilliseconds + 20);
// Check cookies for url.
net::CookieList cookies = cm->GetAllCookiesForURL(url_google);
diff --git a/net/base/directory_lister.cc b/net/base/directory_lister.cc
index 61a2d65..a0f6317 100644
--- a/net/base/directory_lister.cc
+++ b/net/base/directory_lister.cc
@@ -10,8 +10,8 @@
#include "base/file_util.h"
#include "base/i18n/file_util_icu.h"
#include "base/message_loop.h"
-#include "base/platform_thread.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/thread_restrictions.h"
#include "net/base/net_errors.h"
namespace net {
@@ -104,7 +104,7 @@
delegate_(delegate),
sort_(ALPHA_DIRS_FIRST),
message_loop_(NULL),
- thread_(kNullThreadHandle) {
+ thread_(base::kNullThreadHandle) {
DCHECK(!dir.value().empty());
}
@@ -117,7 +117,7 @@
delegate_(delegate),
sort_(sort),
message_loop_(NULL),
- thread_(kNullThreadHandle) {
+ thread_(base::kNullThreadHandle) {
DCHECK(!dir.value().empty());
}
@@ -126,7 +126,7 @@
// This is a bug and we should stop joining this thread.
// http://crbug.com/65331
base::ThreadRestrictions::ScopedAllowIO allow_io;
- PlatformThread::Join(thread_);
+ base::PlatformThread::Join(thread_);
}
}
@@ -139,7 +139,7 @@
AddRef(); // the thread will release us when it is done
- if (!PlatformThread::Create(0, this, &thread_)) {
+ if (!base::PlatformThread::Create(0, this, &thread_)) {
Release();
return false;
}
@@ -154,8 +154,8 @@
// This is a bug and we should stop joining this thread.
// http://crbug.com/65331
base::ThreadRestrictions::ScopedAllowIO allow_io;
- PlatformThread::Join(thread_);
- thread_ = kNullThreadHandle;
+ base::PlatformThread::Join(thread_);
+ thread_ = base::kNullThreadHandle;
}
}
diff --git a/net/base/directory_lister.h b/net/base/directory_lister.h
index b531880..368c783 100644
--- a/net/base/directory_lister.h
+++ b/net/base/directory_lister.h
@@ -8,12 +8,12 @@
#include <vector>
-#include "base/cancellation_flag.h"
#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
+#include "base/synchronization/cancellation_flag.h"
#include "base/task.h"
+#include "base/threading/platform_thread.h"
class MessageLoop;
@@ -27,7 +27,7 @@
// is insulated from any of the multi-threading details.
//
class DirectoryLister : public base::RefCountedThreadSafe<DirectoryLister>,
- public PlatformThread::Delegate {
+ public base::PlatformThread::Delegate {
public:
// Represents one file found.
struct DirectoryListerData {
@@ -106,7 +106,7 @@
DirectoryListerDelegate* delegate_;
SORT_TYPE sort_;
MessageLoop* message_loop_;
- PlatformThreadHandle thread_;
+ base::PlatformThreadHandle thread_;
base::CancellationFlag canceled_;
};
diff --git a/net/base/dns_reload_timer.cc b/net/base/dns_reload_timer.cc
index 1bfe535..89bda59 100644
--- a/net/base/dns_reload_timer.cc
+++ b/net/base/dns_reload_timer.cc
@@ -6,7 +6,7 @@
#if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
#include "base/lazy_instance.h"
-#include "base/thread_local_storage.h"
+#include "base/threading/thread_local_storage.h"
#include "base/time.h"
namespace {
@@ -72,14 +72,15 @@
// We use thread local storage to identify which base::TimeTicks to
// interact with.
- static ThreadLocalStorage::Slot tls_index_ ;
+ static base::ThreadLocalStorage::Slot tls_index_ ;
DISALLOW_COPY_AND_ASSIGN(DnsReloadTimer);
};
// A TLS slot to the TimeTicks for the current thread.
// static
-ThreadLocalStorage::Slot DnsReloadTimer::tls_index_(base::LINKER_INITIALIZED);
+base::ThreadLocalStorage::Slot DnsReloadTimer::tls_index_(
+ base::LINKER_INITIALIZED);
base::LazyInstance<DnsReloadTimer,
base::LeakyLazyInstanceTraits<DnsReloadTimer> >
diff --git a/net/base/dns_util.h b/net/base/dns_util.h
index 60bfc3f..1120140 100644
--- a/net/base/dns_util.h
+++ b/net/base/dns_util.h
@@ -36,6 +36,7 @@
static const uint16 kDNS_RRSIG = 46;
static const uint16 kDNS_DNSKEY = 48;
static const uint16 kDNS_ANY = 0xff;
+static const uint16 kDNS_CAA = 13172; // temporary, not IANA
static const uint16 kDNS_TESTING = 0xfffe; // in private use area.
// http://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml
diff --git a/net/base/dnsrr_resolver.cc b/net/base/dnsrr_resolver.cc
index ba9b42b..cdb305f 100644
--- a/net/base/dnsrr_resolver.cc
+++ b/net/base/dnsrr_resolver.cc
@@ -15,7 +15,7 @@
#include "base/stl_util-inl.h"
#include "base/string_piece.h"
#include "base/task.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/base/dns_reload_timer.h"
#include "net/base/dns_util.h"
#include "net/base/net_errors.h"
@@ -26,10 +26,10 @@
// | (origin loop) (worker loop)
// |
// Resolve()
-// |---->----<creates>
-// |
// |---->-------------------<creates>
// |
+// |---->----<creates>
+// |
// |---->---------------------------------------------------<creates>
// |
// |---->--------------------Start
@@ -58,11 +58,9 @@
//
// A cache hit:
//
-// DnsRRResolver CacheHitCallbackTask Handle
+// DnsRRResolver Handle
// |
// Resolve()
-// |---->----<creates>
-// |
// |---->------------------------<creates>
// |
// |
@@ -70,9 +68,7 @@
//
// (MessageLoop cycles)
//
-// Run
-// |
-// |----->-----------Post
+// Post
@@ -139,9 +135,9 @@
bool Start() {
DCHECK_EQ(MessageLoop::current(), origin_loop_);
- return WorkerPool::PostTask(
- FROM_HERE, NewRunnableMethod(this, &RRResolverWorker::Run),
- true /* task is slow */);
+ return base::WorkerPool::PostTask(
+ FROM_HERE, NewRunnableMethod(this, &RRResolverWorker::Run),
+ true /* task is slow */);
}
// Cancel is called from the origin loop when the DnsRRResolver is getting
@@ -559,7 +555,11 @@
}
~RRResolverJob() {
- Cancel(ERR_ABORTED);
+ if (worker_) {
+ worker_->Cancel();
+ worker_ = NULL;
+ PostAll(ERR_ABORTED, NULL);
+ }
}
void AddHandle(RRResolverHandle* handle) {
@@ -571,14 +571,6 @@
PostAll(result, &response);
}
- void Cancel(int error) {
- if (worker_) {
- worker_->Cancel();
- worker_ = NULL;
- PostAll(error, NULL);
- }
- }
-
private:
void PostAll(int result, const RRResponse* response) {
std::vector<RRResolverHandle*> handles;
@@ -669,6 +661,7 @@
job = new RRResolverJob(worker);
inflight_.insert(make_pair(key, job));
if (!worker->Start()) {
+ inflight_.erase(key);
delete job;
delete worker;
return kInvalidHandle;
diff --git a/net/base/dnsrr_resolver.h b/net/base/dnsrr_resolver.h
index 30de5fe..9cc5bb8 100644
--- a/net/base/dnsrr_resolver.h
+++ b/net/base/dnsrr_resolver.h
@@ -12,8 +12,8 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "base/time.h"
#include "build/build_config.h"
#include "net/base/completion_callback.h"
@@ -66,7 +66,7 @@
// the name is a fully qualified DNS domain.
//
// A DnsRRResolver must be used from the MessageLoop which created it.
-class DnsRRResolver : public NonThreadSafe,
+class DnsRRResolver : public base::NonThreadSafe,
public NetworkChangeNotifier::Observer {
public:
enum {
diff --git a/net/base/dnsrr_resolver_unittest.cc b/net/base/dnsrr_resolver_unittest.cc
index f5b545b..dfa904a 100644
--- a/net/base/dnsrr_resolver_unittest.cc
+++ b/net/base/dnsrr_resolver_unittest.cc
@@ -5,8 +5,7 @@
#include "net/base/dnsrr_resolver.h"
#include "base/callback.h"
-#include "base/condition_variable.h"
-#include "base/lock.h"
+#include "base/synchronization/lock.h"
#include "net/base/dns_util.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
diff --git a/net/base/file_stream_posix.cc b/net/base/file_stream_posix.cc
index 00af6d4..bdc51ce 100644
--- a/net/base/file_stream_posix.cc
+++ b/net/base/file_stream_posix.cc
@@ -21,8 +21,8 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/string_util.h"
-#include "base/waitable_event.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
+#include "base/synchronization/waitable_event.h"
#include "net/base/net_errors.h"
// We cast back and forth, so make sure it's the size we're expecting.
@@ -254,11 +254,11 @@
DCHECK(!callback_);
callback_ = callback;
- WorkerPool::PostTask(FROM_HERE,
- new BackgroundReadTask(
- file, buf, buf_len,
- &background_io_completed_callback_),
- true /* task_is_slow */);
+ base::WorkerPool::PostTask(FROM_HERE,
+ new BackgroundReadTask(
+ file, buf, buf_len,
+ &background_io_completed_callback_),
+ true /* task_is_slow */);
}
void FileStream::AsyncContext::InitiateAsyncWrite(
@@ -267,11 +267,11 @@
DCHECK(!callback_);
callback_ = callback;
- WorkerPool::PostTask(FROM_HERE,
- new BackgroundWriteTask(
- file, buf, buf_len,
- &background_io_completed_callback_),
- true /* task_is_slow */);
+ base::WorkerPool::PostTask(FROM_HERE,
+ new BackgroundWriteTask(
+ file, buf, buf_len,
+ &background_io_completed_callback_),
+ true /* task_is_slow */);
}
void FileStream::AsyncContext::OnBackgroundIOCompleted(int result) {
diff --git a/net/base/gzip_header.h b/net/base/gzip_header.h
index 81f6f19..c245de2 100644
--- a/net/base/gzip_header.h
+++ b/net/base/gzip_header.h
@@ -20,9 +20,16 @@
class GZipHeader {
public:
+ enum Status {
+ INCOMPLETE_HEADER, // don't have all the bits yet...
+ COMPLETE_HEADER, // complete, valid header
+ INVALID_HEADER, // found something invalid in the header
+ };
+
GZipHeader() {
Reset();
}
+
~GZipHeader() {
}
@@ -33,12 +40,6 @@
extra_length_ = 0;
}
- enum Status {
- INCOMPLETE_HEADER, // don't have all the bits yet...
- COMPLETE_HEADER, // complete, valid header
- INVALID_HEADER, // found something invalid in the header
- };
-
// Attempt to parse the given buffer as the next installment of
// bytes from a gzip header. If the bytes we've seen so far do not
// yet constitute a complete gzip header, return
@@ -49,9 +50,6 @@
Status ReadMore(const char* inbuf, int inbuf_len,
const char** header_end);
private:
-
- static const uint8 magic[]; // gzip magic header
-
enum { // flags (see RFC)
FLAG_FTEXT = 0x01, // bit 0 set: file probably ascii text
FLAG_FHCRC = 0x02, // bit 1 set: header CRC present
@@ -88,6 +86,8 @@
IN_DONE,
};
+ static const uint8 magic[]; // gzip magic header
+
int state_; // our current State in the parsing FSM: an int so we can ++
uint8 flags_; // the flags byte of the header ("FLG" in the RFC)
uint16 extra_length_; // how much of the "extra field" we have yet to read
diff --git a/net/base/host_cache.h b/net/base/host_cache.h
index aedc499..11ab1f3 100644
--- a/net/base/host_cache.h
+++ b/net/base/host_cache.h
@@ -10,8 +10,8 @@
#include <string>
#include "base/gtest_prod_util.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "base/time.h"
#include "net/base/address_family.h"
#include "net/base/address_list.h"
@@ -19,7 +19,7 @@
namespace net {
// Cache used by HostResolver to map hostnames to their resolved result.
-class HostCache : public NonThreadSafe {
+class HostCache : public base::NonThreadSafe {
public:
// Stores the latest address list that was looked up for a hostname.
struct Entry : public base::RefCounted<Entry> {
diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc
index fded5ff..a30f320 100644
--- a/net/base/host_resolver_impl.cc
+++ b/net/base/host_resolver_impl.cc
@@ -24,10 +24,10 @@
#include "base/metrics/histogram.h"
#include "base/stl_util-inl.h"
#include "base/string_util.h"
+#include "base/threading/worker_pool.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "base/worker_pool.h"
#include "net/base/address_list.h"
#include "net/base/address_list_net_log_param.h"
#include "net/base/host_port_pair.h"
@@ -385,7 +385,7 @@
start_time_ = base::TimeTicks::Now();
// Dispatch the job to a worker thread.
- if (!WorkerPool::PostTask(FROM_HERE,
+ if (!base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(this, &Job::DoLookup), true)) {
NOTREACHED();
@@ -653,7 +653,7 @@
return;
DCHECK(IsOnOriginThread());
const bool kIsSlow = true;
- WorkerPool::PostTask(
+ base::WorkerPool::PostTask(
FROM_HERE, NewRunnableMethod(this, &IPv6ProbeJob::DoProbe), kIsSlow);
}
diff --git a/net/base/host_resolver_impl.h b/net/base/host_resolver_impl.h
index 68c8c0b..d6d82d0 100644
--- a/net/base/host_resolver_impl.h
+++ b/net/base/host_resolver_impl.h
@@ -8,8 +8,8 @@
#include <vector>
-#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "net/base/capturing_net_log.h"
#include "net/base/host_cache.h"
#include "net/base/host_resolver.h"
@@ -50,7 +50,7 @@
// Requests are ordered in the queue based on their priority.
class HostResolverImpl : public HostResolver,
- public NonThreadSafe,
+ public base::NonThreadSafe,
public NetworkChangeNotifier::Observer {
public:
// The index into |job_pools_| for the various job pools. Pools with a higher
diff --git a/net/base/keygen_handler_unittest.cc b/net/base/keygen_handler_unittest.cc
index f4251f2..ee60cee 100644
--- a/net/base/keygen_handler_unittest.cc
+++ b/net/base/keygen_handler_unittest.cc
@@ -11,9 +11,9 @@
#include "base/logging.h"
#include "base/nss_util.h"
#include "base/task.h"
-#include "base/thread_restrictions.h"
-#include "base/waitable_event.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
+#include "base/threading/thread_restrictions.h"
+#include "base/synchronization/waitable_event.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(USE_NSS)
@@ -124,10 +124,10 @@
std::string results[NUM_HANDLERS];
for (int i = 0; i < NUM_HANDLERS; i++) {
events[i] = new base::WaitableEvent(false, false);
- WorkerPool::PostTask(FROM_HERE,
- new ConcurrencyTestTask(events[i], "some challenge",
- &results[i]),
- true);
+ base::WorkerPool::PostTask(
+ FROM_HERE,
+ new ConcurrencyTestTask(events[i], "some challenge", &results[i]),
+ true);
}
for (int i = 0; i < NUM_HANDLERS; i++) {
diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc
index c964ec9..445d57d 100644
--- a/net/base/listen_socket.cc
+++ b/net/base/listen_socket.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -22,6 +22,7 @@
#endif
#include "base/eintr_wrapper.h"
+#include "base/threading/platform_thread.h"
#include "net/base/net_util.h"
#include "net/base/listen_socket.h"
@@ -231,7 +232,7 @@
send_buf += sent;
len_left -= sent;
}
- PlatformThread::YieldCurrentThread();
+ base::PlatformThread::YieldCurrentThread();
}
}
diff --git a/net/base/listen_socket.h b/net/base/listen_socket.h
index e730b82..641ae51 100644
--- a/net/base/listen_socket.h
+++ b/net/base/listen_socket.h
@@ -19,7 +19,7 @@
#endif
#include <string>
#if defined(OS_WIN)
-#include "base/object_watcher.h"
+#include "base/win/object_watcher.h"
#elif defined(OS_POSIX)
#include "base/message_loop.h"
#endif
@@ -35,7 +35,7 @@
// Implements a raw socket interface
class ListenSocket : public base::RefCountedThreadSafe<ListenSocket>,
#if defined(OS_WIN)
- public base::ObjectWatcher::Delegate
+ public base::win::ObjectWatcher::Delegate
#elif defined(OS_POSIX)
public MessageLoopForIO::Watcher
#endif
@@ -107,7 +107,7 @@
#if defined(OS_WIN)
// ObjectWatcher delegate
virtual void OnObjectSignaled(HANDLE object);
- base::ObjectWatcher watcher_;
+ base::win::ObjectWatcher watcher_;
HANDLE socket_event_;
#elif defined(OS_POSIX)
WaitState wait_state_;
diff --git a/net/base/listen_socket_unittest.h b/net/base/listen_socket_unittest.h
index 6658d91..f283cb0 100644
--- a/net/base/listen_socket_unittest.h
+++ b/net/base/listen_socket_unittest.h
@@ -17,12 +17,12 @@
#endif
#include "base/basictypes.h"
-#include "base/condition_variable.h"
-#include "base/lock.h"
#include "base/message_loop.h"
#include "base/scoped_ptr.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/synchronization/lock.h"
+#include "base/threading/thread.h"
#include "net/base/listen_socket.h"
#include "net/base/net_util.h"
#include "net/base/winsock_init.h"
@@ -116,8 +116,8 @@
SOCKET test_socket_;
static const int kTestPort;
- Lock lock_; // protects |queue_| and wraps |cv_|
- ConditionVariable cv_;
+ base::Lock lock_; // protects |queue_| and wraps |cv_|
+ base::ConditionVariable cv_;
std::deque<ListenSocketTestAction> queue_;
};
diff --git a/net/base/mock_host_resolver.cc b/net/base/mock_host_resolver.cc
index 9ee5c53..a1817a2 100644
--- a/net/base/mock_host_resolver.cc
+++ b/net/base/mock_host_resolver.cc
@@ -5,8 +5,8 @@
#include "net/base/mock_host_resolver.h"
#include "base/string_util.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
+#include "base/threading/platform_thread.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
#include "net/base/sys_addrinfo.h"
@@ -231,7 +231,7 @@
if (matches_flags && matches_address_family &&
MatchPattern(host, r->host_pattern)) {
if (r->latency_ms != 0)
- PlatformThread::Sleep(r->latency_ms);
+ base::PlatformThread::Sleep(r->latency_ms);
// Remap to a new host.
const std::string& effective_host =
diff --git a/net/base/mock_host_resolver.h b/net/base/mock_host_resolver.h
index e5b8694..3b1e36a 100644
--- a/net/base/mock_host_resolver.h
+++ b/net/base/mock_host_resolver.h
@@ -8,7 +8,7 @@
#include <list>
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "net/base/host_resolver_impl.h"
#include "net/base/host_resolver_proc.h"
@@ -41,16 +41,6 @@
public:
virtual ~MockHostResolverBase();
- // HostResolver methods:
- virtual int Resolve(const RequestInfo& info,
- AddressList* addresses,
- CompletionCallback* callback,
- RequestHandle* out_req,
- const BoundNetLog& net_log);
- virtual void CancelRequest(RequestHandle req);
- virtual void AddObserver(Observer* observer);
- virtual void RemoveObserver(Observer* observer);
-
RuleBasedHostResolverProc* rules() { return rules_; }
// Controls whether resolutions complete synchronously or asynchronously.
@@ -68,6 +58,16 @@
pool_index, max_outstanding_jobs, max_pending_requests);
}
+ // HostResolver methods:
+ virtual int Resolve(const RequestInfo& info,
+ AddressList* addresses,
+ CompletionCallback* callback,
+ RequestHandle* out_req,
+ const BoundNetLog& net_log);
+ virtual void CancelRequest(RequestHandle req);
+ virtual void AddObserver(Observer* observer);
+ virtual void RemoveObserver(Observer* observer);
+
protected:
MockHostResolverBase(bool use_caching);
@@ -143,11 +143,11 @@
int* os_error);
private:
- ~RuleBasedHostResolverProc();
-
struct Rule;
typedef std::list<Rule> RuleList;
+ ~RuleBasedHostResolverProc();
+
RuleList rules_;
};
diff --git a/net/base/net_log.cc b/net/base/net_log.cc
index c9e7319..0f1bac4 100644
--- a/net/base/net_log.cc
+++ b/net/base/net_log.cc
@@ -3,11 +3,13 @@
// found in the LICENSE file.
#include "net/base/net_log.h"
+
#include "base/logging.h"
#include "base/string_number_conversions.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "net/base/net_errors.h"
namespace net {
@@ -157,6 +159,18 @@
AddEntry(event_type, NetLog::PHASE_END, params);
}
+void BoundNetLog::EndEventWithNetErrorCode(NetLog::EventType event_type,
+ int net_error) const {
+ DCHECK_NE(net_error, net::ERR_IO_PENDING);
+ if (net_error >= 0) {
+ EndEvent(event_type, NULL);
+ } else {
+ EndEvent(
+ event_type,
+ make_scoped_refptr(new NetLogIntegerParameter("net_error", net_error)));
+ }
+}
+
// static
BoundNetLog BoundNetLog::Make(NetLog* net_log,
NetLog::SourceType source_type) {
diff --git a/net/base/net_log.h b/net/base/net_log.h
index b8f903d..1d37129 100644
--- a/net/base/net_log.h
+++ b/net/base/net_log.h
@@ -34,6 +34,8 @@
// TODO(eroman): Remove the 'const' qualitifer from the BoundNetLog methods.
// TODO(eroman): Start a new Source each time net::URLRequest redirects
// (simpler to reason about each as a separate entity).
+// TODO(mmenke): Replace EndEvent calls with EndEventWithNetErrorCode, where
+// appropriate.
class NetLog {
public:
@@ -193,6 +195,13 @@
void EndEvent(NetLog::EventType event_type,
const scoped_refptr<NetLog::EventParameters>& params) const;
+ // Just like EndEvent, except |net_error| is a net error code. If it's
+ // negative, a parameter called "net_error" with a value of |net_error| is
+ // associated with the event. Otherwise, the end event has no parameters.
+ // |net_error| must not be ERR_IO_PENDING, as it's not a true error.
+ void EndEventWithNetErrorCode(NetLog::EventType event_type,
+ int net_error) const;
+
NetLog::LogLevel GetLogLevel() const;
// Returns true if the log level is LOG_ALL.
diff --git a/net/base/net_log_event_type_list.h b/net/base/net_log_event_type_list.h
index f1bc4f8..0f1eecf 100644
--- a/net/base/net_log_event_type_list.h
+++ b/net/base/net_log_event_type_list.h
@@ -501,22 +501,85 @@
// HttpCache
// ------------------------------------------------------------------------
+// Measures the time while getting a reference to the back end.
+EVENT_TYPE(HTTP_CACHE_GET_BACKEND)
+
// Measures the time while opening a disk cache entry.
EVENT_TYPE(HTTP_CACHE_OPEN_ENTRY)
// Measures the time while creating a disk cache entry.
EVENT_TYPE(HTTP_CACHE_CREATE_ENTRY)
+// Measures the time it takes to add a HttpCache::Transaction to an http cache
+// entry's list of active Transactions.
+EVENT_TYPE(HTTP_CACHE_ADD_TO_ENTRY)
+
// Measures the time while deleting a disk cache entry.
EVENT_TYPE(HTTP_CACHE_DOOM_ENTRY)
-// Measures the time while reading the response info from a disk cache entry.
+// Measures the time while reading/writing a disk cache entry's response headers
+// or metadata.
EVENT_TYPE(HTTP_CACHE_READ_INFO)
+EVENT_TYPE(HTTP_CACHE_WRITE_INFO)
-// Measures the time that an HttpCache::Transaction is stalled waiting for
-// the cache entry to become available (for example if we are waiting for
-// exclusive access to an existing entry).
-EVENT_TYPE(HTTP_CACHE_WAITING)
+// Measures the time while reading/writing a disk cache entry's body.
+EVENT_TYPE(HTTP_CACHE_READ_DATA)
+EVENT_TYPE(HTTP_CACHE_WRITE_DATA)
+
+// ------------------------------------------------------------------------
+// Disk Cache
+// ------------------------------------------------------------------------
+
+// The creation/destruction of a disk_cache::EntryImpl object. The "creation"
+// is considered to be the point at which an Entry is first considered to be
+// good and associated with a key.
+//
+// For the BEGIN phase, the following parameters are attached:
+// {
+// "created": <true if the Entry was created, rather than being opened>;
+// "key": <The Entry's key>;
+// }
+EVENT_TYPE(DISK_CACHE_ENTRY)
+
+// Logs the time required to read/write data from/to a cache entry.
+//
+// For the BEGIN phase, the following parameters are attached:
+// {
+// "index": <Index being read/written>;
+// "offset": <Offset being read/written>;
+// "buf_len": <Length of buffer being read to/written from>;
+// "truncate": <If present for a write, the truncate flag is set to true.
+// Not present in reads or writes where it is false>
+// }
+//
+// For the END phase, the following parameters are attached:
+// {
+// "bytes_copied": <Number of bytes copied. Not present on error>;
+// "net_error": <Network error code. Only present on error>;
+// }
+EVENT_TYPE(DISK_CACHE_READ_DATA)
+EVENT_TYPE(DISK_CACHE_WRITE_DATA)
+
+// Logged when SparseControl starts/stops handling IO for an Entry.
+EVENT_TYPE(SPARSE_CONTROL)
+
+// Logged when SparseControl starts/stops reading/writing a child Entry's data
+//
+// For the BEGIN phase, the following parameters are attached:
+// {
+// "source_dependency": <Source id of the child entry>
+// }
+EVENT_TYPE(SPARSE_CONTROL_READ)
+EVENT_TYPE(SPARSE_CONTROL_WRITE)
+
+// Indicates the time taken by a sparse control to get a range.
+EVENT_TYPE(SPARSE_CONTROL_GET_RANGE)
+
+// Logged when an entry is closed.
+EVENT_TYPE(DISK_CACHE_CLOSE)
+
+// Logged when an entry is doomed.
+EVENT_TYPE(DISK_CACHE_DOOM)
// ------------------------------------------------------------------------
// HttpNetworkTransaction
diff --git a/net/base/net_log_source_type_list.h b/net/base/net_log_source_type_list.h
index 231ecd2..ba34955 100644
--- a/net/base/net_log_source_type_list.h
+++ b/net/base/net_log_source_type_list.h
@@ -15,5 +15,6 @@
SOURCE_TYPE(SPDY_SESSION, 6)
SOURCE_TYPE(HOST_RESOLVER_IMPL_REQUEST, 7)
SOURCE_TYPE(HOST_RESOLVER_IMPL_JOB, 8)
+SOURCE_TYPE(DISK_CACHE_ENTRY, 9)
-SOURCE_TYPE(COUNT, 9) // Always keep this as the last entry.
+SOURCE_TYPE(COUNT, 10) // Always keep this as the last entry.
diff --git a/net/base/network_change_notifier_linux.cc b/net/base/network_change_notifier_linux.cc
index 1db4bd1..c19d182 100644
--- a/net/base/network_change_notifier_linux.cc
+++ b/net/base/network_change_notifier_linux.cc
@@ -10,7 +10,7 @@
#include "base/compiler_specific.h"
#include "base/eintr_wrapper.h"
#include "base/task.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "net/base/net_errors.h"
#include "net/base/network_change_notifier_netlink_linux.h"
@@ -91,7 +91,8 @@
ListenForNotifications();
}
-void NetworkChangeNotifierLinux::Thread::OnFileCanWriteWithoutBlocking(int /* fd */) {
+void NetworkChangeNotifierLinux::Thread::OnFileCanWriteWithoutBlocking(
+ int /* fd */) {
NOTREACHED();
}
diff --git a/net/base/network_change_notifier_win.h b/net/base/network_change_notifier_win.h
index 44782c7..c76f7fd 100644
--- a/net/base/network_change_notifier_win.h
+++ b/net/base/network_change_notifier_win.h
@@ -9,13 +9,13 @@
#include <windows.h>
#include "base/basictypes.h"
-#include "base/object_watcher.h"
+#include "base/win/object_watcher.h"
#include "net/base/network_change_notifier.h"
namespace net {
class NetworkChangeNotifierWin : public NetworkChangeNotifier,
- public base::ObjectWatcher::Delegate {
+ public base::win::ObjectWatcher::Delegate {
public:
NetworkChangeNotifierWin();
@@ -31,7 +31,7 @@
// Begins listening for a single subsequent address change.
void WatchForAddressChange();
- base::ObjectWatcher addr_watcher_;
+ base::win::ObjectWatcher addr_watcher_;
OVERLAPPED addr_overlapped_;
DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierWin);
diff --git a/net/base/network_config_watcher_mac.cc b/net/base/network_config_watcher_mac.cc
index dd93067..afec17d 100644
--- a/net/base/network_config_watcher_mac.cc
+++ b/net/base/network_config_watcher_mac.cc
@@ -9,7 +9,7 @@
#include <algorithm>
#include "base/compiler_specific.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/mac/scoped_cftyperef.h"
namespace net {
diff --git a/net/base/registry_controlled_domain.h b/net/base/registry_controlled_domain.h
index 7586c12..90a1b8f 100644
--- a/net/base/registry_controlled_domain.h
+++ b/net/base/registry_controlled_domain.h
@@ -204,6 +204,8 @@
static RegistryControlledDomainService* GetInstance();
protected:
+ typedef const struct DomainRule* (*FindDomainPtr)(const char *, unsigned int);
+
// The entire protected API is only for unit testing. I mean it. Don't make
// me come over there!
RegistryControlledDomainService();
@@ -216,8 +218,6 @@
static RegistryControlledDomainService* SetInstance(
RegistryControlledDomainService* instance);
- typedef const struct DomainRule* (*FindDomainPtr)(const char *, unsigned int);
-
// Used for unit tests, so that a different perfect hash map from the full
// list is used.
static void UseFindDomainFunction(FindDomainPtr function);
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index 5aca923..18976c9 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -26,41 +26,176 @@
// static
SdchManager* SdchManager::global_;
+//------------------------------------------------------------------------------
+SdchManager::Dictionary::Dictionary(const std::string& dictionary_text,
+ size_t offset, const std::string& client_hash, const GURL& gurl,
+ const std::string& domain, const std::string& path, const Time& expiration,
+ const std::set<int> ports)
+ : text_(dictionary_text, offset),
+ client_hash_(client_hash),
+ url_(gurl),
+ domain_(domain),
+ path_(path),
+ expiration_(expiration),
+ ports_(ports) {
+}
+
+SdchManager::Dictionary::~Dictionary() {
+}
+
+bool SdchManager::Dictionary::CanAdvertise(const GURL& target_url) {
+ if (!SdchManager::Global()->IsInSupportedDomain(target_url))
+ return false;
+ /* The specific rules of when a dictionary should be advertised in an
+ Avail-Dictionary header are modeled after the rules for cookie scoping. The
+ terms "domain-match" and "pathmatch" are defined in RFC 2965 [6]. A
+ dictionary may be advertised in the Avail-Dictionaries header exactly when
+ all of the following are true:
+ 1. The server's effective host name domain-matches the Domain attribute of
+ the dictionary.
+ 2. If the dictionary has a Port attribute, the request port is one of the
+ ports listed in the Port attribute.
+ 3. The request URI path-matches the path header of the dictionary.
+ 4. The request is not an HTTPS request.
+ */
+ if (!DomainMatch(target_url, domain_))
+ return false;
+ if (!ports_.empty() && 0 == ports_.count(target_url.EffectiveIntPort()))
+ return false;
+ if (path_.size() && !PathMatch(target_url.path(), path_))
+ return false;
+ if (target_url.SchemeIsSecure())
+ return false;
+ if (Time::Now() > expiration_)
+ return false;
+ return true;
+}
+
+//------------------------------------------------------------------------------
+// Security functions restricting loads and use of dictionaries.
+
// static
-SdchManager* SdchManager::Global() {
- return global_;
+bool SdchManager::Dictionary::CanSet(const std::string& domain,
+ const std::string& path,
+ const std::set<int> ports,
+ const GURL& dictionary_url) {
+ if (!SdchManager::Global()->IsInSupportedDomain(dictionary_url))
+ return false;
+ /*
+ A dictionary is invalid and must not be stored if any of the following are
+ true:
+ 1. The dictionary has no Domain attribute.
+ 2. The effective host name that derives from the referer URL host name does
+ not domain-match the Domain attribute.
+ 3. The Domain attribute is a top level domain.
+ 4. The referer URL host is a host domain name (not IP address) and has the
+ form HD, where D is the value of the Domain attribute, and H is a string
+ that contains one or more dots.
+ 5. If the dictionary has a Port attribute and the referer URL's port was not
+ in the list.
+ */
+
+ // TODO(jar): Redirects in dictionary fetches might plausibly be problematic,
+ // and hence the conservative approach is to not allow any redirects (if there
+ // were any... then don't allow the dictionary to be set).
+
+ if (domain.empty()) {
+ SdchErrorRecovery(DICTIONARY_MISSING_DOMAIN_SPECIFIER);
+ return false; // Domain is required.
+ }
+ if (net::RegistryControlledDomainService::GetDomainAndRegistry(domain).size()
+ == 0) {
+ SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN);
+ return false; // domain was a TLD.
+ }
+ if (!Dictionary::DomainMatch(dictionary_url, domain)) {
+ SdchErrorRecovery(DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL);
+ return false;
+ }
+
+ std::string referrer_url_host = dictionary_url.host();
+ size_t postfix_domain_index = referrer_url_host.rfind(domain);
+ // See if it is indeed a postfix, or just an internal string.
+ if (referrer_url_host.size() == postfix_domain_index + domain.size()) {
+ // It is a postfix... so check to see if there's a dot in the prefix.
+ size_t end_of_host_index = referrer_url_host.find_first_of('.');
+ if (referrer_url_host.npos != end_of_host_index &&
+ end_of_host_index < postfix_domain_index) {
+ SdchErrorRecovery(DICTIONARY_REFERER_URL_HAS_DOT_IN_PREFIX);
+ return false;
+ }
+ }
+
+ if (!ports.empty()
+ && 0 == ports.count(dictionary_url.EffectiveIntPort())) {
+ SdchErrorRecovery(DICTIONARY_PORT_NOT_MATCHING_SOURCE_URL);
+ return false;
+ }
+ return true;
}
// static
-void SdchManager::SdchErrorRecovery(ProblemCodes problem) {
- UMA_HISTOGRAM_ENUMERATION("Sdch3.ProblemCodes_4", problem, MAX_PROBLEM_CODE);
+bool SdchManager::Dictionary::CanUse(const GURL& referring_url) {
+ if (!SdchManager::Global()->IsInSupportedDomain(referring_url))
+ return false;
+ /*
+ 1. The request URL's host name domain-matches the Domain attribute of the
+ dictionary.
+ 2. If the dictionary has a Port attribute, the request port is one of the
+ ports listed in the Port attribute.
+ 3. The request URL path-matches the path attribute of the dictionary.
+ 4. The request is not an HTTPS request.
+*/
+ if (!DomainMatch(referring_url, domain_)) {
+ SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_DOMAIN);
+ return false;
+ }
+ if (!ports_.empty()
+ && 0 == ports_.count(referring_url.EffectiveIntPort())) {
+ SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_PORT_LIST);
+ return false;
+ }
+ if (path_.size() && !PathMatch(referring_url.path(), path_)) {
+ SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_PATH);
+ return false;
+ }
+ if (referring_url.SchemeIsSecure()) {
+ SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_SCHEME);
+ return false;
+ }
+
+ // TODO(jar): Remove overly restrictive failsafe test (added per security
+ // review) when we have a need to be more general.
+ if (!referring_url.SchemeIs("http")) {
+ SdchErrorRecovery(ATTEMPT_TO_DECODE_NON_HTTP_DATA);
+ return false;
+ }
+
+ return true;
+}
+
+bool SdchManager::Dictionary::PathMatch(const std::string& path,
+ const std::string& restriction) {
+ /* Must be either:
+ 1. P2 is equal to P1
+ 2. P2 is a prefix of P1 and either the final character in P2 is "/" or the
+ character following P2 in P1 is "/".
+ */
+ if (path == restriction)
+ return true;
+ size_t prefix_length = restriction.size();
+ if (prefix_length > path.size())
+ return false; // Can't be a prefix.
+ if (0 != path.compare(0, prefix_length, restriction))
+ return false;
+ return restriction[prefix_length - 1] == '/' || path[prefix_length] == '/';
}
// static
-void SdchManager::ClearBlacklistings() {
- Global()->blacklisted_domains_.clear();
- Global()->exponential_blacklist_count.clear();
-}
-
-// static
-void SdchManager::ClearDomainBlacklisting(const std::string& domain) {
- Global()->blacklisted_domains_.erase(StringToLowerASCII(domain));
-}
-
-// static
-int SdchManager::BlackListDomainCount(const std::string& domain) {
- if (Global()->blacklisted_domains_.end() ==
- Global()->blacklisted_domains_.find(domain))
- return 0;
- return Global()->blacklisted_domains_[StringToLowerASCII(domain)];
-}
-
-// static
-int SdchManager::BlacklistDomainExponential(const std::string& domain) {
- if (Global()->exponential_blacklist_count.end() ==
- Global()->exponential_blacklist_count.find(domain))
- return 0;
- return Global()->exponential_blacklist_count[StringToLowerASCII(domain)];
+bool SdchManager::Dictionary::DomainMatch(const GURL& gurl,
+ const std::string& restriction) {
+ // TODO(jar): This is not precisely a domain match definition.
+ return gurl.DomainIs(restriction.data(), restriction.size());
}
//------------------------------------------------------------------------------
@@ -87,6 +222,22 @@
}
// static
+SdchManager* SdchManager::Global() {
+ return global_;
+}
+
+// static
+void SdchManager::SdchErrorRecovery(ProblemCodes problem) {
+ UMA_HISTOGRAM_ENUMERATION("Sdch3.ProblemCodes_4", problem, MAX_PROBLEM_CODE);
+}
+
+void SdchManager::EnableSdchSupport(const std::string& domain) {
+ // We presume that there is a SDCH manager instance.
+ global_->supported_domain_ = domain;
+ global_->sdch_enabled_ = true;
+}
+
+// static
void SdchManager::BlacklistDomain(const GURL& url) {
if (!global_ )
return;
@@ -117,10 +268,31 @@
global_->blacklisted_domains_[domain] = INT_MAX;
}
-void SdchManager::EnableSdchSupport(const std::string& domain) {
- // We presume that there is a SDCH manager instance.
- global_->supported_domain_ = domain;
- global_->sdch_enabled_ = true;
+// static
+void SdchManager::ClearBlacklistings() {
+ Global()->blacklisted_domains_.clear();
+ Global()->exponential_blacklist_count.clear();
+}
+
+// static
+void SdchManager::ClearDomainBlacklisting(const std::string& domain) {
+ Global()->blacklisted_domains_.erase(StringToLowerASCII(domain));
+}
+
+// static
+int SdchManager::BlackListDomainCount(const std::string& domain) {
+ if (Global()->blacklisted_domains_.end() ==
+ Global()->blacklisted_domains_.find(domain))
+ return 0;
+ return Global()->blacklisted_domains_[StringToLowerASCII(domain)];
+}
+
+// static
+int SdchManager::BlacklistDomainExponential(const std::string& domain) {
+ if (Global()->exponential_blacklist_count.end() ==
+ Global()->exponential_blacklist_count.find(domain))
+ return 0;
+ return Global()->exponential_blacklist_count[StringToLowerASCII(domain)];
}
bool SdchManager::IsInSupportedDomain(const GURL& url) {
@@ -147,6 +319,13 @@
return false;
}
+void SdchManager::FetchDictionary(const GURL& request_url,
+ const GURL& dictionary_url) {
+ if (SdchManager::Global()->CanFetchDictionary(request_url, dictionary_url) &&
+ fetcher_.get())
+ fetcher_->Schedule(dictionary_url);
+}
+
bool SdchManager::CanFetchDictionary(const GURL& referring_url,
const GURL& dictionary_url) const {
/* The user agent may retrieve a dictionary from the dictionary URL if all of
@@ -179,13 +358,6 @@
return true;
}
-void SdchManager::FetchDictionary(const GURL& request_url,
- const GURL& dictionary_url) {
- if (SdchManager::Global()->CanFetchDictionary(request_url, dictionary_url) &&
- fetcher_.get())
- fetcher_->Schedule(dictionary_url);
-}
-
bool SdchManager::AddSdchDictionary(const std::string& dictionary_text,
const GURL& dictionary_url) {
std::string client_hash;
@@ -317,22 +489,6 @@
UMA_HISTOGRAM_COUNTS("Sdch3.Advertisement_Count", count);
}
-SdchManager::Dictionary::Dictionary(const std::string& dictionary_text,
- size_t offset, const std::string& client_hash, const GURL& gurl,
- const std::string& domain, const std::string& path, const Time& expiration,
- const std::set<int> ports)
- : text_(dictionary_text, offset),
- client_hash_(client_hash),
- url_(gurl),
- domain_(domain),
- path_(path),
- expiration_(expiration),
- ports_(ports) {
-}
-
-SdchManager::Dictionary::~Dictionary() {
-}
-
// static
void SdchManager::GenerateHash(const std::string& dictionary_text,
std::string* client_hash, std::string* server_hash) {
@@ -348,181 +504,6 @@
DCHECK_EQ(client_hash->length(), 8u);
}
-// static
-void SdchManager::UrlSafeBase64Encode(const std::string& input,
- std::string* output) {
- // Since this is only done during a dictionary load, and hashes are only 8
- // characters, we just do the simple fixup, rather than rewriting the encoder.
- base::Base64Encode(input, output);
- for (size_t i = 0; i < output->size(); ++i) {
- switch (output->data()[i]) {
- case '+':
- (*output)[i] = '-';
- continue;
- case '/':
- (*output)[i] = '_';
- continue;
- default:
- continue;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-// Security functions restricting loads and use of dictionaries.
-
-// static
-bool SdchManager::Dictionary::CanSet(const std::string& domain,
- const std::string& path,
- const std::set<int> ports,
- const GURL& dictionary_url) {
- if (!SdchManager::Global()->IsInSupportedDomain(dictionary_url))
- return false;
- /*
- A dictionary is invalid and must not be stored if any of the following are
- true:
- 1. The dictionary has no Domain attribute.
- 2. The effective host name that derives from the referer URL host name does
- not domain-match the Domain attribute.
- 3. The Domain attribute is a top level domain.
- 4. The referer URL host is a host domain name (not IP address) and has the
- form HD, where D is the value of the Domain attribute, and H is a string
- that contains one or more dots.
- 5. If the dictionary has a Port attribute and the referer URL's port was not
- in the list.
- */
-
- // TODO(jar): Redirects in dictionary fetches might plausibly be problematic,
- // and hence the conservative approach is to not allow any redirects (if there
- // were any... then don't allow the dictionary to be set).
-
- if (domain.empty()) {
- SdchErrorRecovery(DICTIONARY_MISSING_DOMAIN_SPECIFIER);
- return false; // Domain is required.
- }
- if (net::RegistryControlledDomainService::GetDomainAndRegistry(domain).size()
- == 0) {
- SdchErrorRecovery(DICTIONARY_SPECIFIES_TOP_LEVEL_DOMAIN);
- return false; // domain was a TLD.
- }
- if (!Dictionary::DomainMatch(dictionary_url, domain)) {
- SdchErrorRecovery(DICTIONARY_DOMAIN_NOT_MATCHING_SOURCE_URL);
- return false;
- }
-
- std::string referrer_url_host = dictionary_url.host();
- size_t postfix_domain_index = referrer_url_host.rfind(domain);
- // See if it is indeed a postfix, or just an internal string.
- if (referrer_url_host.size() == postfix_domain_index + domain.size()) {
- // It is a postfix... so check to see if there's a dot in the prefix.
- size_t end_of_host_index = referrer_url_host.find_first_of('.');
- if (referrer_url_host.npos != end_of_host_index &&
- end_of_host_index < postfix_domain_index) {
- SdchErrorRecovery(DICTIONARY_REFERER_URL_HAS_DOT_IN_PREFIX);
- return false;
- }
- }
-
- if (!ports.empty()
- && 0 == ports.count(dictionary_url.EffectiveIntPort())) {
- SdchErrorRecovery(DICTIONARY_PORT_NOT_MATCHING_SOURCE_URL);
- return false;
- }
- return true;
-}
-
-// static
-bool SdchManager::Dictionary::CanUse(const GURL& referring_url) {
- if (!SdchManager::Global()->IsInSupportedDomain(referring_url))
- return false;
- /*
- 1. The request URL's host name domain-matches the Domain attribute of the
- dictionary.
- 2. If the dictionary has a Port attribute, the request port is one of the
- ports listed in the Port attribute.
- 3. The request URL path-matches the path attribute of the dictionary.
- 4. The request is not an HTTPS request.
-*/
- if (!DomainMatch(referring_url, domain_)) {
- SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_DOMAIN);
- return false;
- }
- if (!ports_.empty()
- && 0 == ports_.count(referring_url.EffectiveIntPort())) {
- SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_PORT_LIST);
- return false;
- }
- if (path_.size() && !PathMatch(referring_url.path(), path_)) {
- SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_PATH);
- return false;
- }
- if (referring_url.SchemeIsSecure()) {
- SdchErrorRecovery(DICTIONARY_FOUND_HAS_WRONG_SCHEME);
- return false;
- }
-
- // TODO(jar): Remove overly restrictive failsafe test (added per security
- // review) when we have a need to be more general.
- if (!referring_url.SchemeIs("http")) {
- SdchErrorRecovery(ATTEMPT_TO_DECODE_NON_HTTP_DATA);
- return false;
- }
-
- return true;
-}
-
-bool SdchManager::Dictionary::CanAdvertise(const GURL& target_url) {
- if (!SdchManager::Global()->IsInSupportedDomain(target_url))
- return false;
- /* The specific rules of when a dictionary should be advertised in an
- Avail-Dictionary header are modeled after the rules for cookie scoping. The
- terms "domain-match" and "pathmatch" are defined in RFC 2965 [6]. A
- dictionary may be advertised in the Avail-Dictionaries header exactly when
- all of the following are true:
- 1. The server's effective host name domain-matches the Domain attribute of
- the dictionary.
- 2. If the dictionary has a Port attribute, the request port is one of the
- ports listed in the Port attribute.
- 3. The request URI path-matches the path header of the dictionary.
- 4. The request is not an HTTPS request.
- */
- if (!DomainMatch(target_url, domain_))
- return false;
- if (!ports_.empty() && 0 == ports_.count(target_url.EffectiveIntPort()))
- return false;
- if (path_.size() && !PathMatch(target_url.path(), path_))
- return false;
- if (target_url.SchemeIsSecure())
- return false;
- if (Time::Now() > expiration_)
- return false;
- return true;
-}
-
-bool SdchManager::Dictionary::PathMatch(const std::string& path,
- const std::string& restriction) {
- /* Must be either:
- 1. P2 is equal to P1
- 2. P2 is a prefix of P1 and either the final character in P2 is "/" or the
- character following P2 in P1 is "/".
- */
- if (path == restriction)
- return true;
- size_t prefix_length = restriction.size();
- if (prefix_length > path.size())
- return false; // Can't be a prefix.
- if (0 != path.compare(0, prefix_length, restriction))
- return false;
- return restriction[prefix_length - 1] == '/' || path[prefix_length] == '/';
-}
-
-// static
-bool SdchManager::Dictionary::DomainMatch(const GURL& gurl,
- const std::string& restriction) {
- // TODO(jar): This is not precisely a domain match definition.
- return gurl.DomainIs(restriction.data(), restriction.size());
-}
-
//------------------------------------------------------------------------------
// Methods for supporting latency experiments.
@@ -542,3 +523,23 @@
SdchErrorRecovery(LATENCY_TEST_DISALLOWED);
allow_latency_experiment_.erase(it);
}
+
+// static
+void SdchManager::UrlSafeBase64Encode(const std::string& input,
+ std::string* output) {
+ // Since this is only done during a dictionary load, and hashes are only 8
+ // characters, we just do the simple fixup, rather than rewriting the encoder.
+ base::Base64Encode(input, output);
+ for (size_t i = 0; i < output->size(); ++i) {
+ switch (output->data()[i]) {
+ case '+':
+ (*output)[i] = '-';
+ continue;
+ case '/':
+ (*output)[i] = '_';
+ continue;
+ default:
+ continue;
+ }
+ }
+}
diff --git a/net/base/ssl_config_service.h b/net/base/ssl_config_service.h
index de2ebef..0a9d569 100644
--- a/net/base/ssl_config_service.h
+++ b/net/base/ssl_config_service.h
@@ -22,6 +22,9 @@
SSLConfig();
~SSLConfig();
+ // Returns true if |cert| is one of the certs in |allowed_bad_certs|.
+ bool IsAllowedBadCert(X509Certificate* cert) const;
+
bool rev_checking_enabled; // True if server certificate revocation
// checking is enabled.
// SSL 2.0 is not supported.
@@ -79,9 +82,6 @@
int cert_status;
};
- // Returns true if |cert| is one of the certs in |allowed_bad_certs|.
- bool IsAllowedBadCert(X509Certificate* cert) const;
-
// Add any known-bad SSL certificate (with its cert status) to
// |allowed_bad_certs| that should not trigger an ERR_CERT_* error when
// calling SSLClientSocket::Connect. This would normally be done in
diff --git a/net/base/ssl_config_service_win.cc b/net/base/ssl_config_service_win.cc
index aca0626..ca20e79 100644
--- a/net/base/ssl_config_service_win.cc
+++ b/net/base/ssl_config_service_win.cc
@@ -4,7 +4,7 @@
#include "net/base/ssl_config_service_win.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/win/registry.h"
using base::TimeDelta;
diff --git a/net/base/test_completion_callback_unittest.cc b/net/base/test_completion_callback_unittest.cc
index c19aae0..a0ae9bf 100644
--- a/net/base/test_completion_callback_unittest.cc
+++ b/net/base/test_completion_callback_unittest.cc
@@ -1,13 +1,13 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
// Illustrates how to use worker threads that issue completion callbacks
-#include "testing/gtest/include/gtest/gtest.h"
+#include "base/threading/worker_pool.h"
#include "net/base/completion_callback.h"
#include "net/base/test_completion_callback.h"
-#include "base/worker_pool.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
typedef PlatformTest TestCompletionCallbackTest;
@@ -102,7 +102,7 @@
request_ = new ExampleWorker(this, callback);
// Dispatch to worker thread...
- if (!WorkerPool::PostTask(FROM_HERE,
+ if (!base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(request_.get(), &ExampleWorker::DoWork), true)) {
NOTREACHED();
request_ = NULL;
diff --git a/net/base/transport_security_state.cc b/net/base/transport_security_state.cc
index 258d59f..32b7566 100644
--- a/net/base/transport_security_state.cc
+++ b/net/base/transport_security_state.cc
@@ -435,6 +435,7 @@
{22, false, "\007support\010mayfirst\003org"},
{17, false, "\002id\010mayfirst\003org"},
{20, false, "\005lists\010mayfirst\003org"},
+ {19, true, "\015splendidbacon\003com"},
};
static const size_t kNumPreloadedSTS = ARRAYSIZE_UNSAFE(kPreloadedSTS);
diff --git a/net/base/transport_security_state.h b/net/base/transport_security_state.h
index fcd4e79..768ccbb 100644
--- a/net/base/transport_security_state.h
+++ b/net/base/transport_security_state.h
@@ -43,13 +43,13 @@
// * Certificate issues are fatal.
MODE_SPDY_ONLY = 2,
};
- Mode mode;
DomainState()
: mode(MODE_STRICT),
created(base::Time::Now()),
include_subdomains(false) { }
+ Mode mode;
base::Time created; // when this host entry was first created
base::Time expiry; // the absolute time (UTC) when this record expires
bool include_subdomains; // subdomains included?
@@ -101,6 +101,10 @@
// our state is dirty.
void DirtyNotify();
+ static std::string CanonicaliseHost(const std::string& host);
+ static bool IsPreloadedSTS(const std::string& canonicalised_host,
+ bool* out_include_subdomains);
+
// The set of hosts that have enabled TransportSecurity. The keys here
// are SHA256(DNSForm(domain)) where DNSForm converts from dotted form
// ('www.google.com') to the form used in DNS: "\x03www\x06google\x03com"
@@ -109,10 +113,6 @@
// Our delegate who gets notified when we are dirtied, or NULL.
Delegate* delegate_;
- static std::string CanonicaliseHost(const std::string& host);
- static bool IsPreloadedSTS(const std::string& canonicalised_host,
- bool* out_include_subdomains);
-
DISALLOW_COPY_AND_ASSIGN(TransportSecurityState);
};
diff --git a/net/base/transport_security_state_unittest.cc b/net/base/transport_security_state_unittest.cc
index 3364bf1..3c81c69 100644
--- a/net/base/transport_security_state_unittest.cc
+++ b/net/base/transport_security_state_unittest.cc
@@ -366,6 +366,10 @@
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "id.mayfirst.org"));
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "lists.mayfirst.org"));
EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.mayfirst.org"));
+
+ EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "splendidbacon.com"));
+ EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.splendidbacon.com"));
+ EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "foo.splendidbacon.com"));
}
TEST_F(TransportSecurityStateTest, LongNames) {
diff --git a/net/base/x509_certificate.h b/net/base/x509_certificate.h
index 98375db..b3fa006 100644
--- a/net/base/x509_certificate.h
+++ b/net/base/x509_certificate.h
@@ -109,6 +109,11 @@
FORMAT_PKCS7,
};
+ // Creates a X509Certificate from the ground up. Used by tests that simulate
+ // SSL connections.
+ X509Certificate(const std::string& subject, const std::string& issuer,
+ base::Time start_date, base::Time expiration_date);
+
// Create an X509Certificate from a handle to the certificate object in the
// underlying crypto library. |source| specifies where |cert_handle| comes
// from. Given two certificate handles for the same certificate, our
@@ -175,11 +180,6 @@
uint32 serial_number,
base::TimeDelta valid_duration);
- // Creates a X509Certificate from the ground up. Used by tests that simulate
- // SSL connections.
- X509Certificate(const std::string& subject, const std::string& issuer,
- base::Time start_date, base::Time expiration_date);
-
// Appends a representation of this object to the given pickle.
void Persist(Pickle* pickle);
diff --git a/net/data/ftp/dir-listing-ls-23 b/net/data/ftp/dir-listing-ls-23
new file mode 100644
index 0000000..2b8c494
--- /dev/null
+++ b/net/data/ftp/dir-listing-ls-23
@@ -0,0 +1,2 @@
+total 0
+ftpd: .: Permission denied
diff --git a/net/data/ftp/dir-listing-ls-23.expected b/net/data/ftp/dir-listing-ls-23.expected
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/net/data/ftp/dir-listing-ls-23.expected
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 284657f..347dc0f 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -13,10 +13,10 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/sys_info.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/worker_pool.h"
+#include "base/threading/thread_restrictions.h"
#include "base/time.h"
#include "base/timer.h"
-#include "base/worker_pool.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/entry_impl.h"
@@ -142,7 +142,7 @@
return false;
}
- WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true);
+ base::WorkerPool::PostTask(FROM_HERE, new CleanupTask(path, name_str), true);
return true;
}
@@ -194,11 +194,12 @@
public:
CacheCreator(const FilePath& path, bool force, int max_bytes,
net::CacheType type, uint32 flags,
- base::MessageLoopProxy* thread, disk_cache::Backend** backend,
+ base::MessageLoopProxy* thread, net::NetLog* net_log,
+ disk_cache::Backend** backend,
net::CompletionCallback* callback)
: path_(path), force_(force), retry_(false), max_bytes_(max_bytes),
type_(type), flags_(flags), thread_(thread), backend_(backend),
- callback_(callback), cache_(NULL),
+ callback_(callback), cache_(NULL), net_log_(net_log),
ALLOW_THIS_IN_INITIALIZER_LIST(
my_callback_(this, &CacheCreator::OnIOComplete)) {
}
@@ -223,13 +224,14 @@
disk_cache::Backend** backend_;
net::CompletionCallback* callback_;
disk_cache::BackendImpl* cache_;
+ net::NetLog* net_log_;
net::CompletionCallbackImpl<CacheCreator> my_callback_;
DISALLOW_COPY_AND_ASSIGN(CacheCreator);
};
int CacheCreator::Run() {
- cache_ = new disk_cache::BackendImpl(path_, thread_);
+ cache_ = new disk_cache::BackendImpl(path_, thread_, net_log_);
cache_->SetMaxSize(max_bytes_);
cache_->SetType(type_);
cache_->SetFlags(flags_);
@@ -295,7 +297,8 @@
int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes,
bool force, base::MessageLoopProxy* thread,
- Backend** backend, CompletionCallback* callback) {
+ net::NetLog* net_log, Backend** backend,
+ CompletionCallback* callback) {
DCHECK(callback);
if (type == net::MEMORY_CACHE) {
*backend = MemBackendImpl::CreateBackend(max_bytes);
@@ -304,7 +307,7 @@
DCHECK(thread);
return BackendImpl::CreateBackend(path, force, max_bytes, type, kNone, thread,
- backend, callback);
+ net_log, backend, callback);
}
// Returns the preferred maximum number of bytes for the cache given the
@@ -351,11 +354,12 @@
int BackendImpl::CreateBackend(const FilePath& full_path, bool force,
int max_bytes, net::CacheType type,
uint32 flags, base::MessageLoopProxy* thread,
- Backend** backend,
+ net::NetLog* net_log, Backend** backend,
CompletionCallback* callback) {
DCHECK(callback);
CacheCreator* creator = new CacheCreator(full_path, force, max_bytes, type,
- flags, thread, backend, callback);
+ flags, thread, net_log, backend,
+ callback);
// This object will self-destroy when finished.
return creator->Run();
}
@@ -366,7 +370,8 @@
}
BackendImpl::BackendImpl(const FilePath& path,
- base::MessageLoopProxy* cache_thread)
+ base::MessageLoopProxy* cache_thread,
+ net::NetLog* net_log)
: ALLOW_THIS_IN_INITIALIZER_LIST(background_queue_(this, cache_thread)),
path_(path),
block_files_(path),
@@ -383,6 +388,7 @@
new_eviction_(false),
first_timer_(true),
throttle_requests_(false),
+ net_log_(net_log),
done_(true, false),
ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {
@@ -390,7 +396,8 @@
BackendImpl::BackendImpl(const FilePath& path,
uint32 mask,
- base::MessageLoopProxy* cache_thread)
+ base::MessageLoopProxy* cache_thread,
+ net::NetLog* net_log)
: ALLOW_THIS_IN_INITIALIZER_LIST(background_queue_(this, cache_thread)),
path_(path),
block_files_(path),
@@ -407,6 +414,7 @@
new_eviction_(false),
first_timer_(true),
throttle_requests_(false),
+ net_log_(net_log),
done_(true, false),
ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)),
ALLOW_THIS_IN_INITIALIZER_LIST(ptr_factory_(this)) {
@@ -427,102 +435,6 @@
// ------------------------------------------------------------------------
-int32 BackendImpl::GetEntryCount() const {
- if (!index_ || disabled_)
- return 0;
- // num_entries includes entries already evicted.
- int32 not_deleted = data_->header.num_entries -
- data_->header.lru.sizes[Rankings::DELETED];
-
- if (not_deleted < 0) {
- NOTREACHED();
- not_deleted = 0;
- }
-
- return not_deleted;
-}
-
-int BackendImpl::OpenEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback) {
- DCHECK(callback);
- background_queue_.OpenEntry(key, entry, callback);
- return net::ERR_IO_PENDING;
-}
-
-int BackendImpl::CreateEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback) {
- DCHECK(callback);
- background_queue_.CreateEntry(key, entry, callback);
- return net::ERR_IO_PENDING;
-}
-
-int BackendImpl::DoomEntry(const std::string& key,
- CompletionCallback* callback) {
- DCHECK(callback);
- background_queue_.DoomEntry(key, callback);
- return net::ERR_IO_PENDING;
-}
-
-int BackendImpl::DoomAllEntries(CompletionCallback* callback) {
- DCHECK(callback);
- background_queue_.DoomAllEntries(callback);
- return net::ERR_IO_PENDING;
-}
-
-int BackendImpl::DoomEntriesBetween(const base::Time initial_time,
- const base::Time end_time,
- CompletionCallback* callback) {
- DCHECK(callback);
- background_queue_.DoomEntriesBetween(initial_time, end_time, callback);
- return net::ERR_IO_PENDING;
-}
-
-int BackendImpl::DoomEntriesSince(const base::Time initial_time,
- CompletionCallback* callback) {
- DCHECK(callback);
- background_queue_.DoomEntriesSince(initial_time, callback);
- return net::ERR_IO_PENDING;
-}
-
-int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry,
- CompletionCallback* callback) {
- DCHECK(callback);
- background_queue_.OpenNextEntry(iter, next_entry, callback);
- return net::ERR_IO_PENDING;
-}
-
-void BackendImpl::EndEnumeration(void** iter) {
- background_queue_.EndEnumeration(*iter);
- *iter = NULL;
-}
-
-void BackendImpl::GetStats(StatsItems* stats) {
- if (disabled_)
- return;
-
- std::pair<std::string, std::string> item;
-
- item.first = "Entries";
- item.second = base::StringPrintf("%d", data_->header.num_entries);
- stats->push_back(item);
-
- item.first = "Pending IO";
- item.second = base::StringPrintf("%d", num_pending_io_);
- stats->push_back(item);
-
- item.first = "Max size";
- item.second = base::StringPrintf("%d", max_size_);
- stats->push_back(item);
-
- item.first = "Current size";
- item.second = base::StringPrintf("%d", data_->header.num_bytes);
- stats->push_back(item);
-
- stats_.GetItems(stats);
-}
-
-// ------------------------------------------------------------------------
-
int BackendImpl::SyncInit() {
DCHECK(!init_);
if (init_)
@@ -667,16 +579,15 @@
int BackendImpl::SyncDoomAllEntries() {
// This is not really an error, but it is an interesting condition.
ReportError(ERR_CACHE_DOOMED);
+ stats_.OnEvent(Stats::DOOM_CACHE);
if (!num_refs_) {
- PrepareForRestart();
- DeleteCache(path_, false);
- return SyncInit();
+ RestartCache(false);
+ return disabled_ ? net::ERR_FAILED : net::OK;
} else {
if (disabled_)
return net::ERR_FAILED;
eviction_.TrimCache(true);
- stats_.OnEvent(Stats::DOOM_CACHE);
return net::OK;
}
}
@@ -725,6 +636,7 @@
if (disabled_)
return net::ERR_FAILED;
+ stats_.OnEvent(Stats::DOOM_RECENT);
for (;;) {
void* iter = NULL;
EntryImpl* entry = OpenNextEntryImpl(&iter);
@@ -848,6 +760,8 @@
return NULL;
}
+ cache_entry->BeginLogging(net_log_, true);
+
// We are not failing the operation; let's add this to the map.
open_entries_[entry_address.value()] = cache_entry;
@@ -1178,6 +1092,7 @@
if (disabled_)
return;
+ stats_.OnEvent(Stats::FATAL_ERROR);
LogStats();
ReportError(error);
@@ -1188,7 +1103,7 @@
if (!num_refs_)
MessageLoop::current()->PostTask(FROM_HERE,
- factory_.NewRunnableMethod(&BackendImpl::RestartCache));
+ factory_.NewRunnableMethod(&BackendImpl::RestartCache, true));
}
void BackendImpl::ReportError(int error) {
@@ -1344,6 +1259,102 @@
// ------------------------------------------------------------------------
+int32 BackendImpl::GetEntryCount() const {
+ if (!index_ || disabled_)
+ return 0;
+ // num_entries includes entries already evicted.
+ int32 not_deleted = data_->header.num_entries -
+ data_->header.lru.sizes[Rankings::DELETED];
+
+ if (not_deleted < 0) {
+ NOTREACHED();
+ not_deleted = 0;
+ }
+
+ return not_deleted;
+}
+
+int BackendImpl::OpenEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback) {
+ DCHECK(callback);
+ background_queue_.OpenEntry(key, entry, callback);
+ return net::ERR_IO_PENDING;
+}
+
+int BackendImpl::CreateEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback) {
+ DCHECK(callback);
+ background_queue_.CreateEntry(key, entry, callback);
+ return net::ERR_IO_PENDING;
+}
+
+int BackendImpl::DoomEntry(const std::string& key,
+ CompletionCallback* callback) {
+ DCHECK(callback);
+ background_queue_.DoomEntry(key, callback);
+ return net::ERR_IO_PENDING;
+}
+
+int BackendImpl::DoomAllEntries(CompletionCallback* callback) {
+ DCHECK(callback);
+ background_queue_.DoomAllEntries(callback);
+ return net::ERR_IO_PENDING;
+}
+
+int BackendImpl::DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ CompletionCallback* callback) {
+ DCHECK(callback);
+ background_queue_.DoomEntriesBetween(initial_time, end_time, callback);
+ return net::ERR_IO_PENDING;
+}
+
+int BackendImpl::DoomEntriesSince(const base::Time initial_time,
+ CompletionCallback* callback) {
+ DCHECK(callback);
+ background_queue_.DoomEntriesSince(initial_time, callback);
+ return net::ERR_IO_PENDING;
+}
+
+int BackendImpl::OpenNextEntry(void** iter, Entry** next_entry,
+ CompletionCallback* callback) {
+ DCHECK(callback);
+ background_queue_.OpenNextEntry(iter, next_entry, callback);
+ return net::ERR_IO_PENDING;
+}
+
+void BackendImpl::EndEnumeration(void** iter) {
+ background_queue_.EndEnumeration(*iter);
+ *iter = NULL;
+}
+
+void BackendImpl::GetStats(StatsItems* stats) {
+ if (disabled_)
+ return;
+
+ std::pair<std::string, std::string> item;
+
+ item.first = "Entries";
+ item.second = base::StringPrintf("%d", data_->header.num_entries);
+ stats->push_back(item);
+
+ item.first = "Pending IO";
+ item.second = base::StringPrintf("%d", num_pending_io_);
+ stats->push_back(item);
+
+ item.first = "Max size";
+ item.second = base::StringPrintf("%d", max_size_);
+ stats->push_back(item);
+
+ item.first = "Current size";
+ item.second = base::StringPrintf("%d", data_->header.num_bytes);
+ stats->push_back(item);
+
+ stats_.GetItems(stats);
+}
+
+// ------------------------------------------------------------------------
+
// We just created a new file so we're going to write the header and set the
// file length to include the hash table (zero filled).
bool BackendImpl::CreateBackingStore(disk_cache::File* file) {
@@ -1443,22 +1454,29 @@
max_size_= current_max_size;
}
-// We always execute this method from the message loop so that we can freely
-// release files, memory pointers etc.
-void BackendImpl::RestartCache() {
- DCHECK(!num_refs_);
- DCHECK(!open_entries_.size());
- PrepareForRestart();
- DelayedCacheCleanup(path_);
-
+void BackendImpl::RestartCache(bool failure) {
int64 errors = stats_.GetCounter(Stats::FATAL_ERROR);
+ int64 full_dooms = stats_.GetCounter(Stats::DOOM_CACHE);
+ int64 partial_dooms = stats_.GetCounter(Stats::DOOM_RECENT);
+
+ PrepareForRestart();
+ if (failure) {
+ DCHECK(!num_refs_);
+ DCHECK(!open_entries_.size());
+ DelayedCacheCleanup(path_);
+ } else {
+ DeleteCache(path_, false);
+ }
// Don't call Init() if directed by the unit test: we are simulating a failure
// trying to re-enable the cache.
if (unit_test_)
init_ = true; // Let the destructor do proper cleanup.
- else if (SyncInit())
- stats_.SetCounter(Stats::FATAL_ERROR, errors + 1);
+ else if (SyncInit() == net::OK) {
+ stats_.SetCounter(Stats::FATAL_ERROR, errors);
+ stats_.SetCounter(Stats::DOOM_CACHE, full_dooms);
+ stats_.SetCounter(Stats::DOOM_RECENT, partial_dooms);
+ }
}
void BackendImpl::PrepareForRestart() {
@@ -1469,6 +1487,7 @@
if (!(user_flags_ & kNewEviction))
new_eviction_ = false;
+ disabled_ = true;
data_->header.crash = 0;
index_ = NULL;
data_ = NULL;
@@ -1532,6 +1551,7 @@
open_entries_[address.value()] = cache_entry;
}
+ cache_entry->BeginLogging(net_log_, false);
cache_entry.swap(entry);
return 0;
}
@@ -1831,7 +1851,7 @@
if (!num_refs_ && disabled_)
MessageLoop::current()->PostTask(FROM_HERE,
- factory_.NewRunnableMethod(&BackendImpl::RestartCache));
+ factory_.NewRunnableMethod(&BackendImpl::RestartCache, true));
}
void BackendImpl::IncreaseNumEntries() {
@@ -1872,18 +1892,26 @@
static_cast<int>(stats_.GetCounter(Stats::MAX_ENTRIES)));
stats_.SetCounter(Stats::MAX_ENTRIES, 0);
+ CACHE_UMA(COUNTS_10000, "TotalFatalErrors", 0,
+ static_cast<int>(stats_.GetCounter(Stats::FATAL_ERROR)));
+ CACHE_UMA(COUNTS_10000, "TotalDoomCache", 0,
+ static_cast<int>(stats_.GetCounter(Stats::DOOM_CACHE)));
+ CACHE_UMA(COUNTS_10000, "TotalDoomRecentEntries", 0,
+ static_cast<int>(stats_.GetCounter(Stats::DOOM_RECENT)));
+
+ int64 total_hours = stats_.GetCounter(Stats::TIMER) / 120;
if (!data_->header.create_time || !data_->header.lru.filled) {
int cause = data_->header.create_time ? 0 : 1;
if (!data_->header.lru.filled)
cause |= 2;
CACHE_UMA(CACHE_ERROR, "ShortReport", 0, cause);
+ CACHE_UMA(HOURS, "TotalTimeNotFull", 0, static_cast<int>(total_hours));
return;
}
// This is an up to date client that will report FirstEviction() data. After
// that event, start reporting this:
- int64 total_hours = stats_.GetCounter(Stats::TIMER) / 120;
CACHE_UMA(HOURS, "TotalTime", 0, static_cast<int>(total_hours));
int64 use_hours = stats_.GetCounter(Stats::LAST_REPORT_TIMER) / 120;
diff --git a/net/disk_cache/backend_impl.h b/net/disk_cache/backend_impl.h
index 05e5016..74a1eaf 100644
--- a/net/disk_cache/backend_impl.h
+++ b/net/disk_cache/backend_impl.h
@@ -19,6 +19,10 @@
#include "net/disk_cache/stats.h"
#include "net/disk_cache/trace.h"
+namespace net {
+class NetLog;
+} // namespace net
+
namespace disk_cache {
enum BackendFlags {
@@ -38,10 +42,11 @@
class BackendImpl : public Backend {
friend class Eviction;
public:
- BackendImpl(const FilePath& path, base::MessageLoopProxy* cache_thread);
+ BackendImpl(const FilePath& path, base::MessageLoopProxy* cache_thread,
+ net::NetLog* net_log);
// mask can be used to limit the usable size of the hash table, for testing.
BackendImpl(const FilePath& path, uint32 mask,
- base::MessageLoopProxy* cache_thread);
+ base::MessageLoopProxy* cache_thread, net::NetLog* net_log);
~BackendImpl();
// Returns a new backend with the desired flags. See the declaration of
@@ -49,29 +54,12 @@
static int CreateBackend(const FilePath& full_path, bool force,
int max_bytes, net::CacheType type,
uint32 flags, base::MessageLoopProxy* thread,
- Backend** backend, CompletionCallback* callback);
+ net::NetLog* net_log, Backend** backend,
+ CompletionCallback* callback);
// Performs general initialization for this current instance of the cache.
int Init(CompletionCallback* callback);
- // Backend interface.
- virtual int32 GetEntryCount() const;
- virtual int OpenEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback);
- virtual int CreateEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback);
- virtual int DoomEntry(const std::string& key, CompletionCallback* callback);
- virtual int DoomAllEntries(CompletionCallback* callback);
- virtual int DoomEntriesBetween(const base::Time initial_time,
- const base::Time end_time,
- CompletionCallback* callback);
- virtual int DoomEntriesSince(const base::Time initial_time,
- CompletionCallback* callback);
- virtual int OpenNextEntry(void** iter, Entry** next_entry,
- CompletionCallback* callback);
- virtual void EndEnumeration(void** iter);
- virtual void GetStats(StatsItems* stats);
-
// Performs the actual initialization and final cleanup on destruction.
int SyncInit();
void CleanupCache();
@@ -256,6 +244,24 @@
// or an error code (negative value).
int SelfCheck();
+ // Backend interface.
+ virtual int32 GetEntryCount() const;
+ virtual int OpenEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback);
+ virtual int CreateEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback);
+ virtual int DoomEntry(const std::string& key, CompletionCallback* callback);
+ virtual int DoomAllEntries(CompletionCallback* callback);
+ virtual int DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ CompletionCallback* callback);
+ virtual int DoomEntriesSince(const base::Time initial_time,
+ CompletionCallback* callback);
+ virtual int OpenNextEntry(void** iter, Entry** next_entry,
+ CompletionCallback* callback);
+ virtual void EndEnumeration(void** iter);
+ virtual void GetStats(StatsItems* stats);
+
private:
typedef base::hash_map<CacheAddr, EntryImpl*> EntriesMap;
@@ -265,7 +271,7 @@
void AdjustMaxCacheSize(int table_len);
// Deletes the cache and starts again.
- void RestartCache();
+ void RestartCache(bool failure);
void PrepareForRestart();
// Creates a new entry object and checks to see if it is dirty. Returns zero
@@ -357,6 +363,8 @@
bool first_timer_; // True if the timer has not been called.
bool throttle_requests_;
+ net::NetLog* net_log_;
+
Stats stats_; // Usage statistcs.
base::RepeatingTimer<BackendImpl> timer_; // Usage timer.
base::WaitableEvent done_; // Signals the end of background work.
diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc
index d3e79a1..05f17f6 100644
--- a/net/disk_cache/backend_unittest.cc
+++ b/net/disk_cache/backend_unittest.cc
@@ -1,13 +1,13 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// 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 "base/basictypes.h"
#include "base/file_util.h"
-#include "base/platform_thread.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
+#include "base/threading/platform_thread.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
@@ -20,6 +20,10 @@
#include "net/disk_cache/mem_backend_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
+#if defined(OS_WIN)
+#include "base/win/scoped_handle.h"
+#endif
+
using base::Time;
// Tests that can run with different types of caches.
@@ -195,7 +199,7 @@
disk_cache::Backend* cache = NULL;
int rv = disk_cache::BackendImpl::CreateBackend(
path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom,
- cache_thread.message_loop_proxy(), &cache, &cb);
+ cache_thread.message_loop_proxy(), NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
ASSERT_TRUE(cache);
delete cache;
@@ -208,14 +212,14 @@
// Now test the public API.
rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, path, 0, false,
cache_thread.message_loop_proxy(),
- &cache, &cb);
+ NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
ASSERT_TRUE(cache);
delete cache;
cache = NULL;
rv = disk_cache::CreateCacheBackend(net::MEMORY_CACHE, FilePath(), 0, false,
- NULL, &cache, &cb);
+ NULL, NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
ASSERT_TRUE(cache);
delete cache;
@@ -226,7 +230,7 @@
TEST_F(DiskCacheBackendTest, ExternalFiles) {
InitCache();
- // First, lets create a file on the folder.
+ // First, let's create a file on the folder.
FilePath filename = GetCacheFilePath().AppendASCII("f_000001");
const int kSize = 50;
@@ -260,7 +264,8 @@
disk_cache::Backend* cache;
int rv = disk_cache::BackendImpl::CreateBackend(
path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom,
- base::MessageLoopProxy::CreateForCurrentThread(), &cache, &cb);
+ base::MessageLoopProxy::CreateForCurrentThread(), NULL,
+ &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
disk_cache::EntryImpl* entry;
@@ -311,7 +316,7 @@
disk_cache::Backend* cache;
int rv = disk_cache::BackendImpl::CreateBackend(
path, false, 0, net::DISK_CACHE, disk_cache::kNoRandom,
- cache_thread.message_loop_proxy(), &cache, &cb);
+ cache_thread.message_loop_proxy(), NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
disk_cache::Entry* entry;
@@ -348,7 +353,7 @@
disk_cache::Backend* backend = NULL;
int rv = disk_cache::BackendImpl::CreateBackend(
path, false, 0, net::DISK_CACHE, disk_cache::kNone,
- cache_thread.message_loop_proxy(), &backend, &cb);
+ cache_thread.message_loop_proxy(), NULL, &backend, &cb);
ASSERT_NE(net::OK, cb.GetResult(rv));
ASSERT_TRUE(backend == NULL);
@@ -877,7 +882,7 @@
entry2->Close();
// Make sure that the timestamp is not the same.
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
ASSERT_EQ(net::OK, OpenEntry(second, &entry1));
void* iter = NULL;
ASSERT_EQ(net::OK, OpenNextEntry(&iter, &entry2));
@@ -1053,7 +1058,7 @@
ASSERT_EQ(net::OK, CreateEntry("second", &entry));
entry->Close();
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
Time middle = Time::Now();
ASSERT_EQ(net::OK, CreateEntry("third", &entry));
@@ -1061,7 +1066,7 @@
ASSERT_EQ(net::OK, CreateEntry("fourth", &entry));
entry->Close();
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
Time final = Time::Now();
ASSERT_EQ(4, cache_->GetEntryCount());
@@ -1097,7 +1102,7 @@
ASSERT_EQ(net::OK, CreateEntry("first", &entry));
entry->Close();
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
Time middle_start = Time::Now();
ASSERT_EQ(net::OK, CreateEntry("second", &entry));
@@ -1105,7 +1110,7 @@
ASSERT_EQ(net::OK, CreateEntry("third", &entry));
entry->Close();
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
Time middle_end = Time::Now();
ASSERT_EQ(net::OK, CreateEntry("fourth", &entry));
@@ -1113,7 +1118,7 @@
ASSERT_EQ(net::OK, OpenEntry("fourth", &entry));
entry->Close();
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
Time final = Time::Now();
ASSERT_EQ(4, cache_->GetEntryCount());
@@ -1278,7 +1283,7 @@
disk_cache::Backend* cache;
int rv = disk_cache::BackendImpl::CreateBackend(
path, true, 0, net::DISK_CACHE, disk_cache::kNoRandom,
- cache_thread.message_loop_proxy(), &cache, &cb);
+ cache_thread.message_loop_proxy(), NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
MessageLoopHelper helper;
@@ -1651,7 +1656,8 @@
ASSERT_TRUE(DeleteCache(path));
scoped_ptr<disk_cache::BackendImpl> cache;
cache.reset(new disk_cache::BackendImpl(
- path, base::MessageLoopProxy::CreateForCurrentThread()));
+ path, base::MessageLoopProxy::CreateForCurrentThread(),
+ NULL));
ASSERT_TRUE(NULL != cache.get());
cache->SetUnitTestMode();
ASSERT_EQ(net::OK, cache->SyncInit());
@@ -1769,11 +1775,11 @@
int rv = disk_cache::BackendImpl::CreateBackend(
store1.path(), false, 0, net::DISK_CACHE, disk_cache::kNone,
- cache_thread.message_loop_proxy(), &cache[0], &cb);
+ cache_thread.message_loop_proxy(), NULL, &cache[0], &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
rv = disk_cache::BackendImpl::CreateBackend(
store2.path(), false, 0, net::MEDIA_CACHE, disk_cache::kNone,
- cache_thread.message_loop_proxy(), &cache[1], &cb);
+ cache_thread.message_loop_proxy(), NULL, &cache[1], &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
ASSERT_TRUE(cache[0] != NULL && cache[1] != NULL);
@@ -1927,8 +1933,8 @@
#if defined(OS_WIN)
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE;
DWORD access = GENERIC_READ | GENERIC_WRITE;
- ScopedHandle file2(CreateFile(name.value().c_str(), access, sharing, NULL,
- OPEN_EXISTING, 0, NULL));
+ base::win::ScopedHandle file2(CreateFile(
+ name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL));
EXPECT_FALSE(file2.IsValid());
sharing |= FILE_SHARE_DELETE;
diff --git a/net/disk_cache/block_files.cc b/net/disk_cache/block_files.cc
index 9d5de62..3eb4e35 100644
--- a/net/disk_cache/block_files.cc
+++ b/net/disk_cache/block_files.cc
@@ -8,7 +8,7 @@
#include "base/metrics/histogram.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_checker.h"
+#include "base/threading/thread_checker.h"
#include "base/time.h"
#include "net/disk_cache/cache_util.h"
#include "net/disk_cache/file_lock.h"
@@ -201,7 +201,7 @@
if (init_)
return false;
- thread_checker_.reset(new ThreadChecker);
+ thread_checker_.reset(new base::ThreadChecker);
block_files_.resize(kFirstAdditionalBlockFile);
for (int i = 0; i < kFirstAdditionalBlockFile; i++) {
diff --git a/net/disk_cache/block_files.h b/net/disk_cache/block_files.h
index 5427a58..d677ba3 100644
--- a/net/disk_cache/block_files.h
+++ b/net/disk_cache/block_files.h
@@ -16,7 +16,9 @@
#include "net/disk_cache/addr.h"
#include "net/disk_cache/mapped_file.h"
+namespace base {
class ThreadChecker;
+}
namespace disk_cache {
@@ -87,7 +89,7 @@
char* zero_buffer_; // Buffer to speed-up cleaning deleted entries.
FilePath path_; // Path to the backing folder.
std::vector<MappedFile*> block_files_; // The actual files.
- scoped_ptr<ThreadChecker> thread_checker_;
+ scoped_ptr<base::ThreadChecker> thread_checker_;
FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_ZeroSizeFile);
FRIEND_TEST_ALL_PREFIXES(DiskCacheTest, BlockFiles_InvalidFile);
diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc
index cbe6b87..65fc064 100644
--- a/net/disk_cache/cache_util_win.cc
+++ b/net/disk_cache/cache_util_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,9 +6,10 @@
#include <windows.h>
+#include "base/file_util.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/file_util.h"
+#include "base/win/scoped_handle.h"
namespace {
@@ -66,8 +67,8 @@
// us from opening the file again (unless it was deleted).
DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE;
DWORD access = SYNCHRONIZE;
- ScopedHandle file(CreateFile(name.value().c_str(), access, sharing, NULL,
- OPEN_EXISTING, 0, NULL));
+ base::win::ScopedHandle file(CreateFile(
+ name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL));
if (file.IsValid())
return false;
diff --git a/net/disk_cache/disk_cache.h b/net/disk_cache/disk_cache.h
index 59efe06..18dd447 100644
--- a/net/disk_cache/disk_cache.h
+++ b/net/disk_cache/disk_cache.h
@@ -25,6 +25,7 @@
namespace net {
class IOBuffer;
+class NetLog;
}
namespace disk_cache {
@@ -50,7 +51,8 @@
// completes (the callback is notified).
int CreateCacheBackend(net::CacheType type, const FilePath& path, int max_bytes,
bool force, base::MessageLoopProxy* thread,
- Backend** backend, CompletionCallback* callback);
+ net::NetLog* net_log, Backend** backend,
+ CompletionCallback* callback);
// The root interface for a disk cache instance.
class Backend {
diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc
index c86955f..14f15c6 100644
--- a/net/disk_cache/disk_cache_perftest.cc
+++ b/net/disk_cache/disk_cache_perftest.cc
@@ -9,7 +9,7 @@
#include "base/file_util.h"
#include "base/perftimer.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/test/test_file_util.h"
#include "base/timer.h"
#include "net/base/io_buffer.h"
@@ -169,7 +169,7 @@
disk_cache::Backend* cache;
int rv = disk_cache::CreateCacheBackend(
net::DISK_CACHE, test_cache.path(), 0, false,
- cache_thread.message_loop_proxy(), &cache, &cb);
+ cache_thread.message_loop_proxy(), NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
@@ -198,7 +198,7 @@
rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, test_cache.path(), 0,
false, cache_thread.message_loop_proxy(),
- &cache, &cb);
+ NULL, &cache, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
ret = TimeRead(num_entries, cache, entries, true);
diff --git a/net/disk_cache/disk_cache_test_base.cc b/net/disk_cache/disk_cache_test_base.cc
index cffe3fa..6c9b91c 100644
--- a/net/disk_cache/disk_cache_test_base.cc
+++ b/net/disk_cache/disk_cache_test_base.cc
@@ -75,7 +75,7 @@
TestCompletionCallback cb;
int rv = disk_cache::BackendImpl::CreateBackend(
path, force_creation_, size_, type_,
- disk_cache::kNoRandom, thread, &cache_, &cb);
+ disk_cache::kNoRandom, thread, NULL, &cache_, &cb);
ASSERT_EQ(net::OK, cb.GetResult(rv));
}
@@ -84,9 +84,9 @@
use_current_thread_ ? base::MessageLoopProxy::CreateForCurrentThread() :
cache_thread_.message_loop_proxy();
if (mask_)
- cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread);
+ cache_impl_ = new disk_cache::BackendImpl(path, mask_, thread, NULL);
else
- cache_impl_ = new disk_cache::BackendImpl(path, thread);
+ cache_impl_ = new disk_cache::BackendImpl(path, thread, NULL);
cache_ = cache_impl_;
ASSERT_TRUE(NULL != cache_);
diff --git a/net/disk_cache/disk_cache_test_base.h b/net/disk_cache/disk_cache_test_base.h
index faecc17..13b3879 100644
--- a/net/disk_cache/disk_cache_test_base.h
+++ b/net/disk_cache/disk_cache_test_base.h
@@ -7,7 +7,7 @@
#pragma once
#include "base/basictypes.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "net/base/cache_type.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
diff --git a/net/disk_cache/disk_cache_test_util.cc b/net/disk_cache/disk_cache_test_util.cc
index 76690e6..ed16db0 100644
--- a/net/disk_cache/disk_cache_test_util.cc
+++ b/net/disk_cache/disk_cache_test_util.cc
@@ -94,7 +94,7 @@
bool CheckCacheIntegrity(const FilePath& path, bool new_eviction) {
scoped_ptr<disk_cache::BackendImpl> cache(new disk_cache::BackendImpl(
- path, base::MessageLoopProxy::CreateForCurrentThread()));
+ path, base::MessageLoopProxy::CreateForCurrentThread(), NULL));
if (!cache.get())
return false;
if (new_eviction)
diff --git a/net/disk_cache/entry_impl.cc b/net/disk_cache/entry_impl.cc
index e5e6482..ff05e11 100644
--- a/net/disk_cache/entry_impl.cc
+++ b/net/disk_cache/entry_impl.cc
@@ -7,6 +7,7 @@
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/string_util.h"
+#include "base/values.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
#include "net/disk_cache/backend_impl.h"
@@ -24,14 +25,93 @@
// Index for the file used to store the key, if any (files_[kKeyFileIndex]).
const int kKeyFileIndex = 3;
+// NetLog parameters for the creation of an EntryImpl. Contains an entry's name
+// and whether it was created or opened.
+class EntryCreationParameters : public net::NetLog::EventParameters {
+ public:
+ EntryCreationParameters(const std::string& key, bool created)
+ : key_(key), created_(created) {
+ }
+
+ Value* ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetString("key", key_);
+ dict->SetBoolean("created", created_);
+ return dict;
+ }
+
+ private:
+ const std::string key_;
+ const bool created_;
+
+ DISALLOW_COPY_AND_ASSIGN(EntryCreationParameters);
+};
+
+// NetLog parameters for non-sparse reading and writing to an EntryImpl.
+class ReadWriteDataParams : public net::NetLog::EventParameters {
+ public:
+ // For reads, |truncate| must be false.
+ ReadWriteDataParams(int index, int offset, int buf_len, bool truncate)
+ : index_(index), offset_(offset), buf_len_(buf_len), truncate_(truncate) {
+ }
+
+ Value* ToValue() const {
+ DictionaryValue* dict = new DictionaryValue();
+ dict->SetInteger("index", index_);
+ dict->SetInteger("offset", offset_);
+ dict->SetInteger("buf_len", buf_len_);
+ if (truncate_)
+ dict->SetBoolean("truncate", truncate_);
+ return dict;
+ }
+
+ private:
+ const int index_;
+ const int offset_;
+ const int buf_len_;
+ const bool truncate_;
+
+ DISALLOW_COPY_AND_ASSIGN(ReadWriteDataParams);
+};
+
+// NetLog parameters logged when non-sparse reads and writes complete.
+class FileIOCompleteParameters : public net::NetLog::EventParameters {
+ public:
+ // |bytes_copied| is either the number of bytes copied or a network error
+ // code. |bytes_copied| must not be ERR_IO_PENDING, as it's not a valid
+ // result for an operation.
+ explicit FileIOCompleteParameters(int bytes_copied)
+ : bytes_copied_(bytes_copied) {
+ }
+
+ Value* ToValue() const {
+ DCHECK_NE(bytes_copied_, net::ERR_IO_PENDING);
+ DictionaryValue* dict = new DictionaryValue();
+ if (bytes_copied_ < 0) {
+ dict->SetInteger("net_error", bytes_copied_);
+ } else {
+ dict->SetInteger("bytes_copied", bytes_copied_);
+ }
+ return dict;
+ }
+
+ private:
+ const int bytes_copied_;
+
+ DISALLOW_COPY_AND_ASSIGN(FileIOCompleteParameters);
+};
+
// This class implements FileIOCallback to buffer the callback from a file IO
// operation from the actual net class.
class SyncCallback: public disk_cache::FileIOCallback {
public:
+ // |end_event_type| is the event type to log on completion. Logs nothing on
+ // discard, or when the NetLog is not set to log all events.
SyncCallback(disk_cache::EntryImpl* entry, net::IOBuffer* buffer,
- net::CompletionCallback* callback )
+ net::CompletionCallback* callback,
+ net::NetLog::EventType end_event_type)
: entry_(entry), callback_(callback), buf_(buffer),
- start_(TimeTicks::Now()) {
+ start_(TimeTicks::Now()), end_event_type_(end_event_type) {
entry->AddRef();
entry->IncrementIoCount();
}
@@ -39,11 +119,13 @@
virtual void OnFileIOComplete(int bytes_copied);
void Discard();
+
private:
disk_cache::EntryImpl* entry_;
net::CompletionCallback* callback_;
scoped_refptr<net::IOBuffer> buf_;
TimeTicks start_;
+ net::NetLog::EventType end_event_type_;
DISALLOW_COPY_AND_ASSIGN(SyncCallback);
};
@@ -51,6 +133,11 @@
void SyncCallback::OnFileIOComplete(int bytes_copied) {
entry_->DecrementIoCount();
if (callback_) {
+ if (entry_->net_log().IsLoggingAllEvents()) {
+ entry_->net_log().EndEvent(
+ end_event_type_,
+ make_scoped_refptr(new FileIOCompleteParameters(bytes_copied)));
+ }
entry_->ReportIOTime(disk_cache::EntryImpl::kAsyncIO, start_);
callback_->Run(bytes_copied);
}
@@ -288,195 +375,6 @@
}
}
-// When an entry is deleted from the cache, we clean up all the data associated
-// with it for two reasons: to simplify the reuse of the block (we know that any
-// unused block is filled with zeros), and to simplify the handling of write /
-// read partial information from an entry (don't have to worry about returning
-// data related to a previous cache entry because the range was not fully
-// written before).
-EntryImpl::~EntryImpl() {
- Log("~EntryImpl in");
-
- // Save the sparse info to disk. This will generate IO for this entry and
- // maybe for a child entry, so it is important to do it before deleting this
- // entry.
- sparse_.reset();
-
- // Remove this entry from the list of open entries.
- backend_->OnEntryDestroyBegin(entry_.address());
-
- if (doomed_) {
- DeleteEntryData(true);
- } else {
- bool ret = true;
- for (int index = 0; index < kNumStreams; index++) {
- if (user_buffers_[index].get()) {
- if (!(ret = Flush(index, 0)))
- LOG(ERROR) << "Failed to save user data";
- }
- if (unreported_size_[index]) {
- backend_->ModifyStorageSize(
- entry_.Data()->data_size[index] - unreported_size_[index],
- entry_.Data()->data_size[index]);
- }
- }
-
- if (!ret) {
- // There was a failure writing the actual data. Mark the entry as dirty.
- int current_id = backend_->GetCurrentEntryId();
- node_.Data()->dirty = current_id == 1 ? -1 : current_id - 1;
- node_.Store();
- } else if (node_.HasData() && node_.Data()->dirty) {
- node_.Data()->dirty = 0;
- node_.Store();
- }
- }
-
- Trace("~EntryImpl out 0x%p", reinterpret_cast<void*>(this));
- backend_->OnEntryDestroyEnd();
-}
-
-void EntryImpl::Doom() {
- backend_->background_queue()->DoomEntryImpl(this);
-}
-
-void EntryImpl::Close() {
- backend_->background_queue()->CloseEntryImpl(this);
-}
-
-std::string EntryImpl::GetKey() const {
- CacheEntryBlock* entry = const_cast<CacheEntryBlock*>(&entry_);
- if (entry->Data()->key_len <= kMaxInternalKeyLength)
- return std::string(entry->Data()->key);
-
- // We keep a copy of the key so that we can always return it, even if the
- // backend is disabled.
- if (!key_.empty())
- return key_;
-
- Addr address(entry->Data()->long_key);
- DCHECK(address.is_initialized());
- size_t offset = 0;
- if (address.is_block_file())
- offset = address.start_block() * address.BlockSize() + kBlockHeaderSize;
-
- COMPILE_ASSERT(kNumStreams == kKeyFileIndex, invalid_key_index);
- File* key_file = const_cast<EntryImpl*>(this)->GetBackingFile(address,
- kKeyFileIndex);
-
- if (!key_file ||
- !key_file->Read(WriteInto(&key_, entry->Data()->key_len + 1),
- entry->Data()->key_len + 1, offset))
- key_.clear();
- return key_;
-}
-
-Time EntryImpl::GetLastUsed() const {
- CacheRankingsBlock* node = const_cast<CacheRankingsBlock*>(&node_);
- return Time::FromInternalValue(node->Data()->last_used);
-}
-
-Time EntryImpl::GetLastModified() const {
- CacheRankingsBlock* node = const_cast<CacheRankingsBlock*>(&node_);
- return Time::FromInternalValue(node->Data()->last_modified);
-}
-
-int32 EntryImpl::GetDataSize(int index) const {
- if (index < 0 || index >= kNumStreams)
- return 0;
-
- CacheEntryBlock* entry = const_cast<CacheEntryBlock*>(&entry_);
- return entry->Data()->data_size[index];
-}
-
-int EntryImpl::ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* callback) {
- if (!callback)
- return ReadDataImpl(index, offset, buf, buf_len, callback);
-
- DCHECK(node_.Data()->dirty || read_only_);
- if (index < 0 || index >= kNumStreams)
- return net::ERR_INVALID_ARGUMENT;
-
- int entry_size = entry_.Data()->data_size[index];
- if (offset >= entry_size || offset < 0 || !buf_len)
- return 0;
-
- if (buf_len < 0)
- return net::ERR_INVALID_ARGUMENT;
-
- backend_->background_queue()->ReadData(this, index, offset, buf, buf_len,
- callback);
- return net::ERR_IO_PENDING;
-}
-
-int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
- CompletionCallback* callback, bool truncate) {
- if (!callback)
- return WriteDataImpl(index, offset, buf, buf_len, callback, truncate);
-
- DCHECK(node_.Data()->dirty || read_only_);
- if (index < 0 || index >= kNumStreams)
- return net::ERR_INVALID_ARGUMENT;
-
- if (offset < 0 || buf_len < 0)
- return net::ERR_INVALID_ARGUMENT;
-
- backend_->background_queue()->WriteData(this, index, offset, buf, buf_len,
- truncate, callback);
- return net::ERR_IO_PENDING;
-}
-
-int EntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* callback) {
- if (!callback)
- return ReadSparseDataImpl(offset, buf, buf_len, callback);
-
- backend_->background_queue()->ReadSparseData(this, offset, buf, buf_len,
- callback);
- return net::ERR_IO_PENDING;
-}
-
-int EntryImpl::WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* callback) {
- if (!callback)
- return WriteSparseDataImpl(offset, buf, buf_len, callback);
-
- backend_->background_queue()->WriteSparseData(this, offset, buf, buf_len,
- callback);
- return net::ERR_IO_PENDING;
-}
-
-int EntryImpl::GetAvailableRange(int64 offset, int len, int64* start,
- CompletionCallback* callback) {
- backend_->background_queue()->GetAvailableRange(this, offset, len, start,
- callback);
- return net::ERR_IO_PENDING;
-}
-
-bool EntryImpl::CouldBeSparse() const {
- if (sparse_.get())
- return true;
-
- scoped_ptr<SparseControl> sparse;
- sparse.reset(new SparseControl(const_cast<EntryImpl*>(this)));
- return sparse->CouldBeSparse();
-}
-
-void EntryImpl::CancelSparseIO() {
- backend_->background_queue()->CancelSparseIO(this);
-}
-
-int EntryImpl::ReadyForSparseIO(net::CompletionCallback* callback) {
- if (!sparse_.get())
- return net::OK;
-
- backend_->background_queue()->ReadyForSparseIO(this, callback);
- return net::ERR_IO_PENDING;
-}
-
-// ------------------------------------------------------------------------
-
void EntryImpl::DoomImpl() {
if (doomed_)
return;
@@ -487,163 +385,42 @@
int EntryImpl::ReadDataImpl(int index, int offset, net::IOBuffer* buf,
int buf_len, CompletionCallback* callback) {
- DCHECK(node_.Data()->dirty || read_only_);
- DVLOG(2) << "Read from " << index << " at " << offset << " : " << buf_len;
- if (index < 0 || index >= kNumStreams)
- return net::ERR_INVALID_ARGUMENT;
-
- int entry_size = entry_.Data()->data_size[index];
- if (offset >= entry_size || offset < 0 || !buf_len)
- return 0;
-
- if (buf_len < 0)
- return net::ERR_INVALID_ARGUMENT;
-
- TimeTicks start = TimeTicks::Now();
-
- if (offset + buf_len > entry_size)
- buf_len = entry_size - offset;
-
- UpdateRank(false);
-
- backend_->OnEvent(Stats::READ_DATA);
- backend_->OnRead(buf_len);
-
- Addr address(entry_.Data()->data_addr[index]);
- int eof = address.is_initialized() ? entry_size : 0;
- if (user_buffers_[index].get() &&
- user_buffers_[index]->PreRead(eof, offset, &buf_len)) {
- // Complete the operation locally.
- buf_len = user_buffers_[index]->Read(offset, buf, buf_len);
- ReportIOTime(kRead, start);
- return buf_len;
+ if (net_log_.IsLoggingAllEvents()) {
+ net_log_.BeginEvent(
+ net::NetLog::TYPE_DISK_CACHE_READ_DATA,
+ make_scoped_refptr(
+ new ReadWriteDataParams(index, offset, buf_len, false)));
}
- address.set_value(entry_.Data()->data_addr[index]);
- DCHECK(address.is_initialized());
- if (!address.is_initialized())
- return net::ERR_FAILED;
+ int result = InternalReadData(index, offset, buf, buf_len, callback);
- File* file = GetBackingFile(address, index);
- if (!file)
- return net::ERR_FAILED;
-
- size_t file_offset = offset;
- if (address.is_block_file()) {
- DCHECK_LE(offset + buf_len, kMaxBlockSize);
- file_offset += address.start_block() * address.BlockSize() +
- kBlockHeaderSize;
+ if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) {
+ net_log_.EndEvent(
+ net::NetLog::TYPE_DISK_CACHE_READ_DATA,
+ make_scoped_refptr(new FileIOCompleteParameters(result)));
}
-
- SyncCallback* io_callback = NULL;
- if (callback)
- io_callback = new SyncCallback(this, buf, callback);
-
- bool completed;
- if (!file->Read(buf->data(), buf_len, file_offset, io_callback, &completed)) {
- if (io_callback)
- io_callback->Discard();
- return net::ERR_FAILED;
- }
-
- if (io_callback && completed)
- io_callback->Discard();
-
- ReportIOTime(kRead, start);
- return (completed || !callback) ? buf_len : net::ERR_IO_PENDING;
+ return result;
}
int EntryImpl::WriteDataImpl(int index, int offset, net::IOBuffer* buf,
int buf_len, CompletionCallback* callback,
bool truncate) {
- DCHECK(node_.Data()->dirty || read_only_);
- DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len;
- if (index < 0 || index >= kNumStreams)
- return net::ERR_INVALID_ARGUMENT;
-
- if (offset < 0 || buf_len < 0)
- return net::ERR_INVALID_ARGUMENT;
-
- int max_file_size = backend_->MaxFileSize();
-
- // offset or buf_len could be negative numbers.
- if (offset > max_file_size || buf_len > max_file_size ||
- offset + buf_len > max_file_size) {
- int size = offset + buf_len;
- if (size <= max_file_size)
- size = kint32max;
- backend_->TooMuchStorageRequested(size);
- return net::ERR_FAILED;
+ if (net_log_.IsLoggingAllEvents()) {
+ net_log_.BeginEvent(
+ net::NetLog::TYPE_DISK_CACHE_WRITE_DATA,
+ make_scoped_refptr(
+ new ReadWriteDataParams(index, offset, buf_len, truncate)));
}
- TimeTicks start = TimeTicks::Now();
+ int result = InternalWriteData(index, offset, buf, buf_len, callback,
+ truncate);
- // Read the size at this point (it may change inside prepare).
- int entry_size = entry_.Data()->data_size[index];
- bool extending = entry_size < offset + buf_len;
- truncate = truncate && entry_size > offset + buf_len;
- Trace("To PrepareTarget 0x%x", entry_.address().value());
- if (!PrepareTarget(index, offset, buf_len, truncate))
- return net::ERR_FAILED;
-
- Trace("From PrepareTarget 0x%x", entry_.address().value());
- if (extending || truncate)
- UpdateSize(index, entry_size, offset + buf_len);
-
- UpdateRank(true);
-
- backend_->OnEvent(Stats::WRITE_DATA);
- backend_->OnWrite(buf_len);
-
- if (user_buffers_[index].get()) {
- // Complete the operation locally.
- user_buffers_[index]->Write(offset, buf, buf_len);
- ReportIOTime(kWrite, start);
- return buf_len;
+ if (result != net::ERR_IO_PENDING && net_log_.IsLoggingAllEvents()) {
+ net_log_.EndEvent(
+ net::NetLog::TYPE_DISK_CACHE_WRITE_DATA,
+ make_scoped_refptr(new FileIOCompleteParameters(result)));
}
-
- Addr address(entry_.Data()->data_addr[index]);
- if (offset + buf_len == 0) {
- if (truncate) {
- DCHECK(!address.is_initialized());
- }
- return 0;
- }
-
- File* file = GetBackingFile(address, index);
- if (!file)
- return net::ERR_FAILED;
-
- size_t file_offset = offset;
- if (address.is_block_file()) {
- DCHECK_LE(offset + buf_len, kMaxBlockSize);
- file_offset += address.start_block() * address.BlockSize() +
- kBlockHeaderSize;
- } else if (truncate || (extending && !buf_len)) {
- if (!file->SetLength(offset + buf_len))
- return net::ERR_FAILED;
- }
-
- if (!buf_len)
- return 0;
-
- SyncCallback* io_callback = NULL;
- if (callback)
- io_callback = new SyncCallback(this, buf, callback);
-
- bool completed;
- if (!file->Write(buf->data(), buf_len, file_offset, io_callback,
- &completed)) {
- if (io_callback)
- io_callback->Discard();
- return net::ERR_FAILED;
- }
-
- if (io_callback && completed)
- io_callback->Discard();
-
- ReportIOTime(kWrite, start);
- return (completed || !callback) ? buf_len : net::ERR_IO_PENDING;
+ return result;
}
int EntryImpl::ReadSparseDataImpl(int64 offset, net::IOBuffer* buf, int buf_len,
@@ -694,8 +471,6 @@
return sparse_->ReadyToUse(callback);
}
-// ------------------------------------------------------------------------
-
uint32 EntryImpl::GetHash() {
return entry_.Data()->hash;
}
@@ -757,6 +532,7 @@
}
void EntryImpl::InternalDoom() {
+ net_log_.AddEvent(net::NetLog::TYPE_DISK_CACHE_DOOM, NULL);
DCHECK(node_.HasData());
if (!node_.Data()->dirty) {
node_.Data()->dirty = backend_->GetCurrentEntryId();
@@ -914,6 +690,375 @@
}
}
+void EntryImpl::BeginLogging(net::NetLog* net_log, bool created) {
+ DCHECK(!net_log_.net_log());
+ net_log_ = net::BoundNetLog::Make(
+ net_log, net::NetLog::SOURCE_DISK_CACHE_ENTRY);
+ net_log_.BeginEvent(
+ net::NetLog::TYPE_DISK_CACHE_ENTRY,
+ make_scoped_refptr(new EntryCreationParameters(GetKey(), created)));
+}
+
+const net::BoundNetLog& EntryImpl::net_log() const {
+ return net_log_;
+}
+
+void EntryImpl::Doom() {
+ backend_->background_queue()->DoomEntryImpl(this);
+}
+
+void EntryImpl::Close() {
+ backend_->background_queue()->CloseEntryImpl(this);
+}
+
+std::string EntryImpl::GetKey() const {
+ CacheEntryBlock* entry = const_cast<CacheEntryBlock*>(&entry_);
+ if (entry->Data()->key_len <= kMaxInternalKeyLength)
+ return std::string(entry->Data()->key);
+
+ // We keep a copy of the key so that we can always return it, even if the
+ // backend is disabled.
+ if (!key_.empty())
+ return key_;
+
+ Addr address(entry->Data()->long_key);
+ DCHECK(address.is_initialized());
+ size_t offset = 0;
+ if (address.is_block_file())
+ offset = address.start_block() * address.BlockSize() + kBlockHeaderSize;
+
+ COMPILE_ASSERT(kNumStreams == kKeyFileIndex, invalid_key_index);
+ File* key_file = const_cast<EntryImpl*>(this)->GetBackingFile(address,
+ kKeyFileIndex);
+
+ if (!key_file ||
+ !key_file->Read(WriteInto(&key_, entry->Data()->key_len + 1),
+ entry->Data()->key_len + 1, offset))
+ key_.clear();
+ return key_;
+}
+
+Time EntryImpl::GetLastUsed() const {
+ CacheRankingsBlock* node = const_cast<CacheRankingsBlock*>(&node_);
+ return Time::FromInternalValue(node->Data()->last_used);
+}
+
+Time EntryImpl::GetLastModified() const {
+ CacheRankingsBlock* node = const_cast<CacheRankingsBlock*>(&node_);
+ return Time::FromInternalValue(node->Data()->last_modified);
+}
+
+int32 EntryImpl::GetDataSize(int index) const {
+ if (index < 0 || index >= kNumStreams)
+ return 0;
+
+ CacheEntryBlock* entry = const_cast<CacheEntryBlock*>(&entry_);
+ return entry->Data()->data_size[index];
+}
+
+int EntryImpl::ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* callback) {
+ if (!callback)
+ return ReadDataImpl(index, offset, buf, buf_len, callback);
+
+ DCHECK(node_.Data()->dirty || read_only_);
+ if (index < 0 || index >= kNumStreams)
+ return net::ERR_INVALID_ARGUMENT;
+
+ int entry_size = entry_.Data()->data_size[index];
+ if (offset >= entry_size || offset < 0 || !buf_len)
+ return 0;
+
+ if (buf_len < 0)
+ return net::ERR_INVALID_ARGUMENT;
+
+ backend_->background_queue()->ReadData(this, index, offset, buf, buf_len,
+ callback);
+ return net::ERR_IO_PENDING;
+}
+
+int EntryImpl::WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
+ CompletionCallback* callback, bool truncate) {
+ if (!callback)
+ return WriteDataImpl(index, offset, buf, buf_len, callback, truncate);
+
+ DCHECK(node_.Data()->dirty || read_only_);
+ if (index < 0 || index >= kNumStreams)
+ return net::ERR_INVALID_ARGUMENT;
+
+ if (offset < 0 || buf_len < 0)
+ return net::ERR_INVALID_ARGUMENT;
+
+ backend_->background_queue()->WriteData(this, index, offset, buf, buf_len,
+ truncate, callback);
+ return net::ERR_IO_PENDING;
+}
+
+int EntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* callback) {
+ if (!callback)
+ return ReadSparseDataImpl(offset, buf, buf_len, callback);
+
+ backend_->background_queue()->ReadSparseData(this, offset, buf, buf_len,
+ callback);
+ return net::ERR_IO_PENDING;
+}
+
+int EntryImpl::WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* callback) {
+ if (!callback)
+ return WriteSparseDataImpl(offset, buf, buf_len, callback);
+
+ backend_->background_queue()->WriteSparseData(this, offset, buf, buf_len,
+ callback);
+ return net::ERR_IO_PENDING;
+}
+
+int EntryImpl::GetAvailableRange(int64 offset, int len, int64* start,
+ CompletionCallback* callback) {
+ backend_->background_queue()->GetAvailableRange(this, offset, len, start,
+ callback);
+ return net::ERR_IO_PENDING;
+}
+
+bool EntryImpl::CouldBeSparse() const {
+ if (sparse_.get())
+ return true;
+
+ scoped_ptr<SparseControl> sparse;
+ sparse.reset(new SparseControl(const_cast<EntryImpl*>(this)));
+ return sparse->CouldBeSparse();
+}
+
+void EntryImpl::CancelSparseIO() {
+ backend_->background_queue()->CancelSparseIO(this);
+}
+
+int EntryImpl::ReadyForSparseIO(net::CompletionCallback* callback) {
+ if (!sparse_.get())
+ return net::OK;
+
+ backend_->background_queue()->ReadyForSparseIO(this, callback);
+ return net::ERR_IO_PENDING;
+}
+
+// When an entry is deleted from the cache, we clean up all the data associated
+// with it for two reasons: to simplify the reuse of the block (we know that any
+// unused block is filled with zeros), and to simplify the handling of write /
+// read partial information from an entry (don't have to worry about returning
+// data related to a previous cache entry because the range was not fully
+// written before).
+EntryImpl::~EntryImpl() {
+ Log("~EntryImpl in");
+
+ // Save the sparse info to disk. This will generate IO for this entry and
+ // maybe for a child entry, so it is important to do it before deleting this
+ // entry.
+ sparse_.reset();
+
+ // Remove this entry from the list of open entries.
+ backend_->OnEntryDestroyBegin(entry_.address());
+
+ if (doomed_) {
+ DeleteEntryData(true);
+ } else {
+ net_log_.AddEvent(net::NetLog::TYPE_DISK_CACHE_CLOSE, NULL);
+ bool ret = true;
+ for (int index = 0; index < kNumStreams; index++) {
+ if (user_buffers_[index].get()) {
+ if (!(ret = Flush(index, 0)))
+ LOG(ERROR) << "Failed to save user data";
+ }
+ if (unreported_size_[index]) {
+ backend_->ModifyStorageSize(
+ entry_.Data()->data_size[index] - unreported_size_[index],
+ entry_.Data()->data_size[index]);
+ }
+ }
+
+ if (!ret) {
+ // There was a failure writing the actual data. Mark the entry as dirty.
+ int current_id = backend_->GetCurrentEntryId();
+ node_.Data()->dirty = current_id == 1 ? -1 : current_id - 1;
+ node_.Store();
+ } else if (node_.HasData() && node_.Data()->dirty) {
+ node_.Data()->dirty = 0;
+ node_.Store();
+ }
+ }
+
+ Trace("~EntryImpl out 0x%p", reinterpret_cast<void*>(this));
+ net_log_.EndEvent(net::NetLog::TYPE_DISK_CACHE_ENTRY, NULL);
+ backend_->OnEntryDestroyEnd();
+}
+
+// ------------------------------------------------------------------------
+
+int EntryImpl::InternalReadData(int index, int offset, net::IOBuffer* buf,
+ int buf_len, CompletionCallback* callback) {
+ DCHECK(node_.Data()->dirty || read_only_);
+ DVLOG(2) << "Read from " << index << " at " << offset << " : " << buf_len;
+ if (index < 0 || index >= kNumStreams)
+ return net::ERR_INVALID_ARGUMENT;
+
+ int entry_size = entry_.Data()->data_size[index];
+ if (offset >= entry_size || offset < 0 || !buf_len)
+ return 0;
+
+ if (buf_len < 0)
+ return net::ERR_INVALID_ARGUMENT;
+
+ TimeTicks start = TimeTicks::Now();
+
+ if (offset + buf_len > entry_size)
+ buf_len = entry_size - offset;
+
+ UpdateRank(false);
+
+ backend_->OnEvent(Stats::READ_DATA);
+ backend_->OnRead(buf_len);
+
+ Addr address(entry_.Data()->data_addr[index]);
+ int eof = address.is_initialized() ? entry_size : 0;
+ if (user_buffers_[index].get() &&
+ user_buffers_[index]->PreRead(eof, offset, &buf_len)) {
+ // Complete the operation locally.
+ buf_len = user_buffers_[index]->Read(offset, buf, buf_len);
+ ReportIOTime(kRead, start);
+ return buf_len;
+ }
+
+ address.set_value(entry_.Data()->data_addr[index]);
+ DCHECK(address.is_initialized());
+ if (!address.is_initialized())
+ return net::ERR_FAILED;
+
+ File* file = GetBackingFile(address, index);
+ if (!file)
+ return net::ERR_FAILED;
+
+ size_t file_offset = offset;
+ if (address.is_block_file()) {
+ DCHECK_LE(offset + buf_len, kMaxBlockSize);
+ file_offset += address.start_block() * address.BlockSize() +
+ kBlockHeaderSize;
+ }
+
+ SyncCallback* io_callback = NULL;
+ if (callback) {
+ io_callback = new SyncCallback(this, buf, callback,
+ net::NetLog::TYPE_DISK_CACHE_READ_DATA);
+ }
+
+ bool completed;
+ if (!file->Read(buf->data(), buf_len, file_offset, io_callback, &completed)) {
+ if (io_callback)
+ io_callback->Discard();
+ return net::ERR_FAILED;
+ }
+
+ if (io_callback && completed)
+ io_callback->Discard();
+
+ ReportIOTime(kRead, start);
+ return (completed || !callback) ? buf_len : net::ERR_IO_PENDING;
+}
+
+int EntryImpl::InternalWriteData(int index, int offset, net::IOBuffer* buf,
+ int buf_len, CompletionCallback* callback,
+ bool truncate) {
+ DCHECK(node_.Data()->dirty || read_only_);
+ DVLOG(2) << "Write to " << index << " at " << offset << " : " << buf_len;
+ if (index < 0 || index >= kNumStreams)
+ return net::ERR_INVALID_ARGUMENT;
+
+ if (offset < 0 || buf_len < 0)
+ return net::ERR_INVALID_ARGUMENT;
+
+ int max_file_size = backend_->MaxFileSize();
+
+ // offset or buf_len could be negative numbers.
+ if (offset > max_file_size || buf_len > max_file_size ||
+ offset + buf_len > max_file_size) {
+ int size = offset + buf_len;
+ if (size <= max_file_size)
+ size = kint32max;
+ backend_->TooMuchStorageRequested(size);
+ return net::ERR_FAILED;
+ }
+
+ TimeTicks start = TimeTicks::Now();
+
+ // Read the size at this point (it may change inside prepare).
+ int entry_size = entry_.Data()->data_size[index];
+ bool extending = entry_size < offset + buf_len;
+ truncate = truncate && entry_size > offset + buf_len;
+ Trace("To PrepareTarget 0x%x", entry_.address().value());
+ if (!PrepareTarget(index, offset, buf_len, truncate))
+ return net::ERR_FAILED;
+
+ Trace("From PrepareTarget 0x%x", entry_.address().value());
+ if (extending || truncate)
+ UpdateSize(index, entry_size, offset + buf_len);
+
+ UpdateRank(true);
+
+ backend_->OnEvent(Stats::WRITE_DATA);
+ backend_->OnWrite(buf_len);
+
+ if (user_buffers_[index].get()) {
+ // Complete the operation locally.
+ user_buffers_[index]->Write(offset, buf, buf_len);
+ ReportIOTime(kWrite, start);
+ return buf_len;
+ }
+
+ Addr address(entry_.Data()->data_addr[index]);
+ if (offset + buf_len == 0) {
+ if (truncate) {
+ DCHECK(!address.is_initialized());
+ }
+ return 0;
+ }
+
+ File* file = GetBackingFile(address, index);
+ if (!file)
+ return net::ERR_FAILED;
+
+ size_t file_offset = offset;
+ if (address.is_block_file()) {
+ DCHECK_LE(offset + buf_len, kMaxBlockSize);
+ file_offset += address.start_block() * address.BlockSize() +
+ kBlockHeaderSize;
+ } else if (truncate || (extending && !buf_len)) {
+ if (!file->SetLength(offset + buf_len))
+ return net::ERR_FAILED;
+ }
+
+ if (!buf_len)
+ return 0;
+
+ SyncCallback* io_callback = NULL;
+ if (callback) {
+ io_callback = new SyncCallback(this, buf, callback,
+ net::NetLog::TYPE_DISK_CACHE_WRITE_DATA);
+ }
+
+ bool completed;
+ if (!file->Write(buf->data(), buf_len, file_offset, io_callback,
+ &completed)) {
+ if (io_callback)
+ io_callback->Discard();
+ return net::ERR_FAILED;
+ }
+
+ if (io_callback && completed)
+ io_callback->Discard();
+
+ ReportIOTime(kWrite, start);
+ return (completed || !callback) ? buf_len : net::ERR_IO_PENDING;
+}
+
// ------------------------------------------------------------------------
bool EntryImpl::CreateDataBlock(int index, int size) {
diff --git a/net/disk_cache/entry_impl.h b/net/disk_cache/entry_impl.h
index e27f23a..e56fc6b 100644
--- a/net/disk_cache/entry_impl.h
+++ b/net/disk_cache/entry_impl.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/scoped_ptr.h"
+#include "net/base/net_log.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/storage_block.h"
#include "net/disk_cache/storage_block-inl.h"
@@ -32,28 +33,6 @@
EntryImpl(BackendImpl* backend, Addr address, bool read_only);
- // Entry interface.
- virtual void Doom();
- virtual void Close();
- virtual std::string GetKey() const;
- virtual base::Time GetLastUsed() const;
- virtual base::Time GetLastModified() const;
- virtual int32 GetDataSize(int index) const;
- virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* completion_callback);
- virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* completion_callback,
- bool truncate);
- virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* completion_callback);
- virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
- net::CompletionCallback* completion_callback);
- virtual int GetAvailableRange(int64 offset, int len, int64* start,
- CompletionCallback* callback);
- virtual bool CouldBeSparse() const;
- virtual void CancelSparseIO();
- virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback);
-
// Background implementation of the Entry interface.
void DoomImpl();
int ReadDataImpl(int index, int offset, net::IOBuffer* buf, int buf_len,
@@ -129,6 +108,36 @@
// Generates a histogram for the time spent working on this operation.
void ReportIOTime(Operation op, const base::TimeTicks& start);
+ // Logs a begin event and enables logging for the EntryImpl. Will also cause
+ // an end event to be logged on destruction. The EntryImpl must have its key
+ // initialized before this is called. |created| is true if the Entry was
+ // created rather than opened.
+ void BeginLogging(net::NetLog* net_log, bool created);
+
+ const net::BoundNetLog& net_log() const;
+
+ // Entry interface.
+ virtual void Doom();
+ virtual void Close();
+ virtual std::string GetKey() const;
+ virtual base::Time GetLastUsed() const;
+ virtual base::Time GetLastModified() const;
+ virtual int32 GetDataSize(int index) const;
+ virtual int ReadData(int index, int offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* completion_callback);
+ virtual int WriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* completion_callback,
+ bool truncate);
+ virtual int ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* completion_callback);
+ virtual int WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len,
+ net::CompletionCallback* completion_callback);
+ virtual int GetAvailableRange(int64 offset, int len, int64* start,
+ CompletionCallback* callback);
+ virtual bool CouldBeSparse() const;
+ virtual void CancelSparseIO();
+ virtual int ReadyForSparseIO(net::CompletionCallback* completion_callback);
+
private:
enum {
kNumStreams = 3
@@ -137,6 +146,13 @@
~EntryImpl();
+ // Do all the work for ReadDataImpl and WriteDataImpl. Implemented as
+ // separate functions to make logging of results simpler.
+ int InternalReadData(int index, int offset, net::IOBuffer* buf,
+ int buf_len, CompletionCallback* callback);
+ int InternalWriteData(int index, int offset, net::IOBuffer* buf, int buf_len,
+ CompletionCallback* callback, bool truncate);
+
// Initializes the storage for an internal or external data block.
bool CreateDataBlock(int index, int size);
@@ -220,6 +236,8 @@
bool read_only_; // True if not yet writing.
scoped_ptr<SparseControl> sparse_; // Support for sparse entries.
+ net::BoundNetLog net_log_;
+
DISALLOW_COPY_AND_ASSIGN(EntryImpl);
};
diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc
index cb7f680..21d5839 100644
--- a/net/disk_cache/entry_unittest.cc
+++ b/net/disk_cache/entry_unittest.cc
@@ -1,9 +1,9 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// 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.
#include "base/basictypes.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "base/timer.h"
#include "base/string_util.h"
#include "net/base/io_buffer.h"
@@ -634,7 +634,7 @@
EXPECT_TRUE(entry->GetLastModified() >= t1);
EXPECT_TRUE(entry->GetLastModified() == entry->GetLastUsed());
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
Time t2 = Time::Now();
EXPECT_TRUE(t2 > t1);
EXPECT_EQ(0, WriteData(entry, 0, 200, NULL, 0, false));
@@ -645,7 +645,7 @@
}
EXPECT_TRUE(entry->GetLastModified() == entry->GetLastUsed());
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
Time t3 = Time::Now();
EXPECT_TRUE(t3 > t2);
const int kSize = 200;
@@ -1286,7 +1286,7 @@
FlushQueueForTest();
EXPECT_EQ(0, cache_->GetEntryCount());
Time initial = Time::Now();
- PlatformThread::Sleep(20);
+ base::PlatformThread::Sleep(20);
const int kSize1 = 2000;
const int kSize2 = 2000;
@@ -1746,7 +1746,7 @@
// Most likely we are waiting for the result of reading the sparse info
// (it's always async on Posix so it is easy to miss). Unfortunately we
// don't have any signal to watch for so we can only wait.
- PlatformThread::Sleep(500);
+ base::PlatformThread::Sleep(500);
MessageLoop::current()->RunAllPending();
}
EXPECT_EQ(0, cache_->GetEntryCount());
diff --git a/net/disk_cache/file.h b/net/disk_cache/file.h
index c266311..129c3dd 100644
--- a/net/disk_cache/file.h
+++ b/net/disk_cache/file.h
@@ -18,11 +18,11 @@
// This interface is used to support asynchronous ReadData and WriteData calls.
class FileIOCallback {
public:
+ virtual ~FileIOCallback() {}
+
// Notified of the actual number of bytes read or written. This value is
// negative if an error occurred.
virtual void OnFileIOComplete(int bytes_copied) = 0;
-
- virtual ~FileIOCallback() {}
};
// Simple wrapper around a file that allows asynchronous operations.
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc
index 1870c0b..01dafd3 100644
--- a/net/disk_cache/file_posix.cc
+++ b/net/disk_cache/file_posix.cc
@@ -7,7 +7,7 @@
#include <fcntl.h>
#include "base/logging.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/disk_cache/disk_cache.h"
#include "net/disk_cache/in_flight_io.h"
@@ -113,7 +113,7 @@
new FileBackgroundIO(file, buf, buf_len, offset, callback, this));
file->AddRef(); // Balanced on OnOperationComplete()
- WorkerPool::PostTask(FROM_HERE,
+ base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(operation.get(), &FileBackgroundIO::Read), true);
OnOperationPosted(operation);
}
@@ -125,7 +125,7 @@
new FileBackgroundIO(file, buf, buf_len, offset, callback, this));
file->AddRef(); // Balanced on OnOperationComplete()
- WorkerPool::PostTask(FROM_HERE,
+ base::WorkerPool::PostTask(FROM_HERE,
NewRunnableMethod(operation.get(), &FileBackgroundIO::Write), true);
OnOperationPosted(operation);
}
diff --git a/net/disk_cache/in_flight_io.h b/net/disk_cache/in_flight_io.h
index 6c5f8ab..a361cbd 100644
--- a/net/disk_cache/in_flight_io.h
+++ b/net/disk_cache/in_flight_io.h
@@ -9,7 +9,7 @@
#include <set>
#include "base/message_loop_proxy.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
namespace disk_cache {
diff --git a/net/disk_cache/mem_backend_impl.cc b/net/disk_cache/mem_backend_impl.cc
index 96c615e..0ae858a 100644
--- a/net/disk_cache/mem_backend_impl.cc
+++ b/net/disk_cache/mem_backend_impl.cc
@@ -28,6 +28,17 @@
namespace disk_cache {
+MemBackendImpl::MemBackendImpl() : max_size_(0), current_size_(0) {}
+
+MemBackendImpl::~MemBackendImpl() {
+ EntryMap::iterator it = entries_.begin();
+ while (it != entries_.end()) {
+ it->second->Doom();
+ it = entries_.begin();
+ }
+ DCHECK(!current_size_);
+}
+
// Static.
Backend* MemBackendImpl::CreateBackend(int max_bytes) {
MemBackendImpl* cache = new MemBackendImpl();
@@ -65,17 +76,6 @@
return true;
}
-MemBackendImpl::MemBackendImpl() : max_size_(0), current_size_(0) {}
-
-MemBackendImpl::~MemBackendImpl() {
- EntryMap::iterator it = entries_.begin();
- while (it != entries_.end()) {
- it->second->Doom();
- it = entries_.begin();
- }
- DCHECK(!current_size_);
-}
-
bool MemBackendImpl::SetMaxSize(int max_bytes) {
COMPILE_ASSERT(sizeof(max_bytes) == sizeof(max_size_), unsupported_int_model);
if (max_bytes < 0)
@@ -89,10 +89,107 @@
return true;
}
+void MemBackendImpl::InternalDoomEntry(MemEntryImpl* entry) {
+ // Only parent entries can be passed into this method.
+ DCHECK(entry->type() == MemEntryImpl::kParentEntry);
+
+ rankings_.Remove(entry);
+ EntryMap::iterator it = entries_.find(entry->GetKey());
+ if (it != entries_.end())
+ entries_.erase(it);
+ else
+ NOTREACHED();
+
+ entry->InternalDoom();
+}
+
+void MemBackendImpl::UpdateRank(MemEntryImpl* node) {
+ rankings_.UpdateRank(node);
+}
+
+void MemBackendImpl::ModifyStorageSize(int32 old_size, int32 new_size) {
+ if (old_size >= new_size)
+ SubstractStorageSize(old_size - new_size);
+ else
+ AddStorageSize(new_size - old_size);
+}
+
+int MemBackendImpl::MaxFileSize() const {
+ return max_size_ / 8;
+}
+
+void MemBackendImpl::InsertIntoRankingList(MemEntryImpl* entry) {
+ rankings_.Insert(entry);
+}
+
+void MemBackendImpl::RemoveFromRankingList(MemEntryImpl* entry) {
+ rankings_.Remove(entry);
+}
+
int32 MemBackendImpl::GetEntryCount() const {
return static_cast<int32>(entries_.size());
}
+int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback) {
+ if (OpenEntry(key, entry))
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
+int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback) {
+ if (CreateEntry(key, entry))
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
+int MemBackendImpl::DoomEntry(const std::string& key,
+ CompletionCallback* callback) {
+ if (DoomEntry(key))
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
+int MemBackendImpl::DoomAllEntries(CompletionCallback* callback) {
+ if (DoomAllEntries())
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
+int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ CompletionCallback* callback) {
+ if (DoomEntriesBetween(initial_time, end_time))
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
+int MemBackendImpl::DoomEntriesSince(const base::Time initial_time,
+ CompletionCallback* callback) {
+ if (DoomEntriesSince(initial_time))
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
+int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry,
+ CompletionCallback* callback) {
+ if (OpenNextEntry(iter, next_entry))
+ return net::OK;
+
+ return net::ERR_FAILED;
+}
+
+void MemBackendImpl::EndEnumeration(void** iter) {
+ *iter = NULL;
+}
+
bool MemBackendImpl::OpenEntry(const std::string& key, Entry** entry) {
EntryMap::iterator it = entries_.find(key);
if (it == entries_.end())
@@ -104,14 +201,6 @@
return true;
}
-int MemBackendImpl::OpenEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback) {
- if (OpenEntry(key, entry))
- return net::OK;
-
- return net::ERR_FAILED;
-}
-
bool MemBackendImpl::CreateEntry(const std::string& key, Entry** entry) {
EntryMap::iterator it = entries_.find(key);
if (it != entries_.end())
@@ -130,14 +219,6 @@
return true;
}
-int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback) {
- if (CreateEntry(key, entry))
- return net::OK;
-
- return net::ERR_FAILED;
-}
-
bool MemBackendImpl::DoomEntry(const std::string& key) {
Entry* entry;
if (!OpenEntry(key, &entry))
@@ -148,40 +229,11 @@
return true;
}
-int MemBackendImpl::DoomEntry(const std::string& key,
- CompletionCallback* callback) {
- if (DoomEntry(key))
- return net::OK;
-
- return net::ERR_FAILED;
-}
-
-void MemBackendImpl::InternalDoomEntry(MemEntryImpl* entry) {
- // Only parent entries can be passed into this method.
- DCHECK(entry->type() == MemEntryImpl::kParentEntry);
-
- rankings_.Remove(entry);
- EntryMap::iterator it = entries_.find(entry->GetKey());
- if (it != entries_.end())
- entries_.erase(it);
- else
- NOTREACHED();
-
- entry->InternalDoom();
-}
-
bool MemBackendImpl::DoomAllEntries() {
TrimCache(true);
return true;
}
-int MemBackendImpl::DoomAllEntries(CompletionCallback* callback) {
- if (DoomAllEntries())
- return net::OK;
-
- return net::ERR_FAILED;
-}
-
bool MemBackendImpl::DoomEntriesBetween(const Time initial_time,
const Time end_time) {
if (end_time.is_null())
@@ -208,15 +260,6 @@
return true;
}
-int MemBackendImpl::DoomEntriesBetween(const base::Time initial_time,
- const base::Time end_time,
- CompletionCallback* callback) {
- if (DoomEntriesBetween(initial_time, end_time))
- return net::OK;
-
- return net::ERR_FAILED;
-}
-
bool MemBackendImpl::DoomEntriesSince(const Time initial_time) {
for (;;) {
// Get the entry in the front.
@@ -229,14 +272,6 @@
}
}
-int MemBackendImpl::DoomEntriesSince(const base::Time initial_time,
- CompletionCallback* callback) {
- if (DoomEntriesSince(initial_time))
- return net::OK;
-
- return net::ERR_FAILED;
-}
-
bool MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry) {
MemEntryImpl* current = reinterpret_cast<MemEntryImpl*>(*iter);
MemEntryImpl* node = rankings_.GetNext(current);
@@ -254,18 +289,6 @@
return NULL != node;
}
-int MemBackendImpl::OpenNextEntry(void** iter, Entry** next_entry,
- CompletionCallback* callback) {
- if (OpenNextEntry(iter, next_entry))
- return net::OK;
-
- return net::ERR_FAILED;
-}
-
-void MemBackendImpl::EndEnumeration(void** iter) {
- *iter = NULL;
-}
-
void MemBackendImpl::TrimCache(bool empty) {
MemEntryImpl* next = rankings_.GetPrev(NULL);
@@ -296,27 +319,4 @@
DCHECK(current_size_ >= 0);
}
-void MemBackendImpl::ModifyStorageSize(int32 old_size, int32 new_size) {
- if (old_size >= new_size)
- SubstractStorageSize(old_size - new_size);
- else
- AddStorageSize(new_size - old_size);
-}
-
-void MemBackendImpl::UpdateRank(MemEntryImpl* node) {
- rankings_.UpdateRank(node);
-}
-
-int MemBackendImpl::MaxFileSize() const {
- return max_size_ / 8;
-}
-
-void MemBackendImpl::InsertIntoRankingList(MemEntryImpl* entry) {
- rankings_.Insert(entry);
-}
-
-void MemBackendImpl::RemoveFromRankingList(MemEntryImpl* entry) {
- rankings_.Remove(entry);
-}
-
} // namespace disk_cache
diff --git a/net/disk_cache/mem_backend_impl.h b/net/disk_cache/mem_backend_impl.h
index c78c670..9b920ac 100644
--- a/net/disk_cache/mem_backend_impl.h
+++ b/net/disk_cache/mem_backend_impl.h
@@ -34,25 +34,6 @@
// Performs general initialization for this current instance of the cache.
bool Init();
- // Backend interface.
- virtual int32 GetEntryCount() const;
- virtual int OpenEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback);
- virtual int CreateEntry(const std::string& key, Entry** entry,
- CompletionCallback* callback);
- virtual int DoomEntry(const std::string& key, CompletionCallback* callback);
- virtual int DoomAllEntries(CompletionCallback* callback);
- virtual int DoomEntriesBetween(const base::Time initial_time,
- const base::Time end_time,
- CompletionCallback* callback);
- virtual int DoomEntriesSince(const base::Time initial_time,
- CompletionCallback* callback);
- virtual int OpenNextEntry(void** iter, Entry** next_entry,
- CompletionCallback* callback);
- virtual void EndEnumeration(void** iter);
- virtual void GetStats(
- std::vector<std::pair<std::string, std::string> >* stats) {}
-
// Sets the maximum size for the total amount of data stored by this instance.
bool SetMaxSize(int max_bytes);
@@ -77,7 +58,28 @@
// MemEntryImpl to remove a child entry from the ranking list.
void RemoveFromRankingList(MemEntryImpl* entry);
+ // Backend interface.
+ virtual int32 GetEntryCount() const;
+ virtual int OpenEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback);
+ virtual int CreateEntry(const std::string& key, Entry** entry,
+ CompletionCallback* callback);
+ virtual int DoomEntry(const std::string& key, CompletionCallback* callback);
+ virtual int DoomAllEntries(CompletionCallback* callback);
+ virtual int DoomEntriesBetween(const base::Time initial_time,
+ const base::Time end_time,
+ CompletionCallback* callback);
+ virtual int DoomEntriesSince(const base::Time initial_time,
+ CompletionCallback* callback);
+ virtual int OpenNextEntry(void** iter, Entry** next_entry,
+ CompletionCallback* callback);
+ virtual void EndEnumeration(void** iter);
+ virtual void GetStats(
+ std::vector<std::pair<std::string, std::string> >* stats) {}
+
private:
+ typedef base::hash_map<std::string, MemEntryImpl*> EntryMap;
+
// Old Backend interface.
bool OpenEntry(const std::string& key, Entry** entry);
bool CreateEntry(const std::string& key, Entry** entry);
@@ -97,8 +99,6 @@
void AddStorageSize(int32 bytes);
void SubstractStorageSize(int32 bytes);
- typedef base::hash_map<std::string, MemEntryImpl*> EntryMap;
-
EntryMap entries_;
MemRankings rankings_; // Rankings to be able to trim the cache.
int32 max_size_; // Maximum data size for this instance.
diff --git a/net/disk_cache/rankings.h b/net/disk_cache/rankings.h
index 6066fbf..baf777e 100644
--- a/net/disk_cache/rankings.h
+++ b/net/disk_cache/rankings.h
@@ -93,11 +93,12 @@
// If we have multiple lists, we have to iterate through all at the same time.
// This structure keeps track of where we are on the iteration.
struct Iterator {
+ explicit Iterator(Rankings* rankings);
+ ~Iterator();
+
List list; // Which entry was returned to the user.
CacheRankingsBlock* nodes[3]; // Nodes on the first three lists.
Rankings* my_rankings;
- explicit Iterator(Rankings* rankings);
- ~Iterator();
};
Rankings();
diff --git a/net/disk_cache/sparse_control.cc b/net/disk_cache/sparse_control.cc
index 32f44ab..ebc8250 100644
--- a/net/disk_cache/sparse_control.cc
+++ b/net/disk_cache/sparse_control.cc
@@ -138,6 +138,30 @@
this, &ChildrenDeleter::DeleteChildren));
}
+// Logs the end event for |operation|, if all events are being logged.
+void LogOperationEnd(const net::BoundNetLog& net_log,
+ disk_cache::SparseControl::SparseOperation operation,
+ int result) {
+ if (net_log.IsLoggingAllEvents()) {
+ net::NetLog::EventType event_type;
+ switch (operation) {
+ case disk_cache::SparseControl::kReadOperation:
+ event_type = net::NetLog::TYPE_SPARSE_CONTROL_READ;
+ break;
+ case disk_cache::SparseControl::kWriteOperation:
+ event_type = net::NetLog::TYPE_SPARSE_CONTROL_WRITE;
+ break;
+ case disk_cache::SparseControl::kGetRangeOperation:
+ event_type = net::NetLog::TYPE_SPARSE_CONTROL_GET_RANGE;
+ break;
+ default:
+ NOTREACHED();
+ return;
+ }
+ net_log.EndEventWithNetErrorCode(event_type, result);
+ }
+}
+
} // namespace.
namespace disk_cache {
@@ -223,6 +247,7 @@
finished_ = false;
abort_ = false;
+ entry_->net_log().BeginEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL);
DoChildrenIO();
if (!pending_) {
@@ -610,8 +635,11 @@
void SparseControl::DoChildrenIO() {
while (DoChildIO()) continue;
- if (pending_ && finished_)
- DoUserCallback();
+ if (finished_) {
+ entry_->net_log().EndEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL);
+ if (pending_)
+ DoUserCallback();
+ }
}
bool SparseControl::DoChildIO() {
@@ -632,14 +660,32 @@
int rv = 0;
switch (operation_) {
case kReadOperation:
+ if (entry_->net_log().IsLoggingAllEvents()) {
+ entry_->net_log().BeginEvent(
+ net::NetLog::TYPE_SPARSE_CONTROL_READ,
+ make_scoped_refptr(new net::NetLogSourceParameter(
+ "source_dependency",
+ child_->net_log().source())));
+ }
rv = child_->ReadDataImpl(kSparseData, child_offset_, user_buf_,
child_len_, callback);
break;
case kWriteOperation:
+ if (entry_->net_log().IsLoggingAllEvents()) {
+ entry_->net_log().BeginEvent(
+ net::NetLog::TYPE_SPARSE_CONTROL_WRITE,
+ make_scoped_refptr(new net::NetLogSourceParameter(
+ "source_dependency",
+ child_->net_log().source())));
+ }
rv = child_->WriteDataImpl(kSparseData, child_offset_, user_buf_,
child_len_, callback, false);
break;
case kGetRangeOperation:
+ if (entry_->net_log().IsLoggingAllEvents()) {
+ entry_->net_log().BeginEvent(net::NetLog::TYPE_SPARSE_CONTROL_GET_RANGE,
+ NULL);
+ }
rv = DoGetAvailableRange();
break;
default:
@@ -712,6 +758,7 @@
}
void SparseControl::DoChildIOCompleted(int result) {
+ LogOperationEnd(entry_->net_log(), operation_, result);
if (result < 0) {
// We fail the whole operation if we encounter an error.
result_ = result;
@@ -737,6 +784,8 @@
// We'll return the current result of the operation, which may be less than
// the bytes to read or write, but the user cancelled the operation.
abort_ = false;
+ entry_->net_log().AddEvent(net::NetLog::TYPE_CANCELLED, NULL);
+ entry_->net_log().EndEvent(net::NetLog::TYPE_SPARSE_CONTROL, NULL);
DoUserCallback();
return DoAbortCallbacks();
}
diff --git a/net/disk_cache/stats.cc b/net/disk_cache/stats.cc
index f0446fb..5222112 100644
--- a/net/disk_cache/stats.cc
+++ b/net/disk_cache/stats.cc
@@ -20,6 +20,7 @@
int data_sizes[disk_cache::Stats::kDataSizesLength];
int64 counters[disk_cache::Stats::MAX_COUNTER];
};
+COMPILE_ASSERT(sizeof(OnDiskStats) < 512, needs_more_than_2_blocks);
// Returns the "floor" (as opposed to "ceiling") of log base 2 of number.
int LogBase2(int32 number) {
@@ -37,6 +38,7 @@
return static_cast<int>(result);
}
+// WARNING: Add new stats only at the end, or change LoadStats().
static const char* kCounterNames[] = {
"Open miss",
"Open hit",
@@ -57,7 +59,8 @@
"Get rankings",
"Fatal error",
"Last report",
- "Last report timer"
+ "Last report timer",
+ "Doom recent entries"
};
COMPILE_ASSERT(arraysize(kCounterNames) == disk_cache::Stats::MAX_COUNTER,
update_the_names);
@@ -73,6 +76,7 @@
size_t offset = address.start_block() * address.BlockSize() +
kBlockHeaderSize;
+ memset(stats, 0, sizeof(*stats));
if (!file->Read(stats, sizeof(*stats), offset))
return false;
@@ -80,9 +84,10 @@
return false;
// We don't want to discard the whole cache every time we have one extra
- // counter; just reset them to zero.
- if (stats->size != sizeof(*stats))
+ // counter; we keep old data if we can.
+ if (static_cast<unsigned int>(stats->size) > sizeof(*stats)) {
memset(stats, 0, sizeof(*stats));
+ }
return true;
}
diff --git a/net/disk_cache/stats.h b/net/disk_cache/stats.h
index 3042590..ebf0bc2 100644
--- a/net/disk_cache/stats.h
+++ b/net/disk_cache/stats.h
@@ -45,6 +45,7 @@
FATAL_ERROR,
LAST_REPORT, // Time of the last time we sent a report.
LAST_REPORT_TIMER, // Timer count of the last time we sent a report.
+ DOOM_RECENT, // The cache was partially cleared.
MAX_COUNTER
};
diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc
index ae2f981..ee2db24 100644
--- a/net/disk_cache/stress_cache.cc
+++ b/net/disk_cache/stress_cache.cc
@@ -32,11 +32,11 @@
#include "base/logging.h"
#include "base/message_loop.h"
#include "base/path_service.h"
-#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/platform_thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
@@ -104,7 +104,7 @@
int rv = disk_cache::BackendImpl::CreateBackend(
path, false, cache_size, net::DISK_CACHE,
disk_cache::kNoLoadProtection | disk_cache::kNoRandom,
- cache_thread.message_loop_proxy(), &cache, &cb);
+ cache_thread.message_loop_proxy(), NULL, &cache, &cb);
if (cb.GetResult(rv) != net::OK) {
printf("Unable to initialize cache.\n");
@@ -228,7 +228,7 @@
logging::SetLogAssertHandler(CrashHandler);
// Some time for the memory manager to flush stuff.
- PlatformThread::Sleep(3000);
+ base::PlatformThread::Sleep(3000);
MessageLoop message_loop(MessageLoop::TYPE_IO);
char* end;
diff --git a/net/ftp/ftp_directory_listing_buffer_unittest.cc b/net/ftp/ftp_directory_listing_buffer_unittest.cc
index cb120a6..81e72c1 100644
--- a/net/ftp/ftp_directory_listing_buffer_unittest.cc
+++ b/net/ftp/ftp_directory_listing_buffer_unittest.cc
@@ -42,6 +42,7 @@
"dir-listing-ls-20", // TODO(phajdan.jr): should use windows-1251 encoding.
"dir-listing-ls-21", // TODO(phajdan.jr): should use windows-1251 encoding.
"dir-listing-ls-22", // TODO(phajdan.jr): should use windows-1251 encoding.
+ "dir-listing-ls-23",
"dir-listing-netware-1",
"dir-listing-netware-2",
"dir-listing-vms-1",
diff --git a/net/ftp/ftp_directory_listing_parser_ls.cc b/net/ftp/ftp_directory_listing_parser_ls.cc
index 9660eab..34ef519 100644
--- a/net/ftp/ftp_directory_listing_parser_ls.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls.cc
@@ -45,6 +45,21 @@
(text.substr(10).empty() || text.substr(10) == ASCIIToUTF16("+")));
}
+bool LooksLikePermissionDeniedError(const string16& text) {
+ // Try to recognize a three-part colon-separated error message:
+ //
+ // 1. ftpd server name
+ // 2. directory name (often just ".")
+ // 3. message text (usually "Permission denied")
+ std::vector<string16> parts;
+ base::SplitString(CollapseWhitespace(text, false), ':', &parts);
+
+ if (parts.size() != 3)
+ return false;
+
+ return parts[2] == ASCIIToUTF16("Permission denied");
+}
+
bool DetectColumnOffset(const std::vector<string16>& columns,
const base::Time& current_time, int* offset) {
base::Time time;
@@ -125,8 +140,12 @@
}
int column_offset;
- if (!DetectColumnOffset(columns, current_time_, &column_offset))
- return false;
+ if (!DetectColumnOffset(columns, current_time_, &column_offset)) {
+ // If we can't recognize a normal listing line, maybe it's an error?
+ // In that case, just ignore the error, but still recognize the data
+ // as valid listing.
+ return LooksLikePermissionDeniedError(line);
+ }
// We may receive file names containing spaces, which can make the number of
// columns arbitrarily large. We will handle that later. For now just make
diff --git a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
index 3e777cc..ea4f094 100644
--- a/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
+++ b/net/ftp/ftp_directory_listing_parser_ls_unittest.cc
@@ -95,6 +95,9 @@
const char* ignored_cases[] = {
"drwxr-xr-x 2 0 0 4096 Mar 18 2007 ", // http://crbug.com/60065
+ "ftpd: .: Permission denied",
+ "ftpd-BSD: .: Permission denied",
+
// Tests important for security: verify that after we detect the column
// offset we don't try to access invalid memory on malformed input.
"drwxr-xr-x 3 ftp ftp 4096 May 15 18:11",
diff --git a/net/http/disk_cache_based_ssl_host_info.h b/net/http/disk_cache_based_ssl_host_info.h
index fee0a5c..c094163 100644
--- a/net/http/disk_cache_based_ssl_host_info.h
+++ b/net/http/disk_cache_based_ssl_host_info.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/lock.h"
-#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "base/weak_ptr.h"
#include "net/base/completion_callback.h"
#include "net/disk_cache/disk_cache.h"
@@ -25,7 +25,7 @@
// standard disk cache. Since the information is defined to be non-sensitive,
// it's ok for us to keep it on disk.
class DiskCacheBasedSSLHostInfo : public SSLHostInfo,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
DiskCacheBasedSSLHostInfo(const std::string& hostname,
const SSLConfig& ssl_config,
diff --git a/net/http/http_auth_cache.h b/net/http/http_auth_cache.h
index 707288c..b6c382c 100644
--- a/net/http/http_auth_cache.h
+++ b/net/http/http_auth_cache.h
@@ -28,6 +28,13 @@
public:
class Entry;
+ // Prevent unbounded memory growth. These are safeguards for abuse; it is
+ // not expected that the limits will be reached in ordinary usage.
+ // This also defines the worst-case lookup times (which grow linearly
+ // with number of elements in the cache).
+ enum { kMaxNumPathsPerRealmEntry = 10 };
+ enum { kMaxNumRealmEntries = 10 };
+
HttpAuthCache();
~HttpAuthCache();
@@ -93,13 +100,6 @@
const std::string& scheme,
const std::string& auth_challenge);
- // Prevent unbounded memory growth. These are safeguards for abuse; it is
- // not expected that the limits will be reached in ordinary usage.
- // This also defines the worst-case lookup times (which grow linearly
- // with number of elements in the cache).
- enum { kMaxNumPathsPerRealmEntry = 10 };
- enum { kMaxNumRealmEntries = 10 };
-
private:
typedef std::list<Entry> EntryList;
EntryList entries_;
@@ -108,6 +108,8 @@
// An authentication realm entry.
class HttpAuthCache::Entry {
public:
+ ~Entry();
+
const GURL& origin() const {
return origin_;
}
@@ -143,13 +145,13 @@
void UpdateStaleChallenge(const std::string& auth_challenge);
- ~Entry();
-
private:
friend class HttpAuthCache;
FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddPath);
FRIEND_TEST_ALL_PREFIXES(HttpAuthCacheTest, AddToExistingEntry);
+ typedef std::list<std::string> PathList;
+
Entry();
// Adds a path defining the realm's protection space. If the path is
@@ -172,7 +174,6 @@
int nonce_count_;
// List of paths that define the realm's protection space.
- typedef std::list<std::string> PathList;
PathList paths_;
};
diff --git a/net/http/http_auth_controller.cc b/net/http/http_auth_controller.cc
index e97d06e..ddd0bdb 100644
--- a/net/http/http_auth_controller.cc
+++ b/net/http/http_auth_controller.cc
@@ -6,6 +6,7 @@
#include "base/metrics/histogram.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
#include "net/base/auth.h"
#include "net/base/host_resolver.h"
@@ -90,8 +91,9 @@
// used on the same thread, in which case there are no race conditions. If
// there are race conditions (say, a read completes during a partial write),
// the DCHECK will correctly fail.
- static PlatformThreadId first_thread = PlatformThread::CurrentId();
- DCHECK_EQ(first_thread, PlatformThread::CurrentId());
+ static base::PlatformThreadId first_thread =
+ base::PlatformThread::CurrentId();
+ DCHECK_EQ(first_thread, base::PlatformThread::CurrentId());
#endif
HttpAuthHandler::AuthScheme auth_scheme = handler->auth_scheme();
diff --git a/net/http/http_auth_controller.h b/net/http/http_auth_controller.h
index 1d0a5cd..85d9fa1 100644
--- a/net/http/http_auth_controller.h
+++ b/net/http/http_auth_controller.h
@@ -10,10 +10,10 @@
#include <string>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
#include "base/string16.h"
+#include "base/threading/non_thread_safe.h"
#include "googleurl/src/gurl.h"
#include "net/base/completion_callback.h"
#include "net/base/net_log.h"
@@ -29,7 +29,7 @@
struct HttpRequestInfo;
class HttpAuthController : public base::RefCounted<HttpAuthController>,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
// The arguments are self explanatory except possibly for |auth_url|, which
// should be both the auth target and auth path in a single url argument.
diff --git a/net/http/http_auth_gssapi_posix.cc b/net/http/http_auth_gssapi_posix.cc
index c492b1b..9a69ec3 100644
--- a/net/http/http_auth_gssapi_posix.cc
+++ b/net/http/http_auth_gssapi_posix.cc
@@ -13,7 +13,7 @@
#include "base/logging.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "net/base/net_errors.h"
#include "net/base/net_util.h"
diff --git a/net/http/http_auth_handler.cc b/net/http/http_auth_handler.cc
index 5c86d69..130123b 100644
--- a/net/http/http_auth_handler.cc
+++ b/net/http/http_auth_handler.cc
@@ -5,7 +5,6 @@
#include "net/http/http_auth_handler.h"
#include "base/logging.h"
-#include "base/metrics/histogram.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "net/base/net_errors.h"
@@ -26,12 +25,6 @@
HttpAuthHandler::~HttpAuthHandler() {
}
-//static
-std::string HttpAuthHandler::GenerateHistogramNameFromScheme(
- const std::string& scheme) {
- return base::StringPrintf("Net.AuthGenerateToken_%s", scheme.c_str());
-}
-
bool HttpAuthHandler::InitFromChallenge(
HttpAuth::ChallengeTokenizer* challenge,
HttpAuth::Target target,
@@ -53,13 +46,6 @@
DCHECK(!ok || properties_ != -1);
DCHECK(!ok || auth_scheme_ != AUTH_SCHEME_MAX);
- if (ok)
- histogram_ = base::Histogram::FactoryTimeGet(
- GenerateHistogramNameFromScheme(scheme()),
- base::TimeDelta::FromMilliseconds(1),
- base::TimeDelta::FromSeconds(10), 50,
- base::Histogram::kUmaTargetedHistogramFlag);
-
return ok;
}
@@ -90,10 +76,8 @@
DCHECK(username != NULL || AllowsDefaultCredentials());
DCHECK(auth_token != NULL);
DCHECK(original_callback_ == NULL);
- DCHECK(histogram_.get());
original_callback_ = callback;
net_log_.BeginEvent(EventTypeFromAuthTarget(target_), NULL);
- generate_auth_token_start_ = base::TimeTicks::Now();
int rv = GenerateAuthTokenImpl(username, password, request,
&wrapper_callback_, auth_token);
if (rv != ERR_IO_PENDING)
@@ -118,10 +102,6 @@
void HttpAuthHandler::FinishGenerateAuthToken() {
// TOOD(cbentzel): Should this be done in OK case only?
- DCHECK(histogram_.get());
- base::TimeDelta generate_auth_token_duration =
- base::TimeTicks::Now() - generate_auth_token_start_;
- histogram_->AddTime(generate_auth_token_duration);
net_log_.EndEvent(EventTypeFromAuthTarget(target_), NULL);
original_callback_ = NULL;
}
diff --git a/net/http/http_auth_handler.h b/net/http/http_auth_handler.h
index b48d4c2..65340df 100644
--- a/net/http/http_auth_handler.h
+++ b/net/http/http_auth_handler.h
@@ -9,15 +9,10 @@
#include <string>
#include "base/string16.h"
-#include "base/time.h"
#include "net/base/completion_callback.h"
#include "net/base/net_log.h"
#include "net/http/http_auth.h"
-namespace base {
-class Histogram;
-}
-
namespace net {
struct HttpRequestInfo;
@@ -206,13 +201,9 @@
private:
void OnGenerateAuthTokenComplete(int rv);
void FinishGenerateAuthToken();
- static std::string GenerateHistogramNameFromScheme(const std::string& scheme);
CompletionCallback* original_callback_;
CompletionCallbackImpl<HttpAuthHandler> wrapper_callback_;
- // When GenerateAuthToken was called.
- base::TimeTicks generate_auth_token_start_;
- scoped_refptr<base::Histogram> histogram_;
};
} // namespace net
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index 51cc55f..5710491 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -55,17 +55,18 @@
return new DefaultBackend(MEMORY_CACHE, FilePath(), max_bytes, NULL);
}
-int HttpCache::DefaultBackend::CreateBackend(disk_cache::Backend** backend,
+int HttpCache::DefaultBackend::CreateBackend(NetLog* net_log,
+ disk_cache::Backend** backend,
CompletionCallback* callback) {
DCHECK_GE(max_bytes_, 0);
return disk_cache::CreateCacheBackend(type_, path_, max_bytes_, true,
- thread_, backend, callback);
+ thread_, net_log, backend, callback);
}
//-----------------------------------------------------------------------------
-HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* e)
- : disk_entry(e),
+HttpCache::ActiveEntry::ActiveEntry(disk_cache::Entry* entry)
+ : disk_entry(entry),
writer(NULL),
will_process_pending_queue(false),
doomed(false) {
@@ -288,7 +289,8 @@
HttpNetworkDelegate* network_delegate,
NetLog* net_log,
BackendFactory* backend_factory)
- : backend_factory_(backend_factory),
+ : net_log_(net_log),
+ backend_factory_(backend_factory),
building_backend_(false),
mode_(NORMAL),
ssl_host_info_factory_(new SSLHostInfoFactoryAdaptor(
@@ -303,7 +305,8 @@
HttpCache::HttpCache(HttpNetworkSession* session,
BackendFactory* backend_factory)
- : backend_factory_(backend_factory),
+ : net_log_(session->net_log()),
+ backend_factory_(backend_factory),
building_backend_(false),
mode_(NORMAL),
network_layer_(HttpNetworkLayer::CreateFactory(session)),
@@ -311,8 +314,10 @@
}
HttpCache::HttpCache(HttpTransactionFactory* network_layer,
+ NetLog* net_log,
BackendFactory* backend_factory)
- : backend_factory_(backend_factory),
+ : net_log_(net_log),
+ backend_factory_(backend_factory),
building_backend_(false),
mode_(NORMAL),
network_layer_(network_layer),
@@ -464,7 +469,8 @@
BackendCallback* my_callback = new BackendCallback(this, pending_op);
pending_op->callback = my_callback;
- int rv = backend_factory_->CreateBackend(&pending_op->backend, my_callback);
+ int rv = backend_factory_->CreateBackend(net_log_, &pending_op->backend,
+ my_callback);
if (rv != ERR_IO_PENDING) {
pending_op->writer->ClearCallback();
my_callback->Run(rv);
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index 5c812da..0641ca4 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -23,9 +23,9 @@
#include "base/file_path.h"
#include "base/hash_tables.h"
#include "base/message_loop_proxy.h"
-#include "base/non_thread_safe.h"
#include "base/scoped_ptr.h"
#include "base/task.h"
+#include "base/threading/non_thread_safe.h"
#include "base/weak_ptr.h"
#include "net/base/cache_type.h"
#include "net/base/completion_callback.h"
@@ -58,7 +58,7 @@
class HttpCache : public HttpTransactionFactory,
public base::SupportsWeakPtr<HttpCache>,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
~HttpCache();
@@ -87,7 +87,8 @@
// notification arrives.
// The implementation must not access the factory object after invoking the
// |callback| because the object can be deleted from within the callback.
- virtual int CreateBackend(disk_cache::Backend** backend,
+ virtual int CreateBackend(NetLog* net_log,
+ disk_cache::Backend** backend,
CompletionCallback* callback) = 0;
};
@@ -105,7 +106,8 @@
static BackendFactory* InMemory(int max_bytes);
// BackendFactory implementation.
- virtual int CreateBackend(disk_cache::Backend** backend,
+ virtual int CreateBackend(NetLog* net_log,
+ disk_cache::Backend** backend,
CompletionCallback* callback);
private:
@@ -140,6 +142,7 @@
// by the HttpCache and will be destroyed using |delete| when the HttpCache is
// destroyed.
HttpCache(HttpTransactionFactory* network_layer,
+ NetLog* net_log,
BackendFactory* backend_factory);
HttpTransactionFactory* network_layer() { return network_layer_.get(); }
@@ -215,7 +218,7 @@
bool will_process_pending_queue;
bool doomed;
- explicit ActiveEntry(disk_cache::Entry*);
+ explicit ActiveEntry(disk_cache::Entry* entry);
~ActiveEntry();
};
@@ -344,6 +347,8 @@
// Variables ----------------------------------------------------------------
+ NetLog* net_log_;
+
// Used when lazily constructing the disk_cache_.
scoped_ptr<BackendFactory> backend_factory_;
bool building_backend_;
diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc
index 923ee25..b506edc 100644
--- a/net/http/http_cache_transaction.cc
+++ b/net/http/http_cache_transaction.cc
@@ -354,6 +354,19 @@
callback, true);
}
+// Histogram data from the end of 2010 show the following distribution of
+// response headers:
+//
+// Content-Length............... 87%
+// Date......................... 98%
+// Last-Modified................ 49%
+// Etag......................... 19%
+// Accept-Ranges: bytes......... 25%
+// Accept-Ranges: none.......... 0.4%
+// Strong Validator............. 50%
+// Strong Validator + ranges.... 24%
+// Strong Validator + CL........ 49%
+//
bool HttpCache::Transaction::AddTruncatedFlag() {
DCHECK(mode_ & WRITE);
@@ -385,6 +398,10 @@
return LOAD_STATE_WAITING_FOR_CACHE;
}
+const BoundNetLog& HttpCache::Transaction::net_log() const {
+ return net_log_;
+}
+
//-----------------------------------------------------------------------------
void HttpCache::Transaction::DoCallback(int rv) {
@@ -566,13 +583,14 @@
int HttpCache::Transaction::DoGetBackend() {
cache_pending_ = true;
next_state_ = STATE_GET_BACKEND_COMPLETE;
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_GET_BACKEND, NULL);
return cache_->GetBackendForTransaction(this);
}
int HttpCache::Transaction::DoGetBackendComplete(int result) {
DCHECK(result == OK || result == ERR_FAILED);
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL);
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_GET_BACKEND,
+ result);
cache_pending_ = false;
if (!ShouldPassThrough()) {
@@ -688,8 +706,6 @@
return OK;
}
- HistogramHeaders(new_response->headers);
-
// Are we expecting a response to a conditional query?
if (mode_ == READ_WRITE || mode_ == UPDATE) {
if (new_response->headers->response_code() == 304 ||
@@ -746,7 +762,7 @@
// It is important that we go to STATE_ADD_TO_ENTRY whenever the result is
// OK, otherwise the cache will end up with an active entry without any
// transaction attached.
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY, NULL);
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY, result);
cache_pending_ = false;
if (result == OK) {
next_state_ = STATE_ADD_TO_ENTRY;
@@ -789,7 +805,8 @@
// It is important that we go to STATE_ADD_TO_ENTRY whenever the result is
// OK, otherwise the cache will end up with an active entry without any
// transaction attached.
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY, NULL);
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY,
+ result);
cache_pending_ = false;
next_state_ = STATE_ADD_TO_ENTRY;
@@ -820,7 +837,7 @@
}
int HttpCache::Transaction::DoDoomEntryComplete(int result) {
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY, NULL);
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY, result);
next_state_ = STATE_CREATE_ENTRY;
cache_pending_ = false;
if (result == ERR_CACHE_RACE)
@@ -833,14 +850,15 @@
DCHECK(new_entry_);
cache_pending_ = true;
next_state_ = STATE_ADD_TO_ENTRY_COMPLETE;
- net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL);
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY, NULL);
DCHECK(entry_lock_waiting_since_.is_null());
entry_lock_waiting_since_ = base::TimeTicks::Now();
return cache_->AddTransactionToEntry(new_entry_, this);
}
int HttpCache::Transaction::DoAddToEntryComplete(int result) {
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_WAITING, NULL);
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY,
+ result);
const base::TimeDelta entry_lock_wait =
base::TimeTicks::Now() - entry_lock_waiting_since_;
@@ -991,12 +1009,19 @@
cache_callback_->AddRef(); // Balanced in DoTruncateCachedDataComplete.
if (!entry_)
return OK;
+ if (net_log_.IsLoggingAllEvents())
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_DATA, NULL);
// Truncate the stream.
return WriteToEntry(kResponseContentIndex, 0, NULL, 0, cache_callback_);
}
int HttpCache::Transaction::DoTruncateCachedDataComplete(int result) {
+ if (net_log_.IsLoggingAllEvents() && entry_) {
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_DATA,
+ result);
+ }
+
// Balance the AddRef from DoTruncateCachedData.
cache_callback_->Release();
next_state_ = STATE_TRUNCATE_CACHED_METADATA;
@@ -1009,10 +1034,17 @@
if (!entry_)
return OK;
+ if (net_log_.IsLoggingAllEvents())
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, NULL);
return WriteToEntry(kMetadataIndex, 0, NULL, 0, cache_callback_);
}
int HttpCache::Transaction::DoTruncateCachedMetadataComplete(int result) {
+ if (net_log_.IsLoggingAllEvents() && entry_) {
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_INFO,
+ result);
+ }
+
// Balance the AddRef from DoTruncateCachedMetadata.
cache_callback_->Release();
@@ -1062,7 +1094,7 @@
int HttpCache::Transaction::DoCacheReadResponseComplete(int result) {
cache_callback_->Release(); // Balance the AddRef from DoCacheReadResponse.
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO, NULL);
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_INFO, result);
if (result != io_buf_len_ ||
!HttpCache::ParseResponseInfo(read_buf_->data(), io_buf_len_,
&response_, &truncated_)) {
@@ -1102,10 +1134,14 @@
}
int HttpCache::Transaction::DoCacheWriteResponse() {
+ if (net_log_.IsLoggingAllEvents() && entry_)
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, NULL);
return WriteResponseInfoToEntry(false);
}
int HttpCache::Transaction::DoCacheWriteTruncatedResponse() {
+ if (net_log_.IsLoggingAllEvents() && entry_)
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_INFO, NULL);
return WriteResponseInfoToEntry(true);
}
@@ -1114,6 +1150,10 @@
target_state_ = STATE_NONE;
if (!entry_)
return OK;
+ if (net_log_.IsLoggingAllEvents()) {
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_INFO,
+ result);
+ }
// Balance the AddRef from WriteResponseInfoToEntry.
write_headers_callback_->Release();
@@ -1141,7 +1181,7 @@
int HttpCache::Transaction::DoCacheReadMetadataComplete(int result) {
cache_callback_->Release(); // Balance the AddRef from DoCacheReadMetadata.
- net_log_.EndEvent(NetLog::TYPE_HTTP_CACHE_READ_INFO, NULL);
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_INFO, result);
if (result != response_.metadata->size()) {
DLOG(ERROR) << "ReadData failed: " << result;
return ERR_CACHE_READ_FAILURE;
@@ -1172,6 +1212,9 @@
DCHECK(entry_);
next_state_ = STATE_CACHE_READ_DATA_COMPLETE;
cache_callback_->AddRef(); // Balanced in DoCacheReadDataComplete.
+
+ if (net_log_.IsLoggingAllEvents())
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_READ_DATA, NULL);
if (partial_.get()) {
return partial_->CacheRead(entry_->disk_entry, read_buf_, io_buf_len_,
cache_callback_);
@@ -1183,6 +1226,10 @@
int HttpCache::Transaction::DoCacheReadDataComplete(int result) {
cache_callback_->Release(); // Balance the AddRef from DoCacheReadData.
+ if (net_log_.IsLoggingAllEvents()) {
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_READ_DATA,
+ result);
+ }
if (!cache_)
return ERR_UNEXPECTED;
@@ -1202,12 +1249,18 @@
int HttpCache::Transaction::DoCacheWriteData(int num_bytes) {
next_state_ = STATE_CACHE_WRITE_DATA_COMPLETE;
write_len_ = num_bytes;
+ if (net_log_.IsLoggingAllEvents() && entry_)
+ net_log_.BeginEvent(NetLog::TYPE_HTTP_CACHE_WRITE_DATA, NULL);
cache_callback_->AddRef(); // Balanced in DoCacheWriteDataComplete.
return AppendResponseDataToEntry(read_buf_, num_bytes, cache_callback_);
}
int HttpCache::Transaction::DoCacheWriteDataComplete(int result) {
+ if (net_log_.IsLoggingAllEvents() && entry_) {
+ net_log_.EndEventWithNetErrorCode(NetLog::TYPE_HTTP_CACHE_WRITE_DATA,
+ result);
+ }
// Balance the AddRef from DoCacheWriteData.
cache_callback_->Release();
if (!cache_)
@@ -1857,47 +1910,6 @@
return result;
}
-// For a 200 response we'll add a histogram with one bit set per header:
-// 0x01 Content-Length
-// 0x02 Date
-// 0x04 Last-Modified
-// 0x08 Etag
-// 0x10 Accept-Ranges: bytes
-// 0x20 Accept-Ranges: none
-//
-// TODO(rvargas): remove after having some results.
-void HttpCache::Transaction::HistogramHeaders(
- const HttpResponseHeaders* headers) {
- if (headers->response_code() != 200)
- return;
-
- int64 content_length = headers->GetContentLength();
- int value = 0;
- if (content_length > 0)
- value = 1;
-
- Time date;
- if (headers->GetDateValue(&date))
- value += 2;
- if (headers->GetLastModifiedValue(&date))
- value += 4;
-
- std::string etag;
- headers->EnumerateHeader(NULL, "etag", &etag);
- if (!etag.empty())
- value += 8;
-
- std::string accept_ranges("Accept-Ranges");
- if (headers->HasHeaderValue(accept_ranges, "bytes"))
- value += 0x10;
- if (headers->HasHeaderValue(accept_ranges, "none"))
- value += 0x20;
-
- // |value| goes from 0 to 63. Actually, the max value should be 47 (0x2f)
- // but we'll see.
- UMA_HISTOGRAM_ENUMERATION("HttpCache.ResponseHeaders", value, 65);
-}
-
void HttpCache::Transaction::OnIOComplete(int result) {
DoLoop(result);
}
diff --git a/net/http/http_cache_transaction.h b/net/http/http_cache_transaction.h
index bc0b211..316c15b 100644
--- a/net/http/http_cache_transaction.h
+++ b/net/http/http_cache_transaction.h
@@ -110,6 +110,8 @@
CompletionCallback* io_callback() { return &io_callback_; }
+ const BoundNetLog& net_log() const;
+
private:
static const size_t kNumValidationHeaders = 2;
// Helper struct to pair a header name with its value, for
@@ -312,9 +314,6 @@
// working with range requests.
int DoPartialCacheReadCompleted(int result);
- // Sends a histogram with info about the response headers.
- void HistogramHeaders(const HttpResponseHeaders* headers);
-
// Called to signal completion of asynchronous IO.
void OnIOComplete(int result);
diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc
index a40a5b8..bf8cb6b 100644
--- a/net/http/http_cache_unittest.cc
+++ b/net/http/http_cache_unittest.cc
@@ -536,7 +536,8 @@
class MockBackendFactory : public net::HttpCache::BackendFactory {
public:
- virtual int CreateBackend(disk_cache::Backend** backend,
+ virtual int CreateBackend(net::NetLog* /* net_log */,
+ disk_cache::Backend** backend,
net::CompletionCallback* callback) {
*backend = new MockDiskCache();
return net::OK;
@@ -546,11 +547,11 @@
class MockHttpCache {
public:
MockHttpCache()
- : http_cache_(new MockNetworkLayer(), new MockBackendFactory()) {
+ : http_cache_(new MockNetworkLayer(), NULL, new MockBackendFactory()) {
}
explicit MockHttpCache(net::HttpCache::BackendFactory* disk_cache_factory)
- : http_cache_(new MockNetworkLayer(), disk_cache_factory) {
+ : http_cache_(new MockNetworkLayer(), NULL, disk_cache_factory) {
}
net::HttpCache* http_cache() { return &http_cache_; }
@@ -610,7 +611,8 @@
}
// Helper function to synchronously create a backend entry.
- bool CreateBackendEntry(const std::string& key, disk_cache::Entry** entry) {
+ bool CreateBackendEntry(const std::string& key, disk_cache::Entry** entry,
+ net::NetLog* /* net_log */) {
TestCompletionCallback cb;
int rv = disk_cache()->CreateEntry(key, entry, &cb);
return (cb.GetResult(rv) == net::OK);
@@ -630,7 +632,8 @@
class MockBackendNoCbFactory : public net::HttpCache::BackendFactory {
public:
- virtual int CreateBackend(disk_cache::Backend** backend,
+ virtual int CreateBackend(net::NetLog* /* net_log */,
+ disk_cache::Backend** backend,
net::CompletionCallback* callback) {
*backend = new MockDiskCacheNoCB();
return net::OK;
@@ -643,7 +646,8 @@
MockBlockingBackendFactory()
: backend_(NULL), callback_(NULL), block_(true), fail_(false) {}
- virtual int CreateBackend(disk_cache::Backend** backend,
+ virtual int CreateBackend(net::NetLog* /* net_log */,
+ disk_cache::Backend** backend,
net::CompletionCallback* callback) {
if (!block_) {
if (!fail_)
@@ -1037,6 +1041,7 @@
cache.disk_cache()->set_fail_requests();
net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded);
+ log.SetLogLevel(net::NetLog::LOG_BASIC);
// Read from the network, and don't use the cache.
RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction,
@@ -1049,9 +1054,9 @@
EXPECT_EQ(6u, entries.size());
EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 0, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 1, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
EXPECT_TRUE(net::LogContainsBeginEvent(
entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
EXPECT_TRUE(net::LogContainsEndEvent(
@@ -1143,6 +1148,9 @@
net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded);
+ // This prevents a number of write events from being logged.
+ log.SetLogLevel(net::NetLog::LOG_BASIC);
+
// write to the cache
RunTransactionTestWithLog(cache.http_cache(), kSimpleGET_Transaction,
log.bound());
@@ -1153,9 +1161,9 @@
EXPECT_EQ(8u, entries.size());
EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 0, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 1, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
EXPECT_TRUE(net::LogContainsBeginEvent(
entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
EXPECT_TRUE(net::LogContainsEndEvent(
@@ -1165,9 +1173,9 @@
EXPECT_TRUE(net::LogContainsEndEvent(
entries, 5, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 6, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 6, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 7, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 7, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
// force this transaction to read from the cache
MockTransaction transaction(kSimpleGET_Transaction);
@@ -1182,17 +1190,17 @@
EXPECT_EQ(8u, entries.size());
EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 0, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 1, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
EXPECT_TRUE(net::LogContainsBeginEvent(
entries, 2, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
EXPECT_TRUE(net::LogContainsEndEvent(
entries, 3, net::NetLog::TYPE_HTTP_CACHE_OPEN_ENTRY));
EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 4, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 4, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 5, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 5, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
EXPECT_TRUE(net::LogContainsBeginEvent(
entries, 6, net::NetLog::TYPE_HTTP_CACHE_READ_INFO));
EXPECT_TRUE(net::LogContainsEndEvent(
@@ -1273,6 +1281,9 @@
net::CapturingBoundNetLog log(net::CapturingNetLog::kUnbounded);
+ // This prevents a number of write events from being logged.
+ log.SetLogLevel(net::NetLog::LOG_BASIC);
+
RunTransactionTestWithLog(cache.http_cache(), transaction, log.bound());
// Check that the NetLog was filled as expected.
@@ -1281,9 +1292,9 @@
EXPECT_EQ(8u, entries.size());
EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 0, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 0, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 1, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 1, net::NetLog::TYPE_HTTP_CACHE_GET_BACKEND));
EXPECT_TRUE(net::LogContainsBeginEvent(
entries, 2, net::NetLog::TYPE_HTTP_CACHE_DOOM_ENTRY));
EXPECT_TRUE(net::LogContainsEndEvent(
@@ -1293,9 +1304,9 @@
EXPECT_TRUE(net::LogContainsEndEvent(
entries, 5, net::NetLog::TYPE_HTTP_CACHE_CREATE_ENTRY));
EXPECT_TRUE(net::LogContainsBeginEvent(
- entries, 6, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 6, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
EXPECT_TRUE(net::LogContainsEndEvent(
- entries, 7, net::NetLog::TYPE_HTTP_CACHE_WAITING));
+ entries, 7, net::NetLog::TYPE_HTTP_CACHE_ADD_TO_ENTRY));
EXPECT_EQ(2, cache.network_layer()->transaction_count());
EXPECT_EQ(0, cache.disk_cache()->open_count());
@@ -3302,7 +3313,8 @@
// Create a disk cache entry that stores 206 headers while not being sparse.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kSimpleGET_Transaction.url, &entry));
+ ASSERT_TRUE(cache.CreateBackendEntry(kSimpleGET_Transaction.url, &entry,
+ NULL));
std::string raw_headers(kRangeGET_TransactionOK.status);
raw_headers.append("\n");
@@ -3345,7 +3357,8 @@
// Create a disk cache entry that stores 206 headers while not being sparse.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry));
+ ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry,
+ NULL));
std::string raw_headers(kRangeGET_TransactionOK.status);
raw_headers.append("\n");
@@ -3943,7 +3956,8 @@
TEST(HttpCache, WriteResponseInfo_Truncated) {
MockHttpCache cache;
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry("http://www.google.com", &entry));
+ ASSERT_TRUE(cache.CreateBackendEntry("http://www.google.com", &entry,
+ NULL));
std::string headers("HTTP/1.1 200 OK");
headers = net::HttpUtil::AssembleRawHeaders(headers.data(), headers.size());
@@ -4142,7 +4156,8 @@
// Create a disk cache entry that stores an incomplete resource.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry));
+ ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry,
+ NULL));
std::string raw_headers("HTTP/1.1 200 OK\n"
"Last-Modified: Sat, 18 Apr 2009 01:10:43 GMT\n"
@@ -4202,7 +4217,8 @@
// Create a disk cache entry that stores an incomplete resource.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry));
+ ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry,
+ NULL));
// Content-length will be intentionally bad.
@@ -4261,7 +4277,8 @@
// Create a disk cache entry that stores an incomplete resource.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry));
+ ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry,
+ NULL));
std::string raw_headers("HTTP/1.1 200 OK\n"
"Last-Modified: Sat, 18 Apr 2009 01:10:43 GMT\n"
@@ -4326,7 +4343,8 @@
// Create a disk cache entry that stores an incomplete resource.
disk_cache::Entry* entry;
- ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry));
+ ASSERT_TRUE(cache.CreateBackendEntry(kRangeGET_TransactionOK.url, &entry,
+ NULL));
// Content-length will be intentionally bogus.
std::string raw_headers("HTTP/1.1 200 OK\n"
diff --git a/net/http/http_network_layer.cc b/net/http/http_network_layer.cc
index 3d3c5dd..9a11034 100644
--- a/net/http/http_network_layer.cc
+++ b/net/http/http_network_layer.cc
@@ -5,6 +5,7 @@
#include "net/http/http_network_layer.h"
#include "base/logging.h"
+#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "net/http/http_network_session.h"
@@ -188,6 +189,7 @@
static const char kOff[] = "off";
static const char kSSL[] = "ssl";
static const char kDisableSSL[] = "no-ssl";
+ static const char kExclude[] = "exclude"; // Hosts to exclude
static const char kDisableCompression[] = "no-compress";
static const char kDisableAltProtocols[] = "no-alt-protocols";
static const char kEnableVersionOne[] = "v1";
@@ -228,7 +230,12 @@
for (std::vector<std::string>::iterator it = spdy_options.begin();
it != spdy_options.end(); ++it) {
- const std::string& option = *it;
+ const std::string& element = *it;
+ std::vector<std::string> name_value;
+ base::SplitString(element, '=', &name_value);
+ const std::string& option = name_value[0];
+ const std::string value = name_value.size() > 1 ? name_value[1] : "";
+
if (option == kOff) {
HttpStreamFactory::set_spdy_enabled(false);
} else if (option == kDisableSSL) {
@@ -238,6 +245,8 @@
} else if (option == kSSL) {
HttpStreamFactory::set_force_spdy_over_ssl(true);
HttpStreamFactory::set_force_spdy_always(true);
+ } else if (option == kExclude) {
+ HttpStreamFactory::add_forced_spdy_exclusion(value);
} else if (option == kDisableCompression) {
spdy::SpdyFramer::set_enable_compression_default(false);
} else if (option == kEnableNPN) {
diff --git a/net/http/http_network_layer.h b/net/http/http_network_layer.h
index 91e1a86..730b5c7 100644
--- a/net/http/http_network_layer.h
+++ b/net/http/http_network_layer.h
@@ -8,9 +8,9 @@
#include <string>
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "net/http/http_transaction_factory.h"
namespace net {
@@ -29,7 +29,8 @@
class SSLConfigService;
class SSLHostInfoFactory;
-class HttpNetworkLayer : public HttpTransactionFactory, public NonThreadSafe {
+class HttpNetworkLayer : public HttpTransactionFactory,
+ public base::NonThreadSafe {
public:
// |socket_factory|, |proxy_service|, |host_resolver|, etc. must remain
// valid for the lifetime of HttpNetworkLayer.
diff --git a/net/http/http_network_session.h b/net/http/http_network_session.h
index 2c923b6..b36d7f7 100644
--- a/net/http/http_network_session.h
+++ b/net/http/http_network_session.h
@@ -8,9 +8,9 @@
#include <map>
#include <set>
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "net/base/host_port_pair.h"
#include "net/base/host_resolver.h"
#include "net/base/ssl_client_auth_cache.h"
@@ -45,7 +45,7 @@
// This class holds session objects used by HttpNetworkTransaction objects.
class HttpNetworkSession : public base::RefCounted<HttpNetworkSession>,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
HttpNetworkSession(
HostResolver* host_resolver,
@@ -130,6 +130,10 @@
return &http_stream_factory_;
}
+ NetLog* net_log() {
+ return net_log_;
+ }
+
// Creates a Value summary of the state of the socket pools. The caller is
// responsible for deleting the returned value.
Value* SocketPoolInfoToValue() const {
diff --git a/net/http/http_response_headers.h b/net/http/http_response_headers.h
index aacd35a..2b556b3 100644
--- a/net/http/http_response_headers.h
+++ b/net/http/http_response_headers.h
@@ -27,6 +27,16 @@
class HttpResponseHeaders
: public base::RefCountedThreadSafe<HttpResponseHeaders> {
public:
+ // Persist options.
+ typedef int PersistOptions;
+ static const PersistOptions PERSIST_RAW = -1; // Raw, unparsed headers.
+ static const PersistOptions PERSIST_ALL = 0; // Parsed headers.
+ static const PersistOptions PERSIST_SANS_COOKIES = 1 << 0;
+ static const PersistOptions PERSIST_SANS_CHALLENGES = 1 << 1;
+ static const PersistOptions PERSIST_SANS_HOP_BY_HOP = 1 << 2;
+ static const PersistOptions PERSIST_SANS_NON_CACHEABLE = 1 << 3;
+ static const PersistOptions PERSIST_SANS_RANGES = 1 << 4;
+
// Parses the given raw_headers. raw_headers should be formatted thus:
// includes the http status response line, each line is \0-terminated, and
// it's terminated by an empty line (ie, 2 \0s in a row).
@@ -45,16 +55,6 @@
// be passed to the pickle's various Read* methods.
HttpResponseHeaders(const Pickle& pickle, void** pickle_iter);
- // Persist options.
- typedef int PersistOptions;
- static const PersistOptions PERSIST_RAW = -1; // Raw, unparsed headers.
- static const PersistOptions PERSIST_ALL = 0; // Parsed headers.
- static const PersistOptions PERSIST_SANS_COOKIES = 1 << 0;
- static const PersistOptions PERSIST_SANS_CHALLENGES = 1 << 1;
- static const PersistOptions PERSIST_SANS_HOP_BY_HOP = 1 << 2;
- static const PersistOptions PERSIST_SANS_NON_CACHEABLE = 1 << 3;
- static const PersistOptions PERSIST_SANS_RANGES = 1 << 4;
-
// Appends a representation of this object to the given pickle.
// The options argument can be a combination of PersistOptions.
void Persist(Pickle* pickle, PersistOptions options);
@@ -253,6 +253,19 @@
typedef base::hash_set<std::string> HeaderSet;
+ // The members of this structure point into raw_headers_.
+ struct ParsedHeader {
+ std::string::const_iterator name_begin;
+ std::string::const_iterator name_end;
+ std::string::const_iterator value_begin;
+ std::string::const_iterator value_end;
+
+ // A header "continuation" contains only a subsequent value for the
+ // preceding header. (Header values are comma separated.)
+ bool is_continuation() const { return name_begin == name_end; }
+ };
+ typedef std::vector<ParsedHeader> HeaderList;
+
HttpResponseHeaders();
~HttpResponseHeaders();
@@ -319,19 +332,6 @@
// Adds the set of content range response headers.
static void AddHopContentRangeHeaders(HeaderSet* header_names);
- // The members of this structure point into raw_headers_.
- struct ParsedHeader {
- std::string::const_iterator name_begin;
- std::string::const_iterator name_end;
- std::string::const_iterator value_begin;
- std::string::const_iterator value_end;
-
- // A header "continuation" contains only a subsequent value for the
- // preceding header. (Header values are comma separated.)
- bool is_continuation() const { return name_begin == name_end; }
- };
- typedef std::vector<ParsedHeader> HeaderList;
-
// We keep a list of ParsedHeader objects. These tell us where to locate the
// header-value pairs within raw_headers_.
HeaderList parsed_;
diff --git a/net/http/http_response_info.h b/net/http/http_response_info.h
index cd66982..4fbea3d 100644
--- a/net/http/http_response_info.h
+++ b/net/http/http_response_info.h
@@ -28,6 +28,14 @@
// Even though we could get away with the copy ctor and default operator=,
// that would prevent us from doing a bunch of forward declaration.
+ // Initializes from the representation stored in the given pickle.
+ bool InitFromPickle(const Pickle& pickle, bool* response_truncated);
+
+ // Call this method to persist the response info.
+ void Persist(Pickle* pickle,
+ bool skip_transient_headers,
+ bool response_truncated) const;
+
// The following is only defined if the request_time member is set.
// If this response was resurrected from cache, then this bool is set, and
// request_time may corresponds to a time "far" in the past. Note that
@@ -81,14 +89,6 @@
// Any metadata asociated with this resource's cached data.
scoped_refptr<IOBufferWithSize> metadata;
-
- // Initializes from the representation stored in the given pickle.
- bool InitFromPickle(const Pickle& pickle, bool* response_truncated);
-
- // Call this method to persist the response info.
- void Persist(Pickle* pickle,
- bool skip_transient_headers,
- bool response_truncated) const;
};
} // namespace net
diff --git a/net/http/http_stream_factory.cc b/net/http/http_stream_factory.cc
index e30c0c5..b575f48 100644
--- a/net/http/http_stream_factory.cc
+++ b/net/http/http_stream_factory.cc
@@ -28,6 +28,8 @@
// static
bool HttpStreamFactory::force_spdy_always_ = false;
// static
+std::list<HostPortPair>* HttpStreamFactory::forced_spdy_exclusions_ = NULL;
+// static
bool HttpStreamFactory::ignore_certificate_errors_ = false;
// static
diff --git a/net/http/http_stream_factory.h b/net/http/http_stream_factory.h
index c5a0dc3..3bb6d2f 100644
--- a/net/http/http_stream_factory.h
+++ b/net/http/http_stream_factory.h
@@ -5,6 +5,7 @@
#ifndef NET_HTTP_HTTP_STREAM_FACTORY_H_
#define NET_HTTP_HTTP_STREAM_FACTORY_H_
+#include <list>
#include <map>
#include <set>
#include <string>
@@ -12,6 +13,7 @@
#include "base/scoped_ptr.h"
#include "net/base/completion_callback.h"
#include "net/base/host_mapping_rules.h"
+#include "net/base/host_port_pair.h"
#include "net/base/ssl_config_service.h"
#include "net/http/http_auth.h"
#include "net/http/http_auth_controller.h"
@@ -91,6 +93,17 @@
}
static bool force_spdy_always() { return force_spdy_always_; }
+ // Add a URL to exclude from forced SPDY.
+ static void add_forced_spdy_exclusion(const std::string& value) {
+ HostPortPair pair = HostPortPair::FromURL(GURL(value));
+ if (!forced_spdy_exclusions_)
+ forced_spdy_exclusions_ = new std::list<HostPortPair>();
+ forced_spdy_exclusions_->push_back(pair);
+ }
+ static std::list<HostPortPair>* forced_spdy_exclusions() {
+ return forced_spdy_exclusions_;
+ }
+
// Sets the next protocol negotiation value used during the SSL handshake.
static void set_next_protos(const std::string& value) {
delete next_protos_;
@@ -120,6 +133,7 @@
static bool use_alternate_protocols_;
static bool force_spdy_over_ssl_;
static bool force_spdy_always_;
+ static std::list<HostPortPair>* forced_spdy_exclusions_;
static bool ignore_certificate_errors_;
DISALLOW_COPY_AND_ASSIGN(HttpStreamFactory);
diff --git a/net/http/http_stream_request.cc b/net/http/http_stream_request.cc
index 8f4c9b1..242f899 100644
--- a/net/http/http_stream_request.cc
+++ b/net/http/http_stream_request.cc
@@ -451,6 +451,29 @@
return OK;
}
+bool HasSpdyExclusion(const HostPortPair& endpoint) {
+ std::list<HostPortPair>* exclusions =
+ HttpStreamFactory::forced_spdy_exclusions();
+ if (!exclusions)
+ return false;
+
+ std::list<HostPortPair>::const_iterator it;
+ for (it = exclusions->begin(); it != exclusions->end(); it++)
+ if (it->Equals(endpoint))
+ return true;
+ return false;
+}
+
+bool HttpStreamRequest::ShouldForceSpdySSL() {
+ bool rv = force_spdy_always_ && force_spdy_over_ssl_;
+ return rv && !HasSpdyExclusion(endpoint_);
+}
+
+bool HttpStreamRequest::ShouldForceSpdyWithoutSSL() {
+ bool rv = force_spdy_always_ && !force_spdy_over_ssl_;
+ return rv && !HasSpdyExclusion(endpoint_);
+}
+
int HttpStreamRequest::DoInitConnection() {
DCHECK(!connection_->is_initialized());
DCHECK(proxy_info()->proxy_server().is_valid());
@@ -460,8 +483,7 @@
alternate_protocol_mode_ == kUsingAlternateProtocol &&
alternate_protocol_ == HttpAlternateProtocols::NPN_SPDY_2;
using_ssl_ = request_info().url.SchemeIs("https") ||
- (force_spdy_always_ && force_spdy_over_ssl_) ||
- want_spdy_over_npn;
+ ShouldForceSpdySSL() || want_spdy_over_npn;
using_spdy_ = false;
// If spdy has been turned off on-the-fly, then there may be SpdySessions
@@ -677,7 +699,7 @@
if (ssl_socket->was_spdy_negotiated())
SwitchToSpdyMode();
}
- if (force_spdy_over_ssl_ && force_spdy_always_)
+ if (ShouldForceSpdySSL())
SwitchToSpdyMode();
} else if (proxy_info()->is_https() && connection_->socket() &&
result == OK) {
@@ -690,7 +712,7 @@
}
// We may be using spdy without SSL
- if (!force_spdy_over_ssl_ && force_spdy_always_)
+ if (ShouldForceSpdyWithoutSSL())
SwitchToSpdyMode();
if (result == ERR_PROXY_AUTH_REQUESTED ||
@@ -913,7 +935,7 @@
new SSLSocketParams(tcp_params, socks_params, http_proxy_params,
proxy_scheme, host_and_port,
*ssl_config(), load_flags,
- force_spdy_always_ && force_spdy_over_ssl_,
+ ShouldForceSpdySSL(),
want_spdy_over_npn));
return ssl_params;
diff --git a/net/http/http_stream_request.h b/net/http/http_stream_request.h
index f20b5f3..62ba5d8 100644
--- a/net/http/http_stream_request.h
+++ b/net/http/http_stream_request.h
@@ -180,6 +180,12 @@
// Moves this stream request into SPDY mode.
void SwitchToSpdyMode();
+ // Should we force SPDY to run over SSL for this stream request.
+ bool ShouldForceSpdySSL();
+
+ // Should we force SPDY to run without SSL for this stream request.
+ bool ShouldForceSpdyWithoutSSL();
+
// Record histograms of latency until Connect() completes.
static void LogHttpConnectedMetrics(const ClientSocketHandle& handle);
diff --git a/net/http/http_util.cc b/net/http/http_util.cc
index 1f57d70..bf56136 100644
--- a/net/http/http_util.cc
+++ b/net/http/http_util.cc
@@ -806,6 +806,8 @@
value_is_quoted_(false) {
}
+HttpUtil::NameValuePairsIterator::~NameValuePairsIterator() {}
+
// We expect properties to be formatted as one of:
// name="value"
// name='value'
diff --git a/net/http/http_util.h b/net/http/http_util.h
index 2f5bd85..3da1635 100644
--- a/net/http/http_util.h
+++ b/net/http/http_util.h
@@ -283,6 +283,7 @@
NameValuePairsIterator(std::string::const_iterator begin,
std::string::const_iterator end,
char delimiter);
+ ~NameValuePairsIterator();
// Advances the iterator to the next pair, if any. Returns true if there
// is a next pair. Use name* and value* methods to access the resultant
diff --git a/net/net.gyp b/net/net.gyp
index 09b6267..649544a 100644
--- a/net/net.gyp
+++ b/net/net.gyp
@@ -1205,7 +1205,8 @@
'msvs_guid': '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942',
'variables': {
'grit_cmd': ['python', '../tools/grit/grit.py'],
- 'grit_info_cmd': ['python', '../tools/grit/grit_info.py'],
+ 'grit_info_cmd': ['python', '../tools/grit/grit_info.py',
+ '<@(grit_defines)'],
'input_paths': [
'base/net_resources.grd',
],
@@ -1224,7 +1225,8 @@
'action':
['<@(grit_cmd)',
'-i', '<(RULE_INPUT_PATH)', 'build',
- '-o', '<(SHARED_INTERMEDIATE_DIR)/net'],
+ '-o', '<(SHARED_INTERMEDIATE_DIR)/net',
+ '<@(grit_defines)'],
'message': 'Generating resources from <(RULE_INPUT_PATH)',
},
],
diff --git a/net/ocsp/nss_ocsp.cc b/net/ocsp/nss_ocsp.cc
index 02edd05..78eb7f5 100644
--- a/net/ocsp/nss_ocsp.cc
+++ b/net/ocsp/nss_ocsp.cc
@@ -16,7 +16,6 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
-#include "base/condition_variable.h"
#include "base/lazy_instance.h"
#include "base/lock.h"
#include "base/logging.h"
@@ -25,7 +24,8 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_checker.h"
+#include "base/synchronization/condition_variable.h"
+#include "base/threading/thread_checker.h"
#include "base/time.h"
#include "googleurl/src/gurl.h"
#include "net/base/io_buffer.h"
@@ -46,7 +46,7 @@
class OCSPIOLoop {
public:
void StartUsing() {
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
used_ = true;
}
@@ -54,7 +54,7 @@
void Shutdown();
bool used() const {
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
return used_;
}
@@ -74,13 +74,13 @@
void CancelAllRequests();
- mutable Lock lock_;
+ mutable base::Lock lock_;
bool shutdown_; // Protected by |lock_|.
std::set<OCSPRequestSession*> requests_; // Protected by |lock_|.
bool used_; // Protected by |lock_|.
// This should not be modified after |used_|.
MessageLoopForIO* io_loop_; // Protected by |lock_|.
- ThreadChecker thread_checker_;
+ base::ThreadChecker thread_checker_;
DISALLOW_COPY_AND_ASSIGN(OCSPIOLoop);
};
@@ -188,18 +188,18 @@
void Cancel() {
// IO thread may set |io_loop_| to NULL, so protect by |lock_|.
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
CancelLocked();
}
bool Finished() const {
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
return finished_;
}
bool Wait() {
base::TimeDelta timeout = timeout_;
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
while (!finished_) {
base::TimeTicks last_time = base::TimeTicks::Now();
cv_.TimedWait(timeout);
@@ -290,7 +290,7 @@
request_ = NULL;
g_ocsp_io_loop.Get().RemoveRequest(this);
{
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
finished_ = true;
io_loop_ = NULL;
}
@@ -303,7 +303,7 @@
void CancelURLRequest() {
#ifndef NDEBUG
{
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
if (io_loop_)
DCHECK_EQ(MessageLoopForIO::current(), io_loop_);
}
@@ -314,7 +314,7 @@
request_ = NULL;
g_ocsp_io_loop.Get().RemoveRequest(this);
{
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
finished_ = true;
io_loop_ = NULL;
}
@@ -356,7 +356,7 @@
return;
{
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
DCHECK(!io_loop_);
io_loop_ = MessageLoopForIO::current();
g_ocsp_io_loop.Get().AddRequest(this);
@@ -401,8 +401,8 @@
std::string data_; // Results of the requst
// |lock_| protects |finished_| and |io_loop_|.
- mutable Lock lock_;
- ConditionVariable cv_;
+ mutable base::Lock lock_;
+ base::ConditionVariable cv_;
MessageLoop* io_loop_; // Message loop of the IO thread
bool finished_;
@@ -462,7 +462,7 @@
// IO thread was already deleted before the singleton is deleted
// in AtExitManager.
{
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
DCHECK(!io_loop_);
DCHECK(!used_);
DCHECK(shutdown_);
@@ -479,7 +479,7 @@
// Prevent the worker thread from trying to access |io_loop_|.
{
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
io_loop_ = NULL;
used_ = false;
shutdown_ = true;
@@ -494,13 +494,13 @@
void OCSPIOLoop::PostTaskToIOLoop(
const tracked_objects::Location& from_here, Task* task) {
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
if (io_loop_)
io_loop_->PostTask(from_here, task);
}
void OCSPIOLoop::EnsureIOLoop() {
- AutoLock autolock(lock_);
+ base::AutoLock autolock(lock_);
DCHECK_EQ(MessageLoopForIO::current(), io_loop_);
}
@@ -512,7 +512,7 @@
void OCSPIOLoop::RemoveRequest(OCSPRequestSession* request) {
{
// Ignore if we've already shutdown.
- AutoLock auto_lock(lock_);
+ base::AutoLock auto_lock(lock_);
if (shutdown_)
return;
}
diff --git a/net/ocsp/nss_ocsp.h b/net/ocsp/nss_ocsp.h
index cf2e66e..fae7a87 100644
--- a/net/ocsp/nss_ocsp.h
+++ b/net/ocsp/nss_ocsp.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -6,10 +6,10 @@
#define NET_OCSP_NSS_OCSP_H_
#pragma once
-class URLRequestContext;
-
namespace net {
+class URLRequestContext;
+
// Sets the MessageLoop for OCSP to the current message loop.
// This should be called before EnsureOCSPInit() if you want to
// control the message loop for OCSP.
diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc
index 6c348d2..ad1228c 100644
--- a/net/proxy/multi_threaded_proxy_resolver.cc
+++ b/net/proxy/multi_threaded_proxy_resolver.cc
@@ -7,7 +7,7 @@
#include "base/message_loop.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/proxy/proxy_info.h"
diff --git a/net/proxy/multi_threaded_proxy_resolver.h b/net/proxy/multi_threaded_proxy_resolver.h
index 1ad28f7..4dbe878 100644
--- a/net/proxy/multi_threaded_proxy_resolver.h
+++ b/net/proxy/multi_threaded_proxy_resolver.h
@@ -10,9 +10,9 @@
#include <vector>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "net/proxy/proxy_resolver.h"
namespace base {
@@ -71,7 +71,8 @@
// a global counter and using that to make a decision. In the
// multi-threaded model, each thread may have a different value for this
// counter, so it won't globally be seen as monotonically increasing!
-class MultiThreadedProxyResolver : public ProxyResolver, public NonThreadSafe {
+class MultiThreadedProxyResolver : public ProxyResolver,
+ public base::NonThreadSafe {
public:
// Creates an asynchronous ProxyResolver that runs requests on up to
// |max_num_threads|.
diff --git a/net/proxy/multi_threaded_proxy_resolver_unittest.cc b/net/proxy/multi_threaded_proxy_resolver_unittest.cc
index a18804f..78409e5 100644
--- a/net/proxy/multi_threaded_proxy_resolver_unittest.cc
+++ b/net/proxy/multi_threaded_proxy_resolver_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
@@ -7,8 +7,9 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
+#include "base/threading/platform_thread.h"
#include "base/utf_string_conversions.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "googleurl/src/gurl.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
@@ -40,7 +41,7 @@
RequestHandle* request,
const BoundNetLog& net_log) {
if (resolve_latency_ms_)
- PlatformThread::Sleep(resolve_latency_ms_);
+ base::PlatformThread::Sleep(resolve_latency_ms_);
CheckIsOnWorkerThread();
diff --git a/net/proxy/polling_proxy_config_service.cc b/net/proxy/polling_proxy_config_service.cc
index 2db9792..98a164d 100644
--- a/net/proxy/polling_proxy_config_service.cc
+++ b/net/proxy/polling_proxy_config_service.cc
@@ -8,7 +8,7 @@
#include "base/message_loop_proxy.h"
#include "base/observer_list.h"
#include "base/scoped_ptr.h"
-#include "base/worker_pool.h"
+#include "base/threading/worker_pool.h"
#include "net/proxy/proxy_config.h"
namespace net {
@@ -88,10 +88,10 @@
last_poll_time_ = base::TimeTicks::Now();
poll_task_outstanding_ = true;
poll_task_queued_ = false;
- WorkerPool::PostTask(
+ base::WorkerPool::PostTask(
FROM_HERE,
- NewRunnableMethod(
- this, &Core::PollOnWorkerThread, get_config_func_), true);
+ NewRunnableMethod(this, &Core::PollOnWorkerThread, get_config_func_),
+ true);
}
private:
diff --git a/net/proxy/proxy_config_service_linux_unittest.cc b/net/proxy/proxy_config_service_linux_unittest.cc
index 2cb1259..3005326 100644
--- a/net/proxy/proxy_config_service_linux_unittest.cc
+++ b/net/proxy/proxy_config_service_linux_unittest.cc
@@ -15,8 +15,8 @@
#include "base/string_util.h"
#include "base/stringprintf.h"
#include "base/task.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
#include "net/proxy/proxy_config.h"
#include "net/proxy/proxy_config_service_common_unittest.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/net/proxy/proxy_config_service_mac.cc b/net/proxy/proxy_config_service_mac.cc
index c6faa27..3dacf77 100644
--- a/net/proxy/proxy_config_service_mac.cc
+++ b/net/proxy/proxy_config_service_mac.cc
@@ -8,7 +8,7 @@
#include <SystemConfiguration/SystemConfiguration.h>
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
#include "net/base/net_errors.h"
@@ -27,7 +27,7 @@
bool GetBoolFromDictionary(CFDictionaryRef dict,
CFStringRef key,
bool default_value) {
- CFNumberRef number = (CFNumberRef)mac_util::GetValueFromDictionary(
+ CFNumberRef number = (CFNumberRef)base::mac::GetValueFromDictionary(
dict, key, CFNumberGetTypeID());
if (!number)
return default_value;
@@ -59,7 +59,7 @@
if (GetBoolFromDictionary(config_dict.get(),
kSCPropNetProxiesProxyAutoConfigEnable,
false)) {
- CFStringRef pac_url_ref = (CFStringRef)mac_util::GetValueFromDictionary(
+ CFStringRef pac_url_ref = (CFStringRef)base::mac::GetValueFromDictionary(
config_dict.get(),
kSCPropNetProxiesProxyAutoConfigURLString,
CFStringGetTypeID());
@@ -129,7 +129,7 @@
// proxy bypass list
CFArrayRef bypass_array_ref =
- (CFArrayRef)mac_util::GetValueFromDictionary(
+ (CFArrayRef)base::mac::GetValueFromDictionary(
config_dict.get(),
kSCPropNetProxiesExceptionsList,
CFArrayGetTypeID());
diff --git a/net/proxy/proxy_config_service_win.cc b/net/proxy/proxy_config_service_win.cc
index 5aca4ae..849fc24 100644
--- a/net/proxy/proxy_config_service_win.cc
+++ b/net/proxy/proxy_config_service_win.cc
@@ -12,7 +12,7 @@
#include "base/string_tokenizer.h"
#include "base/string_util.h"
#include "base/stl_util-inl.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/win/registry.h"
#include "net/base/net_errors.h"
#include "net/proxy/proxy_config.h"
@@ -39,7 +39,7 @@
// RegKey and ObjectWatcher pair.
class ProxyConfigServiceWin::KeyEntry {
public:
- bool StartWatching(base::ObjectWatcher::Delegate* delegate) {
+ bool StartWatching(base::win::ObjectWatcher::Delegate* delegate) {
// Try to create a watch event for the registry key (which watches the
// sibling tree as well).
if (!key_.StartWatching())
@@ -63,7 +63,7 @@
private:
base::win::RegKey key_;
- base::ObjectWatcher watcher_;
+ base::win::ObjectWatcher watcher_;
};
ProxyConfigServiceWin::ProxyConfigServiceWin()
diff --git a/net/proxy/proxy_config_service_win.h b/net/proxy/proxy_config_service_win.h
index e10e9a0..dc1da12 100644
--- a/net/proxy/proxy_config_service_win.h
+++ b/net/proxy/proxy_config_service_win.h
@@ -12,7 +12,7 @@
#include <vector>
#include "base/gtest_prod_util.h"
-#include "base/object_watcher.h"
+#include "base/win/object_watcher.h"
#include "net/proxy/polling_proxy_config_service.h"
namespace net {
@@ -40,7 +40,7 @@
// change, or in case we got it wrong (and are not checking all possible
// registry dependencies).
class ProxyConfigServiceWin : public PollingProxyConfigService,
- public base::ObjectWatcher::Delegate {
+ public base::win::ObjectWatcher::Delegate {
public:
ProxyConfigServiceWin();
virtual ~ProxyConfigServiceWin();
diff --git a/net/proxy/proxy_resolver_mac.cc b/net/proxy/proxy_resolver_mac.cc
index 128450f..31d9b61 100644
--- a/net/proxy/proxy_resolver_mac.cc
+++ b/net/proxy/proxy_resolver_mac.cc
@@ -7,7 +7,7 @@
#include <CoreFoundation/CoreFoundation.h>
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
@@ -154,7 +154,7 @@
// PAC file, I'm going home.
CFStringRef proxy_type =
- (CFStringRef)mac_util::GetValueFromDictionary(proxy_dictionary,
+ (CFStringRef)base::mac::GetValueFromDictionary(proxy_dictionary,
kCFProxyTypeKey,
CFStringGetTypeID());
ProxyServer proxy_server = ProxyServer::FromDictionary(
diff --git a/net/proxy/proxy_script_fetcher.h b/net/proxy/proxy_script_fetcher.h
index bf33bcb..9829316 100644
--- a/net/proxy/proxy_script_fetcher.h
+++ b/net/proxy/proxy_script_fetcher.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -14,10 +14,11 @@
#include "net/base/completion_callback.h"
class GURL;
-class URLRequestContext;
namespace net {
+class URLRequestContext;
+
// Interface for downloading a PAC script. Implementations can enforce
// timeouts, maximum size constraints, content encoding, etc..
class ProxyScriptFetcher {
diff --git a/net/proxy/proxy_script_fetcher_impl.h b/net/proxy/proxy_script_fetcher_impl.h
index 4461650..bd141f3 100644
--- a/net/proxy/proxy_script_fetcher_impl.h
+++ b/net/proxy/proxy_script_fetcher_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -16,11 +16,12 @@
#include "net/url_request/url_request.h"
class GURL;
-class URLRequestContext;
class X509Certificate;
namespace net {
+class URLRequestContext;
+
// Implementation of ProxyScriptFetcher that downloads scripts using the
// specified request context.
class ProxyScriptFetcherImpl : public ProxyScriptFetcher,
diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc
index ec0fb58..043f71e 100644
--- a/net/proxy/proxy_script_fetcher_impl_unittest.cc
+++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc
@@ -47,6 +47,7 @@
net::HttpNetworkLayer::CreateFactory(host_resolver_, cert_verifier_,
NULL, NULL, NULL, proxy_service_, ssl_config_service_, NULL, NULL,
NULL),
+ NULL,
net::HttpCache::DefaultBackend::InMemory(0));
}
diff --git a/net/proxy/proxy_server_mac.cc b/net/proxy/proxy_server_mac.cc
index 61e320f..566d25e 100644
--- a/net/proxy/proxy_server_mac.cc
+++ b/net/proxy/proxy_server_mac.cc
@@ -9,7 +9,7 @@
#include <string>
#include "base/logging.h"
-#include "base/mac_util.h"
+#include "base/mac/mac_util.h"
#include "base/sys_string_conversions.h"
namespace net {
@@ -25,7 +25,7 @@
}
CFStringRef host_ref =
- (CFStringRef)mac_util::GetValueFromDictionary(dict, host_key,
+ (CFStringRef)base::mac::GetValueFromDictionary(dict, host_key,
CFStringGetTypeID());
if (!host_ref) {
LOG(WARNING) << "Could not find expected key "
@@ -36,7 +36,7 @@
std::string host = base::SysCFStringRefToUTF8(host_ref);
CFNumberRef port_ref =
- (CFNumberRef)mac_util::GetValueFromDictionary(dict, port_key,
+ (CFNumberRef)base::mac::GetValueFromDictionary(dict, port_key,
CFNumberGetTypeID());
int port;
if (port_ref) {
diff --git a/net/proxy/proxy_service.h b/net/proxy/proxy_service.h
index ba56f4d..75ac3c9 100644
--- a/net/proxy/proxy_service.h
+++ b/net/proxy/proxy_service.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,7 +11,7 @@
#include "base/gtest_prod_util.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "net/base/completion_callback.h"
#include "net/base/network_change_notifier.h"
#include "net/base/net_log.h"
@@ -21,7 +21,6 @@
class GURL;
class MessageLoop;
-class URLRequestContext;
namespace net {
@@ -29,6 +28,7 @@
class InitProxyResolver;
class ProxyResolver;
class ProxyScriptFetcher;
+class URLRequestContext;
// This class can be used to resolve the proxy server to use when loading a
// HTTP(S) URL. It uses the given ProxyResolver to handle the actual proxy
@@ -277,6 +277,9 @@
int result_code,
const BoundNetLog& net_log);
+ // Start initialization using |fetched_config_|.
+ void InitializeUsingLastFetchedConfig();
+
// NetworkChangeNotifier::Observer
// When this is called, we re-fetch PAC scripts and re-run WPAD.
virtual void OnIPAddressChanged();
@@ -284,9 +287,6 @@
// ProxyConfigService::Observer
virtual void OnProxyConfigChanged(const ProxyConfig& config);
- // Start initialization using |fetched_config_|.
- void InitializeUsingLastFetchedConfig();
-
scoped_ptr<ProxyConfigService> config_service_;
scoped_ptr<ProxyResolver> resolver_;
diff --git a/net/proxy/sync_host_resolver_bridge.cc b/net/proxy/sync_host_resolver_bridge.cc
index bcb05d6..37a847f 100644
--- a/net/proxy/sync_host_resolver_bridge.cc
+++ b/net/proxy/sync_host_resolver_bridge.cc
@@ -8,7 +8,7 @@
#include "base/logging.h"
#include "base/lock.h"
#include "base/message_loop.h"
-#include "base/waitable_event.h"
+#include "base/synchronization/waitable_event.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
diff --git a/net/proxy/sync_host_resolver_bridge_unittest.cc b/net/proxy/sync_host_resolver_bridge_unittest.cc
index 43c829f..5cb053e 100644
--- a/net/proxy/sync_host_resolver_bridge_unittest.cc
+++ b/net/proxy/sync_host_resolver_bridge_unittest.cc
@@ -4,8 +4,8 @@
#include "net/proxy/sync_host_resolver_bridge.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
#include "net/base/address_list.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc
index 7c0e2e1..c6092d7 100644
--- a/net/socket/client_socket_pool_base_unittest.cc
+++ b/net/socket/client_socket_pool_base_unittest.cc
@@ -7,11 +7,11 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
-#include "base/platform_thread.h"
#include "base/ref_counted.h"
#include "base/scoped_vector.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
+#include "base/threading/platform_thread.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
#include "net/base/net_log_unittest.h"
@@ -618,7 +618,7 @@
&client_socket_factory_,
&log);
ASSERT_EQ(ERR_IO_PENDING, job->Connect());
- PlatformThread::Sleep(1);
+ base::PlatformThread::Sleep(1);
EXPECT_EQ(ERR_TIMED_OUT, delegate.WaitForResult());
net::CapturingNetLog::EntryList entries;
@@ -872,7 +872,7 @@
// actually become pending until 2ms after they have been created. In order
// to flush all tasks, we need to wait so that we know there are no
// soon-to-be-pending tasks waiting.
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
MessageLoop::current()->RunAllPending();
// The next synchronous request should wait for its turn.
@@ -1315,7 +1315,7 @@
{
MessageLoop::ScopedNestableTaskAllower nestable(
MessageLoop::current());
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
EXPECT_EQ(OK, next_job_callback.WaitForResult());
}
break;
@@ -1890,7 +1890,7 @@
// actually become pending until 2ms after they have been created. In order
// to flush all tasks, we need to wait so that we know there are no
// soon-to-be-pending tasks waiting.
- PlatformThread::Sleep(10);
+ base::PlatformThread::Sleep(10);
MessageLoop::current()->RunAllPending();
ASSERT_EQ(2, pool_->IdleSocketCount());
@@ -2313,7 +2313,8 @@
handle.Reset();
// Wait for the backup timer to fire (add some slop to ensure it fires)
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3);
+ base::PlatformThread::Sleep(
+ ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3);
MessageLoop::current()->RunAllPending();
EXPECT_EQ(kDefaultMaxSockets, client_socket_factory_.allocation_count());
@@ -2341,7 +2342,8 @@
// the backup time to see if it indeed got canceled.
handle.Reset();
// Wait for the backup timer to fire (add some slop to ensure it fires)
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3);
+ base::PlatformThread::Sleep(
+ ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3);
MessageLoop::current()->RunAllPending();
ASSERT_TRUE(pool_->HasGroup("bar"));
EXPECT_EQ(1, pool_->NumConnectJobsInGroup("bar"));
@@ -2379,7 +2381,8 @@
handle.Reset();
EXPECT_EQ(OK, callback2.WaitForResult());
// Wait for the backup timer to fire (add some slop to ensure it fires)
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3);
+ base::PlatformThread::Sleep(
+ ClientSocketPool::kMaxConnectRetryIntervalMs / 2 * 3);
MessageLoop::current()->RunAllPending();
}
diff --git a/net/socket/client_socket_pool_manager.h b/net/socket/client_socket_pool_manager.h
index cfcb465..d6d09e9 100644
--- a/net/socket/client_socket_pool_manager.h
+++ b/net/socket/client_socket_pool_manager.h
@@ -12,11 +12,11 @@
#include <map>
#include "base/basictypes.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "base/template_util.h"
#include "base/stl_util-inl.h"
+#include "base/template_util.h"
+#include "base/threading/non_thread_safe.h"
#include "net/socket/client_socket_pool_histograms.h"
class Value;
@@ -57,7 +57,7 @@
} // namespace internal
-class ClientSocketPoolManager : public NonThreadSafe {
+class ClientSocketPoolManager : public base::NonThreadSafe {
public:
ClientSocketPoolManager(NetLog* net_log,
ClientSocketFactory* socket_factory,
diff --git a/net/socket/dns_cert_provenance_checker.cc b/net/socket/dns_cert_provenance_checker.cc
index 51a9750..665a16a 100644
--- a/net/socket/dns_cert_provenance_checker.cc
+++ b/net/socket/dns_cert_provenance_checker.cc
@@ -21,9 +21,9 @@
#include "base/crypto/encryptor.h"
#include "base/crypto/symmetric_key.h"
#include "base/lazy_instance.h"
-#include "base/non_thread_safe.h"
#include "base/pickle.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "net/base/completion_callback.h"
#include "net/base/dns_util.h"
#include "net/base/dnsrr_resolver.h"
@@ -85,7 +85,7 @@
// DnsCertProvenanceCheck performs the DNS lookup of the certificate. This
// class is self-deleting.
-class DnsCertProvenanceCheck : public NonThreadSafe {
+class DnsCertProvenanceCheck : public base::NonThreadSafe {
public:
DnsCertProvenanceCheck(
const std::string& hostname,
diff --git a/net/socket/dns_cert_provenance_checker.h b/net/socket/dns_cert_provenance_checker.h
index 810e272..74e8768 100644
--- a/net/socket/dns_cert_provenance_checker.h
+++ b/net/socket/dns_cert_provenance_checker.h
@@ -27,10 +27,10 @@
const std::vector<std::string>& der_certs) = 0;
};
- virtual void Shutdown() = 0;
-
virtual ~DnsCertProvenanceChecker();
+ virtual void Shutdown() = 0;
+
// DoAsyncVerification starts an asynchronous check for the given certificate
// chain. It must be run on the network thread.
virtual void DoAsyncVerification(
diff --git a/net/socket/nss_ssl_util.cc b/net/socket/nss_ssl_util.cc
index eb8bafb..1ad1f1c 100644
--- a/net/socket/nss_ssl_util.cc
+++ b/net/socket/nss_ssl_util.cc
@@ -13,7 +13,7 @@
#include "base/logging.h"
#include "base/nss_util.h"
#include "base/singleton.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "net/base/net_errors.h"
#include "net/base/net_log.h"
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index 73dd07c..91f8fc9 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -168,12 +168,6 @@
MockWrite* writes, size_t writes_count);
virtual ~StaticSocketDataProvider();
- // SocketDataProvider methods:
- virtual MockRead GetNextRead();
- virtual MockWriteResult OnWrite(const std::string& data);
- virtual void Reset();
- virtual void CompleteRead() {}
-
// These functions get access to the next available read and write data.
const MockRead& PeekRead() const;
const MockWrite& PeekWrite() const;
@@ -188,6 +182,12 @@
bool at_read_eof() const { return read_index_ >= read_count_; }
bool at_write_eof() const { return write_index_ >= write_count_; }
+ // SocketDataProvider methods:
+ virtual MockRead GetNextRead();
+ virtual MockWriteResult OnWrite(const std::string& data);
+ virtual void Reset();
+ virtual void CompleteRead() {}
+
private:
MockRead* reads_;
size_t read_index_;
diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc
index e0753b9..868e13d 100644
--- a/net/socket/ssl_client_socket_mac.cc
+++ b/net/socket/ssl_client_socket_mac.cc
@@ -14,6 +14,7 @@
#include "base/lazy_instance.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/string_util.h"
+#include "base/sys_info.h"
#include "net/base/address_list.h"
#include "net/base/cert_verifier.h"
#include "net/base/io_buffer.h"
@@ -140,6 +141,27 @@
};
#endif
+// On OS X 10.5.x, SSLHandshake() is broken with respect to renegotiation
+// handshakes, and the only way to advance the handshake state machine is
+// to use SSLRead(), which transparently re-handshakes and then reads
+// application data. Using SSLRead() to pump the handshake, rather than
+// SSLHandshake(), is not presently implemented, so on 10.5.x, SSL
+// renegotiation is disabled entirely. On 10.6.x, SSLHandshake() behaves as
+// expected/documented, so renegotiation is supported.
+struct RenegotiationBroken {
+ RenegotiationBroken() : broken(false) {
+ int32 major, minor, bugfix;
+ base::SysInfo::OperatingSystemVersionNumbers(&major, &minor, &bugfix);
+ if (major < 10 || (major == 10 && minor < 6))
+ broken = true;
+ }
+
+ bool broken;
+};
+
+base::LazyInstance<RenegotiationBroken> g_renegotiation_broken(
+ base::LINKER_INITIALIZED);
+
// For an explanation of the Mac OS X error codes, please refer to:
// http://developer.apple.com/mac/library/documentation/Security/Reference/secureTransportRef/Reference/reference.html
int NetErrorFromOSStatus(OSStatus status) {
@@ -1127,6 +1149,9 @@
OSStatus status = SSLRead(ssl_context_, user_read_buf_->data(),
user_read_buf_len_, &processed);
if (status == errSSLWouldBlock && renegotiating_) {
+ if (g_renegotiation_broken.Get().broken)
+ return ERR_SSL_RENEGOTIATION_REQUESTED;
+
CHECK_EQ(static_cast<size_t>(0), processed);
next_handshake_state_ = STATE_HANDSHAKE;
return DoHandshakeLoop(OK);
diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc
index 333fe67..b12c59d 100644
--- a/net/socket/ssl_client_socket_nss.cc
+++ b/net/socket/ssl_client_socket_nss.cc
@@ -52,6 +52,7 @@
#include <keyhi.h>
#include <nspr.h>
#include <nss.h>
+#include <ocsp.h>
#include <pk11pub.h>
#include <secerr.h>
#include <sechash.h>
@@ -68,7 +69,7 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/thread_restrictions.h"
#include "base/values.h"
#include "net/base/address_list.h"
#include "net/base/cert_status_flags.h"
@@ -111,6 +112,29 @@
// and some will time out such sockets quite aggressively.
static const int kCorkTimeoutMs = 200;
+#if defined(OS_LINUX)
+// On Linux, we dynamically link against the system version of libnss3.so. In
+// order to continue working on systems without up-to-date versions of NSS we
+// declare CERT_CacheOCSPResponseFromSideChannel to be a weak symbol. If, at
+// run time, we find that the symbol didn't resolve then we can avoid calling
+// the function.
+extern SECStatus
+CERT_CacheOCSPResponseFromSideChannel(
+ CERTCertDBHandle *handle, CERTCertificate *cert, PRTime time,
+ SECItem *encodedResponse, void *pwArg) __attribute__((weak));
+
+static bool HaveCacheOCSPResponseFromSideChannelFunction() {
+ return CERT_CacheOCSPResponseFromSideChannel != NULL;
+}
+#else
+// On other platforms we use the system's certificate validation functions.
+// Thus we need, in the future, to plumb the OCSP response into those system
+// functions. Until then, we act as if we didn't support OCSP stapling.
+static bool HaveCacheOCSPResponseFromSideChannelFunction() {
+ return false;
+}
+#endif
+
namespace net {
// State machines are easier to debug if you log state transitions.
@@ -641,6 +665,15 @@
}
#endif
+#ifdef SSL_ENABLE_OCSP_STAPLING
+ if (HaveCacheOCSPResponseFromSideChannelFunction() &&
+ !ssl_config_.snap_start_enabled) {
+ rv = SSL_OptionSet(nss_fd_, SSL_ENABLE_OCSP_STAPLING, PR_TRUE);
+ if (rv != SECSuccess)
+ LogFailedNSSFunction(net_log_, "SSL_OptionSet (OCSP stapling)", "");
+ }
+#endif
+
rv = SSL_OptionSet(nss_fd_, SSL_HANDSHAKE_AS_CLIENT, PR_TRUE);
if (rv != SECSuccess) {
LogFailedNSSFunction(net_log_, "SSL_OptionSet", "SSL_HANDSHAKE_AS_CLIENT");
@@ -1963,6 +1996,32 @@
}
}
+#if defined(SSL_ENABLE_OCSP_STAPLING)
+ // TODO: we need to be able to plumb an OCSP response into the system
+ // libraries. When we do, HaveCacheOCSPResponseFromSideChannelFunction
+ // needs to be updated for those platforms.
+ if (!predicted_cert_chain_correct_ &&
+ HaveCacheOCSPResponseFromSideChannelFunction()) {
+ unsigned int len = 0;
+ SSL_GetStapledOCSPResponse(nss_fd_, NULL, &len);
+ if (len) {
+ const unsigned int orig_len = len;
+ scoped_array<uint8> ocsp_response(new uint8[orig_len]);
+ SSL_GetStapledOCSPResponse(nss_fd_, ocsp_response.get(), &len);
+ DCHECK_EQ(orig_len, len);
+
+ SECItem ocsp_response_item;
+ ocsp_response_item.type = siBuffer;
+ ocsp_response_item.data = ocsp_response.get();
+ ocsp_response_item.len = len;
+
+ CERT_CacheOCSPResponseFromSideChannel(
+ CERT_GetDefaultCertDB(), server_cert_nss_, PR_Now(),
+ &ocsp_response_item, NULL);
+ }
+ }
+#endif
+
SaveSnapStartInfo();
// SSL handshake is completed. It's possible that we mispredicted the
// NPN agreed protocol. In this case, we've just sent a request in the
diff --git a/net/socket/ssl_client_socket_pool.cc b/net/socket/ssl_client_socket_pool.cc
index 1e53c6f..d899c16 100644
--- a/net/socket/ssl_client_socket_pool.cc
+++ b/net/socket/ssl_client_socket_pool.cc
@@ -210,6 +210,10 @@
ssl_host_info_factory_->GetForHost(params_->host_and_port().host(),
params_->ssl_config()));
}
+
+ if (dnsrr_resolver_)
+ ssl_host_info_->StartDnsLookup(dnsrr_resolver_);
+
if (ssl_host_info_.get()) {
// This starts fetching the SSL host info from the disk cache for Snap
// Start.
diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc
index 9ba5cbf..3df20bb 100644
--- a/net/socket/ssl_client_socket_unittest.cc
+++ b/net/socket/ssl_client_socket_unittest.cc
@@ -58,8 +58,8 @@
// write.
static bool LogContainsSSLConnectEndEvent(
const net::CapturingNetLog::EntryList& log, int i) {
- return net::LogContainsEndEvent(log, -1, net::NetLog::TYPE_SSL_CONNECT) ||
- net::LogContainsEvent(log, -1, net::NetLog::TYPE_SOCKET_BYTES_SENT,
+ return net::LogContainsEndEvent(log, i, net::NetLog::TYPE_SSL_CONNECT) ||
+ net::LogContainsEvent(log, i, net::NetLog::TYPE_SOCKET_BYTES_SENT,
net::NetLog::PHASE_NONE);
};
@@ -608,5 +608,14 @@
// We cannot test sock->IsConnected(), as the NSS implementation disconnects
// the socket when it encounters an error, whereas other implementations
// leave it connected.
- EXPECT_TRUE(LogContainsSSLConnectEndEvent(entries, -1));
+ // Because this an error that the test server is mutually aware of, as opposed
+ // to being an error such as a certificate name mismatch, which is
+ // client-only, the exact index of the SSL connect end depends on how
+ // quickly the test server closes the underlying socket. If the test server
+ // closes before the IO message loop pumps messages, there may be a 0-byte
+ // Read event in the NetLog due to TCPClientSocket picking up the EOF. As a
+ // result, the SSL connect end event will be the second-to-last entry,
+ // rather than the last entry.
+ EXPECT_TRUE(LogContainsSSLConnectEndEvent(entries, -1) ||
+ LogContainsSSLConnectEndEvent(entries, -2));
}
diff --git a/net/socket/ssl_host_info.cc b/net/socket/ssl_host_info.cc
index ccfe7a5..1fcc053 100644
--- a/net/socket/ssl_host_info.cc
+++ b/net/socket/ssl_host_info.cc
@@ -7,6 +7,8 @@
#include "base/metrics/histogram.h"
#include "base/pickle.h"
#include "base/string_piece.h"
+#include "net/base/dns_util.h"
+#include "net/base/dnsrr_resolver.h"
#include "net/base/ssl_config_service.h"
#include "net/base/x509_certificate.h"
#include "net/socket/ssl_client_socket.h"
@@ -40,11 +42,31 @@
verifier_(cert_verifier),
callback_(new CancelableCompletionCallback<SSLHostInfo>(
ALLOW_THIS_IN_INITIALIZER_LIST(this),
- &SSLHostInfo::VerifyCallback)) {
+ &SSLHostInfo::VerifyCallback)),
+ dnsrr_resolver_(NULL),
+ dns_callback_(NULL),
+ dns_handle_(DnsRRResolver::kInvalidHandle) {
state_.npn_valid = false;
}
-SSLHostInfo::~SSLHostInfo() {}
+SSLHostInfo::~SSLHostInfo() {
+ if (dns_handle_ != DnsRRResolver::kInvalidHandle) {
+ dnsrr_resolver_->CancelResolve(dns_handle_);
+ delete dns_callback_;
+ }
+}
+
+void SSLHostInfo::StartDnsLookup(DnsRRResolver* dnsrr_resolver) {
+#if defined(OS_LINUX)
+ dnsrr_resolver_ = dnsrr_resolver;
+ dns_callback_ = NewCallback(this, &SSLHostInfo::DnsComplete);
+ dns_lookup_start_time_ = base::TimeTicks::Now();
+
+ dns_handle_ = dnsrr_resolver->Resolve(
+ hostname_, kDNS_CAA, DnsRRResolver::FLAG_WANT_DNSSEC, dns_callback_,
+ &dns_response_, 0, BoundNetLog());
+#endif
+}
const SSLHostInfo::State& SSLHostInfo::state() const {
return state_;
@@ -196,6 +218,16 @@
}
}
+void SSLHostInfo::DnsComplete(int rv) {
+ dns_handle_ = DnsRRResolver::kInvalidHandle;
+ delete dns_callback_;
+ dns_callback_ = NULL;
+
+ const base::TimeTicks now = base::TimeTicks::Now();
+ const base::TimeDelta elapsed = now - dns_lookup_start_time_;
+ UMA_HISTOGRAM_TIMES("Net.SSLHostInfoDNSLookup", elapsed);
+}
+
SSLHostInfoFactory::~SSLHostInfoFactory() {}
} // namespace net
diff --git a/net/socket/ssl_host_info.h b/net/socket/ssl_host_info.h
index 8f1502b..c384e2e 100644
--- a/net/socket/ssl_host_info.h
+++ b/net/socket/ssl_host_info.h
@@ -14,6 +14,7 @@
#include "net/base/cert_verifier.h"
#include "net/base/cert_verify_result.h"
#include "net/base/completion_callback.h"
+#include "net/base/dnsrr_resolver.h"
#include "net/socket/ssl_client_socket.h"
namespace net {
@@ -56,6 +57,9 @@
// callback.
virtual void Persist() = 0;
+ // StartDnsLookup triggers a DNS lookup for the host.
+ void StartDnsLookup(DnsRRResolver* dnsrr_resolver);
+
struct State {
State();
~State();
@@ -119,6 +123,10 @@
// ParseInner is a helper function for Parse.
bool ParseInner(const std::string& data);
+ // DnsComplete is a callback function which is called when our DNS resolution
+ // completes.
+ void DnsComplete(int rv);
+
// This is the hostname that we'll validate the certificates against.
const std::string hostname_;
bool cert_parsing_failed_;
@@ -132,6 +140,12 @@
SingleRequestCertVerifier verifier_;
scoped_refptr<X509Certificate> cert_;
scoped_refptr<CancelableCompletionCallback<SSLHostInfo> > callback_;
+
+ DnsRRResolver* dnsrr_resolver_;
+ CompletionCallback* dns_callback_;
+ DnsRRResolver::Handle dns_handle_;
+ RRResponse dns_response_;
+ base::TimeTicks dns_lookup_start_time_;
};
class SSLHostInfoFactory {
diff --git a/net/socket/tcp_client_socket_libevent.h b/net/socket/tcp_client_socket_libevent.h
index 1f3434b..345c688 100644
--- a/net/socket/tcp_client_socket_libevent.h
+++ b/net/socket/tcp_client_socket_libevent.h
@@ -7,9 +7,9 @@
#pragma once
#include "base/message_loop.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
+#include "base/threading/non_thread_safe.h"
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/base/net_log.h"
@@ -22,7 +22,7 @@
class BoundNetLog;
// A client socket that uses TCP as the transport layer.
-class TCPClientSocketLibevent : public ClientSocket, NonThreadSafe {
+class TCPClientSocketLibevent : public ClientSocket, base::NonThreadSafe {
public:
// The IP address(es) and port number to connect to. The TCP socket will try
// each IP address in the list until it succeeds in establishing a
diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc
index 454f5b8..bd1b8bd 100644
--- a/net/socket/tcp_client_socket_pool_unittest.cc
+++ b/net/socket/tcp_client_socket_pool_unittest.cc
@@ -7,6 +7,7 @@
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
+#include "base/threading/platform_thread.h"
#include "net/base/mock_host_resolver.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
@@ -758,7 +759,8 @@
MessageLoop::current()->RunAllPending();
// Wait for the backup socket timer to fire.
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs * 2);
+ base::PlatformThread::Sleep(
+ ClientSocketPool::kMaxConnectRetryIntervalMs * 2);
// Let the appropriate socket connect.
MessageLoop::current()->RunAllPending();
@@ -800,7 +802,7 @@
if (index == CANCEL_AFTER_WAIT) {
// Wait for the backup socket timer to fire.
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
}
// Let the appropriate socket connect.
@@ -843,7 +845,7 @@
MessageLoop::current()->RunAllPending();
// Wait for the backup socket timer to fire.
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
// Let the second connect be synchronous. Otherwise, the emulated
// host resolution takes an extra trip through the message loop.
@@ -888,7 +890,7 @@
MessageLoop::current()->RunAllPending();
// Wait for the backup socket timer to fire.
- PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
+ base::PlatformThread::Sleep(ClientSocketPool::kMaxConnectRetryIntervalMs);
// Let the second connect be synchronous. Otherwise, the emulated
// host resolution takes an extra trip through the message loop.
diff --git a/net/socket/tcp_client_socket_win.cc b/net/socket/tcp_client_socket_win.cc
index 6624a5e..262ccd4 100644
--- a/net/socket/tcp_client_socket_win.cc
+++ b/net/socket/tcp_client_socket_win.cc
@@ -10,6 +10,7 @@
#include "base/metrics/stats_counters.h"
#include "base/string_util.h"
#include "base/sys_info.h"
+#include "base/win/object_watcher.h"
#include "net/base/address_list_net_log_param.h"
#include "net/base/connection_type_histograms.h"
#include "net/base/io_buffer.h"
@@ -170,7 +171,7 @@
private:
friend class base::RefCounted<Core>;
- class ReadDelegate : public base::ObjectWatcher::Delegate {
+ class ReadDelegate : public base::win::ObjectWatcher::Delegate {
public:
explicit ReadDelegate(Core* core) : core_(core) {}
virtual ~ReadDelegate() {}
@@ -182,7 +183,7 @@
Core* const core_;
};
- class WriteDelegate : public base::ObjectWatcher::Delegate {
+ class WriteDelegate : public base::win::ObjectWatcher::Delegate {
public:
explicit WriteDelegate(Core* core) : core_(core) {}
virtual ~WriteDelegate() {}
@@ -205,9 +206,9 @@
WriteDelegate writer_;
// |read_watcher_| watches for events from Connect() and Read().
- base::ObjectWatcher read_watcher_;
+ base::win::ObjectWatcher read_watcher_;
// |write_watcher_| watches for events from Write();
- base::ObjectWatcher write_watcher_;
+ base::win::ObjectWatcher write_watcher_;
// When doing reads from the socket, we try to mirror TCP's slow start.
// We do this because otherwise the async IO subsystem artifically delays
diff --git a/net/socket/tcp_client_socket_win.h b/net/socket/tcp_client_socket_win.h
index bfd6a93..93fe9e6 100644
--- a/net/socket/tcp_client_socket_win.h
+++ b/net/socket/tcp_client_socket_win.h
@@ -8,8 +8,7 @@
#include <winsock2.h>
-#include "base/non_thread_safe.h"
-#include "base/object_watcher.h"
+#include "base/threading/non_thread_safe.h"
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
#include "net/base/net_log.h"
@@ -19,7 +18,7 @@
class BoundNetLog;
-class TCPClientSocketWin : public ClientSocket, NonThreadSafe {
+class TCPClientSocketWin : public ClientSocket, base::NonThreadSafe {
public:
// The IP address(es) and port number to connect to. The TCP socket will try
// each IP address in the list until it succeeds in establishing a
diff --git a/net/socket_stream/socket_stream.h b/net/socket_stream/socket_stream.h
index f485543..b2afd1b 100644
--- a/net/socket_stream/socket_stream.h
+++ b/net/socket_stream/socket_stream.h
@@ -156,6 +156,11 @@
Delegate* delegate_;
private:
+ friend class WebSocketThrottleTest;
+
+ typedef std::map<const void*, linked_ptr<UserData> > UserDataMap;
+ typedef std::deque< scoped_refptr<IOBufferWithSize> > PendingDataQueue;
+
class RequestHeaders : public IOBuffer {
public:
RequestHeaders() : IOBuffer() {}
@@ -212,9 +217,8 @@
kSOCKSProxy, // If using a SOCKS proxy
};
- typedef std::deque< scoped_refptr<IOBufferWithSize> > PendingDataQueue;
-
- friend class WebSocketThrottleTest;
+ // Use the same number as HttpNetworkTransaction::kMaxHeaderBufSize.
+ enum { kMaxTunnelResponseHeadersSize = 32768 }; // 32 kilobytes.
// Copies the given addrinfo list in |addresses_|.
// Used for WebSocketThrottleTest.
@@ -269,7 +273,6 @@
int max_pending_send_allowed_;
scoped_refptr<URLRequestContext> context_;
- typedef std::map<const void*, linked_ptr<UserData> > UserDataMap;
UserDataMap user_data_;
State next_state_;
@@ -295,9 +298,6 @@
int tunnel_response_headers_capacity_;
int tunnel_response_headers_len_;
- // Use the same number as HttpNetworkTransaction::kMaxHeaderBufSize.
- enum { kMaxTunnelResponseHeadersSize = 32768 }; // 32 kilobytes.
-
scoped_ptr<SingleRequestHostResolver> resolver_;
AddressList addresses_;
scoped_ptr<ClientSocket> socket_;
diff --git a/net/socket_stream/socket_stream_job.h b/net/socket_stream/socket_stream_job.h
index a301709..973c20a 100644
--- a/net/socket_stream/socket_stream_job.h
+++ b/net/socket_stream/socket_stream_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
diff --git a/net/spdy/spdy_protocol.h b/net/spdy/spdy_protocol.h
index 9834a11..2389152 100644
--- a/net/spdy/spdy_protocol.h
+++ b/net/spdy/spdy_protocol.h
@@ -302,9 +302,6 @@
// A structure for the 8 bit flags and 24 bit ID fields.
union SettingsFlagsAndId {
- uint8 flags_[4]; // 8 bits
- uint32 id_; // 24 bits
-
SettingsFlagsAndId(uint32 val) : id_(val) {}
uint8 flags() const { return flags_[0]; }
void set_flags(uint8 flags) { flags_[0] = flags; }
@@ -314,6 +311,9 @@
id = htonl(id & kSettingsIdMask);
id_ = flags() | id;
}
+
+ uint8 flags_[4]; // 8 bits
+ uint32 id_; // 24 bits
};
#pragma pack(pop)
diff --git a/net/spdy/spdy_test_util.h b/net/spdy/spdy_test_util.h
index aeabe6a..1b052fa 100644
--- a/net/spdy/spdy_test_util.h
+++ b/net/spdy/spdy_test_util.h
@@ -419,6 +419,7 @@
http_auth_handler_factory_,
network_delegate_,
NULL),
+ NULL /* net_log */,
net::HttpCache::DefaultBackend::InMemory(0));
}
diff --git a/net/test/python_utils.cc b/net/test/python_utils.cc
index 0c61b48..df404ad 100644
--- a/net/test/python_utils.cc
+++ b/net/test/python_utils.cc
@@ -8,6 +8,7 @@
#include "base/environment.h"
#include "base/file_path.h"
#include "base/file_util.h"
+#include "base/logging.h"
#include "base/path_service.h"
#include "base/scoped_ptr.h"
#include "base/utf_string_conversions.h"
@@ -37,31 +38,68 @@
}
}
+namespace {
+
+// Search for |to_try|, rolling up the directory tree from
+// |start_dir|. If found, return true and put the path to |to_try| in
+// |out_dir|. If not, return false and leave |out_dir| untouched.
+bool TryRelativeToDir(const FilePath& start_dir,
+ const FilePath& to_try,
+ FilePath* out_dir) {
+ FilePath dir(start_dir);
+ while (!file_util::DirectoryExists(dir.Append(to_try))) {
+ FilePath parent = dir.DirName();
+ if (parent == dir) {
+ // We hit the root directory.
+ return false;
+ }
+ dir = parent;
+ }
+ *out_dir = dir;
+ return true;
+}
+
+} // namespace
+
bool GetPyProtoPath(FilePath* dir) {
// Locate the Python code generated by the protocol buffers compiler.
FilePath generated_code_dir;
if (!PathService::Get(base::DIR_EXE, &generated_code_dir)) {
+ LOG(ERROR) << "Can't find " << generated_code_dir.value();
return false;
}
const FilePath kPyProto(FILE_PATH_LITERAL("pyproto"));
#if defined(OS_MACOSX) || defined(OS_CHROMEOS)
- // On Mac and Chrome OS, DIR_EXE might be pointing deep into the Release/
- // (or Debug/) directory and we can't depend on how far down it goes. So we
- // walk upwards from DIR_EXE until we find a likely looking spot.
- while (!file_util::DirectoryExists(generated_code_dir.Append(kPyProto))) {
- FilePath parent = generated_code_dir.DirName();
- if (parent == generated_code_dir) {
- // We hit the root directory. Maybe we didn't build any targets which
- // produced Python protocol buffers.
- PathService::Get(base::DIR_EXE, &generated_code_dir);
+ FilePath source_dir;
+ if (!PathService::Get(base::DIR_SOURCE_ROOT, &source_dir)) {
+ LOG(ERROR) << "Can't find " << source_dir.value();
+ return false;
+ }
+ // On Mac, and possibly Chrome OS, DIR_EXE might be pointing deep
+ // into the Release/ (or Debug/) directory and we can't depend on
+ // how far down it goes. So we walk upwards from DIR_EXE until we
+ // find a likely looking spot.
+ if (!TryRelativeToDir(generated_code_dir, kPyProto, dir)) {
+ LOG(WARNING) << "Can't find " << kPyProto.value()
+ << " next to " << generated_code_dir.value();
+ // On Chrome OS, we may have installed the test binaries and support tools
+ // in a wholly separate location, relative to DIR_SOURCE_ROOT. We'll want
+ // to do a similar investigation from that point as well.
+ generated_code_dir = source_dir
+ .Append(FILE_PATH_LITERAL("out"))
+ .Append(FILE_PATH_LITERAL("Release"));
+ if (!TryRelativeToDir(generated_code_dir, kPyProto, dir)) {
+ LOG(WARNING) << "Can't find " << kPyProto.value()
+ << " next to " << generated_code_dir.value();
return false;
}
- generated_code_dir = parent;
}
+ generated_code_dir = *dir;
#endif
*dir = generated_code_dir.Append(kPyProto);
+ VLOG(2) << "Found " << kPyProto.value() << " in " << dir->value();
return true;
}
diff --git a/net/test/test_server.h b/net/test/test_server.h
index 9686aef..6d93fc8 100644
--- a/net/test/test_server.h
+++ b/net/test/test_server.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -20,7 +20,7 @@
#include "net/base/net_util.h"
#if defined(OS_WIN)
-#include "base/scoped_handle_win.h"
+#include "base/win/scoped_handle.h"
#endif
class CommandLine;
@@ -177,13 +177,13 @@
#if defined(OS_WIN)
// JobObject used to clean up orphaned child processes.
- ScopedHandle job_handle_;
+ base::win::ScopedHandle job_handle_;
// The pipe file handle we read from.
- ScopedHandle child_read_fd_;
+ base::win::ScopedHandle child_read_fd_;
// The pipe file handle the child and we write to.
- ScopedHandle child_write_fd_;
+ base::win::ScopedHandle child_write_fd_;
#endif
#if defined(OS_POSIX)
diff --git a/net/test/test_server_win.cc b/net/test/test_server_win.cc
index e38d0bc..9fc13cd 100644
--- a/net/test/test_server_win.cc
+++ b/net/test/test_server_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -15,8 +15,9 @@
#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/test/test_timeouts.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
+#include "base/win/scoped_handle.h"
#pragma comment(lib, "crypt32.lib")
@@ -25,7 +26,7 @@
bool LaunchTestServerAsJob(const CommandLine& cmdline,
bool start_hidden,
base::ProcessHandle* process_handle,
- ScopedHandle* job_handle) {
+ base::win::ScopedHandle* job_handle) {
// Launch test server process.
STARTUPINFO startup_info = {0};
startup_info.cb = sizeof(startup_info);
@@ -191,8 +192,8 @@
}
bool TestServer::WaitToStart() {
- ScopedHandle read_fd(child_read_fd_.Take());
- ScopedHandle write_fd(child_write_fd_.Take());
+ base::win::ScopedHandle read_fd(child_read_fd_.Take());
+ base::win::ScopedHandle write_fd(child_write_fd_.Take());
uint32 server_data_len = 0;
if (!ReadData(read_fd.Get(), write_fd.Get(), sizeof(server_data_len),
diff --git a/net/tools/crash_cache/crash_cache.cc b/net/tools/crash_cache/crash_cache.cc
index 88d7d87..40c6a41 100644
--- a/net/tools/crash_cache/crash_cache.cc
+++ b/net/tools/crash_cache/crash_cache.cc
@@ -18,7 +18,7 @@
#include "base/process_util.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "net/base/net_errors.h"
#include "net/base/test_completion_callback.h"
@@ -135,7 +135,7 @@
disk_cache::Backend* cache;
int rv = disk_cache::CreateCacheBackend(net::DISK_CACHE, path, 0, false,
cache_thread->message_loop_proxy(),
- &cache, &cb);
+ NULL, &cache, &cb);
if (cb.GetResult(rv) != net::OK || cache->GetEntryCount())
return GENERIC;
@@ -176,7 +176,7 @@
// Use a simple LRU for eviction.
int rv = disk_cache::CreateCacheBackend(net::MEDIA_CACHE, path, 0, false,
cache_thread->message_loop_proxy(),
- &cache, &cb);
+ NULL, &cache, &cb);
if (cb.GetResult(rv) != net::OK || cache->GetEntryCount())
return GENERIC;
@@ -219,7 +219,7 @@
// Use a simple LRU for eviction.
int rv = disk_cache::CreateCacheBackend(net::MEDIA_CACHE, path, 0, false,
cache_thread->message_loop_proxy(),
- &cache, &cb);
+ NULL, &cache, &cb);
if (cb.GetResult(rv) != net::OK || cache->GetEntryCount())
return GENERIC;
@@ -256,7 +256,7 @@
// Work with a tiny index table (16 entries).
disk_cache::BackendImpl* cache = new disk_cache::BackendImpl(
- path, 0xf, cache_thread->message_loop_proxy());
+ path, 0xf, cache_thread->message_loop_proxy(), NULL);
if (!cache || !cache->SetMaxSize(0x100000))
return GENERIC;
diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc
index 3561fb7..53dd121 100644
--- a/net/tools/dump_cache/dump_cache.cc
+++ b/net/tools/dump_cache/dump_cache.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,10 +11,9 @@
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/process_util.h"
-#include "base/scoped_handle.h"
#include "base/string_util.h"
#include "base/stringprintf.h"
-
+#include "base/win/scoped_handle.h"
#include "net/disk_cache/disk_format.h"
enum Errors {
@@ -156,7 +155,7 @@
if (command_line.HasSwitch(kSlave) && slave_required)
return RunSlave(input_path, pipe_number);
- ScopedHandle server;
+ base::win::ScopedHandle server;
if (slave_required) {
server.Set(CreateServer(&pipe_number));
if (!server.IsValid()) {
diff --git a/net/tools/dump_cache/dump_files.cc b/net/tools/dump_cache/dump_files.cc
index 7a2585f..2f37c5d 100644
--- a/net/tools/dump_cache/dump_files.cc
+++ b/net/tools/dump_cache/dump_files.cc
@@ -80,7 +80,7 @@
if (!ReadHeader(name, reinterpret_cast<char*>(&header), sizeof(header)))
return;
- std::wstring file_name = file_util::GetFilenameFromPath(name);
+ std::wstring file_name = FilePath(name).BaseName().value();
printf("Block file: %ls\n", file_name.c_str());
printf("magic: %x\n", header.magic);
diff --git a/net/tools/dump_cache/upgrade.cc b/net/tools/dump_cache/upgrade.cc
index 0d6d5e4..7b86237 100644
--- a/net/tools/dump_cache/upgrade.cc
+++ b/net/tools/dump_cache/upgrade.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,7 +8,8 @@
#include "base/scoped_ptr.h"
#include "base/string_number_conversions.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
+#include "base/win/scoped_handle.h"
#include "googleurl/src/gurl.h"
#include "net/base/io_buffer.h"
#include "net/base/test_completion_callback.h"
@@ -326,7 +327,7 @@
FilePath::FromWStringHack(path_), 0,
false,
cache_thread_.message_loop_proxy(),
- &cache, &cb);
+ NULL, &cache, &cb);
if (cb.GetResult(rv) != net::OK) {
printf("Unable to initialize new files\n");
return false;
@@ -607,7 +608,7 @@
FilePath::FromWStringHack(path), 0,
false,
cache_thread_.message_loop_proxy(),
- &cache, &cb);
+ NULL, &cache, &cb);
if (cb.GetResult(rv) != net::OK) {
printf("Unable to open cache files\n");
return;
@@ -912,7 +913,7 @@
int RunSlave(const std::wstring& input_path, const std::wstring& pipe_number) {
MessageLoop loop(MessageLoop::TYPE_IO);
- ScopedHandle pipe(OpenServer(pipe_number));
+ base::win::ScopedHandle pipe(OpenServer(pipe_number));
if (!pipe.IsValid()) {
printf("Unable to open the server pipe\n");
return -1;
diff --git a/net/tools/flip_server/flip_in_mem_edsm_server.cc b/net/tools/flip_server/flip_in_mem_edsm_server.cc
index 1969e0c..a378e72 100644
--- a/net/tools/flip_server/flip_in_mem_edsm_server.cc
+++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc
@@ -19,7 +19,7 @@
#include "base/command_line.h"
#include "base/logging.h"
-#include "base/simple_thread.h"
+#include "base/threading/simple_thread.h"
#include "base/timer.h"
#include "base/lock.h"
#include "net/spdy/spdy_frame_builder.h"
diff --git a/net/tools/hresolv/hresolv.cc b/net/tools/hresolv/hresolv.cc
index 314ff32..24d73a8 100644
--- a/net/tools/hresolv/hresolv.cc
+++ b/net/tools/hresolv/hresolv.cc
@@ -24,14 +24,13 @@
#include "base/at_exit.h"
#include "base/command_line.h"
-#include "base/condition_variable.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/message_loop.h"
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "net/base/address_list.h"
#include "net/base/completion_callback.h"
diff --git a/net/tools/testserver/testserver.py b/net/tools/testserver/testserver.py
index 56d7c0e..acfafae 100755
--- a/net/tools/testserver/testserver.py
+++ b/net/tools/testserver/testserver.py
@@ -913,8 +913,18 @@
return False
username = userpass = password = b64str = ""
+ expected_password = 'secret'
+ realm = 'testrealm'
+ set_cookie_if_challenged = False
- set_cookie_if_challenged = self.path.find('?set-cookie-if-challenged') > 0
+ _, _, url_path, _, query, _ = urlparse.urlparse(self.path)
+ query_params = cgi.parse_qs(query, True)
+ if 'set-cookie-if-challenged' in query_params:
+ set_cookie_if_challenged = True
+ if 'password' in query_params:
+ expected_password = query_params['password'][0]
+ if 'realm' in query_params:
+ realm = query_params['realm'][0]
auth = self.headers.getheader('authorization')
try:
@@ -923,12 +933,12 @@
b64str = re.findall(r'Basic (\S+)', auth)[0]
userpass = base64.b64decode(b64str)
username, password = re.findall(r'([^:]+):(\S+)', userpass)[0]
- if password != 'secret':
+ if password != expected_password:
raise Exception('wrong password')
except Exception, e:
# Authentication failed.
self.send_response(401)
- self.send_header('WWW-Authenticate', 'Basic realm="testrealm"')
+ self.send_header('WWW-Authenticate', 'Basic realm="%s"' % realm)
self.send_header('Content-type', 'text/html')
if set_cookie_if_challenged:
self.send_header('Set-Cookie', 'got_challenged=true')
@@ -951,6 +961,24 @@
if if_none_match == "abc":
self.send_response(304)
self.end_headers()
+ elif url_path.endswith(".gif"):
+ # Using chrome/test/data/google/logo.gif as the test image
+ test_image_path = ['google', 'logo.gif']
+ gif_path = os.path.join(self.server.data_dir, *test_image_path)
+ if not os.path.isfile(gif_path):
+ self.send_error(404)
+ return True
+
+ f = open(gif_path, "rb")
+ data = f.read()
+ f.close()
+
+ self.send_response(200)
+ self.send_header('Content-type', 'image/gif')
+ self.send_header('Cache-control', 'max-age=60000')
+ self.send_header('Etag', 'abc')
+ self.end_headers()
+ self.wfile.write(data)
else:
self.send_response(200)
self.send_header('Content-type', 'text/html')
diff --git a/net/url_request/https_prober.h b/net/url_request/https_prober.h
index 5d1a622..6540224 100644
--- a/net/url_request/https_prober.h
+++ b/net/url_request/https_prober.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -14,10 +14,11 @@
#include "net/url_request/url_request.h"
template <typename T> struct DefaultSingletonTraits;
-class URLRequestContext;
namespace net {
+class URLRequestContext;
+
// This should be scoped inside HTTPSProber, but VC cannot compile
// HTTPProber::Delegate when HTTPSProber also inherits from
// net::URLRequest::Delegate.
@@ -77,4 +78,5 @@
};
} // namespace net
-#endif
+
+#endif // NET_BASE_HTTPS_PROBER_H_
diff --git a/net/url_request/url_request.h b/net/url_request/url_request.h
index ffd4f88..3561a29 100644
--- a/net/url_request/url_request.h
+++ b/net/url_request/url_request.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -13,9 +13,9 @@
#include "base/debug/leak_tracker.h"
#include "base/linked_ptr.h"
#include "base/logging.h"
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
#include "base/string16.h"
+#include "base/threading/non_thread_safe.h"
#include "googleurl/src/gurl.h"
#include "net/base/load_states.h"
#include "net/base/net_log.h"
@@ -28,17 +28,7 @@
class Time;
} // namespace base
-namespace net {
-class CookieOptions;
-class IOBuffer;
-class SSLCertRequestInfo;
-class UploadData;
-class URLRequestJob;
-class X509Certificate;
-} // namespace net
-
class FilePath;
-class URLRequestContext;
// This stores the values of the Set-Cookie headers received during the request.
// Each item in the vector corresponds to a Set-Cookie: line received,
@@ -46,6 +36,15 @@
typedef std::vector<std::string> ResponseCookies;
namespace net {
+
+class CookieOptions;
+class IOBuffer;
+class SSLCertRequestInfo;
+class UploadData;
+class URLRequestContext;
+class URLRequestJob;
+class X509Certificate;
+
//-----------------------------------------------------------------------------
// A class representing the asynchronous load of a data stream from an URL.
//
@@ -57,7 +56,7 @@
//
// NOTE: All usage of all instances of this class should be on the same thread.
//
-class URLRequest : public NonThreadSafe {
+class URLRequest : public base::NonThreadSafe {
public:
// Derive from this class and add your own data members to associate extra
// information with a URLRequest. Use GetUserData(key) and SetUserData()
@@ -435,7 +434,7 @@
bool is_pending() const { return is_pending_; }
// Returns the error status of the request.
- const URLRequestStatus& status() const { return status_; }
+ const net::URLRequestStatus& status() const { return status_; }
// This method is called to start the request. The delegate will receive
// a OnResponseStarted callback when the request is started.
@@ -550,7 +549,7 @@
void set_is_pending(bool value) { is_pending_ = value; }
// Allow the URLRequestJob class to set our status too
- void set_status(const URLRequestStatus& value) { status_ = value; }
+ void set_status(const net::URLRequestStatus& value) { status_ = value; }
// Allow the URLRequestJob to redirect this request. Returns net::OK if
// successful, otherwise an error code is returned.
@@ -610,7 +609,7 @@
// Current error status of the job. When no error has been encountered, this
// will be SUCCESS. If multiple errors have been encountered, this will be
// the first non-SUCCESS status seen.
- URLRequestStatus status_;
+ net::URLRequestStatus status_;
// The HTTP response info, lazily initialized.
net::HttpResponseInfo response_info_;
diff --git a/net/url_request/url_request_context.cc b/net/url_request/url_request_context.cc
index 3bc7da6..8e0f3bd 100644
--- a/net/url_request/url_request_context.cc
+++ b/net/url_request/url_request_context.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -8,6 +8,8 @@
#include "net/base/cookie_store.h"
#include "net/base/host_resolver.h"
+namespace net {
+
URLRequestContext::URLRequestContext()
: net_log_(NULL),
host_resolver_(NULL),
@@ -30,6 +32,8 @@
URLRequestContext::~URLRequestContext() {
}
-void URLRequestContext::set_cookie_store(net::CookieStore* cookie_store) {
+void URLRequestContext::set_cookie_store(CookieStore* cookie_store) {
cookie_store_ = cookie_store;
}
+
+} // namespace net
diff --git a/net/url_request/url_request_context.h b/net/url_request/url_request_context.h
index d929696..d7e360d 100644
--- a/net/url_request/url_request_context.h
+++ b/net/url_request/url_request_context.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,8 +11,8 @@
#define NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
#pragma once
-#include "base/non_thread_safe.h"
#include "base/ref_counted.h"
+#include "base/threading/non_thread_safe.h"
#include "net/base/net_log.h"
#include "net/base/ssl_config_service.h"
#include "net/base/transport_security_state.h"
@@ -33,104 +33,103 @@
class HttpTransactionFactory;
class SSLConfigService;
class URLRequest;
-} // namespace net
-// Subclass to provide application-specific context for net::URLRequest
+// Subclass to provide application-specific context for URLRequest
// instances.
class URLRequestContext
: public base::RefCountedThreadSafe<URLRequestContext>,
- public NonThreadSafe {
+ public base::NonThreadSafe {
public:
URLRequestContext();
- net::NetLog* net_log() const {
+ NetLog* net_log() const {
return net_log_;
}
- void set_net_log(net::NetLog* net_log) {
+ void set_net_log(NetLog* net_log) {
net_log_ = net_log;
}
- net::HostResolver* host_resolver() const {
+ HostResolver* host_resolver() const {
return host_resolver_;
}
- void set_host_resolver(net::HostResolver* host_resolver) {
+ void set_host_resolver(HostResolver* host_resolver) {
host_resolver_ = host_resolver;
}
- net::CertVerifier* cert_verifier() const {
+ CertVerifier* cert_verifier() const {
return cert_verifier_;
}
- void set_cert_verifier(net::CertVerifier* cert_verifier) {
+ void set_cert_verifier(CertVerifier* cert_verifier) {
cert_verifier_ = cert_verifier;
}
- net::DnsRRResolver* dnsrr_resolver() const {
+ DnsRRResolver* dnsrr_resolver() const {
return dnsrr_resolver_;
}
- void set_dnsrr_resolver(net::DnsRRResolver* dnsrr_resolver) {
+ void set_dnsrr_resolver(DnsRRResolver* dnsrr_resolver) {
dnsrr_resolver_ = dnsrr_resolver;
}
- net::DnsCertProvenanceChecker* dns_cert_checker() const {
+ DnsCertProvenanceChecker* dns_cert_checker() const {
return dns_cert_checker_.get();
}
// Get the proxy service for this context.
- net::ProxyService* proxy_service() const {
+ ProxyService* proxy_service() const {
return proxy_service_;
}
- void set_proxy_service(net::ProxyService* proxy_service) {
+ void set_proxy_service(ProxyService* proxy_service) {
proxy_service_ = proxy_service;
}
// Get the ssl config service for this context.
- net::SSLConfigService* ssl_config_service() const {
+ SSLConfigService* ssl_config_service() const {
return ssl_config_service_;
}
// Gets the HTTP Authentication Handler Factory for this context.
// The factory is only valid for the lifetime of this URLRequestContext
- net::HttpAuthHandlerFactory* http_auth_handler_factory() {
+ HttpAuthHandlerFactory* http_auth_handler_factory() {
return http_auth_handler_factory_;
}
- void set_http_auth_handler_factory(net::HttpAuthHandlerFactory* factory) {
+ void set_http_auth_handler_factory(HttpAuthHandlerFactory* factory) {
http_auth_handler_factory_ = factory;
}
// Gets the http transaction factory for this context.
- net::HttpTransactionFactory* http_transaction_factory() const {
+ HttpTransactionFactory* http_transaction_factory() const {
return http_transaction_factory_;
}
- void set_http_transaction_factory(net::HttpTransactionFactory* factory) {
+ void set_http_transaction_factory(HttpTransactionFactory* factory) {
http_transaction_factory_ = factory;
}
// Gets the ftp transaction factory for this context.
- net::FtpTransactionFactory* ftp_transaction_factory() {
+ FtpTransactionFactory* ftp_transaction_factory() {
return ftp_transaction_factory_;
}
// Gets the cookie store for this context (may be null, in which case
// cookies are not stored).
- net::CookieStore* cookie_store() { return cookie_store_.get(); }
+ CookieStore* cookie_store() { return cookie_store_.get(); }
- void set_cookie_store(net::CookieStore* cookie_store);
+ void set_cookie_store(CookieStore* cookie_store);
// Gets the cookie policy for this context (may be null, in which case
// cookies are allowed).
- net::CookiePolicy* cookie_policy() { return cookie_policy_; }
+ CookiePolicy* cookie_policy() { return cookie_policy_; }
- net::TransportSecurityState* transport_security_state() {
+ TransportSecurityState* transport_security_state() {
return transport_security_state_; }
// Gets the FTP authentication cache for this context.
- net::FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; }
+ FtpAuthCache* ftp_auth_cache() { return &ftp_auth_cache_; }
// Gets the value of 'Accept-Charset' header field.
const std::string& accept_charset() const { return accept_charset_; }
@@ -167,21 +166,21 @@
// The following members are expected to be initialized and owned by
// subclasses.
- net::NetLog* net_log_;
- net::HostResolver* host_resolver_;
- net::CertVerifier* cert_verifier_;
- net::DnsRRResolver* dnsrr_resolver_;
- scoped_ptr<net::DnsCertProvenanceChecker> dns_cert_checker_;
- scoped_refptr<net::ProxyService> proxy_service_;
- scoped_refptr<net::SSLConfigService> ssl_config_service_;
- net::HttpTransactionFactory* http_transaction_factory_;
- net::FtpTransactionFactory* ftp_transaction_factory_;
- net::HttpAuthHandlerFactory* http_auth_handler_factory_;
- net::HttpNetworkDelegate* network_delegate_;
- scoped_refptr<net::CookieStore> cookie_store_;
- net::CookiePolicy* cookie_policy_;
- scoped_refptr<net::TransportSecurityState> transport_security_state_;
- net::FtpAuthCache ftp_auth_cache_;
+ NetLog* net_log_;
+ HostResolver* host_resolver_;
+ CertVerifier* cert_verifier_;
+ DnsRRResolver* dnsrr_resolver_;
+ scoped_ptr<DnsCertProvenanceChecker> dns_cert_checker_;
+ scoped_refptr<ProxyService> proxy_service_;
+ scoped_refptr<SSLConfigService> ssl_config_service_;
+ HttpTransactionFactory* http_transaction_factory_;
+ FtpTransactionFactory* ftp_transaction_factory_;
+ HttpAuthHandlerFactory* http_auth_handler_factory_;
+ HttpNetworkDelegate* network_delegate_;
+ scoped_refptr<CookieStore> cookie_store_;
+ CookiePolicy* cookie_policy_;
+ scoped_refptr<TransportSecurityState> transport_security_state_;
+ FtpAuthCache ftp_auth_cache_;
std::string accept_language_;
std::string accept_charset_;
// The charset of the referrer where this request comes from. It's not
@@ -196,4 +195,9 @@
DISALLOW_COPY_AND_ASSIGN(URLRequestContext);
};
+} // namespace net
+
+// TODO(tfarina): Fix the callers and remove this!
+typedef net::URLRequestContext URLRequestContext;
+
#endif // NET_URL_REQUEST_URL_REQUEST_CONTEXT_H_
diff --git a/net/url_request/url_request_file_dir_job.cc b/net/url_request/url_request_file_dir_job.cc
index 553add8..badb6b8 100644
--- a/net/url_request/url_request_file_dir_job.cc
+++ b/net/url_request/url_request_file_dir_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -19,11 +19,11 @@
#include <sys/stat.h>
#endif
-using std::string;
+namespace net {
-URLRequestFileDirJob::URLRequestFileDirJob(net::URLRequest* request,
+URLRequestFileDirJob::URLRequestFileDirJob(URLRequest* request,
const FilePath& dir_path)
- : net::URLRequestJob(request),
+ : URLRequestJob(request),
dir_path_(dir_path),
canceled_(false),
list_complete_(false),
@@ -57,7 +57,7 @@
// is trying to feed us data.
AddRef();
- lister_ = new net::DirectoryLister(dir_path_, this);
+ lister_ = new DirectoryLister(dir_path_, this);
lister_->Start();
NotifyHeadersComplete();
@@ -69,18 +69,18 @@
canceled_ = true;
- // Don't call CloseLister or dispatch an error to the net::URLRequest because
+ // Don't call CloseLister or dispatch an error to the URLRequest because
// we want OnListDone to be called to also write the error to the output
- // stream. OnListDone will notify the net::URLRequest at this time.
+ // stream. OnListDone will notify the URLRequest at this time.
if (lister_)
lister_->Cancel();
- net::URLRequestJob::Kill();
+ URLRequestJob::Kill();
method_factory_.RevokeAll();
}
-bool URLRequestFileDirJob::ReadRawData(net::IOBuffer* buf, int buf_size,
+bool URLRequestFileDirJob::ReadRawData(IOBuffer* buf, int buf_size,
int *bytes_read) {
DCHECK(bytes_read);
*bytes_read = 0;
@@ -99,19 +99,19 @@
return false;
}
-bool URLRequestFileDirJob::GetMimeType(string* mime_type) const {
+bool URLRequestFileDirJob::GetMimeType(std::string* mime_type) const {
*mime_type = "text/html";
return true;
}
-bool URLRequestFileDirJob::GetCharset(string* charset) {
+bool URLRequestFileDirJob::GetCharset(std::string* charset) {
// All the filenames are converted to UTF-8 before being added.
*charset = "utf-8";
return true;
}
void URLRequestFileDirJob::OnListFile(
- const net::DirectoryLister::DirectoryListerData& data) {
+ const DirectoryLister::DirectoryListerData& data) {
// We wait to write out the header until we get the first file, so that we
// can catch errors from DirectoryLister and show an error page.
if (!wrote_header_) {
@@ -126,7 +126,7 @@
const string16& title = WideToUTF16(
base::SysNativeMBToWide(dir_path_.value()));
#endif
- data_.append(net::GetDirectoryListingHeader(title));
+ data_.append(GetDirectoryListingHeader(title));
wrote_header_ = true;
}
@@ -137,7 +137,7 @@
// Note that we should not convert ftLastWriteTime to the local time because
// ICU's datetime formatting APIs expect time in UTC and take into account
// the timezone before formatting.
- data_.append(net::GetDirectoryListingEntry(
+ data_.append(GetDirectoryListingEntry(
data.info.cFileName, std::string(),
(data.info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) ? true : false,
size,
@@ -145,7 +145,7 @@
#elif defined(OS_POSIX)
// TOOD(jungshik): The same issue as for the directory name.
- data_.append(net::GetDirectoryListingEntry(
+ data_.append(GetDirectoryListingEntry(
WideToUTF16(base::SysNativeMBToWide(data.info.filename)),
data.info.filename,
S_ISDIR(data.info.stat.st_mode),
@@ -220,3 +220,5 @@
}
}
}
+
+} // namespace net
diff --git a/net/url_request/url_request_file_dir_job.h b/net/url_request/url_request_file_dir_job.h
index bdb9b37..2b40a98 100644
--- a/net/url_request/url_request_file_dir_job.h
+++ b/net/url_request/url_request_file_dir_job.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__
-#define NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__
+#ifndef NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_
+#define NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_
#pragma once
#include <string>
@@ -14,23 +14,25 @@
#include "net/base/directory_lister.h"
#include "net/url_request/url_request_job.h"
-class URLRequestFileDirJob
- : public net::URLRequestJob,
- public net::DirectoryLister::DirectoryListerDelegate {
- public:
- URLRequestFileDirJob(net::URLRequest* request, const FilePath& dir_path);
+namespace net {
- // net::URLRequestJob methods:
+class URLRequestFileDirJob
+ : public URLRequestJob,
+ public DirectoryLister::DirectoryListerDelegate {
+ public:
+ URLRequestFileDirJob(URLRequest* request, const FilePath& dir_path);
+
+ // Overridden from URLRequestJob:
virtual void Start();
virtual void StartAsync();
virtual void Kill();
- virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
+ virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read);
virtual bool GetMimeType(std::string* mime_type) const;
virtual bool GetCharset(std::string* charset);
- // DirectoryLister::DirectoryListerDelegate methods:
+ // Overridden from DirectoryLister::DirectoryListerDelegate:
virtual void OnListFile(
- const net::DirectoryLister::DirectoryListerData& data);
+ const DirectoryLister::DirectoryListerData& data);
virtual void OnListDone(int error);
bool list_complete() const { return list_complete_; }
@@ -47,7 +49,7 @@
// Fills a buffer with the output.
bool FillReadBuffer(char *buf, int buf_size, int *bytes_read);
- scoped_refptr<net::DirectoryLister> lister_;
+ scoped_refptr<DirectoryLister> lister_;
FilePath dir_path_;
std::string data_;
bool canceled_;
@@ -62,11 +64,13 @@
// we wait for IO to complete. When done, we fill the buffer
// manually.
bool read_pending_;
- scoped_refptr<net::IOBuffer> read_buffer_;
+ scoped_refptr<IOBuffer> read_buffer_;
int read_buffer_length_;
ScopedRunnableMethodFactory<URLRequestFileDirJob> method_factory_;
DISALLOW_COPY_AND_ASSIGN(URLRequestFileDirJob);
};
-#endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H__
+} // namespace net
+
+#endif // NET_URL_REQUEST_URL_REQUEST_FILE_DIR_JOB_H_
diff --git a/net/url_request/url_request_file_job.cc b/net/url_request/url_request_file_job.cc
index 230ee06..adc6f44 100644
--- a/net/url_request/url_request_file_job.cc
+++ b/net/url_request/url_request_file_job.cc
@@ -23,7 +23,8 @@
#include "base/message_loop.h"
#include "base/platform_file.h"
#include "base/string_util.h"
-#include "base/thread_restrictions.h"
+#include "base/threading/worker_pool.h"
+#include "base/threading/thread_restrictions.h"
#include "build/build_config.h"
#include "googleurl/src/gurl.h"
#include "net/base/io_buffer.h"
@@ -36,10 +37,6 @@
#include "net/url_request/url_request_error_job.h"
#include "net/url_request/url_request_file_dir_job.h"
-#if defined(OS_WIN)
-#include "base/worker_pool.h"
-#endif
-
namespace net {
#if defined(OS_WIN)
@@ -136,7 +133,7 @@
if (!file_path_.value().compare(0, 2, L"\\\\")) {
DCHECK(!async_resolver_);
async_resolver_ = new AsyncResolver(this);
- WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(
+ base::WorkerPool::PostTask(FROM_HERE, NewRunnableMethod(
async_resolver_.get(), &AsyncResolver::Resolve, file_path_), true);
return;
}
diff --git a/net/url_request/url_request_filter.cc b/net/url_request/url_request_filter.cc
index 946c2c3..d52fef5 100644
--- a/net/url_request/url_request_filter.cc
+++ b/net/url_request/url_request_filter.cc
@@ -8,16 +8,18 @@
#include "base/logging.h"
+namespace net {
+
URLRequestFilter* URLRequestFilter::shared_instance_ = NULL;
-/* static */
+// static
URLRequestFilter* URLRequestFilter::GetInstance() {
if (!shared_instance_)
shared_instance_ = new URLRequestFilter;
return shared_instance_;
}
-/* static */
+// static
net::URLRequestJob* URLRequestFilter::Factory(net::URLRequest* request,
const std::string& scheme) {
// Returning null here just means that the built-in handler will be used.
@@ -142,3 +144,5 @@
}
return job;
}
+
+} // namespace net
diff --git a/net/url_request/url_request_filter.h b/net/url_request/url_request_filter.h
index 716ad4d..9138b87 100644
--- a/net/url_request/url_request_filter.h
+++ b/net/url_request/url_request_filter.h
@@ -30,7 +30,6 @@
namespace net {
class URLRequestJob;
-} // namespace net
class URLRequestFilter {
public:
@@ -89,4 +88,6 @@
DISALLOW_COPY_AND_ASSIGN(URLRequestFilter);
};
+} // namespace net
+
#endif // NET_URL_REQUEST_URL_REQUEST_FILTER_H_
diff --git a/net/url_request/url_request_ftp_job.h b/net/url_request/url_request_ftp_job.h
index d503766..ed65214 100644
--- a/net/url_request/url_request_ftp_job.h
+++ b/net/url_request/url_request_ftp_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -16,10 +16,10 @@
#include "net/ftp/ftp_transaction.h"
#include "net/url_request/url_request_job.h"
-class URLRequestContext;
-
namespace net {
+class URLRequestContext;
+
// A URLRequestJob subclass that is built on top of FtpTransaction. It
// provides an implementation for FTP.
class URLRequestFtpJob : public URLRequestJob {
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h
index 78778c5..fbd8baf 100644
--- a/net/url_request/url_request_http_job.h
+++ b/net/url_request/url_request_http_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -18,12 +18,11 @@
#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_throttler_entry_interface.h"
-class URLRequestContext;
-
namespace net {
class HttpResponseInfo;
class HttpTransaction;
+class URLRequestContext;
// A net::URLRequestJob subclass that is built on top of HttpTransaction. It
// provides an implementation for both HTTP and HTTPS.
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h
index 6f91c9a..23a3232 100644
--- a/net/url_request/url_request_job.h
+++ b/net/url_request/url_request_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -17,7 +17,6 @@
#include "net/base/filter.h"
#include "net/base/load_states.h"
-class URLRequestStatus;
namespace net {
@@ -28,6 +27,7 @@
class URLRequest;
class URLRequestJobMetrics;
class UploadData;
+class URLRequestStatus;
class X509Certificate;
class URLRequestJob : public base::RefCounted<URLRequestJob>,
@@ -225,13 +225,13 @@
void NotifyReadComplete(int bytes_read);
// Notifies the request that a start error has occurred.
- void NotifyStartError(const URLRequestStatus& status);
+ void NotifyStartError(const net::URLRequestStatus& status);
// NotifyDone marks when we are done with a request. It is really
// a glorified set_status, but also does internal state checking and
// job tracking. It should be called once per request, when the job is
// finished doing all IO.
- void NotifyDone(const URLRequestStatus& status);
+ void NotifyDone(const net::URLRequestStatus& status);
// Some work performed by NotifyDone must be completed on a separate task
// so as to avoid re-entering the delegate. This method exists to perform
@@ -282,10 +282,10 @@
net::URLRequest* request_;
// The status of the job.
- const URLRequestStatus GetStatus();
+ const net::URLRequestStatus GetStatus();
// Set the status of the job.
- void SetStatus(const URLRequestStatus& status);
+ void SetStatus(const net::URLRequestStatus& status);
// Whether the job is doing performance profiling
bool is_profiling_;
diff --git a/net/url_request/url_request_job_manager.h b/net/url_request/url_request_job_manager.h
index a0d3c87..34e3a58 100644
--- a/net/url_request/url_request_job_manager.h
+++ b/net/url_request/url_request_job_manager.h
@@ -11,7 +11,7 @@
#include <vector>
#include "base/lock.h"
-#include "base/platform_thread.h"
+#include "base/threading/platform_thread.h"
#include "net/url_request/url_request.h"
template <typename T> struct DefaultSingletonTraits;
@@ -84,7 +84,7 @@
#ifndef NDEBUG
// We use this to assert that CreateJob and the registration functions all
// run on the same thread.
- mutable PlatformThreadId allowed_thread_;
+ mutable base::PlatformThreadId allowed_thread_;
mutable bool allowed_thread_initialized_;
// The first guy to call this function sets the allowed thread. This way we
@@ -94,10 +94,10 @@
bool IsAllowedThread() const {
#if 0
if (!allowed_thread_initialized_) {
- allowed_thread_ = PlatformThread::CurrentId();
+ allowed_thread_ = base::PlatformThread::CurrentId();
allowed_thread_initialized_ = true;
}
- return allowed_thread_ == PlatformThread::CurrentId();
+ return allowed_thread_ == base::PlatformThread::CurrentId();
#else
// The previous version of this check used GetCurrentThread on Windows to
// get thread handles to compare. Unfortunately, GetCurrentThread returns
diff --git a/net/url_request/url_request_job_metrics.h b/net/url_request/url_request_job_metrics.h
index 15bbaf6..6552026 100644
--- a/net/url_request/url_request_job_metrics.h
+++ b/net/url_request/url_request_job_metrics.h
@@ -23,6 +23,9 @@
URLRequestJobMetrics();
~URLRequestJobMetrics();
+ // Append the text report of the frame loading to the input string.
+ void AppendText(std::wstring* text);
+
// The original url the job has been created for.
scoped_ptr<GURL> original_url_;
@@ -44,9 +47,6 @@
// Final status of the job.
bool success_;
-
- // Append the text report of the frame loading to the input string.
- void AppendText(std::wstring* text);
};
} // namespace net
diff --git a/net/url_request/url_request_job_tracker.h b/net/url_request/url_request_job_tracker.h
index 4c8ecec..4a03cf7 100644
--- a/net/url_request/url_request_job_tracker.h
+++ b/net/url_request/url_request_job_tracker.h
@@ -40,7 +40,7 @@
// Called when the given job has completed, before notifying the request
virtual void OnJobDone(URLRequestJob* job,
- const URLRequestStatus& status) = 0;
+ const net::URLRequestStatus& status) = 0;
// Called when the given job is about to follow a redirect to the given
// new URL. The redirect type is given in status_code
@@ -77,7 +77,7 @@
void RemoveJob(URLRequestJob* job);
// Job status change notifications
- void OnJobDone(URLRequestJob* job, const URLRequestStatus& status);
+ void OnJobDone(URLRequestJob* job, const net::URLRequestStatus& status);
void OnJobRedirect(URLRequestJob* job, const GURL& location,
int status_code);
diff --git a/net/url_request/url_request_status.h b/net/url_request/url_request_status.h
index ca376fb..332e7e9 100644
--- a/net/url_request/url_request_status.h
+++ b/net/url_request/url_request_status.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -9,6 +9,8 @@
#define NET_URL_REQUEST_URL_REQUEST_STATUS_H_
#pragma once
+namespace net {
+
// Represents the result of a URL request. It encodes errors and various
// types of success.
class URLRequestStatus {
@@ -64,4 +66,9 @@
int os_error_;
};
+} // namespace net
+
+// TODO(tfarina): Fix the callers and remove this!
+typedef net::URLRequestStatus URLRequestStatus;
+
#endif // NET_URL_REQUEST_URL_REQUEST_STATUS_H_
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc
index 7fd019c..4aa7c16 100644
--- a/net/url_request/url_request_test_job.cc
+++ b/net/url_request/url_request_test_job.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -16,7 +16,9 @@
// This emulates the global message loop for the test URL request class, since
// this is only test code, it's probably not too dangerous to have this static
// object.
-static std::vector< scoped_refptr<URLRequestTestJob> > pending_jobs;
+static std::vector< scoped_refptr<URLRequestTestJob> > g_pending_jobs;
+
+namespace net {
// static getters for known URLs
GURL URLRequestTestJob::test_url_1() {
@@ -70,13 +72,13 @@
}
// static
-net::URLRequestJob* URLRequestTestJob::Factory(net::URLRequest* request,
- const std::string& scheme) {
+URLRequestJob* URLRequestTestJob::Factory(URLRequest* request,
+ const std::string& scheme) {
return new URLRequestTestJob(request);
}
-URLRequestTestJob::URLRequestTestJob(net::URLRequest* request)
- : net::URLRequestJob(request),
+URLRequestTestJob::URLRequestTestJob(URLRequest* request)
+ : URLRequestJob(request),
auto_advance_(false),
stage_(WAITING),
offset_(0),
@@ -84,9 +86,9 @@
async_buf_size_(0) {
}
-URLRequestTestJob::URLRequestTestJob(net::URLRequest* request,
+URLRequestTestJob::URLRequestTestJob(URLRequest* request,
bool auto_advance)
- : net::URLRequestJob(request),
+ : URLRequestJob(request),
auto_advance_(auto_advance),
stage_(WAITING),
offset_(0),
@@ -94,14 +96,14 @@
async_buf_size_(0) {
}
-URLRequestTestJob::URLRequestTestJob(net::URLRequest* request,
+URLRequestTestJob::URLRequestTestJob(URLRequest* request,
const std::string& response_headers,
const std::string& response_data,
bool auto_advance)
- : net::URLRequestJob(request),
+ : URLRequestJob(request),
auto_advance_(auto_advance),
stage_(WAITING),
- response_headers_(new net::HttpResponseHeaders(response_headers)),
+ response_headers_(new HttpResponseHeaders(response_headers)),
response_data_(response_data),
offset_(0),
async_buf_(NULL),
@@ -127,7 +129,7 @@
void URLRequestTestJob::StartAsync() {
if (!response_headers_) {
- response_headers_ = new net::HttpResponseHeaders(test_headers());
+ response_headers_ = new HttpResponseHeaders(test_headers());
if (request_->url().spec() == test_url_1().spec()) {
response_data_ = test_data_1();
stage_ = DATA_AVAILABLE; // Simulate a synchronous response for this one.
@@ -140,7 +142,7 @@
// FIXME(brettw) we may want to use WININET errors or have some more types
// of errors
NotifyDone(URLRequestStatus(URLRequestStatus::FAILED,
- net::ERR_INVALID_URL));
+ ERR_INVALID_URL));
// FIXME(brettw): this should emulate a network error, and not just fail
// initiating a connection
return;
@@ -152,7 +154,7 @@
this->NotifyHeadersComplete();
}
-bool URLRequestTestJob::ReadRawData(net::IOBuffer* buf, int buf_size,
+bool URLRequestTestJob::ReadRawData(IOBuffer* buf, int buf_size,
int *bytes_read) {
if (stage_ == WAITING) {
async_buf_ = buf;
@@ -179,7 +181,7 @@
return true;
}
-void URLRequestTestJob::GetResponseInfo(net::HttpResponseInfo* info) {
+void URLRequestTestJob::GetResponseInfo(HttpResponseInfo* info) {
if (response_headers_)
info->headers = response_headers_;
}
@@ -207,7 +209,7 @@
void URLRequestTestJob::Kill() {
stage_ = DONE;
- net::URLRequestJob::Kill();
+ URLRequestJob::Kill();
}
void URLRequestTestJob::ProcessNextOperation() {
@@ -244,18 +246,20 @@
this, &URLRequestTestJob::ProcessNextOperation));
return;
}
- pending_jobs.push_back(scoped_refptr<URLRequestTestJob>(this));
+ g_pending_jobs.push_back(scoped_refptr<URLRequestTestJob>(this));
}
// static
bool URLRequestTestJob::ProcessOnePendingMessage() {
- if (pending_jobs.empty())
+ if (g_pending_jobs.empty())
return false;
- scoped_refptr<URLRequestTestJob> next_job(pending_jobs[0]);
- pending_jobs.erase(pending_jobs.begin());
+ scoped_refptr<URLRequestTestJob> next_job(g_pending_jobs[0]);
+ g_pending_jobs.erase(g_pending_jobs.begin());
DCHECK(!next_job->auto_advance()); // auto_advance jobs should be in this q
next_job->ProcessNextOperation();
return true;
}
+
+} // namespace net
diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h
index ec92dc2..252c173 100644
--- a/net/url_request/url_request_test_job.h
+++ b/net/url_request/url_request_test_job.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,6 +11,8 @@
#include "net/url_request/url_request.h"
#include "net/url_request/url_request_job.h"
+namespace net {
+
// This job type is designed to help with simple unit tests. To use, you
// probably want to inherit from it to set up the state you want. Then install
// it as the protocol handler for the "test" scheme.
@@ -33,20 +35,20 @@
//
// Optionally, you can also construct test jobs that advance automatically
// without having to call ProcessOnePendingMessage.
-class URLRequestTestJob : public net::URLRequestJob {
+class URLRequestTestJob : public URLRequestJob {
public:
// Constructs a job to return one of the canned responses depending on the
// request url, with auto advance disabled.
- explicit URLRequestTestJob(net::URLRequest* request);
+ explicit URLRequestTestJob(URLRequest* request);
// Constructs a job to return one of the canned responses depending on the
// request url, optionally with auto advance enabled.
- explicit URLRequestTestJob(net::URLRequest* request, bool auto_advance);
+ explicit URLRequestTestJob(URLRequest* request, bool auto_advance);
// Constructs a job to return the given response regardless of the request
// url. The headers should include the HTTP status line and be formatted as
- // expected by net::HttpResponseHeaders.
- explicit URLRequestTestJob(net::URLRequest* request,
+ // expected by HttpResponseHeaders.
+ explicit URLRequestTestJob(URLRequest* request,
const std::string& response_headers,
const std::string& response_data,
bool auto_advance);
@@ -86,14 +88,14 @@
void set_auto_advance(bool auto_advance) { auto_advance_ = auto_advance; }
// Factory method for protocol factory registration if callers don't subclass
- static net::URLRequest::ProtocolFactory Factory;
+ static URLRequest::ProtocolFactory Factory;
// Job functions
virtual void Start();
- virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
+ virtual bool ReadRawData(IOBuffer* buf, int buf_size, int *bytes_read);
virtual void Kill();
virtual bool GetMimeType(std::string* mime_type) const;
- virtual void GetResponseInfo(net::HttpResponseInfo* info);
+ virtual void GetResponseInfo(HttpResponseInfo* info);
virtual int GetResponseCode() const;
virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
@@ -120,7 +122,7 @@
// The headers the job should return, will be set in Start() if not provided
// in the explicit ctor.
- scoped_refptr<net::HttpResponseHeaders> response_headers_;
+ scoped_refptr<HttpResponseHeaders> response_headers_;
// The data to send, will be set in Start() if not provided in the explicit
// ctor.
@@ -130,8 +132,13 @@
int offset_;
// Holds the buffer for an asynchronous ReadRawData call
- net::IOBuffer* async_buf_;
+ IOBuffer* async_buf_;
int async_buf_size_;
};
+} // namespace net
+
+// TODO(tfarina): Fix the callers and remove this!
+typedef net::URLRequestTestJob URLRequestTestJob;
+
#endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_
diff --git a/net/url_request/url_request_unittest.h b/net/url_request/url_request_unittest.h
index 50236fd..c336b41 100644
--- a/net/url_request/url_request_unittest.h
+++ b/net/url_request/url_request_unittest.h
@@ -17,7 +17,7 @@
#include "base/process_util.h"
#include "base/string_util.h"
#include "base/string16.h"
-#include "base/thread.h"
+#include "base/threading/thread.h"
#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "net/base/cert_verifier.h"
@@ -173,6 +173,7 @@
http_auth_handler_factory_,
network_delegate_,
NULL),
+ NULL /* net_log */,
net::HttpCache::DefaultBackend::InMemory(0));
// In-memory cookie store.
cookie_store_ = new net::CookieMonster(NULL, NULL);
diff --git a/net/url_request/view_cache_helper.h b/net/url_request/view_cache_helper.h
index 03af714..1952916 100644
--- a/net/url_request/view_cache_helper.h
+++ b/net/url_request/view_cache_helper.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved.
+// 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.
@@ -11,15 +11,15 @@
#include "net/base/completion_callback.h"
#include "net/base/io_buffer.h"
-class URLRequestContext;
-
namespace disk_cache {
class Backend;
class Entry;
-}
+} // namespace disk_cache
namespace net {
+class URLRequestContext;
+
class ViewCacheHelper {
public:
ViewCacheHelper();
@@ -29,16 +29,20 @@
// If this method returns ERR_IO_PENDING, |callback| will be notified when the
// operation completes. |out| must remain valid until this operation completes
// or the object is destroyed.
- int GetEntryInfoHTML(const std::string& key, URLRequestContext* context,
- std::string* out, CompletionCallback* callback);
+ int GetEntryInfoHTML(const std::string& key,
+ net::URLRequestContext* context,
+ std::string* out,
+ CompletionCallback* callback);
// Formats the cache contents as HTML. Returns a net error code.
// If this method returns ERR_IO_PENDING, |callback| will be notified when the
// operation completes. |out| must remain valid until this operation completes
// or the object is destroyed. |url_prefix| will be prepended to each entry
// key as a link to the entry.
- int GetContentsHTML(URLRequestContext* context, const std::string& url_prefix,
- std::string* out, CompletionCallback* callback);
+ int GetContentsHTML(net::URLRequestContext* context,
+ const std::string& url_prefix,
+ std::string* out,
+ CompletionCallback* callback);
private:
enum State {
@@ -56,8 +60,10 @@
};
// Implements GetEntryInfoHTML and GetContentsHTML.
- int GetInfoHTML(const std::string& key, URLRequestContext* context,
- const std::string& url_prefix, std::string* out,
+ int GetInfoHTML(const std::string& key,
+ net::URLRequestContext* context,
+ const std::string& url_prefix,
+ std::string* out,
CompletionCallback* callback);
// This is a helper function used to trigger a completion callback. It may
@@ -87,7 +93,7 @@
// Called to signal completion of asynchronous IO.
void OnIOComplete(int result);
- scoped_refptr<URLRequestContext> context_;
+ scoped_refptr<net::URLRequestContext> context_;
disk_cache::Backend* disk_cache_;
disk_cache::Entry* entry_;
void* iter_;
diff --git a/net/url_request/view_cache_helper_unittest.cc b/net/url_request/view_cache_helper_unittest.cc
index 5338ee5..3903c2b 100644
--- a/net/url_request/view_cache_helper_unittest.cc
+++ b/net/url_request/view_cache_helper_unittest.cc
@@ -25,7 +25,7 @@
};
TestURLRequestContext::TestURLRequestContext()
- : cache_(reinterpret_cast<net::HttpTransactionFactory*>(NULL),
+ : cache_(reinterpret_cast<net::HttpTransactionFactory*>(NULL), NULL,
net::HttpCache::DefaultBackend::InMemory(0)) {
http_transaction_factory_ = &cache_;
}
diff --git a/net/websockets/websocket.h b/net/websockets/websocket.h
index c729afc..ec1297a 100644
--- a/net/websockets/websocket.h
+++ b/net/websockets/websocket.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// 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.
//
@@ -74,7 +74,7 @@
Request(const GURL& url, const std::string protocol,
const std::string origin, const std::string location,
ProtocolVersion version,
- URLRequestContext* context)
+ net::URLRequestContext* context)
: url_(url),
protocol_(protocol),
origin_(origin),
@@ -90,7 +90,7 @@
const std::string& origin() const { return origin_; }
const std::string& location() const { return location_; }
ProtocolVersion version() const { return version_; }
- URLRequestContext* context() const { return context_; }
+ net::URLRequestContext* context() const { return context_; }
// Sets an alternative HostResolver. For testing purposes only.
void SetHostResolver(HostResolver* host_resolver) {
@@ -113,7 +113,7 @@
std::string origin_;
std::string location_;
ProtocolVersion version_;
- scoped_refptr<URLRequestContext> context_;
+ scoped_refptr<net::URLRequestContext> context_;
HostResolver* host_resolver_;
ClientSocketFactory* client_socket_factory_;
diff --git a/net/websockets/websocket_handshake_handler.cc b/net/websockets/websocket_handshake_handler.cc
index 57f01e9..734b93e 100644
--- a/net/websockets/websocket_handshake_handler.cc
+++ b/net/websockets/websocket_handshake_handler.cc
@@ -284,6 +284,8 @@
: original_header_length_(0) {
}
+WebSocketHandshakeResponseHandler::~WebSocketHandshakeResponseHandler() {}
+
size_t WebSocketHandshakeResponseHandler::ParseRawResponse(
const char* data, int length) {
DCHECK_GT(length, 0);
diff --git a/net/websockets/websocket_handshake_handler.h b/net/websockets/websocket_handshake_handler.h
index 5455444..b191dba 100644
--- a/net/websockets/websocket_handshake_handler.h
+++ b/net/websockets/websocket_handshake_handler.h
@@ -71,7 +71,7 @@
class WebSocketHandshakeResponseHandler {
public:
WebSocketHandshakeResponseHandler();
- ~WebSocketHandshakeResponseHandler() {}
+ ~WebSocketHandshakeResponseHandler();
// Parses WebSocket handshake response from WebSocket server.
// Returns number of bytes in |data| used for WebSocket handshake response
diff --git a/net/websockets/websocket_job.h b/net/websockets/websocket_job.h
index f19653d..d9a6e71 100644
--- a/net/websockets/websocket_job.h
+++ b/net/websockets/websocket_job.h
@@ -39,10 +39,11 @@
CLOSING = 2,
CLOSED = 3,
};
- static void EnsureInit();
explicit WebSocketJob(SocketStream::Delegate* delegate);
+ static void EnsureInit();
+
State state() const { return state_; }
virtual void Connect();
virtual bool SendData(const char* data, int len);
diff --git a/webkit/glue/cpp_bound_class_unittest.cc b/webkit/glue/cpp_bound_class_unittest.cc
index 54581ad..f2ef018 100644
--- a/webkit/glue/cpp_bound_class_unittest.cc
+++ b/webkit/glue/cpp_bound_class_unittest.cc
@@ -230,7 +230,8 @@
CheckJavaScriptSuccess(js);
}
-TEST_F(CppBoundClassTest, InvokeMethods) {
+// Disabled, http://crbug.com/68445.
+TEST_F(CppBoundClassTest, DISABLED_InvokeMethods) {
// The expression on the left is expected to return the value on the right.
static const std::string tests[] = {
"example.echoValue(true)", "true",
diff --git a/webkit/glue/resource_loader_bridge.h b/webkit/glue/resource_loader_bridge.h
index 7257b0c..85facfa 100644
--- a/webkit/glue/resource_loader_bridge.h
+++ b/webkit/glue/resource_loader_bridge.h
@@ -308,7 +308,7 @@
// Called when the response is complete. This method signals completion of
// the resource load.ff
- virtual void OnCompletedRequest(const URLRequestStatus& status,
+ virtual void OnCompletedRequest(const net::URLRequestStatus& status,
const std::string& security_info,
const base::Time& completion_time) = 0;
};
diff --git a/webkit/glue/resources/webkit_strings_am.xtb b/webkit/glue/resources/webkit_strings_am.xtb
index 1a71058..4f5108e 100644
--- a/webkit/glue/resources/webkit_strings_am.xtb
+++ b/webkit/glue/resources/webkit_strings_am.xtb
@@ -8,6 +8,7 @@
<translation id="7658239707568436148">ሰርዝ</translation>
<translation id="795667975304826397">ምንም ፋይል አልተመረጠም</translation>
<translation id="8141602879876242471">ይህ ሊፈለግ የሚችል መረጃ ጠቋሚ ነው። የፍለጋ ቁልፍ ቃላት አስገባ፦</translation>
+<translation id="370665806235115550">በመጫን ላይ...</translation>
<translation id="6845533974506654842">ተጫን</translation>
<translation id="8244226242650769279">የምስል ካርታ</translation>
<translation id="2548326553472216322">የቅርብ ጊዜ ፍለጋዎች የሉም</translation>
@@ -20,7 +21,6 @@
<translation id="5476505524087279545">አታመልክት</translation>
<translation id="3789841737615482174">ጫን</translation>
<translation id="6663448176199120256">የቅርብ ጊዜ ፍለጋዎችን</translation>
-<translation id="6807599807928161586">የድር ክልል</translation>
<translation id="5939518447894949180">ዳግም አስጀምር</translation>
<translation id="1842960171412779397">ምረጥ</translation>
<translation id="6119846243427417423">አንቃ</translation>
diff --git a/webkit/glue/resources/webkit_strings_ar.xtb b/webkit/glue/resources/webkit_strings_ar.xtb
index 6f454f7..0f2e739 100644
--- a/webkit/glue/resources/webkit_strings_ar.xtb
+++ b/webkit/glue/resources/webkit_strings_ar.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="ar">
<translation id="4519964825805946997">أخفق تثبيت المكون الإضافي من <ph name="URL"/></translation>
+<translation id="9186171386827445984">جارٍ تحميل المستند: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> من الصفحات...</translation>
<translation id="1235745349614807883">محو آخر عمليات البحث</translation>
<translation id="5048533449481078685">محدّد القائمة</translation>
<translation id="372362261556059955">المكوّن الإضافي المطلوب</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">أخفق تثبيت المكون الإضافي</translation>
<translation id="8141602879876242471">يمكن البحث في هذا الفهرس بإدخال كلمات مفتاحية:</translation>
<translation id="5650795167354946011">بعد تثبيت المكون الإضافي، انقر هنا للتحديث</translation>
+<translation id="370665806235115550">تحميل...</translation>
<translation id="6845533974506654842">اضغط</translation>
<translation id="8244226242650769279">مخطّط صورة</translation>
<translation id="2548326553472216322">لا عمليات بحث حديثة</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">الرجاء التأكيد على أنك تريد تثبيت المكوّن الإضافي <ph name="PLUGIN"/>. يجب تثبيت المكونات الإضافية التي تثق فيها فقط.</translation>
<translation id="6663448176199120256">آخر عمليات البحث</translation>
<translation id="2597378329261239068">هذا المستند محمي بكلمة المرور. الرجاء إدخال كلمة مرور.</translation>
-<translation id="6807599807928161586">منطقة الويب</translation>
+<translation id="7740050170769002709">محتوى HTML</translation>
<translation id="5939518447894949180">إعادة</translation>
<translation id="1842960171412779397">الاختيار</translation>
<translation id="7638452146404718955">انقر هنا لتنزيل المكون الإضافي</translation>
diff --git a/webkit/glue/resources/webkit_strings_bg.xtb b/webkit/glue/resources/webkit_strings_bg.xtb
index 4edbd69..09f4a71 100644
--- a/webkit/glue/resources/webkit_strings_bg.xtb
+++ b/webkit/glue/resources/webkit_strings_bg.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="bg">
<translation id="4519964825805946997">Инсталирането на приставката от <ph name="URL"/> не бе успешно</translation>
+<translation id="9186171386827445984">Документът се зарежда: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> страници...</translation>
<translation id="1235745349614807883">Изчистване на скорошните търсения</translation>
<translation id="5048533449481078685">списъчен показалец</translation>
<translation id="372362261556059955">Необходима е допълнителна приставка</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Инсталирането на приставката не бе успешно</translation>
<translation id="8141602879876242471">В този индекс може да се търси. Въведете ключови думи за търсене:</translation>
<translation id="5650795167354946011">След инсталирането на приставката кликнете тук за опресняване</translation>
+<translation id="370665806235115550">Зарежда се...</translation>
<translation id="6845533974506654842">натискане</translation>
<translation id="8244226242650769279">карта с изображения</translation>
<translation id="2548326553472216322">Няма скорошни търсения</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Моля, потвърдете, че искате да инсталирате приставката <ph name="PLUGIN"/>. Трябва да инсталирате само приставки, на които имате доверие.</translation>
<translation id="6663448176199120256">Скорошни търсения</translation>
<translation id="2597378329261239068">Този документ е защитен с парола. Моля, въведете я.</translation>
-<translation id="6807599807928161586">уеб зона</translation>
+<translation id="7740050170769002709">HTML съдържание</translation>
<translation id="5939518447894949180">Повторно задаване</translation>
<translation id="1842960171412779397">Избиране</translation>
<translation id="7638452146404718955">Кликнете тук, за да изтеглите приставката</translation>
diff --git a/webkit/glue/resources/webkit_strings_bn.xtb b/webkit/glue/resources/webkit_strings_bn.xtb
index 1a29278..7143769 100644
--- a/webkit/glue/resources/webkit_strings_bn.xtb
+++ b/webkit/glue/resources/webkit_strings_bn.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="bn">
<translation id="4519964825805946997"><ph name="URL"/>-এর থেকে প্ল্যাগ-ইন ইনস্টল করতে ব্যর্থ হয়েছে</translation>
+<translation id="9186171386827445984">নথি লোড হচ্ছে: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> পৃষ্ঠা...</translation>
<translation id="1235745349614807883">সাম্প্রতিক অনুসন্ধানগুলি সাফ করুন</translation>
<translation id="5048533449481078685">তালিকা নির্দেশক</translation>
<translation id="372362261556059955">অতিরিক্ত প্লাগ-ইন দরকার</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">প্লাগ-ইন ইনস্টলেশান ব্যর্থ হয়েছে</translation>
<translation id="8141602879876242471">এটি অনুসন্ধানযোগ্য সূচি৷ অনুসন্ধানের মূলশব্দ প্রবেশ করান:</translation>
<translation id="5650795167354946011">প্ল্যাগ-ইন ইনস্টল করার পরে, রিফ্রেশ করার জন্য এখানে ক্লিক করুন</translation>
+<translation id="370665806235115550">লোড হচ্ছে...</translation>
<translation id="6845533974506654842">টিপুন</translation>
<translation id="8244226242650769279">ছবি মানচিত্র</translation>
<translation id="2548326553472216322">কোন সাম্প্রতিক অনুসন্ধান নেই</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">আপনি <ph name="PLUGIN"/> প্ল্যাগ-ইনটি ইনস্টল করতে চান কি না দয়া করে নিশ্চিত করুন৷ আপনার কেবল সেই প্ল্যাগ-ইনগুলি ইনস্টল করার উচিত যেগুলিকে আপনি বিশ্বাস করেন৷</translation>
<translation id="6663448176199120256">সাম্প্রতিক অনুসন্ধানগুলি</translation>
<translation id="2597378329261239068">এই দস্তাবেজটি পাসওয়ার্ড সুরক্ষিত৷ দয়া করে একটি পাসওয়ার্ড লিখুন৷</translation>
-<translation id="6807599807928161586">ওয়েব এলাকা</translation>
+<translation id="7740050170769002709">HTML সামগ্রী</translation>
<translation id="5939518447894949180">রিসেট করুন</translation>
<translation id="1842960171412779397">নির্বাচন করুন</translation>
<translation id="7638452146404718955">প্ল্যাগ-ইন ডাউনলোড করার জন্য এখানে ক্লিক করুন</translation>
diff --git a/webkit/glue/resources/webkit_strings_ca.xtb b/webkit/glue/resources/webkit_strings_ca.xtb
index 6f3dc90..59756a8 100644
--- a/webkit/glue/resources/webkit_strings_ca.xtb
+++ b/webkit/glue/resources/webkit_strings_ca.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="ca">
<translation id="4519964825805946997">S'ha produït un error en instal·lar el connector des de <ph name="URL"/></translation>
+<translation id="9186171386827445984">S'està carregant el document: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> pàgines...</translation>
<translation id="1235745349614807883">Esborra les cerques recents</translation>
<translation id="5048533449481078685">marcador de llistes</translation>
<translation id="372362261556059955">Es necessita un connector addicional</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">S'ha produït un error en instal·lar el connector </translation>
<translation id="8141602879876242471">És un índex on es poden realitzar cerques. Introdueix els termes de cerca:</translation>
<translation id="5650795167354946011">Després d'instal·lar el connector, feu clic aquí per actualitzar</translation>
+<translation id="370665806235115550">S'està carregant...</translation>
<translation id="6845533974506654842">prem</translation>
<translation id="8244226242650769279">mapa d'imatges</translation>
<translation id="2548326553472216322">No hi ha cerques recents</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Confirmeu que voleu instal·lar el connector <ph name="PLUGIN"/>. Us recomanem que només instal·leu connectors de la vostra confiança.</translation>
<translation id="6663448176199120256">Cerques recents</translation>
<translation id="2597378329261239068">Aquest document està protegit mitjançant contrasenya. Introduïu una contrasenya.</translation>
-<translation id="6807599807928161586">àrea web</translation>
+<translation id="7740050170769002709">Contingut HTML</translation>
<translation id="5939518447894949180">Restablir</translation>
<translation id="1842960171412779397">selecciona</translation>
<translation id="7638452146404718955">Feu clic aquí per baixar el connector</translation>
diff --git a/webkit/glue/resources/webkit_strings_cs.xtb b/webkit/glue/resources/webkit_strings_cs.xtb
index 33a0d12..8d3784f 100644
--- a/webkit/glue/resources/webkit_strings_cs.xtb
+++ b/webkit/glue/resources/webkit_strings_cs.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="cs">
<translation id="4519964825805946997">Instalace pluginu z adresy URL <ph name="URL"/> se nezdařila</translation>
+<translation id="9186171386827445984">Načítání dokumentu: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> stran...</translation>
<translation id="1235745349614807883">Smazat nedávná vyhledávání</translation>
<translation id="5048533449481078685">značka seznamu</translation>
<translation id="372362261556059955">Je zapotřebí další plugin</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Instalace pluginu selhala</translation>
<translation id="8141602879876242471">Toto je prohledávatelný index. Zadejte hledaná klíčová slova:</translation>
<translation id="5650795167354946011">Po instalaci pluginu obnovte okno kliknutím sem</translation>
+<translation id="370665806235115550">Načítání...</translation>
<translation id="6845533974506654842">zmáčknout</translation>
<translation id="8244226242650769279">obrázková mapa</translation>
<translation id="2548326553472216322">Žádná nedávná vyhledávání</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Potvrďte prosím, zda chcete nainstalovat plugin <ph name="PLUGIN"/>. Instalujte pouze pluginy, kterým důvěřujete.</translation>
<translation id="6663448176199120256">Nedávná vyhledávání</translation>
<translation id="2597378329261239068">Tento dokument je chráněn heslem. Zadejte prosím heslo.</translation>
-<translation id="6807599807928161586">oblast webu</translation>
+<translation id="7740050170769002709">Obsah ve formátu HTML</translation>
<translation id="5939518447894949180">Resetovat</translation>
<translation id="1842960171412779397">zvolit</translation>
<translation id="7638452146404718955">Plugin můžete stáhnout kliknutím sem</translation>
diff --git a/webkit/glue/resources/webkit_strings_da.xtb b/webkit/glue/resources/webkit_strings_da.xtb
index 78f06ff..71d2a6a 100644
--- a/webkit/glue/resources/webkit_strings_da.xtb
+++ b/webkit/glue/resources/webkit_strings_da.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="da">
<translation id="4519964825805946997">Installation af plugin fra <ph name="URL"/> mislykkedes</translation>
+<translation id="9186171386827445984">Indlæser dokument: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> sider...</translation>
<translation id="1235745349614807883">Slet nylige søgninger</translation>
<translation id="5048533449481078685">listemarkering</translation>
<translation id="372362261556059955">Ekstra plugin påkrævet</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Installation af plugin mislykkedes</translation>
<translation id="8141602879876242471">Der kan søges i dette indeks. Indtast søge-nøgleord:</translation>
<translation id="5650795167354946011">Når du har installeret plugin'et, skal du klikke her for at opdatere</translation>
+<translation id="370665806235115550">Indlæser ...</translation>
<translation id="6845533974506654842">tryk</translation>
<translation id="8244226242650769279">billedekort</translation>
<translation id="2548326553472216322">Ingen nylige søgninger</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Bekræft, at du vil installere dette <ph name="PLUGIN"/>-plugin. Du skal kun installere plugins, som du har tillid til.</translation>
<translation id="6663448176199120256">Nylige søgninger</translation>
<translation id="2597378329261239068">Dette dokument er adgangskodebeskyttet. Indtast en adgangskode.</translation>
-<translation id="6807599807928161586">webområde</translation>
+<translation id="7740050170769002709">HTML-indhold</translation>
<translation id="5939518447894949180">Nulstil</translation>
<translation id="1842960171412779397">vælg</translation>
<translation id="7638452146404718955">Klik her for at downloade plugin</translation>
diff --git a/webkit/glue/resources/webkit_strings_de.xtb b/webkit/glue/resources/webkit_strings_de.xtb
index 45fab1b..6d27410 100644
--- a/webkit/glue/resources/webkit_strings_de.xtb
+++ b/webkit/glue/resources/webkit_strings_de.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="de">
<translation id="4519964825805946997">Installation des Plug-ins von <ph name="URL"/> fehlgeschlagen</translation>
+<translation id="9186171386827445984">Dokument wird geladen <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> Seiten...</translation>
<translation id="1235745349614807883">Vor kurzem durchgeführte Suchanfragen löschen</translation>
<translation id="5048533449481078685">Listenmarkierung</translation>
<translation id="372362261556059955">Zusätzliches Plug-in erforderlich</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Plug-in-Installation fehlgeschlagen</translation>
<translation id="8141602879876242471">Dieser Index kann durchsucht werden. Geben Sie Suchbegriffe ein:</translation>
<translation id="5650795167354946011">Klicken Sie nach der Installation des Plug-ins hier, um eine Aktualisierung durchzuführen.</translation>
+<translation id="370665806235115550">Wird geladen...</translation>
<translation id="6845533974506654842">klicken</translation>
<translation id="8244226242650769279">Imagemap</translation>
<translation id="2548326553472216322">Keine vor kurzem durchgeführte Suchanfragen</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Bitte bestätigen Sie, dass Sie das Plug-in <ph name="PLUGIN"/> installieren möchten. Installieren Sie nur Plug-ins, denen Sie vertrauen.</translation>
<translation id="6663448176199120256">Vor kurzem durchgeführte Suchanfragen</translation>
<translation id="2597378329261239068">Dieses Dokument ist passwortgeschützt. Geben Sie ein Passwort ein.</translation>
-<translation id="6807599807928161586">Webbereich</translation>
+<translation id="7740050170769002709">HTML-Inhalte</translation>
<translation id="5939518447894949180">Zurücksetzen</translation>
<translation id="1842960171412779397">auswählen</translation>
<translation id="7638452146404718955">Hier klicken, um das Plug-in herunterzuladen</translation>
diff --git a/webkit/glue/resources/webkit_strings_el.xtb b/webkit/glue/resources/webkit_strings_el.xtb
index 509307e..c429294 100644
--- a/webkit/glue/resources/webkit_strings_el.xtb
+++ b/webkit/glue/resources/webkit_strings_el.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="el">
<translation id="4519964825805946997">Η εγκατάσταση της προσθήκης από τη διεύθυνση <ph name="URL"/> απέτυχε</translation>
+<translation id="9186171386827445984">Φόρτωση εγγράφου: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> σελίδες...</translation>
<translation id="1235745349614807883">Εκκαθάριση πρόσφατων αναζητήσεων</translation>
<translation id="5048533449481078685">δείκτης λίστας</translation>
<translation id="372362261556059955">Απαιτείται επιπλέον προσθήκη</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Η εγκατάσταση προσθήκης απέτυχε</translation>
<translation id="8141602879876242471">Πρόκειται για ευρετήριο με δυνατότητα αναζήτησης. Πληκτρολογήστε λέξεις-κλειδιά αναζήτησης:</translation>
<translation id="5650795167354946011">Μετά την εγκατάσταση της προσθήκης, κάντε κλικ εδώ για ανανέωση των δεδομένων</translation>
+<translation id="370665806235115550">Φόρτωση...</translation>
<translation id="6845533974506654842">πατήστε</translation>
<translation id="8244226242650769279">χάρτης εικόνας</translation>
<translation id="2548326553472216322">Δεν υπάρχουν πρόσφατες αναζητήσεις</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Επιβεβαιώστε ότι θέλετε να εγκαταστήσετε την προσθήκη <ph name="PLUGIN"/>. Πρέπει να εγκαθιστάτε μόνο προσθήκες που θεωρείτε αξιόπιστες.</translation>
<translation id="6663448176199120256">Πρόσφατες αναζητήσεις</translation>
<translation id="2597378329261239068">Αυτό το έγγραφο προστατεύεται με κωδικό πρόσβασης. Πληκτρολογήστε έναν κωδικό πρόσβασης.</translation>
-<translation id="6807599807928161586">περιοχή ιστού</translation>
+<translation id="7740050170769002709">Περιεχόμενο HTML</translation>
<translation id="5939518447894949180">Επαναφορά</translation>
<translation id="1842960171412779397">επιλογή</translation>
<translation id="7638452146404718955">Κάντε κλικ εδώ για να κάνετε λήψη της προσθήκης</translation>
diff --git a/webkit/glue/resources/webkit_strings_en-GB.xtb b/webkit/glue/resources/webkit_strings_en-GB.xtb
index 14befa8..417f44a 100644
--- a/webkit/glue/resources/webkit_strings_en-GB.xtb
+++ b/webkit/glue/resources/webkit_strings_en-GB.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="en-GB">
<translation id="4519964825805946997">Failed to install plug-in from <ph name="URL"/></translation>
+<translation id="9186171386827445984">Loading document: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> pages...</translation>
<translation id="1235745349614807883">Clear Recent Searches</translation>
<translation id="5048533449481078685">list marker</translation>
<translation id="372362261556059955">Additional plug-in needed</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Plug-in installation failed</translation>
<translation id="8141602879876242471">This is a searchable index. Enter search keywords:</translation>
<translation id="5650795167354946011">After installing the plug-in, click here to refresh</translation>
+<translation id="370665806235115550">Loading...</translation>
<translation id="6845533974506654842">press</translation>
<translation id="8244226242650769279">image map</translation>
<translation id="2548326553472216322">No recent searches</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Please confirm that you would like to install the <ph name="PLUGIN"/> plug-in. You should only install plug-ins that you trust.</translation>
<translation id="6663448176199120256">Recent Searches</translation>
<translation id="2597378329261239068">This document is password-protected. Please enter a password.</translation>
-<translation id="6807599807928161586">web area</translation>
+<translation id="7740050170769002709">HTML content</translation>
<translation id="5939518447894949180">Reset</translation>
<translation id="1842960171412779397">select</translation>
<translation id="7638452146404718955">Click here to download plug-in</translation>
diff --git a/webkit/glue/resources/webkit_strings_es-419.xtb b/webkit/glue/resources/webkit_strings_es-419.xtb
index 12bc57b..5ec0935 100644
--- a/webkit/glue/resources/webkit_strings_es-419.xtb
+++ b/webkit/glue/resources/webkit_strings_es-419.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="es-419">
<translation id="4519964825805946997">Error al instalar el complemento desde <ph name="URL"/></translation>
+<translation id="9186171386827445984">Cargando documento: páginas <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/>...</translation>
<translation id="1235745349614807883">Eliminar búsquedas recientes</translation>
<translation id="5048533449481078685">marcador de listas</translation>
<translation id="372362261556059955">Se necesita un complemento adicional</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Error de instalación del complemento</translation>
<translation id="8141602879876242471">Se trata de un índice que admite búsquedas. Escribe las palabras clave de búsqueda:</translation>
<translation id="5650795167354946011">Después de instalar el complemento, haz clic aquí para actualizar</translation>
+<translation id="370665806235115550">Cargando...</translation>
<translation id="6845533974506654842">hacer clic</translation>
<translation id="8244226242650769279">mapa de imágenes</translation>
<translation id="2548326553472216322">No hay búsquedas recientes</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Confirma que deseas instalar el complemento <ph name="PLUGIN"/>. Sólo deberías instalar los complementos confiables.</translation>
<translation id="6663448176199120256">Búsquedas recientes</translation>
<translation id="2597378329261239068">Este documento está protegido por contraseña. Ingresa una contraseña.</translation>
-<translation id="6807599807928161586">área web</translation>
+<translation id="7740050170769002709">Contenido HTML</translation>
<translation id="5939518447894949180">Restablecer</translation>
<translation id="1842960171412779397">seleccionar</translation>
<translation id="7638452146404718955">Haz clic aquí para descargar el complemento</translation>
diff --git a/webkit/glue/resources/webkit_strings_es.xtb b/webkit/glue/resources/webkit_strings_es.xtb
index 5f9a245..8315543 100644
--- a/webkit/glue/resources/webkit_strings_es.xtb
+++ b/webkit/glue/resources/webkit_strings_es.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="es">
<translation id="4519964825805946997">Se ha producido un error al descargar el complemento de la página <ph name="URL"/>.</translation>
+<translation id="9186171386827445984">Cargando documento: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> páginas...</translation>
<translation id="1235745349614807883">Eliminar búsquedas recientes</translation>
<translation id="5048533449481078685">marcador de listas</translation>
<translation id="372362261556059955">Se necesita un complemento adicional</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Se ha producido un error al instalar el complemento.</translation>
<translation id="8141602879876242471">Se trata de un índice que admite búsquedas. Introduce las palabras clave de búsqueda:</translation>
<translation id="5650795167354946011">Una vez que hayas instalado el complemento, haz clic aquí para actualizar la ventana.</translation>
+<translation id="370665806235115550">Cargando...</translation>
<translation id="6845533974506654842">pulsar</translation>
<translation id="8244226242650769279">mapa de imágenes</translation>
<translation id="2548326553472216322">No hay búsquedas recientes</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Confirma que quieres instalar el complemento <ph name="PLUGIN"/>. Solo debes instalar complementos en los que confíes.</translation>
<translation id="6663448176199120256">Búsquedas recientes</translation>
<translation id="2597378329261239068">Este documento está protegido por contraseña. Introduce una contraseña.</translation>
-<translation id="6807599807928161586">área web</translation>
+<translation id="7740050170769002709">Contenido HTML</translation>
<translation id="5939518447894949180">Restablecer</translation>
<translation id="1842960171412779397">seleccionar</translation>
<translation id="7638452146404718955">Haz clic aquí para descargar el complemento.</translation>
diff --git a/webkit/glue/resources/webkit_strings_et.xtb b/webkit/glue/resources/webkit_strings_et.xtb
index 2ac3c7a..e5932ac 100644
--- a/webkit/glue/resources/webkit_strings_et.xtb
+++ b/webkit/glue/resources/webkit_strings_et.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="et">
<translation id="4519964825805946997">Pistikprogrammi installimine asukohast <ph name="URL"/> ebaõnnestus.</translation>
+<translation id="9186171386827445984">Dokumendi laadimine: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> lehte ...</translation>
<translation id="1235745349614807883">Kustuta viimased otsingud</translation>
<translation id="5048533449481078685">loendilooja</translation>
<translation id="372362261556059955">Vaja on täiendavat pistikprogrammi</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Pistikprogrammi installimine nurjus</translation>
<translation id="8141602879876242471">See on otsitav indeks. Sisestage otsingu jaoks märksõnad:</translation>
<translation id="5650795167354946011">Pärast lisandmooduli installimist klõpsake värskendamiseks siin</translation>
+<translation id="370665806235115550">Laadimine...</translation>
<translation id="6845533974506654842">vajuta</translation>
<translation id="8244226242650769279">hüperpilt</translation>
<translation id="2548326553472216322">Pole viimaseid otsingud</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Palun kinnitage, et soovite pistikprogrammi <ph name="PLUGIN"/> installida. Peaksite installima vaid usaldusväärseid pistikprogramme.</translation>
<translation id="6663448176199120256">Viimased otsingud</translation>
<translation id="2597378329261239068">Dokument on parooliga kaitstud. Sisestage parool.</translation>
-<translation id="6807599807928161586">veebiala</translation>
+<translation id="7740050170769002709">HTML-sisu</translation>
<translation id="5939518447894949180">Lähtesta</translation>
<translation id="1842960171412779397">vali</translation>
<translation id="7638452146404718955">Pistikprogrammi allalaadimiseks klõpsake siin</translation>
diff --git a/webkit/glue/resources/webkit_strings_fa.xtb b/webkit/glue/resources/webkit_strings_fa.xtb
index 870dcf6..094ad9f 100644
--- a/webkit/glue/resources/webkit_strings_fa.xtb
+++ b/webkit/glue/resources/webkit_strings_fa.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="fa">
<translation id="4519964825805946997">نصب افزونه از <ph name="URL"/> ناموفق بود</translation>
+<translation id="9186171386827445984">در حال بارگیری سند: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> صفحات...</translation>
<translation id="1235745349614807883">پاک کردن جستجوهای اخیر</translation>
<translation id="5048533449481078685">علامت گذار لیست</translation>
<translation id="372362261556059955">افزونه دیگری مورد نیاز است</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">نصب افزونه انجام نشد</translation>
<translation id="8141602879876242471">این نمایه قابل جستجو است. کلمات کلیدی جستجو را وارد کنید:</translation>
<translation id="5650795167354946011">بعد از نصب افزونه، برای تازه کردن اینجا را کلیک کنید</translation>
+<translation id="370665806235115550">درحال بارگیری...</translation>
<translation id="6845533974506654842">فشار دادن</translation>
<translation id="8244226242650769279">نقشه تصویر</translation>
<translation id="2548326553472216322">جستجوی جدیدی وجود ندارد</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">لطفاً تأیید کنید که مایلید افزونه <ph name="PLUGIN"/> نصب شود. فقط باید افزونه هایی را نصب کنید که به آنها اعتماد دارید.</translation>
<translation id="6663448176199120256">جستجوهای جدید</translation>
<translation id="2597378329261239068">این سند توسط رمز ورود محافظت می شود. لطفاً یک رمز ورود وارد کنید.</translation>
-<translation id="6807599807928161586">حیطه وب</translation>
+<translation id="7740050170769002709">محتوای HTML</translation>
<translation id="5939518447894949180">بازنشانی</translation>
<translation id="1842960171412779397">انتخاب</translation>
<translation id="7638452146404718955">برای دانلود کردن افزونه اینجا را کلیک کنید</translation>
diff --git a/webkit/glue/resources/webkit_strings_fi.xtb b/webkit/glue/resources/webkit_strings_fi.xtb
index 4a1b6a3..604021f 100644
--- a/webkit/glue/resources/webkit_strings_fi.xtb
+++ b/webkit/glue/resources/webkit_strings_fi.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="fi">
<translation id="4519964825805946997">Laajennuksen asennus osoitteesta <ph name="URL"/> epäonnistui</translation>
+<translation id="9186171386827445984">Ladataan asiakirjaa: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> sivua...</translation>
<translation id="1235745349614807883">Poista viimeisimmät haut</translation>
<translation id="5048533449481078685">luettelon merkitsijä</translation>
<translation id="372362261556059955">Toinen laajennus vaaditaan</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Laajennuksen asennus epäonnistui</translation>
<translation id="8141602879876242471">Tämä on haettavissa oleva hakemisto. Anna hakusanat:</translation>
<translation id="5650795167354946011">Päivitä laajennuksen asennuksen jälkeen napsauttamalla tästä</translation>
+<translation id="370665806235115550">Ladataan...</translation>
<translation id="6845533974506654842">paina</translation>
<translation id="8244226242650769279">kuvakartta</translation>
<translation id="2548326553472216322">Ei viimeisimpiä hakuja</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Vahvista, että haluat asentaa laajennuksen <ph name="PLUGIN"/>. Suosittelemme asentamaan vain laajennuksia, joihin luotat.</translation>
<translation id="6663448176199120256">Viimeisimmät haut</translation>
<translation id="2597378329261239068">Tämä asiakirja on suojattu salasanalla. Anna salasana.</translation>
-<translation id="6807599807928161586">verkkoalue</translation>
+<translation id="7740050170769002709">HTML-sisältö</translation>
<translation id="5939518447894949180">Tyhjennä</translation>
<translation id="1842960171412779397">Valitse</translation>
<translation id="7638452146404718955">Lataa laajennus napsauttamalla tätä</translation>
diff --git a/webkit/glue/resources/webkit_strings_fil.xtb b/webkit/glue/resources/webkit_strings_fil.xtb
index 43f88c3..8459aca 100644
--- a/webkit/glue/resources/webkit_strings_fil.xtb
+++ b/webkit/glue/resources/webkit_strings_fil.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="fil">
<translation id="4519964825805946997">Nabigong ma-install ang plug-in mula sa <ph name="URL"/></translation>
+<translation id="9186171386827445984">Nilo-load ang dokumento: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> (na) pahina...</translation>
<translation id="1235745349614807883">Lisiman ang Kasalukuyang Mga Paghahanap</translation>
<translation id="5048533449481078685">Ilista ang marker</translation>
<translation id="372362261556059955">Kinakailangan ang karagdagang plug-in</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Nabigo ang pag-install ng plug-in</translation>
<translation id="8141602879876242471">Isa itong paghahanap ng index. Ipasok ang paghahanap sa mga keyword:</translation>
<translation id="5650795167354946011">Pagkatapos i-install ng plug-in, mag-click dito upang mag-refresh</translation>
+<translation id="370665806235115550">Kumakarga...</translation>
<translation id="6845533974506654842">pindutin</translation>
<translation id="8244226242650769279">mapa ng imahe</translation>
<translation id="2548326553472216322">Walang kamakailang mga paghahanap</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Pakikumpirma na gusto mong i-install ang <ph name="PLUGIN"/> plug-in na ito. Dapat mong i-install lamang ang mga plug-in na iyong pinagkakatiwalaan.</translation>
<translation id="6663448176199120256">Kasalukuyang Mga Paghahanap</translation>
<translation id="2597378329261239068">Protektado ng password ang dokumentong ito. Mangyaring magpasok ng password.</translation>
-<translation id="6807599807928161586">web area</translation>
+<translation id="7740050170769002709">HTML na nilalaman</translation>
<translation id="5939518447894949180">I-reset</translation>
<translation id="1842960171412779397">piliin</translation>
<translation id="7638452146404718955">Mag-click dito upang ma-download ang plug-in</translation>
diff --git a/webkit/glue/resources/webkit_strings_fr.xtb b/webkit/glue/resources/webkit_strings_fr.xtb
index 00ab953..ab1e32f 100644
--- a/webkit/glue/resources/webkit_strings_fr.xtb
+++ b/webkit/glue/resources/webkit_strings_fr.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="fr">
<translation id="4519964825805946997">Échec de l'installation du plug-in depuis <ph name="URL"/></translation>
+<translation id="9186171386827445984">Chargement du document : <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> pages...</translation>
<translation id="1235745349614807883">Effacer les recherches récentes</translation>
<translation id="5048533449481078685">marqueur de liste</translation>
<translation id="372362261556059955">Plug-in supplémentaire requis</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Échec de l'installation du plug-in</translation>
<translation id="8141602879876242471">Vous pouvez lancer des recherches dans cet index. Pour cela, entrez des mots clés de recherche :</translation>
<translation id="5650795167354946011">Après l'installation du plug-in, cliquez ici pour actualiser.</translation>
+<translation id="370665806235115550">Chargement...</translation>
<translation id="6845533974506654842">appuyer</translation>
<translation id="8244226242650769279">image map</translation>
<translation id="2548326553472216322">Aucune recherche récente</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Merci de confirmer que vous souhaitez installer le plug-in <ph name="PLUGIN"/>. N'installez que les plug-ins que vous considérez fiables.</translation>
<translation id="6663448176199120256">Recherches récentes</translation>
<translation id="2597378329261239068">Ce document est protégé par mot de passe. Veuillez saisir ce dernier.</translation>
-<translation id="6807599807928161586">Zone Web</translation>
+<translation id="7740050170769002709">Contenu HTML</translation>
<translation id="5939518447894949180">Réinitialiser</translation>
<translation id="1842960171412779397">sélectionner</translation>
<translation id="7638452146404718955">Cliquer ici pour télécharger le plug-in</translation>
diff --git a/webkit/glue/resources/webkit_strings_gu.xtb b/webkit/glue/resources/webkit_strings_gu.xtb
index e7160bb..ad48fa1 100644
--- a/webkit/glue/resources/webkit_strings_gu.xtb
+++ b/webkit/glue/resources/webkit_strings_gu.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="gu">
<translation id="4519964825805946997"><ph name="URL"/> થી પ્લગ-ઇન ઇન્સ્ટોલ કરવામાં નિષ્ફળ રહ્યાં</translation>
+<translation id="9186171386827445984">દસ્તાવેજ લોડ કરી રહ્યું છે: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> પૃષ્ઠ...</translation>
<translation id="1235745349614807883">હાલની શોધને સાફ કરો</translation>
<translation id="5048533449481078685">સૂચિ માર્કર</translation>
<translation id="372362261556059955">વધારાનું પ્લગ-ઇન આવશ્યક છે </translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">પ્લગ-ઇન ઇન્સ્ટોલેશન નિષ્ફળ ગયું</translation>
<translation id="8141602879876242471">આ એક શોધસક્ષમ અનુક્રમણિકા છે. શોધ કીવર્ડ્સ દાખલ કરો:</translation>
<translation id="5650795167354946011">પ્લગ-ઇન ઇન્સ્ટોલ કર્યા પછી, રીફ્રેશ કરવા અહીં ક્લિક કરો</translation>
+<translation id="370665806235115550">લોડ કરી રહ્યું છે...</translation>
<translation id="6845533974506654842">દબાવો</translation>
<translation id="8244226242650769279">છબી નકશો</translation>
<translation id="2548326553472216322">હાલની શોધો નથી</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">કૃપા કરીને પુષ્ટી કરો કે તમે <ph name="PLUGIN"/> પ્લગ-ઇન ઇન્સ્ટોલ કરવાનું પસંદ કરશો. તમારે ફક્ત તે જ પ્લગ-ઇન્સ ઇન્સ્ટોલ કરવા જોઈએ જે વિશ્વસ્ત હોય.</translation>
<translation id="6663448176199120256">તાજેતરની શોધ</translation>
<translation id="2597378329261239068">આ દસ્તાવેજ પાસવર્ડ સુરક્ષિત છે. કૃપા કરીને પાસવર્ડ દાખલ કરો.</translation>
-<translation id="6807599807928161586">વેબ ક્ષેત્ર</translation>
+<translation id="7740050170769002709">HTML સામગ્રી</translation>
<translation id="5939518447894949180">રીસેટ કરો</translation>
<translation id="1842960171412779397">પસંદ કરો</translation>
<translation id="7638452146404718955">પ્લગ-ઇન ડાઉનલોડ કરવા માટે અહીં ક્લિક કરો</translation>
diff --git a/webkit/glue/resources/webkit_strings_hi.xtb b/webkit/glue/resources/webkit_strings_hi.xtb
index e9bf9e7..e7ef77f 100644
--- a/webkit/glue/resources/webkit_strings_hi.xtb
+++ b/webkit/glue/resources/webkit_strings_hi.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="hi">
<translation id="4519964825805946997"><ph name="URL"/> से प्लग-इन स्थापित करने में विफल हुआ</translation>
+<translation id="9186171386827445984">दस्तावेज़ लोड कर रहा है: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> पृष्ठ...</translation>
<translation id="1235745349614807883">हाल ही की खोजें साफ़ करें</translation>
<translation id="5048533449481078685">सूची चिन्हक</translation>
<translation id="372362261556059955">अतिरिक्त प्लग-इन की आवश्यकता है</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">प्लग-इन स्थापना विफल हुई</translation>
<translation id="8141602879876242471">यह एक खोजने योग्य इंडेक्स है. खोज कुंजीशब्द प्रविष्ट करें :</translation>
<translation id="5650795167354946011">प्लग-इन स्थापित करने के बाद, रीफ़्रेश करने के लिए यहां क्लिक करें</translation>
+<translation id="370665806235115550">लोड हो रहा है ...</translation>
<translation id="6845533974506654842">दबाएँ</translation>
<translation id="8244226242650769279">चित्र मैप</translation>
<translation id="2548326553472216322">हाल ही में कोई खोज नहीं</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">कृपया पुष्टि करें कि आप <ph name="PLUGIN"/> प्लग-इन स्थापित करना चाहेंगे. आपको केवल वे प्लग-इन स्थापित करने चाहिए जिन पर आप विश्वास करते हैं.</translation>
<translation id="6663448176199120256">हाल ही में की गई खोजें</translation>
<translation id="2597378329261239068">यह दस्तावेज़ पासवर्ड सुरक्षित है. कृपया एक पासवर्ड दर्ज करें.</translation>
-<translation id="6807599807928161586">वेब क्षेत्र</translation>
+<translation id="7740050170769002709">HTML सामग्री</translation>
<translation id="5939518447894949180">पुन: सेट करें</translation>
<translation id="1842960171412779397">चुनें</translation>
<translation id="7638452146404718955">प्लग-इन डाउनलोड करने के लिए यहां क्लिक करें</translation>
diff --git a/webkit/glue/resources/webkit_strings_hr.xtb b/webkit/glue/resources/webkit_strings_hr.xtb
index 89458bb..dfef690 100644
--- a/webkit/glue/resources/webkit_strings_hr.xtb
+++ b/webkit/glue/resources/webkit_strings_hr.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="hr">
<translation id="4519964825805946997">Nije uspjela instalacija dodatka s adrese <ph name="URL"/></translation>
+<translation id="9186171386827445984">Učitavanje dokumenta: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> stranica...</translation>
<translation id="1235745349614807883">Obriši najnovija pretraživanja</translation>
<translation id="5048533449481078685">oznaka popisa</translation>
<translation id="372362261556059955">Potreban je dodatni dodatak</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Nije uspjela instalacija dodatka</translation>
<translation id="8141602879876242471">Ovaj je indeks moguće pretraživati. Unesite ključne riječi za pretraživanje:</translation>
<translation id="5650795167354946011">Nakon instalacije dodatka kliknite ovdje za osvježenje stranice</translation>
+<translation id="370665806235115550">Učitavanje...</translation>
<translation id="6845533974506654842">pritisni</translation>
<translation id="8244226242650769279">karta slika</translation>
<translation id="2548326553472216322">Nema najnovijih pretraživanja</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Potvrdite da želite instalirati dodatak <ph name="PLUGIN"/>. Instalirajte samo dodatke koje smatrate pouzdanima.</translation>
<translation id="6663448176199120256">Najnovija pretraživanja</translation>
<translation id="2597378329261239068">Ovaj je dokument zaštićen zaporkom. Unesite zaporku.</translation>
-<translation id="6807599807928161586">web područje</translation>
+<translation id="7740050170769002709">HTML sadržaj</translation>
<translation id="5939518447894949180">Ponovno postavi</translation>
<translation id="1842960171412779397">odaberi</translation>
<translation id="7638452146404718955">Kliknite ovdje za preuzimanje dodatka</translation>
diff --git a/webkit/glue/resources/webkit_strings_hu.xtb b/webkit/glue/resources/webkit_strings_hu.xtb
index 848f2df..1b43f0f 100644
--- a/webkit/glue/resources/webkit_strings_hu.xtb
+++ b/webkit/glue/resources/webkit_strings_hu.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="hu">
<translation id="4519964825805946997">A plug-in telepítése nem sikerült a következő helyről: <ph name="URL"/></translation>
+<translation id="9186171386827445984">Dokumentum betöltése: <ph name="NUMBER_OF_PAGES"/>/<ph name="PAGE_NUMBER"/>. oldal...</translation>
<translation id="1235745349614807883">Friss keresések törlése</translation>
<translation id="5048533449481078685">listajelölő</translation>
<translation id="372362261556059955">További plug-in szükséges</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">A plug-in telepítése sikertelen</translation>
<translation id="8141602879876242471">Ez egy kereshető index. Írjon be keresési kulcsszavakat:</translation>
<translation id="5650795167354946011">A plug-in telepítését követően kattintson ide a frissítéshez</translation>
+<translation id="370665806235115550">Betöltés…</translation>
<translation id="6845533974506654842">Gomb lenyomása</translation>
<translation id="8244226242650769279">képtérkép</translation>
<translation id="2548326553472216322">Nincsenek friss keresések</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Kérjük, erősítse meg, hogy valóban telepíteni szeretné a következő plug-int: <ph name="PLUGIN"/>. Csak azokat a plug-ineket telepítse, amelyekben megbízik.</translation>
<translation id="6663448176199120256">Friss keresések</translation>
<translation id="2597378329261239068">Ez a dokumentum jelszóval védett. Kérjük, adja meg a jelszót.</translation>
-<translation id="6807599807928161586">internetes terület</translation>
+<translation id="7740050170769002709">HTML-tartalom</translation>
<translation id="5939518447894949180">Visszaállítás</translation>
<translation id="1842960171412779397">Kiválasztás</translation>
<translation id="7638452146404718955">Ide kattintva letöltheti a plug-int</translation>
diff --git a/webkit/glue/resources/webkit_strings_id.xtb b/webkit/glue/resources/webkit_strings_id.xtb
index 6451c08..50c97a2 100644
--- a/webkit/glue/resources/webkit_strings_id.xtb
+++ b/webkit/glue/resources/webkit_strings_id.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="id">
<translation id="4519964825805946997">Gagal memasang pengaya dari <ph name="URL"/></translation>
+<translation id="9186171386827445984">Memuat dokumen: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> halaman...</translation>
<translation id="1235745349614807883">Hapus Penelusuran Barusan</translation>
<translation id="5048533449481078685">penanda daftar</translation>
<translation id="372362261556059955">Diperlukan pengaya tambahan</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Pemasangan pengaya gagal</translation>
<translation id="8141602879876242471">Terdapat indeks yang dapat dicari. Masukkan kata kunci penelusuran:</translation>
<translation id="5650795167354946011">Setelah memasang pengaya, klik di sini untuk menyegarkan</translation>
+<translation id="370665806235115550">Membuka...</translation>
<translation id="6845533974506654842">tekan</translation>
<translation id="8244226242650769279">gambar peta</translation>
<translation id="2548326553472216322">Tidak ada penelusuran terkini</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Konfirmasikan bahwa Anda ingin memasang pengaya <ph name="PLUGIN"/>. Anda harus memasang pengaya yang Anda percayai saja.</translation>
<translation id="6663448176199120256">Penelusuran Barusan</translation>
<translation id="2597378329261239068">Dokumen ini dilindungi sandi. Masukkan sandi.</translation>
-<translation id="6807599807928161586">area Web</translation>
+<translation id="7740050170769002709">Konten HTML</translation>
<translation id="5939518447894949180">Atur ulang</translation>
<translation id="1842960171412779397">pilih</translation>
<translation id="7638452146404718955">Klik di sini untuk mengunduh pengaya</translation>
diff --git a/webkit/glue/resources/webkit_strings_it.xtb b/webkit/glue/resources/webkit_strings_it.xtb
index 61c1e79..1fae27f 100644
--- a/webkit/glue/resources/webkit_strings_it.xtb
+++ b/webkit/glue/resources/webkit_strings_it.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="it">
<translation id="4519964825805946997">Installazione del plug-in da <ph name="URL"/> non riuscita</translation>
+<translation id="9186171386827445984">Caricamento del documento in corso: pagine <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/>...</translation>
<translation id="1235745349614807883">Cancella ricerche recenti</translation>
<translation id="5048533449481078685">indicatore elenco</translation>
<translation id="372362261556059955">È necessario un plug-in aggiuntivo</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Installazione del plug-in non riuscita</translation>
<translation id="8141602879876242471">Questo è un indice di ricerca. Inserisci le parole chiave di ricerca:</translation>
<translation id="5650795167354946011">Dopo aver installato il plug-in, fai clic qui per aggiornare</translation>
+<translation id="370665806235115550">Caricamento in corso...</translation>
<translation id="6845533974506654842">premi</translation>
<translation id="8244226242650769279">image map</translation>
<translation id="2548326553472216322">Nessuna ricerca recente</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Conferma che desideri installare il plug-in <ph name="PLUGIN"/>. Dovresti installare soltanto plug-in attendibili.</translation>
<translation id="6663448176199120256">Ricerche recenti</translation>
<translation id="2597378329261239068">Questo documento è protetto da password. Inserisci una password.</translation>
-<translation id="6807599807928161586">area web</translation>
+<translation id="7740050170769002709">Contenuti HTML</translation>
<translation id="5939518447894949180">Ripristina</translation>
<translation id="1842960171412779397">seleziona</translation>
<translation id="7638452146404718955">Fai clic qui per scaricare il plug-in</translation>
diff --git a/webkit/glue/resources/webkit_strings_iw.xtb b/webkit/glue/resources/webkit_strings_iw.xtb
index 436b298..f748311 100644
--- a/webkit/glue/resources/webkit_strings_iw.xtb
+++ b/webkit/glue/resources/webkit_strings_iw.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="iw">
<translation id="4519964825805946997">התקנת הפלאגין מתוך <ph name="URL"/> נכשלה</translation>
+<translation id="9186171386827445984">טוען מסמך: דפים <ph name="NUMBER_OF_PAGES"/>/<ph name="PAGE_NUMBER"/>...</translation>
<translation id="1235745349614807883">הסר חיפושים אחרונים</translation>
<translation id="5048533449481078685">סמן רשימה</translation>
<translation id="372362261556059955">פלאגין נוסף נחוץ</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">התקנת הפלאגין נכשלה</translation>
<translation id="8141602879876242471">זהו אינדקס שניתן לבצע בו חיפוש. הזן מילות מפתח לחיפוש:</translation>
<translation id="5650795167354946011">לאחר התקנת הפלאגין, לחץ כאן לרענון</translation>
+<translation id="370665806235115550">טוען...</translation>
<translation id="6845533974506654842">לחץ</translation>
<translation id="8244226242650769279">מפת תמונות</translation>
<translation id="2548326553472216322">אין חיפושים אחרונים</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">אשר שברצונך להתקין את הפלאגין <ph name="PLUGIN"/>. יש להתקין רכיבי פלאגין שאתה בוטח בהם בלבד.</translation>
<translation id="6663448176199120256">חיפושים אחרונים</translation>
<translation id="2597378329261239068">מסמך זה מוגן באמצעות סיסמה. הזן סיסמה.</translation>
-<translation id="6807599807928161586">אזור אינטרנט</translation>
+<translation id="7740050170769002709">תוכן HTML</translation>
<translation id="5939518447894949180">אפס</translation>
<translation id="1842960171412779397">בחר</translation>
<translation id="7638452146404718955">לחץ כאן להורדת פלאגין</translation>
diff --git a/webkit/glue/resources/webkit_strings_ja.xtb b/webkit/glue/resources/webkit_strings_ja.xtb
index 2eccba2..865979d 100644
--- a/webkit/glue/resources/webkit_strings_ja.xtb
+++ b/webkit/glue/resources/webkit_strings_ja.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="ja">
<translation id="4519964825805946997"><ph name="URL"/> からプラグインをインストールできませんでした</translation>
+<translation id="9186171386827445984">ドキュメントの読み込み中: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> ページ...</translation>
<translation id="1235745349614807883">最近の検索履歴を消去</translation>
<translation id="5048533449481078685">リスト マーカー</translation>
<translation id="372362261556059955">追加のプラグインが必要です</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">プラグインをインストールできませんでした</translation>
<translation id="8141602879876242471">このインデックスは検索できます。キーワードを入力してください:</translation>
<translation id="5650795167354946011">プラグインをインストールした後は、ここをクリックして更新を行ってください</translation>
+<translation id="370665806235115550">読み込み中...</translation>
<translation id="6845533974506654842">押す</translation>
<translation id="8244226242650769279">イメージ マップ</translation>
<translation id="2548326553472216322">最近の検索はありません</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">この <ph name="PLUGIN"/> プラグインをインストールしてもよいかご確認ください。信頼できるプラグインのみをインストールする必要があります。</translation>
<translation id="6663448176199120256">最近の検索</translation>
<translation id="2597378329261239068">このドキュメントはパスワードで保護されています。パスワードを入力してください。</translation>
-<translation id="6807599807928161586">ウェブ領域</translation>
+<translation id="7740050170769002709">HTML コンテンツ</translation>
<translation id="5939518447894949180">リセット</translation>
<translation id="1842960171412779397">選択</translation>
<translation id="7638452146404718955">ここをクリックしてプラグインをダウンロード</translation>
diff --git a/webkit/glue/resources/webkit_strings_kn.xtb b/webkit/glue/resources/webkit_strings_kn.xtb
index 61dbd2c..9a8f827 100644
--- a/webkit/glue/resources/webkit_strings_kn.xtb
+++ b/webkit/glue/resources/webkit_strings_kn.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="kn">
<translation id="4519964825805946997"><ph name="URL"/> ನಿಂದ ಪ್ಲಗ್-ಇನ್ ಅನ್ನು ಸ್ಥಾಪಿಸುವಲ್ಲಿ ವಿಫಲವಾಗಿದೆ</translation>
+<translation id="9186171386827445984">ಲೋಡಿಂಗ್ ಡಾಕ್ಯುಮೆಂಟ್: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> ಪುಟಗಳು...</translation>
<translation id="1235745349614807883">ಇತ್ತೀಚಿನ ಹುಡುಕಾಟವನ್ನು ತೆರವುಗೊಳಿಸಿ</translation>
<translation id="5048533449481078685">ಪಟ್ಟಿ ಗುರುತು</translation>
<translation id="372362261556059955">ಹೆಚ್ಚುವರಿ ಪ್ಲಗ್-ಇನ್ ಅಗತ್ಯವಿದೆ</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">ಪ್ಲಗ್-ಇನ್ ಅಳವಡಿಸುವಿಕೆಯು ವಿಫಲವಾಗಿದೆ</translation>
<translation id="8141602879876242471">ಇದು ಹುಡುಕಾಡಬಹುದಾದ ಸೂಚಿಕೆ ಹುಡುಕಾಟ ಕೀವರ್ಡ್ಗಳನ್ನು ನಮೂದಿಸಿ:</translation>
<translation id="5650795167354946011">ಪ್ಲಗ್-ಇನ್ ಸ್ಥಾಪನೆ ಮಾಡಿದ ನಂತರ, ರಿಫ್ರೆಶ್ ಮಾಡಲು ಇಲ್ಲಿ ಕ್ಲಿಕ್ ಮಾಡಿ</translation>
+<translation id="370665806235115550">ಲೋಡ್ ಮಾಡಲಾಗುತ್ತಿದೆ...</translation>
<translation id="6845533974506654842">ಒತ್ತಿ</translation>
<translation id="8244226242650769279">ಇಮೇಜ್ ನಕ್ಷೆ</translation>
<translation id="2548326553472216322">ಇತ್ತೀಚಿನ ಹುಡುಕಾಟಗಳು ಇಲ್ಲ</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">ನೀವು <ph name="PLUGIN"/> ಪ್ಲಗ್-ಇನ್ ಅನ್ನು ಅಳವಡಿಸಲು ಬಯಸುವುದಾದಲ್ಲಿ ದಯವಿಟ್ಟು ಖಚಿತಪಡಿಸಿ. ನೀವು ನಂಬುವಂತಹ ಫ್ಲಗ್-ಇನ್ಗಳನ್ನು ಮಾತ್ರ ನೀವು ಅಳವಡಿಸಬೇಕು.</translation>
<translation id="6663448176199120256">ಇತ್ತೀಚಿನ ಹುಡುಕಾಟಗಳು</translation>
<translation id="2597378329261239068">ಈ ಡಾಕ್ಯುಮೆಂಟ್ ಅನ್ನು ಪಾಸ್ವರ್ಡ್ನಿಂದ ರಕ್ಷಿಸಲಾಗಿದೆ. ದಯವಿಟ್ಟು ಪಾಸ್ವರ್ಡ್ ಅನ್ನು ನಮೂದಿಸಿ.</translation>
-<translation id="6807599807928161586">ವೆಬ್ ಪ್ರದೇಶ</translation>
+<translation id="7740050170769002709">HTML ವಿಷಯ</translation>
<translation id="5939518447894949180">ಮರುಹೊಂದಿಸು</translation>
<translation id="1842960171412779397">ಆಯ್ಕೆ ಮಾಡಿ</translation>
<translation id="7638452146404718955">ಪ್ಲಗ್-ಇನ್ ಅನ್ನು ಡೌನ್ಲೋಡ್ ಮಾಡಲು ಇಲ್ಲಿ ಕ್ಲಿಕ್ ಮಾಡಿ</translation>
diff --git a/webkit/glue/resources/webkit_strings_ko.xtb b/webkit/glue/resources/webkit_strings_ko.xtb
index 819c8ce..f3e829e 100644
--- a/webkit/glue/resources/webkit_strings_ko.xtb
+++ b/webkit/glue/resources/webkit_strings_ko.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="ko">
<translation id="4519964825805946997"><ph name="URL"/>의 플러그인 설치 실패</translation>
+<translation id="9186171386827445984">문서 로드 중: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/>페이지</translation>
<translation id="1235745349614807883">최근 검색 삭제</translation>
<translation id="5048533449481078685">목록 표시기</translation>
<translation id="372362261556059955">추가 플러그인 필요</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">플러그인 설치 실패</translation>
<translation id="8141602879876242471">이것은 검색 색인합니다. 검색 키워드 입력:</translation>
<translation id="5650795167354946011">플러그인 설치 후 여기를 클릭하여 새로고침</translation>
+<translation id="370665806235115550">로드 중...</translation>
<translation id="6845533974506654842">누르기</translation>
<translation id="8244226242650769279">이미지 지도</translation>
<translation id="2548326553472216322">최근 수행된 검색 없음</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419"><ph name="PLUGIN"/> 플러그인을 설치할지 여부를 확인하시기 바랍니다. 신뢰할 수 있는 플러그인만 설치해야 합니다.</translation>
<translation id="6663448176199120256">최근 수행된 검색</translation>
<translation id="2597378329261239068">문서가 비밀번호로 보호되고 있습니다. 비밀번호를 입력하세요.</translation>
-<translation id="6807599807928161586">웹 영역</translation>
+<translation id="7740050170769002709">HTML 콘텐츠</translation>
<translation id="5939518447894949180">재설정</translation>
<translation id="1842960171412779397">선택</translation>
<translation id="7638452146404718955">여기를 클릭하여 플러그인 다운로드</translation>
diff --git a/webkit/glue/resources/webkit_strings_lt.xtb b/webkit/glue/resources/webkit_strings_lt.xtb
index 8e8a7a7..7138796 100644
--- a/webkit/glue/resources/webkit_strings_lt.xtb
+++ b/webkit/glue/resources/webkit_strings_lt.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="lt">
<translation id="4519964825805946997">Nepavyko įdiegti papildinio iš <ph name="URL"/></translation>
+<translation id="9186171386827445984">Įkeliamas dokumentas: <ph name="PAGE_NUMBER"/> / <ph name="NUMBER_OF_PAGES"/> psl...</translation>
<translation id="1235745349614807883">Išvalyti pastarąsias paieškas</translation>
<translation id="5048533449481078685">sąrašo žymeklis</translation>
<translation id="372362261556059955">Reikia papildomo papildinio</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Papildinio diegimas nepavyko</translation>
<translation id="8141602879876242471">Tai yra ieškotinas indeksas. Įveskite paieškos raktinių žodžių:</translation>
<translation id="5650795167354946011">Įdiegę papildinį spustelėkite čia, kad puslapis būtų atnaujintas</translation>
+<translation id="370665806235115550">Įkeliama...</translation>
<translation id="6845533974506654842">paspausti</translation>
<translation id="8244226242650769279">paveikslėlio žemėlapis</translation>
<translation id="2548326553472216322">Pastaruoju metu paieškų nevykdyta</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Patvirtinkite, kad norite įdiegti šį „<ph name="PLUGIN"/>“ papildinį. Turėtumėte diegti tik tuos papildinius, kurie patikimi.</translation>
<translation id="6663448176199120256">Naujausios paieškos</translation>
<translation id="2597378329261239068">Šis dokumentas apsaugotas slaptažodžiu. Įveskite slaptažodį.</translation>
-<translation id="6807599807928161586">interneto sritis</translation>
+<translation id="7740050170769002709">HTML turinys</translation>
<translation id="5939518447894949180">Nustatyti iš naujo</translation>
<translation id="1842960171412779397">pasirinkti</translation>
<translation id="7638452146404718955">Spustelėkite čia, kad atsisiųstumėte papildinį</translation>
diff --git a/webkit/glue/resources/webkit_strings_lv.xtb b/webkit/glue/resources/webkit_strings_lv.xtb
index c97eb32..f070834 100644
--- a/webkit/glue/resources/webkit_strings_lv.xtb
+++ b/webkit/glue/resources/webkit_strings_lv.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="lv">
<translation id="4519964825805946997">Neizdevās instalēt spraudni no <ph name="URL"/></translation>
+<translation id="9186171386827445984">Notiek dokumenta ielāde: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> lappuses...</translation>
<translation id="1235745349614807883">Dzēst nesenos meklējumus</translation>
<translation id="5048533449481078685">sarakstu marķieris</translation>
<translation id="372362261556059955">Nepieciešams papildu spraudnis</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Spraudņa instalēšana neizdevās</translation>
<translation id="8141602879876242471">Šis ir indekss ar meklēšanas iespējām. Ievadīt meklēšanas atslēgvārdus:</translation>
<translation id="5650795167354946011">Pēc spraudņa instalēšanas noklikšķiniet šeit, lai atsvaidzinātu</translation>
+<translation id="370665806235115550">Notiek ielāde...</translation>
<translation id="6845533974506654842">nospiest</translation>
<translation id="8244226242650769279">attēlu karte</translation>
<translation id="2548326553472216322">Nav nesenu meklējumu</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Lūdzu, apstipriniet, ka vēlaties instalēt <ph name="PLUGIN"/> spraudni. Jums ir jāinstalē tikai tie spraudņi, kuriem uzticaties.</translation>
<translation id="6663448176199120256">Neseni meklējumi</translation>
<translation id="2597378329261239068">Šis dokuments ir aizsargāts ar paroli. Lūdzu, ievadiet paroli.</translation>
-<translation id="6807599807928161586">tīmekļa apgabals</translation>
+<translation id="7740050170769002709">HTML saturs</translation>
<translation id="5939518447894949180">Atiestatīt</translation>
<translation id="1842960171412779397">Atlasiet</translation>
<translation id="7638452146404718955">Noklikšķiniet šeit, lai lejupielādētu spraudni</translation>
diff --git a/webkit/glue/resources/webkit_strings_ml.xtb b/webkit/glue/resources/webkit_strings_ml.xtb
index 437330d..fdf0843 100644
--- a/webkit/glue/resources/webkit_strings_ml.xtb
+++ b/webkit/glue/resources/webkit_strings_ml.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="ml">
<translation id="4519964825805946997"><ph name="URL"/> എന്നതില് നിന്നുള്ള പ്ലഗ്-ഇന് ഇന്സ്റ്റാളുചെയ്യുന്നതിന് പരാജയപ്പെട്ടു</translation>
+<translation id="9186171386827445984">പ്രമാണങ്ങള് ലോഡുചെയ്യുന്നു: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> പേജുകള്...</translation>
<translation id="1235745349614807883">അടുത്തിടെയുള്ള തിരയലുകള് മായ്ക്കുക</translation>
<translation id="5048533449481078685">പട്ടിക മാര്ക്കര്</translation>
<translation id="372362261556059955">കൂടുതല് പ്ലഗ്-ഇന് ആവശ്യമുണ്ട്</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">പ്ലഗ്-ഇന് ഇന്സ്റ്റാളേഷന് പരാജയപ്പെട്ടു</translation>
<translation id="8141602879876242471">ഇത് തിരയാവുന്ന സൂചികയാണ്. തിരയല് കീവേഡുകള് നല്കുക:</translation>
<translation id="5650795167354946011">പ്ലഗ്-ഇന് ഇന്സ്റ്റാളുചെയ്തതിനുശേഷം, പുതുക്കുന്നതിന് ഇവിടെ ക്ലിക്കുചെയ്യുക</translation>
+<translation id="370665806235115550">ലോഡ്ചെയ്യുന്നു...</translation>
<translation id="6845533974506654842">അമര്ത്തുക</translation>
<translation id="8244226242650769279">ഇമേജ് മാപ്പ്</translation>
<translation id="2548326553472216322">സമീപകാല തിരയലുകള് ഇല്ല</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">നിങ്ങള് ഈ <ph name="PLUGIN"/> പ്ലഗ്-ഇന് ഇന്സ്റ്റാളുചെയ്യാന് താല്പ്പര്യപ്പെടുന്നുവെന്നത് ദയവായി സ്ഥിരീകരിക്കുക. നിങ്ങള് വിശ്വസിക്കുന്ന പ്ലഗ്-ഇനുകള് മാത്രമേ ഇന്സ്റ്റാള് ചെയ്യാവൂ.</translation>
<translation id="6663448176199120256">സമീപകാല തിരയലുകള്</translation>
<translation id="2597378329261239068">ഈ പ്രമാണം പാസ്വേഡ് പരിരക്ഷിതമാണ്. ദയവായി ഒരു പാസ്വേഡ് നല്കുക.</translation>
-<translation id="6807599807928161586">വെബ് മേഖല</translation>
+<translation id="7740050170769002709">HTML ഉള്ളടക്കം</translation>
<translation id="5939518447894949180">വീണ്ടും സജ്ജീകരിക്കുക</translation>
<translation id="1842960171412779397">തിരഞ്ഞെടുക്കൂ</translation>
<translation id="7638452146404718955">പ്ലഗ്-ഇന് ഡൌണ്ലോഡുചെയ്യുന്നതിന് ഇവിടെ ക്ലിക്കുചെയ്യുക</translation>
diff --git a/webkit/glue/resources/webkit_strings_mr.xtb b/webkit/glue/resources/webkit_strings_mr.xtb
index 3061c16..da03fe1 100644
--- a/webkit/glue/resources/webkit_strings_mr.xtb
+++ b/webkit/glue/resources/webkit_strings_mr.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="mr">
<translation id="4519964825805946997"><ph name="URL"/> वरून प्लग-इन स्थापित करणे अयशस्वी</translation>
+<translation id="9186171386827445984">दस्तऐवज लोड करत आहे: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> पृष्ठे...</translation>
<translation id="1235745349614807883">अलीकडील शोध साफ करा</translation>
<translation id="5048533449481078685">सूची चिन्हक</translation>
<translation id="372362261556059955">अतिरिक्त प्लग-इन आवश्यक</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">प्लग-इन स्थापना अयशस्वी</translation>
<translation id="8141602879876242471">ही शोध घेण्यायोग्य अनुक्रमणिका आहे. शोध कीवर्ड प्रविष्ट करा:</translation>
<translation id="5650795167354946011">प्लग-इन स्थापित केल्यानंतर, रीफ्रेश करण्यासाठी येथे क्लिक करा</translation>
+<translation id="370665806235115550">लोड करीत आहे...</translation>
<translation id="6845533974506654842">दाबा</translation>
<translation id="8244226242650769279">प्रतिमा नकाशा</translation>
<translation id="2548326553472216322">अलीकडील शोध नाहीत</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">कृपया आपल्याला प्लग-इन <ph name="PLUGIN"/> स्थापित करणे आवडत असल्याची पुष्टी करा. आपण आपला विश्वास असलेले प्लग-इन्स फक्त स्थापित करावे. </translation>
<translation id="6663448176199120256">अलीकडील शोध</translation>
<translation id="2597378329261239068">हा दस्तऐवज संकेतशब्द संरक्षित आहे. कृपया संकेतशब्द प्रविष्ट करा.</translation>
-<translation id="6807599807928161586">वेब क्षेत्र</translation>
+<translation id="7740050170769002709">HTML सामुग्री</translation>
<translation id="5939518447894949180">रीसेट करा</translation>
<translation id="1842960171412779397">निवडा</translation>
<translation id="7638452146404718955">प्लग-इन डाउनलोड करण्यासाठी येथे क्लिक करा</translation>
diff --git a/webkit/glue/resources/webkit_strings_nl.xtb b/webkit/glue/resources/webkit_strings_nl.xtb
index df39241..d3b90a2 100644
--- a/webkit/glue/resources/webkit_strings_nl.xtb
+++ b/webkit/glue/resources/webkit_strings_nl.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="nl">
<translation id="4519964825805946997">Het installeren van de invoegtoepassing van <ph name="URL"/> is mislukt</translation>
+<translation id="9186171386827445984">Document wordt geladen: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> pagina's...</translation>
<translation id="1235745349614807883">Recente zoekopdrachten wissen</translation>
<translation id="5048533449481078685">lijstmarkering</translation>
<translation id="372362261556059955">Aanvullende invoegtoepassing vereist</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">De installatie van de invoegtoepassing is mislukt</translation>
<translation id="8141602879876242471">Dit is een doorzoekbare index. Geef zoekwoorden op:</translation>
<translation id="5650795167354946011">Klik hier na het installeren van de invoegtoepassing om te vernieuwen</translation>
+<translation id="370665806235115550">Laden...</translation>
<translation id="6845533974506654842">Indrukken</translation>
<translation id="8244226242650769279">image map</translation>
<translation id="2548326553472216322">Geen recente zoekopdrachten</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Bevestig dat u de invoegtoepassing van <ph name="PLUGIN"/> wilt installeren. U moet alleen invoegtoepassingen installeren die u vertrouwt.</translation>
<translation id="6663448176199120256">Recente zoekopdrachten</translation>
<translation id="2597378329261239068">Dit document is beveiligd met een wachtwoord. Geef een wachtwoord op.</translation>
-<translation id="6807599807928161586">webgedeelte</translation>
+<translation id="7740050170769002709">HTML-inhoud</translation>
<translation id="5939518447894949180">Herstellen</translation>
<translation id="1842960171412779397">Selecteren</translation>
<translation id="7638452146404718955">Klik hier om de invoegtoepassing te downloaden</translation>
diff --git a/webkit/glue/resources/webkit_strings_no.xtb b/webkit/glue/resources/webkit_strings_no.xtb
index c94ad8f..6346872 100644
--- a/webkit/glue/resources/webkit_strings_no.xtb
+++ b/webkit/glue/resources/webkit_strings_no.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="no">
<translation id="4519964825805946997">Kunne ikke installere programtillegget fra <ph name="URL"/></translation>
+<translation id="9186171386827445984">Laster inn dokument: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> sider</translation>
<translation id="1235745349614807883">Fjern nylige søk</translation>
<translation id="5048533449481078685">listemarkør</translation>
<translation id="372362261556059955">Ekstra programtillegg kreves</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Installering av programtillegg mislyktes</translation>
<translation id="8141602879876242471">Dette er en søkbar indeks. Angi søkeordene:</translation>
<translation id="5650795167354946011">Når programtillegget er installert, klikker du her for å oppdatere</translation>
+<translation id="370665806235115550">Laster inn...</translation>
<translation id="6845533974506654842">trykk</translation>
<translation id="8244226242650769279">bildekart</translation>
<translation id="2548326553472216322">Ingen nylige søk</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Bekreft at du ønsker å installere programtillegget <ph name="PLUGIN"/>. Du bør kun installere programtillegg du stoler på.</translation>
<translation id="6663448176199120256">Nylige søk</translation>
<translation id="2597378329261239068">Dette dokumentet er passordbeskyttet. Skriv inn et passord.</translation>
-<translation id="6807599807928161586">nettområde</translation>
+<translation id="7740050170769002709">HTML-innhold</translation>
<translation id="5939518447894949180">Tilbakestill</translation>
<translation id="1842960171412779397">velg</translation>
<translation id="7638452146404718955">Klikk her for å laste ned programtillegget</translation>
diff --git a/webkit/glue/resources/webkit_strings_pl.xtb b/webkit/glue/resources/webkit_strings_pl.xtb
index ea4f6cf..b37ec7e 100644
--- a/webkit/glue/resources/webkit_strings_pl.xtb
+++ b/webkit/glue/resources/webkit_strings_pl.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="pl">
<translation id="4519964825805946997">Nie można zainstalować wtyczki dostępnej pod adresem <ph name="URL"/></translation>
+<translation id="9186171386827445984">Wczytywanie dokumentu: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> stron...</translation>
<translation id="1235745349614807883">Wyczyść ostatnie wyszukiwania</translation>
<translation id="5048533449481078685">znacznik listy</translation>
<translation id="372362261556059955">Potrzebna jest dodatkowa wtyczka</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Instalacja wtyczki nie powiodła się</translation>
<translation id="8141602879876242471">Ten indeks można przeszukiwać. Wprowadź wyszukiwane słowa kluczowe:</translation>
<translation id="5650795167354946011">Po zainstalowaniu wtyczki kliknij tutaj, aby odświeżyć okno</translation>
+<translation id="370665806235115550">Ładowanie...</translation>
<translation id="6845533974506654842">naciśnij</translation>
<translation id="8244226242650769279">mapa grafiki</translation>
<translation id="2548326553472216322">Brak ostatnich wyszukiwań</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Potwierdź zamiar zainstalowania wtyczki <ph name="PLUGIN"/>. Należy instalować wyłącznie zaufane wtyczki.</translation>
<translation id="6663448176199120256">Ostatnie wyszukiwania</translation>
<translation id="2597378329261239068">Ten dokument jest chroniony hasłem. Wprowadź hasło.</translation>
-<translation id="6807599807928161586">obszar sieci</translation>
+<translation id="7740050170769002709">Treść HTML</translation>
<translation id="5939518447894949180">Resetuj</translation>
<translation id="1842960171412779397">wybierz</translation>
<translation id="7638452146404718955">Kliknij tutaj, aby pobrać wtyczkę</translation>
diff --git a/webkit/glue/resources/webkit_strings_pt-BR.xtb b/webkit/glue/resources/webkit_strings_pt-BR.xtb
index b34c7cb..5233854 100644
--- a/webkit/glue/resources/webkit_strings_pt-BR.xtb
+++ b/webkit/glue/resources/webkit_strings_pt-BR.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="pt-BR">
<translation id="4519964825805946997">Falha ao instalar o plug-in de <ph name="URL"/></translation>
+<translation id="9186171386827445984">Carregando documento: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> páginas...</translation>
<translation id="1235745349614807883">Limpar pesquisas recentes</translation>
<translation id="5048533449481078685">marcador de lista</translation>
<translation id="372362261556059955">Plug-in adicional necessário</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Falha na instalação do plug-in</translation>
<translation id="8141602879876242471">Este é um índice pesquisável. Insira palavras-chave de pesquisa:</translation>
<translation id="5650795167354946011">Depois de instalar o plug-in, clique aqui para atualizar</translation>
+<translation id="370665806235115550">Carregando...</translation>
<translation id="6845533974506654842">pressione</translation>
<translation id="8244226242650769279">mapa de imagens</translation>
<translation id="2548326553472216322">Nenhuma pesquisa recente</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Confirme se você deseja instalar o plug-in do <ph name="PLUGIN"/>. Você deve instalar apenas plug-ins em que você confia.</translation>
<translation id="6663448176199120256">Pesquisas recentes</translation>
<translation id="2597378329261239068">Este documento está protegido por senha. Digite a senha.</translation>
-<translation id="6807599807928161586">área da web</translation>
+<translation id="7740050170769002709">Conteúdo HTML</translation>
<translation id="5939518447894949180">Redefinir</translation>
<translation id="1842960171412779397">selecione</translation>
<translation id="7638452146404718955">Clique aqui para fazer download do plug-in</translation>
diff --git a/webkit/glue/resources/webkit_strings_pt-PT.xtb b/webkit/glue/resources/webkit_strings_pt-PT.xtb
index 817cdf4..a93bd4f 100644
--- a/webkit/glue/resources/webkit_strings_pt-PT.xtb
+++ b/webkit/glue/resources/webkit_strings_pt-PT.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="pt-PT">
<translation id="4519964825805946997">Falha ao instalar o plug-in de <ph name="URL"/></translation>
+<translation id="9186171386827445984">A carregar o documento: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> páginas...</translation>
<translation id="1235745349614807883">Limpar pesquisas recentes</translation>
<translation id="5048533449481078685">marcador de lista</translation>
<translation id="372362261556059955">Plug-in adicional requerido</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">A instalação do plug-in falhou</translation>
<translation id="8141602879876242471">Este índice é pesquisável. Introduza palavras-chave de pesquisa:</translation>
<translation id="5650795167354946011">Após instalar o plug-in, clique aqui para actualizar</translation>
+<translation id="370665806235115550">A carregar...</translation>
<translation id="6845533974506654842">premir</translation>
<translation id="8244226242650769279">mapa de imagem</translation>
<translation id="2548326553472216322">Nenhuma pesquisa recente</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Confirme se pretende instalar o plug-in do <ph name="PLUGIN"/>. Deve instalar apenas plug-ins fidedignos.</translation>
<translation id="6663448176199120256">Pesquisas recentes</translation>
<translation id="2597378329261239068">Este documento está protegido por palavra-passe. Introduza uma palavra-passe.</translation>
-<translation id="6807599807928161586">Área Web</translation>
+<translation id="7740050170769002709">Conteúdo HTML</translation>
<translation id="5939518447894949180">Repor</translation>
<translation id="1842960171412779397">seleccionar</translation>
<translation id="7638452146404718955">Clique aqui para transferir o plug-in</translation>
diff --git a/webkit/glue/resources/webkit_strings_ro.xtb b/webkit/glue/resources/webkit_strings_ro.xtb
index 2f8ec55..eeebfc3 100644
--- a/webkit/glue/resources/webkit_strings_ro.xtb
+++ b/webkit/glue/resources/webkit_strings_ro.xtb
@@ -1,44 +1,46 @@
<?xml version="1.0" ?>
<!DOCTYPE translationbundle>
<translationbundle lang="ro">
-<translation id="4519964825805946997">Instalarea pluginului de la <ph name="URL"/> a eşuat</translation>
-<translation id="1235745349614807883">Ştergeţi căutările recente</translation>
+<translation id="4519964825805946997">Instalarea pluginului de la <ph name="URL"/> a eșuat</translation>
+<translation id="9186171386827445984">Se încarcă documentul: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> (de) pagini...</translation>
+<translation id="1235745349614807883">Ștergeți căutările recente</translation>
<translation id="5048533449481078685">marcator listă</translation>
<translation id="372362261556059955">Este necesar un plugin suplimentar</translation>
<translation id="4202807286478387388">Salt</translation>
<translation id="4611115858363067980"><ph name="FILENAME"/><ph name="WIDTH"/>×<ph name="HEIGHT"/></translation>
-<translation id="7658239707568436148">Anulaţi</translation>
-<translation id="795667975304826397">Nu s-au ales fişiere</translation>
-<translation id="1416462845279468967">Instalarea pluginului a eşuat</translation>
-<translation id="8141602879876242471">Acesta este un index în care se poate căuta. Introduceţi cuvintele cheie pentru căutare:</translation>
-<translation id="5650795167354946011">După instalarea pluginului, faceţi clic aici pentru a actualiza</translation>
-<translation id="6845533974506654842">Apăsaţi</translation>
+<translation id="7658239707568436148">Anulați</translation>
+<translation id="795667975304826397">Nu s-au ales fișiere</translation>
+<translation id="1416462845279468967">Instalarea pluginului a eșuat</translation>
+<translation id="8141602879876242471">Acesta este un index în care se poate căuta. Introduceți cuvintele cheie pentru căutare:</translation>
+<translation id="5650795167354946011">După instalarea pluginului, faceți clic aici pentru a actualiza</translation>
+<translation id="370665806235115550">Se încarcă...</translation>
+<translation id="6845533974506654842">Apăsați</translation>
<translation id="8244226242650769279">hartă cu imagini</translation>
<translation id="2548326553472216322">Nicio căutare recentă</translation>
<translation id="5944544982112848342">2048 (Grad înalt)</translation>
<translation id="3040011195152428237">link</translation>
-<translation id="2745343197843472802">Descărcaţi pluginul</translation>
-<translation id="5776402066334188252">Confirmaţi că doriţi să instalaţi acest plugin. Vă recomandăm să instalaţi numai pluginuri în care aveţi încredere.</translation>
+<translation id="2745343197843472802">Descărcați pluginul</translation>
+<translation id="5776402066334188252">Confirmați că doriți să instalați acest plugin. Vă recomandăm să instalați numai pluginuri în care aveți încredere.</translation>
<translation id="4003986561708175844">Pluginul necesar nu este instalat</translation>
<translation id="3018094406922859308">Se descarcă pluginul...</translation>
-<translation id="7364796246159120393">Alegeţi fişierul</translation>
-<translation id="8964020114565522021">Trageţi fişierul aici</translation>
-<translation id="838869780401515933">Bifaţi</translation>
+<translation id="7364796246159120393">Alegeți fișierul</translation>
+<translation id="8964020114565522021">Trageți fișierul aici</translation>
+<translation id="838869780401515933">Bifați</translation>
<translation id="2846343701378493991">1024 (Grad mediu)</translation>
-<translation id="5476505524087279545">Debifaţi</translation>
-<translation id="3789841737615482174">Instalaţi</translation>
-<translation id="5253117816378681419">Confirmaţi că doriţi să instalaţi pluginul <ph name="PLUGIN"/>. Vă recomandăm să instalaţi numai pluginuri în care aveţi încredere.</translation>
+<translation id="5476505524087279545">Debifați</translation>
+<translation id="3789841737615482174">Instalați</translation>
+<translation id="5253117816378681419">Confirmați că doriți să instalați pluginul <ph name="PLUGIN"/>. Vă recomandăm să instalați numai pluginuri în care aveți încredere.</translation>
<translation id="6663448176199120256">Căutări recente</translation>
-<translation id="2597378329261239068">Acest document este protejat cu parolă. Introduceţi o parolă.</translation>
-<translation id="6807599807928161586">zona Web</translation>
-<translation id="5939518447894949180">Resetaţi</translation>
-<translation id="1842960171412779397">Selectaţi</translation>
-<translation id="7638452146404718955">Faceţi clic aici pentru a descărca pluginul</translation>
-<translation id="6119846243427417423">Activaţi</translation>
-<translation id="8444882422881193423"><ph name="NUMBER_OF_FILES"/> fişiere</translation>
+<translation id="2597378329261239068">Acest document este protejat cu parolă. Introduceți o parolă.</translation>
+<translation id="7740050170769002709">Conținut HTML</translation>
+<translation id="5939518447894949180">Resetați</translation>
+<translation id="1842960171412779397">Selectați</translation>
+<translation id="7638452146404718955">Faceți clic aici pentru a descărca pluginul</translation>
+<translation id="6119846243427417423">Activați</translation>
+<translation id="8444882422881193423"><ph name="NUMBER_OF_FILES"/> fișiere</translation>
<translation id="4470547978413275879">Pluginul <ph name="PLUGIN"/> nu este instalat</translation>
-<translation id="6765711848403622008">Niciun plugin disponibil pentru a afişa acest conţinut</translation>
+<translation id="6765711848403622008">Niciun plugin disponibil pentru a afișa acest conținut</translation>
<translation id="8597182159515967513">titlu</translation>
-<translation id="2653659639078652383">Trimiteţi</translation>
+<translation id="2653659639078652383">Trimiteți</translation>
<translation id="8475551193147984329">Este necesar pluginul <ph name="PLUGIN"/></translation>
</translationbundle>
\ No newline at end of file
diff --git a/webkit/glue/resources/webkit_strings_ru.xtb b/webkit/glue/resources/webkit_strings_ru.xtb
index 97e2796..5ea9049 100644
--- a/webkit/glue/resources/webkit_strings_ru.xtb
+++ b/webkit/glue/resources/webkit_strings_ru.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="ru">
<translation id="4519964825805946997">Не удалось установить подключаемый модуль с адреса <ph name="URL"/></translation>
+<translation id="9186171386827445984">Загрузка документа: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> стр.</translation>
<translation id="1235745349614807883">Очистить недавние поиски</translation>
<translation id="5048533449481078685">маркер списка</translation>
<translation id="372362261556059955">Необходим дополнительный подключаемый модуль</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Не удалось установить подключаемый модуль</translation>
<translation id="8141602879876242471">Это индекс с возможностью поиска. Введите ключевые слова для поиска:</translation>
<translation id="5650795167354946011">После установки подключаемого модуля нажмите здесь, чтобы обновить страницу</translation>
+<translation id="370665806235115550">Загрузка...</translation>
<translation id="6845533974506654842">нажать</translation>
<translation id="8244226242650769279">графическая карта</translation>
<translation id="2548326553472216322">Нет недавних поисков</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Подтвердите, что вы хотите установить подключаемый модуль <ph name="PLUGIN"/>. Вы доверяете ему?</translation>
<translation id="6663448176199120256">Недавние поиски</translation>
<translation id="2597378329261239068">Документ защищен паролем. Введите пароль.</translation>
-<translation id="6807599807928161586">область Интернетеа</translation>
+<translation id="7740050170769002709">HTML-содержание</translation>
<translation id="5939518447894949180">Изменить</translation>
<translation id="1842960171412779397">выбрать</translation>
<translation id="7638452146404718955">Нажмите здесь, чтобы загрузить подключаемый модуль</translation>
diff --git a/webkit/glue/resources/webkit_strings_sk.xtb b/webkit/glue/resources/webkit_strings_sk.xtb
index 71e68a9..a9b37ba 100644
--- a/webkit/glue/resources/webkit_strings_sk.xtb
+++ b/webkit/glue/resources/webkit_strings_sk.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="sk">
<translation id="4519964825805946997">Inštalácia doplnku z adresy <ph name="URL"/> zlyhala</translation>
+<translation id="9186171386827445984">Prebieha načítavanie dokumentu: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> stránok...</translation>
<translation id="1235745349614807883">Vyčistiť posledné vyhľadávania</translation>
<translation id="5048533449481078685">ukazovateľ v zozname</translation>
<translation id="372362261556059955">Vyžaduje sa ďalší doplnok</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Inštalácia doplnku zlyhala</translation>
<translation id="8141602879876242471">Tento index sa dá prehľadávať. Zadajte kľúčové slová na vyhľadanie:</translation>
<translation id="5650795167354946011">Kliknutím sem po inštalácii doplnku obnovíte obsah</translation>
+<translation id="370665806235115550">Načítava sa...</translation>
<translation id="6845533974506654842">stlačiť</translation>
<translation id="8244226242650769279">mapa obrázka</translation>
<translation id="2548326553472216322">Žiadne posledné vyhľadávania</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Potvrďte, že chcete nainštalovať doplnok <ph name="PLUGIN"/>. Mali by ste inštalovať len doplnky, ktorým dôverujete.</translation>
<translation id="6663448176199120256">Posledné vyhľadávania</translation>
<translation id="2597378329261239068">Tento dokument je chránený heslom. Zadajte heslo.</translation>
-<translation id="6807599807928161586">webová oblasť</translation>
+<translation id="7740050170769002709">Obsah HTML</translation>
<translation id="5939518447894949180">Vynulovať</translation>
<translation id="1842960171412779397">vybrať</translation>
<translation id="7638452146404718955">Kliknutím sem prevezmete doplnok</translation>
diff --git a/webkit/glue/resources/webkit_strings_sl.xtb b/webkit/glue/resources/webkit_strings_sl.xtb
index 2ee1e5b..e3b1061 100644
--- a/webkit/glue/resources/webkit_strings_sl.xtb
+++ b/webkit/glue/resources/webkit_strings_sl.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="sl">
<translation id="4519964825805946997">Namestitev vtičnika z naslova <ph name="URL"/> ni bila uspešna</translation>
+<translation id="9186171386827445984">Nalaganje dokumenta: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> strani ...</translation>
<translation id="1235745349614807883">Počisti zadnja iskanja</translation>
<translation id="5048533449481078685">označevalnik seznama</translation>
<translation id="372362261556059955">Potreben je dodaten vtičnik</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Namestitev vtičnika ni bila uspešna</translation>
<translation id="8141602879876242471">To je kazalo, ki omogoča iskanje. Vnesite ključne besede za iskanje:</translation>
<translation id="5650795167354946011">Po namestitvi vtičnika, kliknite tu, da osvežite</translation>
+<translation id="370665806235115550">Nalagam ...</translation>
<translation id="6845533974506654842">pritisni</translation>
<translation id="8244226242650769279">slikovni zemljevid</translation>
<translation id="2548326553472216322">Ni zadnjih iskanj</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Potrdite, da želite namestiti ta <ph name="PLUGIN"/> vtičnik. Nameščajte le vtičnike, ki jim zaupate.</translation>
<translation id="6663448176199120256">Zadnja iskanja</translation>
<translation id="2597378329261239068">Dokument je zaščiten z geslom. Vnesite geslo.</translation>
-<translation id="6807599807928161586">spletno področje</translation>
+<translation id="7740050170769002709">Vsebina HTML</translation>
<translation id="5939518447894949180">Ponastavi</translation>
<translation id="1842960171412779397">izberi</translation>
<translation id="7638452146404718955">Če želite prenesti vtičnik, kliknite tukaj</translation>
diff --git a/webkit/glue/resources/webkit_strings_sr.xtb b/webkit/glue/resources/webkit_strings_sr.xtb
index a54c61b..3b32e4d 100644
--- a/webkit/glue/resources/webkit_strings_sr.xtb
+++ b/webkit/glue/resources/webkit_strings_sr.xtb
@@ -2,16 +2,18 @@
<!DOCTYPE translationbundle>
<translationbundle lang="sr">
<translation id="4519964825805946997">Инсталирање додатка са адресе <ph name="URL"/> није успело</translation>
+<translation id="9186171386827445984">Учитавање документа: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> странице(а)...</translation>
<translation id="1235745349614807883">Обриши недавне претраге</translation>
<translation id="5048533449481078685">означивач листе</translation>
<translation id="372362261556059955">Потребан је још један додатак</translation>
<translation id="4202807286478387388">прескочи</translation>
<translation id="4611115858363067980"><ph name="FILENAME"/><ph name="WIDTH"/>×<ph name="HEIGHT"/></translation>
<translation id="7658239707568436148">Откажи</translation>
-<translation id="795667975304826397">Није одабрана датотека</translation>
+<translation id="795667975304826397">Није одабрано</translation>
<translation id="1416462845279468967">Инсталација додатка није успела</translation>
<translation id="8141602879876242471">Ово је индекс који може да се претражује. Унесите кључне речи за претрагу:</translation>
<translation id="5650795167354946011">Након инсталирања додатка, кликните овде да бисте освежили</translation>
+<translation id="370665806235115550">Учитавање...</translation>
<translation id="6845533974506654842">притисни</translation>
<translation id="8244226242650769279">мапа слике</translation>
<translation id="2548326553472216322">Нема недавних претрага</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Потврдите да желите да инсталирате <ph name="PLUGIN"/> додатак. Инсталирајте само додатке у које имате поверења.</translation>
<translation id="6663448176199120256">Недавне претраге</translation>
<translation id="2597378329261239068">Овај документ је заштићен лозинком. Унесите лозинку.</translation>
-<translation id="6807599807928161586">веб област</translation>
+<translation id="7740050170769002709">HTML садржај</translation>
<translation id="5939518447894949180">Ресетуј</translation>
<translation id="1842960171412779397">изабери</translation>
<translation id="7638452146404718955">Кликните овде да бисте преузели додатак</translation>
diff --git a/webkit/glue/resources/webkit_strings_sv.xtb b/webkit/glue/resources/webkit_strings_sv.xtb
index aa42d57..7cbe67d 100644
--- a/webkit/glue/resources/webkit_strings_sv.xtb
+++ b/webkit/glue/resources/webkit_strings_sv.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="sv">
<translation id="4519964825805946997">Det gick inte att installera plugin-program från <ph name="URL"/></translation>
+<translation id="9186171386827445984">Läser in dokument: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> sidor...</translation>
<translation id="1235745349614807883">Rensa senaste sökningar</translation>
<translation id="5048533449481078685">listmarkör</translation>
<translation id="372362261556059955">Ett ytterligare plugin-program krävs</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Installationen av plugin-programmet misslyckades</translation>
<translation id="8141602879876242471">Det här är ett sökbart index. Skriv sökord:</translation>
<translation id="5650795167354946011">Klicka här för att uppdatera när du har installerat plugin-programmet</translation>
+<translation id="370665806235115550">Laddar...</translation>
<translation id="6845533974506654842">tryck</translation>
<translation id="8244226242650769279">bildkarta</translation>
<translation id="2548326553472216322">Inga nya sökningar</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Bekräfta att du vill installera plugin-programmet <ph name="PLUGIN"/>. Installera bara plugin-program från tillförlitliga källor.</translation>
<translation id="6663448176199120256">Senaste sökningar</translation>
<translation id="2597378329261239068">Dokumentet är lösenordsskyddat. Ange ett lösenord.</translation>
-<translation id="6807599807928161586">webbområde</translation>
+<translation id="7740050170769002709">HTML-innehåll</translation>
<translation id="5939518447894949180">Återställ</translation>
<translation id="1842960171412779397">välj</translation>
<translation id="7638452146404718955">Klicka här för att hämta plugin-programmet</translation>
diff --git a/webkit/glue/resources/webkit_strings_sw.xtb b/webkit/glue/resources/webkit_strings_sw.xtb
index e507aa6..088048a 100644
--- a/webkit/glue/resources/webkit_strings_sw.xtb
+++ b/webkit/glue/resources/webkit_strings_sw.xtb
@@ -8,6 +8,7 @@
<translation id="7658239707568436148">Ghairi</translation>
<translation id="795667975304826397">Hakuna faili lililochaguliwa</translation>
<translation id="8141602879876242471">Hii ni fahirisi inayoweza kutafutwa. Weka maneno muhimu ya utafutaji.</translation>
+<translation id="370665806235115550">Inapakia...</translation>
<translation id="6845533974506654842">bofya</translation>
<translation id="8244226242650769279">ramani ya picha</translation>
<translation id="2548326553472216322">Hakuna utafutaji wa hivi karibuni</translation>
@@ -20,7 +21,6 @@
<translation id="5476505524087279545">toa tiki</translation>
<translation id="3789841737615482174">Sakinisha</translation>
<translation id="6663448176199120256">Utafutaji wa hivi karibuni</translation>
-<translation id="6807599807928161586">eneo wavuti</translation>
<translation id="5939518447894949180">Weka upya</translation>
<translation id="1842960171412779397">chagua</translation>
<translation id="6119846243427417423">wezesha</translation>
diff --git a/webkit/glue/resources/webkit_strings_ta.xtb b/webkit/glue/resources/webkit_strings_ta.xtb
index 47d8547..f8dbf00 100644
--- a/webkit/glue/resources/webkit_strings_ta.xtb
+++ b/webkit/glue/resources/webkit_strings_ta.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="ta">
<translation id="4519964825805946997"><ph name="URL"/> இலிருந்து செருகுநிரலை நிறுவுதல் தோல்வியடைந்தது</translation>
+<translation id="9186171386827445984">ஆவணத்தை ஏற்றுகிறது: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> பக்கங்கள்...</translation>
<translation id="1235745349614807883">சமீபத்திய தேடல்களை சுத்தமாக்கு</translation>
<translation id="5048533449481078685">பட்டியல் குறிப்பான்</translation>
<translation id="372362261556059955">கூடுதல் செருகுநிரல் தேவைப்படுகிறது</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">செருகுநிரலை நிறுவுதல் தோல்வியடைந்தது</translation>
<translation id="8141602879876242471">இது தேடக்கூடிய பொருளடக்கம். தேடல் சொற்களை உள்ளிடுக:</translation>
<translation id="5650795167354946011">செருகுநிரலை நிறுவிய பின்பு புதுப்பிக்க இங்கு கிளிக்செய்க</translation>
+<translation id="370665806235115550">நினைவேறுகிறது...</translation>
<translation id="6845533974506654842">அழுத்துக</translation>
<translation id="8244226242650769279">பட மேப்</translation>
<translation id="2548326553472216322">சமீபத்திய தேடல்கள் எதுவுமில்லை</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419"><ph name="PLUGIN"/> செருகுநிரலை நிறுவ நீங்கள் விரும்புகிறீர்கள் என்பதை தயவுசெய்து உறுதிசெய்க. நீங்கள் நம்பும் செருகுநிரல்களை மட்டும் நிறுவ வேண்டும்.</translation>
<translation id="6663448176199120256">சமீபத்திய தேடல்கள்</translation>
<translation id="2597378329261239068">இந்த ஆவணம் கடவுச்சொல் பாதுகாக்கப்பட்ட ஒன்று. தயவுசெய்து ஒரு கடவுச்சொல்லை உள்ளிடுக.</translation>
-<translation id="6807599807928161586">வலைப் பகுதி</translation>
+<translation id="7740050170769002709">HTML உள்ளடக்கம்</translation>
<translation id="5939518447894949180">மீட்டமை</translation>
<translation id="1842960171412779397">தேர்ந்தெடு</translation>
<translation id="7638452146404718955">செருகுநிரலைப் பதிவிறக்க இங்கே கிளிக் செய்க</translation>
diff --git a/webkit/glue/resources/webkit_strings_te.xtb b/webkit/glue/resources/webkit_strings_te.xtb
index 3c1e875..a1f9fd6 100644
--- a/webkit/glue/resources/webkit_strings_te.xtb
+++ b/webkit/glue/resources/webkit_strings_te.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="te">
<translation id="4519964825805946997"><ph name="URL"/> నుండి ప్లగ్-ఇన్ను వ్యవస్థాపించడానికి విఫలమైంది</translation>
+<translation id="9186171386827445984">పత్రాన్ని లోడ్ చేస్తోంది: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> పేజీలు...</translation>
<translation id="1235745349614807883">ఇటీవల శోధనలను క్లియర్ చెయ్యి</translation>
<translation id="5048533449481078685">జాబితా మార్కర్</translation>
<translation id="372362261556059955">అదనపు ప్లగ్-ఇన్ అవసరం</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">ప్లగ్-ఇన్ వ్యవస్థాపన విఫలమైంది</translation>
<translation id="8141602879876242471">ఇది ఒక శోధించగల సూచిక. శోధన కీవర్డ్లను ఎంటర్ చెయ్యండి:</translation>
<translation id="5650795167354946011">ప్లగ్-ఇన్ను వ్యవస్థాపించిన తర్వాత, రిఫ్రెష్ చెయ్యడానికి ఇక్కడ క్లిక్ చెయ్యండి.</translation>
+<translation id="370665806235115550">లోడ్ అవుతోంది...</translation>
<translation id="6845533974506654842">నొక్కండి</translation>
<translation id="8244226242650769279">చిత్రం మాప్</translation>
<translation id="2548326553472216322">ఇటీవల శోధనలు లేవు</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">దయచేసి మీరు <ph name="PLUGIN"/> ప్లగ్-ఇన్ను వ్యవస్థాపించాలనుకుంటున్నారని నిర్థారించండి. మీరు విశ్వసించే ప్లగ్-ఇన్లను మాత్రమే వ్యవస్థాపించాలి.</translation>
<translation id="6663448176199120256">ఇటీవల శోధనలు</translation>
<translation id="2597378329261239068">ఈ పత్రం అనుమతి పదంచే రక్షించబడింది. దయచేసి అనుమతి పదాన్ని నమోదు చేయండి.</translation>
-<translation id="6807599807928161586">వెబ్ ప్రాంతం</translation>
+<translation id="7740050170769002709">HTML కంటెంట్</translation>
<translation id="5939518447894949180">తిరిగి అమర్చండి</translation>
<translation id="1842960171412779397">ఎంచుకోండి</translation>
<translation id="7638452146404718955">ప్లగ్-ఇన్ను డౌన్లోడ్ చేయడానికి ఇక్కడ క్లిక్ చేయండి</translation>
diff --git a/webkit/glue/resources/webkit_strings_th.xtb b/webkit/glue/resources/webkit_strings_th.xtb
index 80dd787..a6ffcc6 100644
--- a/webkit/glue/resources/webkit_strings_th.xtb
+++ b/webkit/glue/resources/webkit_strings_th.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="th">
<translation id="4519964825805946997">การติดตั้งปลั๊กอินจาก <ph name="URL"/> ล้มเหลว</translation>
+<translation id="9186171386827445984">กำลังโหลดเอกสาร: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> หน้า...</translation>
<translation id="1235745349614807883">ลบการค้นหาล่าสุด</translation>
<translation id="5048533449481078685">ผู้สร้างรายการ</translation>
<translation id="372362261556059955">ต้องการปลั๊กอินเพิ่มเติม</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">การติดตั้งปลั๊กอินล้มเหลว</translation>
<translation id="8141602879876242471">นี่คือดัชนีที่สามารถค้นหาได้ ป้อนคำหลักในการค้นหา:</translation>
<translation id="5650795167354946011">หลังจากติดตั้งปลั๊กอิน ให้คลิกที่นี่เพื่อรีเฟรช</translation>
+<translation id="370665806235115550">กำลังโหลด...</translation>
<translation id="6845533974506654842">กด</translation>
<translation id="8244226242650769279">แผนที่รูปภาพ</translation>
<translation id="2548326553472216322">ไม่พบการค้นหาล่าสุด</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">โปรดยืนยันว่าคุณต้องการติดตั้งปลั๊กอิน <ph name="PLUGIN"/> คุณควรติดตั้งเฉพาะปลั๊กอินที่คุณไว้ใจเท่านั้น</translation>
<translation id="6663448176199120256">การค้นหาล่าสุด</translation>
<translation id="2597378329261239068">เอกสารนี้ได้รับการป้องกันด้วยรหัสผ่าน โปรดป้อนรหัสผ่าน</translation>
-<translation id="6807599807928161586">พื้นที่เว็บ</translation>
+<translation id="7740050170769002709">เนื้อหา HTML</translation>
<translation id="5939518447894949180">ตั้งค่าใหม่</translation>
<translation id="1842960171412779397">เลือก</translation>
<translation id="7638452146404718955">คลิกที่นี่เพื่อดาวน์โหลดปลั๊กอิน</translation>
diff --git a/webkit/glue/resources/webkit_strings_tr.xtb b/webkit/glue/resources/webkit_strings_tr.xtb
index a4d880d..5a24891 100644
--- a/webkit/glue/resources/webkit_strings_tr.xtb
+++ b/webkit/glue/resources/webkit_strings_tr.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="tr">
<translation id="4519964825805946997">Eklenti, <ph name="URL"/> kaynağından yüklenemedi</translation>
+<translation id="9186171386827445984">Belge yükleniyor: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> sayfa...</translation>
<translation id="1235745349614807883">Son Aramaları Temizle</translation>
<translation id="5048533449481078685">liste işaretçisi</translation>
<translation id="372362261556059955">Başka eklenti gerekiyor</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Eklenti yüklenemedi</translation>
<translation id="8141602879876242471">Bu dizinde arama yapılabilir. Arama anahtar kelimeleri girin:</translation>
<translation id="5650795167354946011">Eklentiyi yükledikten sonra yenilemek için burayı tıklayın</translation>
+<translation id="370665806235115550">Yükleniyor...</translation>
<translation id="6845533974506654842">bas</translation>
<translation id="8244226242650769279">resim haritası</translation>
<translation id="2548326553472216322">Yeni arama yok</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Lütfen <ph name="PLUGIN"/> eklentisini yüklemek istediğinizi onaylayın. Yalnızca güvendiğiniz eklentileri yüklemelisiniz.</translation>
<translation id="6663448176199120256">Son Aramalar</translation>
<translation id="2597378329261239068">Doküman şifre korumalı. Lütfen şifreyi girin.</translation>
-<translation id="6807599807928161586">web alanı</translation>
+<translation id="7740050170769002709">HTML içeriği</translation>
<translation id="5939518447894949180">Sıfırla</translation>
<translation id="1842960171412779397">seç</translation>
<translation id="7638452146404718955">Eklentiyi indirmek için burayı tıklayın</translation>
diff --git a/webkit/glue/resources/webkit_strings_uk.xtb b/webkit/glue/resources/webkit_strings_uk.xtb
index a125fe2..360c85f 100644
--- a/webkit/glue/resources/webkit_strings_uk.xtb
+++ b/webkit/glue/resources/webkit_strings_uk.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="uk">
<translation id="4519964825805946997">Не вдалося встановити плагін із <ph name="URL"/></translation>
+<translation id="9186171386827445984">Завантаження документа – сторінки: <ph name="PAGE_NUMBER"/> із <ph name="NUMBER_OF_PAGES"/>...</translation>
<translation id="1235745349614807883">Очистити останні пошуки</translation>
<translation id="5048533449481078685">маркер списку</translation>
<translation id="372362261556059955">Потрібен додатковий плагін.</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Помилка встановлення плагіна</translation>
<translation id="8141602879876242471">Цей доступний для пошуку індекс. Введіть ключові слова пошуку:</translation>
<translation id="5650795167354946011">Після встановлення плагіна натисніть тут, щоб оновити</translation>
+<translation id="370665806235115550">Завантаження...</translation>
<translation id="6845533974506654842">натиснути</translation>
<translation id="8244226242650769279">мапа зображення</translation>
<translation id="2548326553472216322">Немає останніх пошуків</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Підтвердьте встановлення плагіна <ph name="PLUGIN"/>. Слід установлювати лише плагіни, яким ви довіряєте.</translation>
<translation id="6663448176199120256">Останні пошуки</translation>
<translation id="2597378329261239068">Цей документ захищено паролем. Введіть пароль.</translation>
-<translation id="6807599807928161586">область Інтернету</translation>
+<translation id="7740050170769002709">Вміст HTML</translation>
<translation id="5939518447894949180">Скинути</translation>
<translation id="1842960171412779397">вибрати</translation>
<translation id="7638452146404718955">Натисніть тут, щоб завантажити плагін</translation>
diff --git a/webkit/glue/resources/webkit_strings_vi.xtb b/webkit/glue/resources/webkit_strings_vi.xtb
index 84668c5..0ee2d09 100644
--- a/webkit/glue/resources/webkit_strings_vi.xtb
+++ b/webkit/glue/resources/webkit_strings_vi.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="vi">
<translation id="4519964825805946997">Cài đặt trình cắm từ <ph name="URL"/> không thành công</translation>
+<translation id="9186171386827445984">Đang tải tài liệu: <ph name="PAGE_NUMBER"/>/<ph name="NUMBER_OF_PAGES"/> trang...</translation>
<translation id="1235745349614807883">Xoá Tìm kiếm Gần đây</translation>
<translation id="5048533449481078685">đánh dấu danh sách</translation>
<translation id="372362261556059955">Cần trình cắm bổ sung</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">Cài đặt trình cắm không thành công</translation>
<translation id="8141602879876242471">Đây là chỉ mục có thể tìm kiếm. Nhập từ khoá tìm kiếm vào:</translation>
<translation id="5650795167354946011">Sau khi cài đặt trình cắm, hãy nhấp vào đây để làm mới</translation>
+<translation id="370665806235115550">Đang tải...</translation>
<translation id="6845533974506654842">nhấn</translation>
<translation id="8244226242650769279">bản đồ hình ảnh</translation>
<translation id="2548326553472216322">Không có tìm kiếm nào gần đây</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">Vui lòng xác nhận rằng bạn muốn cài đặt trình cắm <ph name="PLUGIN"/>. Bạn chỉ nên cài đặt những trình cắm mà bạn tin tưởng.</translation>
<translation id="6663448176199120256">Tìm kiếm Gần đây</translation>
<translation id="2597378329261239068">Tài liệu này được bảo vệ bằng mật khẩu. Vui lòng nhập mật khẩu.</translation>
-<translation id="6807599807928161586">khu vực web</translation>
+<translation id="7740050170769002709">Nội dung HTML</translation>
<translation id="5939518447894949180">Đặt lại</translation>
<translation id="1842960171412779397">chọn</translation>
<translation id="7638452146404718955">Nhấp vào đây để tải xuống trình cắm</translation>
diff --git a/webkit/glue/resources/webkit_strings_zh-CN.xtb b/webkit/glue/resources/webkit_strings_zh-CN.xtb
index f5c0644..f931c5c 100644
--- a/webkit/glue/resources/webkit_strings_zh-CN.xtb
+++ b/webkit/glue/resources/webkit_strings_zh-CN.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="zh-CN">
<translation id="4519964825805946997">无法从 <ph name="URL"/> 安装插件</translation>
+<translation id="9186171386827445984">正在载入文档:已载入 <ph name="PAGE_NUMBER"/> 页,共 <ph name="NUMBER_OF_PAGES"/> 页...</translation>
<translation id="1235745349614807883">清除最近的搜索</translation>
<translation id="5048533449481078685">列表标记</translation>
<translation id="372362261556059955">需要其他插件</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">插件安装失败</translation>
<translation id="8141602879876242471">这是一个可搜索的索引。请输入搜索关键字:</translation>
<translation id="5650795167354946011">安装插件后,点击此处可刷新</translation>
+<translation id="370665806235115550">正在载入...</translation>
<translation id="6845533974506654842">按</translation>
<translation id="8244226242650769279">图片映射</translation>
<translation id="2548326553472216322">最近未执行搜索</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">请确认您要安装 <ph name="PLUGIN"/> 插件。您应该只安装自己信任的插件。</translation>
<translation id="6663448176199120256">近期搜索</translation>
<translation id="2597378329261239068">本文档设置了密码保护,请输入密码。</translation>
-<translation id="6807599807928161586">网络区域</translation>
+<translation id="7740050170769002709">HTML 内容</translation>
<translation id="5939518447894949180">重置</translation>
<translation id="1842960171412779397">选中</translation>
<translation id="7638452146404718955">点击此处可下载插件</translation>
diff --git a/webkit/glue/resources/webkit_strings_zh-TW.xtb b/webkit/glue/resources/webkit_strings_zh-TW.xtb
index 7d7eda3..368a365 100644
--- a/webkit/glue/resources/webkit_strings_zh-TW.xtb
+++ b/webkit/glue/resources/webkit_strings_zh-TW.xtb
@@ -2,6 +2,7 @@
<!DOCTYPE translationbundle>
<translationbundle lang="zh-TW">
<translation id="4519964825805946997">無法從 <ph name="URL"/> 安裝外掛程式</translation>
+<translation id="9186171386827445984">正在載入文件:第 <ph name="PAGE_NUMBER"/> 頁,共 <ph name="NUMBER_OF_PAGES"/> 頁...</translation>
<translation id="1235745349614807883">清除最近的搜尋記錄</translation>
<translation id="5048533449481078685">清單標記</translation>
<translation id="372362261556059955">需要其他外掛程式</translation>
@@ -12,6 +13,7 @@
<translation id="1416462845279468967">外掛程式安裝不成功</translation>
<translation id="8141602879876242471">這是可搜尋的索引,輸入搜尋關鍵字:</translation>
<translation id="5650795167354946011">安裝外掛程式後,請按一下這裡重新整理</translation>
+<translation id="370665806235115550">載入中...</translation>
<translation id="6845533974506654842">按下</translation>
<translation id="8244226242650769279">影像地圖</translation>
<translation id="2548326553472216322">沒有近期的搜尋</translation>
@@ -30,7 +32,7 @@
<translation id="5253117816378681419">請確認您要安裝 <ph name="PLUGIN"/> 外掛程式,建議您僅安裝您所信任的外掛程式。</translation>
<translation id="6663448176199120256">最近的搜尋</translation>
<translation id="2597378329261239068">此文件受到密碼保護,請輸入密碼。</translation>
-<translation id="6807599807928161586">網頁範圍</translation>
+<translation id="7740050170769002709">HTML 內容</translation>
<translation id="5939518447894949180">重設</translation>
<translation id="1842960171412779397">選取</translation>
<translation id="7638452146404718955">按一下這裡下載外掛程式</translation>
diff --git a/webkit/glue/webkit_glue.gypi b/webkit/glue/webkit_glue.gypi
index 959f4e1..e64f667 100644
--- a/webkit/glue/webkit_glue.gypi
+++ b/webkit/glue/webkit_glue.gypi
@@ -1,4 +1,4 @@
-# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# 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.
@@ -12,7 +12,8 @@
}],
],
- 'grit_info_cmd': ['python', '<(DEPTH)/tools/grit/grit_info.py'],
+ 'grit_info_cmd': ['python', '<(DEPTH)/tools/grit/grit_info.py',
+ '<@(grit_defines)'],
'grit_cmd': ['python', '<(DEPTH)/tools/grit/grit.py'],
},
'targets': [
@@ -37,7 +38,8 @@
],
'action': ['<@(grit_cmd)',
'-i', '<(input_path)', 'build',
- '-o', '<(grit_out_dir)'],
+ '-o', '<(grit_out_dir)',
+ '<@(grit_defines)'],
'message': 'Generating resources from <(input_path)',
},
{
@@ -53,7 +55,8 @@
],
'action': ['<@(grit_cmd)',
'-i', '<(input_path)', 'build',
- '-o', '<(grit_out_dir)'],
+ '-o', '<(grit_out_dir)',
+ '<@(grit_defines)'],
'message': 'Generating resources from <(input_path)',
},
],
@@ -89,7 +92,8 @@
],
'action': ['<@(grit_cmd)',
'-i', '<(input_path)', 'build',
- '-o', '<(grit_out_dir)'],
+ '-o', '<(grit_out_dir)',
+ '<@(grit_defines)'],
'message': 'Generating resources from <(input_path)',
},
],
@@ -117,7 +121,7 @@
'action_name': 'webkit_version',
'inputs': [
'../build/webkit_version.py',
- '<(webkit_src_dir)/WebCore/Configurations/Version.xcconfig',
+ '<(webkit_src_dir)/Source/WebCore/Configurations/Version.xcconfig',
],
'outputs': [
'<(INTERMEDIATE_DIR)/webkit_version.h',
@@ -281,12 +285,13 @@
'../plugins/ppapi/ppb_file_ref_impl.h',
'../plugins/ppapi/ppb_file_system_impl.cc',
'../plugins/ppapi/ppb_file_system_impl.h',
- '../plugins/ppapi/ppb_flash.h',
'../plugins/ppapi/ppb_flash_impl.cc',
'../plugins/ppapi/ppb_flash_impl.h',
'../plugins/ppapi/ppb_flash_impl_linux.cc',
'../plugins/ppapi/ppb_font_impl.cc',
'../plugins/ppapi/ppb_font_impl.h',
+ '../plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.cc',
+ '../plugins/ppapi/ppb_gles_chromium_texture_mapping_impl.h',
'../plugins/ppapi/ppb_graphics_2d_impl.cc',
'../plugins/ppapi/ppb_graphics_2d_impl.h',
'../plugins/ppapi/ppb_graphics_3d_impl.cc',
@@ -302,6 +307,8 @@
'../plugins/ppapi/ppb_pdf_impl.h',
'../plugins/ppapi/ppb_scrollbar_impl.cc',
'../plugins/ppapi/ppb_scrollbar_impl.h',
+ '../plugins/ppapi/ppb_surface_3d_impl.cc',
+ '../plugins/ppapi/ppb_surface_3d_impl.h',
'../plugins/ppapi/ppb_transport_impl.cc',
'../plugins/ppapi/ppb_transport_impl.h',
'../plugins/ppapi/ppb_url_loader_impl.cc',
@@ -420,6 +427,7 @@
'websocketstreamhandle_impl.cc',
'websocketstreamhandle_impl.h',
'webthemeengine_impl_linux.cc',
+ 'webthemeengine_impl_mac.cc',
'webthemeengine_impl_win.cc',
'weburlloader_impl.cc',
'weburlloader_impl.h',
@@ -463,6 +471,9 @@
}],
['OS!="mac"', {
'sources/': [['exclude', '_mac\\.(cc|mm)$']],
+ 'sources!': [
+ 'webthemeengine_impl_mac.cc',
+ ],
}, { # else: OS=="mac"
'sources/': [['exclude', 'plugin_(lib|list)_posix\\.cc$']],
'link_settings': {
diff --git a/webkit/glue/webkitclient_impl.cc b/webkit/glue/webkitclient_impl.cc
index 844aae7..faf2926 100644
--- a/webkit/glue/webkitclient_impl.cc
+++ b/webkit/glue/webkitclient_impl.cc
@@ -204,7 +204,7 @@
}
WebThemeEngine* WebKitClientImpl::themeEngine() {
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX)
return &theme_engine_;
#else
return NULL;
diff --git a/webkit/glue/webkitclient_impl.h b/webkit/glue/webkitclient_impl.h
index cc361d3..42b436d 100644
--- a/webkit/glue/webkitclient_impl.h
+++ b/webkit/glue/webkitclient_impl.h
@@ -12,6 +12,8 @@
#include "webkit/glue/webthemeengine_impl_win.h"
#elif defined(OS_LINUX)
#include "webkit/glue/webthemeengine_impl_linux.h"
+#elif defined(OS_MACOSX)
+#include "webkit/glue/webthemeengine_impl_mac.h"
#endif
@@ -86,7 +88,7 @@
double shared_timer_fire_time_;
int shared_timer_suspended_; // counter
-#if defined(OS_WIN) || defined(OS_LINUX)
+#if defined(OS_WIN) || defined(OS_LINUX) || defined(OS_MACOSX)
WebThemeEngineImpl theme_engine_;
#endif
};
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc
index 4a64b0f..005c7cf 100644
--- a/webkit/glue/webmediaplayer_impl.cc
+++ b/webkit/glue/webmediaplayer_impl.cc
@@ -737,6 +737,8 @@
case media::PIPELINE_ERROR_ABORT:
case media::PIPELINE_ERROR_OUT_OF_MEMORY:
case media::PIPELINE_ERROR_AUDIO_HARDWARE:
+ case media::PIPELINE_ERROR_OPERATION_PENDING:
+ case media::PIPELINE_ERROR_INVALID_STATE:
// Decode error.
SetNetworkState(WebMediaPlayer::DecodeError);
break;
diff --git a/webkit/glue/webmediaplayer_impl.h b/webkit/glue/webmediaplayer_impl.h
index bae0d9b..abb1c60 100644
--- a/webkit/glue/webmediaplayer_impl.h
+++ b/webkit/glue/webmediaplayer_impl.h
@@ -57,8 +57,8 @@
#include "base/message_loop.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "base/thread.h"
-#include "base/waitable_event.h"
+#include "base/threading/thread.h"
+#include "base/synchronization/waitable_event.h"
#include "gfx/rect.h"
#include "gfx/size.h"
#include "media/base/filters.h"
diff --git a/webkit/glue/webpreferences.cc b/webkit/glue/webpreferences.cc
index abe5903..02092de 100644
--- a/webkit/glue/webpreferences.cc
+++ b/webkit/glue/webpreferences.cc
@@ -64,6 +64,7 @@
show_composited_layer_borders(false),
accelerated_compositing_enabled(false),
accelerated_layers_enabled(false),
+ accelerated_video_enabled(false),
accelerated_2d_canvas_enabled(false),
memory_info_enabled(false) {
}
@@ -160,7 +161,7 @@
settings->setAcceleratedCompositingFor3DTransformsEnabled(
accelerated_layers_enabled);
settings->setAcceleratedCompositingForVideoEnabled(
- accelerated_layers_enabled);
+ accelerated_video_enabled);
settings->setAcceleratedCompositingForPluginsEnabled(
accelerated_layers_enabled);
settings->setAcceleratedCompositingForAnimationEnabled(
diff --git a/webkit/glue/webpreferences.h b/webkit/glue/webpreferences.h
index 8ee4ce8..b14d323 100644
--- a/webkit/glue/webpreferences.h
+++ b/webkit/glue/webpreferences.h
@@ -70,6 +70,7 @@
bool show_composited_layer_borders;
bool accelerated_compositing_enabled;
bool accelerated_layers_enabled;
+ bool accelerated_video_enabled;
bool accelerated_2d_canvas_enabled;
bool memory_info_enabled;
diff --git a/webkit/glue/webthemeengine_impl_mac.cc b/webkit/glue/webthemeengine_impl_mac.cc
new file mode 100644
index 0000000..ac28334
--- /dev/null
+++ b/webkit/glue/webthemeengine_impl_mac.cc
@@ -0,0 +1,58 @@
+// 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.
+
+#include "webkit/glue/webthemeengine_impl_mac.h"
+
+#include <Carbon/Carbon.h>
+
+#include "third_party/WebKit/WebKit/chromium/public/WebCanvas.h"
+#include "third_party/WebKit/WebKit/chromium/public/WebRect.h"
+
+using WebKit::WebCanvas;
+using WebKit::WebRect;
+using WebKit::WebThemeEngine;
+
+namespace webkit_glue {
+
+static ThemeTrackEnableState stateToHIEnableState(WebThemeEngine::State state) {
+ switch (state) {
+ case WebThemeEngine::StateDisabled:
+ return kThemeTrackDisabled;
+ case WebThemeEngine::StateInactive:
+ return kThemeTrackInactive;
+ default:
+ return kThemeTrackActive;
+ }
+}
+
+void WebThemeEngineImpl::paintScrollbarThumb(
+ WebCanvas* canvas,
+ WebThemeEngine::State state,
+ WebThemeEngine::Size size,
+ const WebRect& rect,
+ const WebThemeEngine::ScrollbarInfo& scrollbarInfo) {
+ HIThemeTrackDrawInfo trackInfo;
+ trackInfo.version = 0;
+ trackInfo.kind = size == WebThemeEngine::SizeRegular ?
+ kThemeMediumScrollBar : kThemeSmallScrollBar;
+ trackInfo.bounds = CGRectMake(rect.x, rect.y, rect.width, rect.height);
+ trackInfo.min = 0;
+ trackInfo.max = scrollbarInfo.maxValue;
+ trackInfo.value = scrollbarInfo.currentValue;
+ trackInfo.trackInfo.scrollbar.viewsize = scrollbarInfo.visibleSize;
+ trackInfo.attributes = 0;
+ if (scrollbarInfo.orientation ==
+ WebThemeEngine::ScrollbarOrientationHorizontal) {
+ trackInfo.attributes |= kThemeTrackHorizontal;
+ }
+
+ trackInfo.enableState = stateToHIEnableState(state);
+
+ trackInfo.trackInfo.scrollbar.pressState =
+ state == WebThemeEngine::StatePressed ? kThemeThumbPressed : 0;
+ trackInfo.attributes |= (kThemeTrackShowThumb | kThemeTrackHideTrack);
+ HIThemeDrawTrack(&trackInfo, 0, canvas, kHIThemeOrientationNormal);
+}
+
+} // namespace webkit_glue
diff --git a/webkit/glue/webthemeengine_impl_mac.h b/webkit/glue/webthemeengine_impl_mac.h
new file mode 100644
index 0000000..788cba3
--- /dev/null
+++ b/webkit/glue/webthemeengine_impl_mac.h
@@ -0,0 +1,25 @@
+// 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.
+
+#ifndef WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_MAC_H_
+#define WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_MAC_H_
+
+#include "third_party/WebKit/WebKit/chromium/public/mac/WebThemeEngine.h"
+
+namespace webkit_glue {
+
+class WebThemeEngineImpl : public WebKit::WebThemeEngine {
+ public:
+ // WebKit::WebThemeEngine implementation.
+ virtual void paintScrollbarThumb(
+ WebKit::WebCanvas*,
+ WebKit::WebThemeEngine::State,
+ WebKit::WebThemeEngine::Size,
+ const WebKit::WebRect&,
+ const WebKit::WebThemeEngine::ScrollbarInfo&);
+};
+
+} // namespace webkit_glue
+
+#endif // WEBKIT_GLUE_WEBTHEMEENGINE_IMPL_MAC_H_