OLD | NEW |
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/chrome_paths.h" | 27 #include "chrome/common/chrome_paths.h" |
27 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
28 #include "chrome/common/chrome_version_info.h" | |
29 #include "chrome/common/extensions/extension_constants.h" | 29 #include "chrome/common/extensions/extension_constants.h" |
30 #include "chrome/grit/generated_resources.h" | 30 #include "chrome/grit/generated_resources.h" |
31 #include "components/crx_file/id_util.h" | 31 #include "components/crx_file/id_util.h" |
32 #include "components/signin/core/browser/signin_manager.h" | 32 #include "components/signin/core/browser/signin_manager.h" |
33 #include "components/signin/core/browser/signin_manager_base.h" | 33 #include "components/signin/core/browser/signin_manager_base.h" |
| 34 #include "components/version_info/version_info.h" |
34 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
35 #include "content/public/browser/plugin_service.h" | 36 #include "content/public/browser/plugin_service.h" |
36 #include "extensions/common/constants.h" | 37 #include "extensions/common/constants.h" |
37 #include "extensions/common/extension.h" | 38 #include "extensions/common/extension.h" |
38 #include "extensions/common/extension_l10n_util.h" | 39 #include "extensions/common/extension_l10n_util.h" |
39 #include "extensions/common/file_util.h" | 40 #include "extensions/common/file_util.h" |
40 #include "extensions/common/manifest_constants.h" | 41 #include "extensions/common/manifest_constants.h" |
41 #include "grit/browser_resources.h" | 42 #include "grit/browser_resources.h" |
42 #include "ui/base/l10n/l10n_util.h" | 43 #include "ui/base/l10n/l10n_util.h" |
43 #include "ui/base/resource/resource_bundle.h" | 44 #include "ui/base/resource/resource_bundle.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 const char kFieldTrialName[] = "GoogleNow"; | 389 const char kFieldTrialName[] = "GoogleNow"; |
389 std::string enable_prefix(kEnablePrefix); | 390 std::string enable_prefix(kEnablePrefix); |
390 std::string field_trial_result = | 391 std::string field_trial_result = |
391 base::FieldTrialList::FindFullName(kFieldTrialName); | 392 base::FieldTrialList::FindFullName(kFieldTrialName); |
392 | 393 |
393 bool enabled_via_field_trial = | 394 bool enabled_via_field_trial = |
394 field_trial_result.compare(0, enable_prefix.length(), enable_prefix) == 0; | 395 field_trial_result.compare(0, enable_prefix.length(), enable_prefix) == 0; |
395 | 396 |
396 // Enable the feature on trybots and trunk builds. | 397 // Enable the feature on trybots and trunk builds. |
397 bool enabled_via_trunk_build = | 398 bool enabled_via_trunk_build = |
398 chrome::VersionInfo::GetChannel() == version_info::Channel::UNKNOWN; | 399 chrome::GetChannel() == version_info::Channel::UNKNOWN; |
399 | 400 |
400 bool is_authenticated = | 401 bool is_authenticated = |
401 SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated(); | 402 SigninManagerFactory::GetForProfile(profile_)->IsAuthenticated(); |
402 | 403 |
403 bool enabled = | 404 bool enabled = |
404 (enabled_via_field_trial && is_authenticated) || enabled_via_trunk_build; | 405 (enabled_via_field_trial && is_authenticated) || enabled_via_trunk_build; |
405 | 406 |
406 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) | 407 #if defined(ENABLE_APP_LIST) && defined(OS_CHROMEOS) |
407 // Don't load if newer trial is running (== new extension id is available). | 408 // Don't load if newer trial is running (== new extension id is available). |
408 std::string ignored_extension_id; | 409 std::string ignored_extension_id; |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 manifest.release(), | 770 manifest.release(), |
770 root_directory, | 771 root_directory, |
771 false); | 772 false); |
772 CHECK_EQ(extension_id, actual_extension_id); | 773 CHECK_EQ(extension_id, actual_extension_id); |
773 if (!done_cb.is_null()) | 774 if (!done_cb.is_null()) |
774 done_cb.Run(); | 775 done_cb.Run(); |
775 } | 776 } |
776 #endif | 777 #endif |
777 | 778 |
778 } // namespace extensions | 779 } // namespace extensions |
OLD | NEW |