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

Side by Side Diff: chrome/browser/ui/webui/extensions/extension_settings_handler.cc

Issue 196413028: Promote Apps Developer Tools in the chrome:extensions page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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
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/ui/webui/extensions/extension_settings_handler.h" 5 #include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
6 6
7 #include "apps/app_load_service.h" 7 #include "apps/app_load_service.h"
8 #include "apps/app_restore_service.h" 8 #include "apps/app_restore_service.h"
9 #include "apps/app_window.h" 9 #include "apps/app_window.h"
10 #include "apps/app_window_registry.h" 10 #include "apps/app_window_registry.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 #include "chrome/browser/managed_mode/managed_user_service.h" 45 #include "chrome/browser/managed_mode/managed_user_service.h"
46 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 46 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
47 #include "chrome/browser/profiles/profile.h" 47 #include "chrome/browser/profiles/profile.h"
48 #include "chrome/browser/tab_contents/background_contents.h" 48 #include "chrome/browser/tab_contents/background_contents.h"
49 #include "chrome/browser/ui/browser_finder.h" 49 #include "chrome/browser/ui/browser_finder.h"
50 #include "chrome/browser/ui/chrome_select_file_policy.h" 50 #include "chrome/browser/ui/chrome_select_file_policy.h"
51 #include "chrome/browser/ui/extensions/application_launch.h" 51 #include "chrome/browser/ui/extensions/application_launch.h"
52 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h" 52 #include "chrome/browser/ui/webui/extensions/extension_basic_info.h"
53 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h" 53 #include "chrome/browser/ui/webui/extensions/extension_icon_source.h"
54 #include "chrome/common/chrome_switches.h" 54 #include "chrome/common/chrome_switches.h"
55 #include "chrome/common/chrome_version_info.h"
55 #include "chrome/common/extensions/extension_constants.h" 56 #include "chrome/common/extensions/extension_constants.h"
57 #include "chrome/common/extensions/features/feature_channel.h"
56 #include "chrome/common/extensions/manifest_url_handler.h" 58 #include "chrome/common/extensions/manifest_url_handler.h"
57 #include "chrome/common/pref_names.h" 59 #include "chrome/common/pref_names.h"
58 #include "chrome/common/url_constants.h" 60 #include "chrome/common/url_constants.h"
59 #include "components/user_prefs/pref_registry_syncable.h" 61 #include "components/user_prefs/pref_registry_syncable.h"
60 #include "content/public/browser/notification_service.h" 62 #include "content/public/browser/notification_service.h"
61 #include "content/public/browser/notification_source.h" 63 #include "content/public/browser/notification_source.h"
62 #include "content/public/browser/notification_types.h" 64 #include "content/public/browser/notification_types.h"
63 #include "content/public/browser/render_process_host.h" 65 #include "content/public/browser/render_process_host.h"
64 #include "content/public/browser/render_view_host.h" 66 #include "content/public/browser/render_view_host.h"
65 #include "content/public/browser/site_instance.h" 67 #include "content/public/browser/site_instance.h"
66 #include "content/public/browser/user_metrics.h" 68 #include "content/public/browser/user_metrics.h"
67 #include "content/public/browser/web_contents.h" 69 #include "content/public/browser/web_contents.h"
68 #include "content/public/browser/web_contents_view.h" 70 #include "content/public/browser/web_contents_view.h"
69 #include "content/public/browser/web_ui.h" 71 #include "content/public/browser/web_ui.h"
70 #include "content/public/browser/web_ui_data_source.h" 72 #include "content/public/browser/web_ui_data_source.h"
71 #include "extensions/browser/blacklist_state.h" 73 #include "extensions/browser/blacklist_state.h"
72 #include "extensions/browser/extension_error.h" 74 #include "extensions/browser/extension_error.h"
73 #include "extensions/browser/extension_host.h" 75 #include "extensions/browser/extension_host.h"
74 #include "extensions/browser/extension_registry.h" 76 #include "extensions/browser/extension_registry.h"
75 #include "extensions/browser/extension_system.h" 77 #include "extensions/browser/extension_system.h"
76 #include "extensions/browser/lazy_background_task_queue.h" 78 #include "extensions/browser/lazy_background_task_queue.h"
77 #include "extensions/browser/management_policy.h" 79 #include "extensions/browser/management_policy.h"
78 #include "extensions/browser/pref_names.h" 80 #include "extensions/browser/pref_names.h"
79 #include "extensions/browser/view_type_utils.h" 81 #include "extensions/browser/view_type_utils.h"
80 #include "extensions/common/constants.h" 82 #include "extensions/common/constants.h"
81 #include "extensions/common/extension.h" 83 #include "extensions/common/extension.h"
82 #include "extensions/common/extension_icon_set.h" 84 #include "extensions/common/extension_icon_set.h"
83 #include "extensions/common/extension_set.h" 85 #include "extensions/common/extension_set.h"
84 #include "extensions/common/feature_switch.h"
85 #include "extensions/common/manifest.h" 86 #include "extensions/common/manifest.h"
86 #include "extensions/common/manifest_handlers/background_info.h" 87 #include "extensions/common/manifest_handlers/background_info.h"
87 #include "extensions/common/manifest_handlers/incognito_info.h" 88 #include "extensions/common/manifest_handlers/incognito_info.h"
88 #include "grit/browser_resources.h" 89 #include "grit/browser_resources.h"
89 #include "grit/chromium_strings.h" 90 #include "grit/chromium_strings.h"
90 #include "grit/generated_resources.h" 91 #include "grit/generated_resources.h"
91 #include "grit/theme_resources.h" 92 #include "grit/theme_resources.h"
92 #include "ui/base/l10n/l10n_util.h" 93 #include "ui/base/l10n/l10n_util.h"
93 #include "ui/base/resource/resource_bundle.h" 94 #include "ui/base/resource/resource_bundle.h"
94 95
95 using base::DictionaryValue; 96 using base::DictionaryValue;
96 using base::ListValue; 97 using base::ListValue;
97 using content::RenderViewHost; 98 using content::RenderViewHost;
98 using content::WebContents; 99 using content::WebContents;
99 100
101 namespace {
102 const char kAppsDeveloperToolsExtensionId[] =
103 "ohmmkhmmmpcnpikjeljgnaoabkaalbgc";
104 }
105
100 namespace extensions { 106 namespace extensions {
101 107
102 ExtensionPage::ExtensionPage(const GURL& url, 108 ExtensionPage::ExtensionPage(const GURL& url,
103 int render_process_id, 109 int render_process_id,
104 int render_view_id, 110 int render_view_id,
105 bool incognito, 111 bool incognito,
106 bool generated_background_page) 112 bool generated_background_page)
107 : url(url), 113 : url(url),
108 render_process_id(render_process_id), 114 render_process_id(render_process_id),
109 render_view_id(render_view_id), 115 render_view_id(render_view_id),
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 source->AddString("extensionSettingsShowButton", 466 source->AddString("extensionSettingsShowButton",
461 l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_BUTTON)); 467 l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_BUTTON));
462 source->AddString("extensionSettingsLoadUnpackedButton", 468 source->AddString("extensionSettingsLoadUnpackedButton",
463 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOAD_UNPACKED_BUTTON)); 469 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LOAD_UNPACKED_BUTTON));
464 source->AddString("extensionSettingsPackButton", 470 source->AddString("extensionSettingsPackButton",
465 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PACK_BUTTON)); 471 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PACK_BUTTON));
466 source->AddString("extensionSettingsCommandsLink", 472 source->AddString("extensionSettingsCommandsLink",
467 l10n_util::GetStringUTF16(IDS_EXTENSIONS_COMMANDS_CONFIGURE)); 473 l10n_util::GetStringUTF16(IDS_EXTENSIONS_COMMANDS_CONFIGURE));
468 source->AddString("extensionSettingsUpdateButton", 474 source->AddString("extensionSettingsUpdateButton",
469 l10n_util::GetStringUTF16(IDS_EXTENSIONS_UPDATE_BUTTON)); 475 l10n_util::GetStringUTF16(IDS_EXTENSIONS_UPDATE_BUTTON));
476 source->AddString(
477 "extensionSettingsAppsDevToolsPromoText",
Dan Beam 2014/04/18 21:27:28 I don't really think the "extensionSettings" prefi
Devlin 2014/04/18 22:19:55 Yeah, went with consistency over easy typing. :/
478 l10n_util::GetStringUTF16(IDS_EXTENSIONS_APPS_DEV_TOOLS_PROMO_TEXT));
479 source->AddString(
480 "extensionSettingsAppsDevToolsLinkText",
481 l10n_util::GetStringUTF16(IDS_EXTENSIONS_APPS_DEV_TOOLS_LINK_TEXT));
482 source->AddString(
483 "extensionSettingsAppsDevToolsUrl",
484 base::ASCIIToUTF16(google_util::AppendGoogleLocaleParam(
485 GURL(extension_urls::GetWebstoreItemDetailURLPrefix() +
486 kAppsDeveloperToolsExtensionId)).spec()));
470 source->AddString("extensionSettingsCrashMessage", 487 source->AddString("extensionSettingsCrashMessage",
471 l10n_util::GetStringUTF16(IDS_EXTENSIONS_CRASHED_EXTENSION)); 488 l10n_util::GetStringUTF16(IDS_EXTENSIONS_CRASHED_EXTENSION));
472 source->AddString("extensionSettingsInDevelopment", 489 source->AddString("extensionSettingsInDevelopment",
473 l10n_util::GetStringUTF16(IDS_EXTENSIONS_IN_DEVELOPMENT)); 490 l10n_util::GetStringUTF16(IDS_EXTENSIONS_IN_DEVELOPMENT));
474 source->AddString("extensionSettingsWarningsTitle", 491 source->AddString("extensionSettingsWarningsTitle",
475 l10n_util::GetStringUTF16(IDS_EXTENSION_WARNINGS_TITLE)); 492 l10n_util::GetStringUTF16(IDS_EXTENSION_WARNINGS_TITLE));
476 source->AddString("extensionSettingsShowDetails", 493 source->AddString("extensionSettingsShowDetails",
477 l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_DETAILS)); 494 l10n_util::GetStringUTF16(IDS_EXTENSIONS_SHOW_DETAILS));
478 source->AddString("extensionSettingsHideDetails", 495 source->AddString("extensionSettingsHideDetails",
479 l10n_util::GetStringUTF16(IDS_EXTENSIONS_HIDE_DETAILS)); 496 l10n_util::GetStringUTF16(IDS_EXTENSIONS_HIDE_DETAILS));
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 } 824 }
808 results.Set("extensions", extensions_list); 825 results.Set("extensions", extensions_list);
809 826
810 bool is_managed = profile->IsManaged(); 827 bool is_managed = profile->IsManaged();
811 bool developer_mode = 828 bool developer_mode =
812 !is_managed && 829 !is_managed &&
813 profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode); 830 profile->GetPrefs()->GetBoolean(prefs::kExtensionsUIDeveloperMode);
814 results.SetBoolean("profileIsManaged", is_managed); 831 results.SetBoolean("profileIsManaged", is_managed);
815 results.SetBoolean("developerMode", developer_mode); 832 results.SetBoolean("developerMode", developer_mode);
816 833
834 // We should promote the Apps Developer Tools if the user does not have it
835 // already. If they do, we shouldn't promote it.
Dan Beam 2014/04/18 21:27:28 nit: // Promote Apps Developer Tools if they're no
Devlin 2014/04/18 22:19:55 Done.
836 bool promote_apps_dev_tools =
837 GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV &&
838 ExtensionRegistry::Get(Profile::FromWebUI(web_ui()))
839 ->GetExtensionById(kAppsDeveloperToolsExtensionId,
Dan Beam 2014/04/18 21:27:28 nit: -> at end, CLANG FORMATTTTTTTTTTTTT!
Devlin 2014/04/18 22:19:55 Haha done. :)
840 ExtensionRegistry::EVERYTHING) == NULL;
Dan Beam 2014/04/18 21:27:28 Get(...) == NULL -> !Get(...)
Devlin 2014/04/18 22:19:55 Done (sometimes people have preferences when testi
841 results.SetBoolean("promoteAppsDevTools", promote_apps_dev_tools);
842
817 bool load_unpacked_disabled = 843 bool load_unpacked_disabled =
818 ExtensionPrefs::Get(profile)->ExtensionsBlacklistedByDefault(); 844 ExtensionPrefs::Get(profile)->ExtensionsBlacklistedByDefault();
819 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled); 845 results.SetBoolean("loadUnpackedDisabled", load_unpacked_disabled);
820 846
821 web_ui()->CallJavascriptFunction( 847 web_ui()->CallJavascriptFunction(
822 "extensions.ExtensionSettings.returnExtensionsData", results); 848 "extensions.ExtensionSettings.returnExtensionsData", results);
823 849
824 MaybeRegisterForNotifications(); 850 MaybeRegisterForNotifications();
825 UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck", 851 UMA_HISTOGRAM_BOOLEAN("ExtensionSettings.ShouldDoVerificationCheck",
826 should_do_verification_check_); 852 should_do_verification_check_);
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1331 const base::FilePath& path) { 1357 const base::FilePath& path) {
1332 if (IndexOfLoadingPath(path) == -1) 1358 if (IndexOfLoadingPath(path) == -1)
1333 return; // Not an extension we're tracking. 1359 return; // Not an extension we're tracking.
1334 if (retry) 1360 if (retry)
1335 LoadUnpackedExtension(path); 1361 LoadUnpackedExtension(path);
1336 else 1362 else
1337 RemoveLoadingPath(path); 1363 RemoveLoadingPath(path);
1338 } 1364 }
1339 1365
1340 } // namespace extensions 1366 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698