Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" | 5 #include "chrome/browser/extensions/chrome_extensions_browser_client.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/version.h" | 8 #include "base/version.h" |
| 9 #include "chrome/browser/app_mode/app_mode_utils.h" | 9 #include "chrome/browser/app_mode/app_mode_utils.h" |
| 10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
| 11 #include "chrome/browser/extensions/activity_log/activity_log.h" | 11 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 12 #include "chrome/browser/extensions/api/chrome_extensions_api_client.h" | |
| 12 #include "chrome/browser/extensions/chrome_app_sorting.h" | 13 #include "chrome/browser/extensions/chrome_app_sorting.h" |
| 13 #include "chrome/browser/extensions/extension_host.h" | 14 #include "chrome/browser/extensions/extension_host.h" |
| 14 #include "chrome/browser/extensions/extension_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
| 15 #include "chrome/browser/extensions/extension_system_factory.h" | 16 #include "chrome/browser/extensions/extension_system_factory.h" |
| 16 #include "chrome/browser/extensions/extension_util.h" | 17 #include "chrome/browser/extensions/extension_util.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/profiles/profile_manager.h" | 19 #include "chrome/browser/profiles/profile_manager.h" |
| 19 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" | 20 #include "chrome/browser/ui/app_modal_dialogs/javascript_dialog_manager.h" |
| 20 #include "chrome/browser/ui/browser_finder.h" | 21 #include "chrome/browser/ui/browser_finder.h" |
| 21 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" | 22 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" |
| 22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 23 #include "chrome/common/chrome_version_info.h" | 24 #include "chrome/common/chrome_version_info.h" |
| 24 #include "chrome/common/extensions/features/feature_channel.h" | 25 #include "chrome/common/extensions/features/feature_channel.h" |
| 25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 26 #include "extensions/browser/extension_prefs.h" | 27 #include "extensions/browser/extension_prefs.h" |
| 27 #include "extensions/browser/extension_system.h" | 28 #include "extensions/browser/extension_system.h" |
| 28 #include "extensions/browser/pref_names.h" | 29 #include "extensions/browser/pref_names.h" |
| 29 | 30 |
| 30 #if defined(OS_CHROMEOS) | 31 #if defined(OS_CHROMEOS) |
| 31 #include "chromeos/chromeos_switches.h" | 32 #include "chromeos/chromeos_switches.h" |
| 32 #endif | 33 #endif |
| 33 | 34 |
| 34 namespace extensions { | 35 namespace extensions { |
| 35 | 36 |
| 36 ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() { | 37 ChromeExtensionsBrowserClient::ChromeExtensionsBrowserClient() |
| 38 : api_client_(new ChromeExtensionsApiClient) { | |
| 39 ExtensionsApiClient::Set(api_client_.get()); | |
|
Devlin
2014/03/03 17:07:59
I'm quite certain I'm paranoid here, but I might p
James Cook
2014/03/03 19:53:09
SGTM. Done.
| |
| 40 | |
| 37 // Only set if it hasn't already been set (e.g. by a test). | 41 // Only set if it hasn't already been set (e.g. by a test). |
| 38 if (GetCurrentChannel() == GetDefaultChannel()) | 42 if (GetCurrentChannel() == GetDefaultChannel()) |
| 39 SetCurrentChannel(chrome::VersionInfo::GetChannel()); | 43 SetCurrentChannel(chrome::VersionInfo::GetChannel()); |
| 40 } | 44 } |
| 41 | 45 |
| 42 ChromeExtensionsBrowserClient::~ChromeExtensionsBrowserClient() {} | 46 ChromeExtensionsBrowserClient::~ChromeExtensionsBrowserClient() { |
| 47 ExtensionsApiClient::Set(NULL); | |
| 48 } | |
| 43 | 49 |
| 44 bool ChromeExtensionsBrowserClient::IsShuttingDown() { | 50 bool ChromeExtensionsBrowserClient::IsShuttingDown() { |
| 45 return g_browser_process->IsShuttingDown(); | 51 return g_browser_process->IsShuttingDown(); |
| 46 } | 52 } |
| 47 | 53 |
| 48 bool ChromeExtensionsBrowserClient::AreExtensionsDisabled( | 54 bool ChromeExtensionsBrowserClient::AreExtensionsDisabled( |
| 49 const CommandLine& command_line, | 55 const CommandLine& command_line, |
| 50 content::BrowserContext* context) { | 56 content::BrowserContext* context) { |
| 51 Profile* profile = static_cast<Profile*>(context); | 57 Profile* profile = static_cast<Profile*>(context); |
| 52 return command_line.HasSwitch(switches::kDisableExtensions) || | 58 return command_line.HasSwitch(switches::kDisableExtensions) || |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 196 // The ActivityLog monitors and records function calls and events. | 202 // The ActivityLog monitors and records function calls and events. |
| 197 return ActivityLog::GetInstance(context); | 203 return ActivityLog::GetInstance(context); |
| 198 } | 204 } |
| 199 | 205 |
| 200 ExtensionSystemProvider* | 206 ExtensionSystemProvider* |
| 201 ChromeExtensionsBrowserClient::GetExtensionSystemFactory() { | 207 ChromeExtensionsBrowserClient::GetExtensionSystemFactory() { |
| 202 return ExtensionSystemFactory::GetInstance(); | 208 return ExtensionSystemFactory::GetInstance(); |
| 203 } | 209 } |
| 204 | 210 |
| 205 } // namespace extensions | 211 } // namespace extensions |
| OLD | NEW |