Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1282)

Side by Side Diff: chrome/browser/extensions/component_loader.cc

Issue 174513003: Move ProfileKeyedAPI implementations to take BrowserContext in the constructor (part 3). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/component_loader.h" 5 #include "chrome/browser/extensions/component_loader.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/file_util.h" 11 #include "base/file_util.h"
12 #include "base/json/json_string_value_serializer.h" 12 #include "base/json/json_string_value_serializer.h"
13 #include "base/metrics/field_trial.h" 13 #include "base/metrics/field_trial.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/prefs/pref_change_registrar.h" 15 #include "base/prefs/pref_change_registrar.h"
16 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/profiles/profile.h"
19 #include "chrome/browser/search/hotword_service_factory.h" 18 #include "chrome/browser/search/hotword_service_factory.h"
20 #include "chrome/common/chrome_paths.h" 19 #include "chrome/common/chrome_paths.h"
21 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
22 #include "chrome/common/chrome_version_info.h" 21 #include "chrome/common/chrome_version_info.h"
23 #include "chrome/common/extensions/extension_file_util.h" 22 #include "chrome/common/extensions/extension_file_util.h"
24 #include "chrome/common/pref_names.h" 23 #include "chrome/common/pref_names.h"
25 #include "content/public/browser/notification_details.h" 24 #include "content/public/browser/notification_details.h"
26 #include "content/public/browser/notification_source.h" 25 #include "content/public/browser/notification_source.h"
27 #include "content/public/browser/plugin_service.h" 26 #include "content/public/browser/plugin_service.h"
28 #include "extensions/common/extension.h" 27 #include "extensions/common/extension.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 } 288 }
290 289
291 void ComponentLoader::AddHangoutServicesExtension() { 290 void ComponentLoader::AddHangoutServicesExtension() {
292 #if defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTENSION) 291 #if defined(GOOGLE_CHROME_BUILD) || defined(ENABLE_HANGOUT_SERVICES_EXTENSION)
293 Add(IDR_HANGOUT_SERVICES_MANIFEST, 292 Add(IDR_HANGOUT_SERVICES_MANIFEST,
294 base::FilePath(FILE_PATH_LITERAL("hangout_services"))); 293 base::FilePath(FILE_PATH_LITERAL("hangout_services")));
295 #endif 294 #endif
296 } 295 }
297 296
298 void ComponentLoader::AddHotwordHelperExtension() { 297 void ComponentLoader::AddHotwordHelperExtension() {
299 Profile* profile = static_cast<Profile*>(browser_context_); 298 if (HotwordServiceFactory::IsHotwordAllowed(browser_context_)) {
300 if (HotwordServiceFactory::IsHotwordAllowed(profile)) {
301 Add(IDR_HOTWORD_HELPER_MANIFEST, 299 Add(IDR_HOTWORD_HELPER_MANIFEST,
302 base::FilePath(FILE_PATH_LITERAL("hotword_helper"))); 300 base::FilePath(FILE_PATH_LITERAL("hotword_helper")));
303 } 301 }
304 } 302 }
305 303
306 void ComponentLoader::AddImageLoaderExtension() { 304 void ComponentLoader::AddImageLoaderExtension() {
307 #if defined(IMAGE_LOADER_EXTENSION) 305 #if defined(IMAGE_LOADER_EXTENSION)
308 #ifndef NDEBUG 306 #ifndef NDEBUG
309 const CommandLine* command_line = CommandLine::ForCurrentProcess(); 307 const CommandLine* command_line = CommandLine::ForCurrentProcess();
310 if (command_line->HasSwitch(switches::kImageLoaderExtensionPath)) { 308 if (command_line->HasSwitch(switches::kImageLoaderExtensionPath)) {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 off_the_record_context, Extension::GetBaseURLFromExtensionId(id)); 613 off_the_record_context, Extension::GetBaseURLFromExtensionId(id));
616 fileapi::FileSystemContext* file_system_context = 614 fileapi::FileSystemContext* file_system_context =
617 content::BrowserContext::GetStoragePartitionForSite( 615 content::BrowserContext::GetStoragePartitionForSite(
618 off_the_record_context, site)->GetFileSystemContext(); 616 off_the_record_context, site)->GetFileSystemContext();
619 file_system_context->EnableTemporaryFileSystemInIncognito(); 617 file_system_context->EnableTemporaryFileSystemInIncognito();
620 } 618 }
621 #endif 619 #endif
622 } 620 }
623 621
624 } // namespace extensions 622 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698