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

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

Issue 1458653002: New build flag system, convert Google Now flag (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/profiles/profile.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
11 #include "base/json/json_string_value_serializer.h" 11 #include "base/json/json_string_value_serializer.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/metrics/histogram_macros.h" 13 #include "base/metrics/histogram_macros.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/profiler/scoped_profile.h" 15 #include "base/profiler/scoped_profile.h"
16 #include "base/time/time.h" 16 #include "base/time/time.h"
17 #include "base/trace_event/trace_event.h" 17 #include "base/trace_event/trace_event.h"
18 #include "chrome/browser/extensions/component_extensions_whitelist/whitelist.h" 18 #include "chrome/browser/extensions/component_extensions_whitelist/whitelist.h"
19 #include "chrome/browser/extensions/data_deleter.h" 19 #include "chrome/browser/extensions/data_deleter.h"
20 #include "chrome/browser/extensions/extension_service.h" 20 #include "chrome/browser/extensions/extension_service.h"
21 #include "chrome/browser/pdf/pdf_extension_util.h" 21 #include "chrome/browser/pdf/pdf_extension_util.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/search/hotword_service.h" 23 #include "chrome/browser/search/hotword_service.h"
24 #include "chrome/browser/search/hotword_service_factory.h" 24 #include "chrome/browser/search/hotword_service_factory.h"
25 #include "chrome/browser/signin/signin_manager_factory.h" 25 #include "chrome/browser/signin/signin_manager_factory.h"
26 #include "chrome/common/channel_info.h" 26 #include "chrome/common/channel_info.h"
27 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
29 #include "chrome/common/extensions/extension_constants.h" 29 #include "chrome/common/extensions/extension_constants.h"
30 #include "chrome/common/features.h"
30 #include "chrome/grit/chromium_strings.h" 31 #include "chrome/grit/chromium_strings.h"
31 #include "chrome/grit/generated_resources.h" 32 #include "chrome/grit/generated_resources.h"
32 #include "components/crx_file/id_util.h" 33 #include "components/crx_file/id_util.h"
33 #include "components/signin/core/browser/signin_manager.h" 34 #include "components/signin/core/browser/signin_manager.h"
34 #include "components/signin/core/browser/signin_manager_base.h" 35 #include "components/signin/core/browser/signin_manager_base.h"
35 #include "components/version_info/version_info.h" 36 #include "components/version_info/version_info.h"
36 #include "content/public/browser/browser_thread.h" 37 #include "content/public/browser/browser_thread.h"
37 #include "content/public/browser/plugin_service.h" 38 #include "content/public/browser/plugin_service.h"
38 #include "content/public/common/content_switches.h" 39 #include "content/public/common/content_switches.h"
39 #include "extensions/common/constants.h" 40 #include "extensions/common/constants.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 base::FilePath(FILE_PATH_LITERAL("image_loader"))); 376 base::FilePath(FILE_PATH_LITERAL("image_loader")));
376 #endif // defined(IMAGE_LOADER_EXTENSION) 377 #endif // defined(IMAGE_LOADER_EXTENSION)
377 } 378 }
378 379
379 void ComponentLoader::AddNetworkSpeechSynthesisExtension() { 380 void ComponentLoader::AddNetworkSpeechSynthesisExtension() {
380 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST, 381 Add(IDR_NETWORK_SPEECH_SYNTHESIS_MANIFEST,
381 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis"))); 382 base::FilePath(FILE_PATH_LITERAL("network_speech_synthesis")));
382 } 383 }
383 384
384 void ComponentLoader::AddGoogleNowExtension() { 385 void ComponentLoader::AddGoogleNowExtension() {
385 #if defined(ENABLE_GOOGLE_NOW) 386 #if BUILDFLAG(ENABLE_GOOGLE_NOW)
386 const char kEnablePrefix[] = "Enable"; 387 const char kEnablePrefix[] = "Enable";
387 const char kFieldTrialName[] = "GoogleNow"; 388 const char kFieldTrialName[] = "GoogleNow";
388 std::string enable_prefix(kEnablePrefix); 389 std::string enable_prefix(kEnablePrefix);
389 std::string field_trial_result = 390 std::string field_trial_result =
390 base::FieldTrialList::FindFullName(kFieldTrialName); 391 base::FieldTrialList::FindFullName(kFieldTrialName);
391 392
392 bool enabled_via_field_trial = 393 bool enabled_via_field_trial =
393 field_trial_result.compare(0, enable_prefix.length(), enable_prefix) == 0; 394 field_trial_result.compare(0, enable_prefix.length(), enable_prefix) == 0;
394 395
395 // Enable the feature on trybots and trunk builds. 396 // Enable the feature on trybots and trunk builds.
(...skipping 15 matching lines...) Expand all
411 #endif // defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) 412 #endif // defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS)
412 413
413 const int google_now_manifest_id = IDR_GOOGLE_NOW_MANIFEST; 414 const int google_now_manifest_id = IDR_GOOGLE_NOW_MANIFEST;
414 const base::FilePath root_directory = 415 const base::FilePath root_directory =
415 base::FilePath(FILE_PATH_LITERAL("google_now")); 416 base::FilePath(FILE_PATH_LITERAL("google_now"));
416 if (enabled) { 417 if (enabled) {
417 Add(google_now_manifest_id, root_directory); 418 Add(google_now_manifest_id, root_directory);
418 } else { 419 } else {
419 DeleteData(google_now_manifest_id, root_directory); 420 DeleteData(google_now_manifest_id, root_directory);
420 } 421 }
421 #endif // defined(ENABLE_GOOGLE_NOW) 422 #endif // BUILDFLAG(ENABLE_GOOGLE_NOW)
422 } 423 }
423 424
424 #if defined(OS_CHROMEOS) 425 #if defined(OS_CHROMEOS)
425 void ComponentLoader::AddChromeVoxExtension( 426 void ComponentLoader::AddChromeVoxExtension(
426 const base::Closure& done_cb) { 427 const base::Closure& done_cb) {
427 base::FilePath resources_path; 428 base::FilePath resources_path;
428 CHECK(PathService::Get(chrome::DIR_RESOURCES, &resources_path)); 429 CHECK(PathService::Get(chrome::DIR_RESOURCES, &resources_path));
429 430
430 base::FilePath chromevox_path = 431 base::FilePath chromevox_path =
431 resources_path.Append(extension_misc::kChromeVoxExtensionPath); 432 resources_path.Append(extension_misc::kChromeVoxExtensionPath);
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 manifest.release(), 766 manifest.release(),
766 root_directory, 767 root_directory,
767 false); 768 false);
768 CHECK_EQ(extension_id, actual_extension_id); 769 CHECK_EQ(extension_id, actual_extension_id);
769 if (!done_cb.is_null()) 770 if (!done_cb.is_null())
770 done_cb.Run(); 771 done_cb.Run();
771 } 772 }
772 #endif 773 #endif
773 774
774 } // namespace extensions 775 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/BUILD.gn ('k') | chrome/browser/profiles/profile.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698