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/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/saved_files_service.h" | 8 #include "apps/saved_files_service.h" |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 #include "grit/components_strings.h" | 101 #include "grit/components_strings.h" |
102 #include "grit/theme_resources.h" | 102 #include "grit/theme_resources.h" |
103 #include "ui/base/l10n/l10n_util.h" | 103 #include "ui/base/l10n/l10n_util.h" |
104 | 104 |
105 using base::DictionaryValue; | 105 using base::DictionaryValue; |
106 using base::ListValue; | 106 using base::ListValue; |
107 using content::RenderViewHost; | 107 using content::RenderViewHost; |
108 using content::WebContents; | 108 using content::WebContents; |
109 | 109 |
110 namespace { | 110 namespace { |
111 | |
112 const char kAppsDeveloperToolsExtensionId[] = | 111 const char kAppsDeveloperToolsExtensionId[] = |
113 "ohmmkhmmmpcnpikjeljgnaoabkaalbgc"; | 112 "ohmmkhmmmpcnpikjeljgnaoabkaalbgc"; |
114 | |
115 // Returns true if the extensions page should display the new-style extension | |
116 // info dialog. If false, display the old permissions dialog. | |
117 bool ShouldDisplayExtensionInfoDialog() { | |
118 #if defined(OS_MACOSX) | |
119 return false; | |
120 #else | |
121 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | |
122 extensions::switches::kDisableExtensionInfoDialog); | |
123 #endif | |
124 } | 113 } |
125 | 114 |
126 } // namespace | |
127 | |
128 namespace extensions { | 115 namespace extensions { |
129 | 116 |
130 ExtensionPage::ExtensionPage(const GURL& url, | 117 ExtensionPage::ExtensionPage(const GURL& url, |
131 int render_process_id, | 118 int render_process_id, |
132 int render_view_id, | 119 int render_view_id, |
133 bool incognito, | 120 bool incognito, |
134 bool generated_background_page) | 121 bool generated_background_page) |
135 : url(url), | 122 : url(url), |
136 render_process_id(render_process_id), | 123 render_process_id(render_process_id), |
137 render_view_id(render_view_id), | 124 render_view_id(render_view_id), |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 source->AddString("extensionSettingsReloadTerminated", | 533 source->AddString("extensionSettingsReloadTerminated", |
547 l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD_TERMINATED)); | 534 l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD_TERMINATED)); |
548 source->AddString("extensionSettingsRepairCorrupted", | 535 source->AddString("extensionSettingsRepairCorrupted", |
549 l10n_util::GetStringUTF16(IDS_EXTENSIONS_REPAIR_CORRUPTED)); | 536 l10n_util::GetStringUTF16(IDS_EXTENSIONS_REPAIR_CORRUPTED)); |
550 source->AddString("extensionSettingsLaunch", | 537 source->AddString("extensionSettingsLaunch", |
551 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LAUNCH)); | 538 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LAUNCH)); |
552 source->AddString("extensionSettingsReloadUnpacked", | 539 source->AddString("extensionSettingsReloadUnpacked", |
553 l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD_UNPACKED)); | 540 l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD_UNPACKED)); |
554 source->AddString("extensionSettingsOptions", | 541 source->AddString("extensionSettingsOptions", |
555 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK)); | 542 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK)); |
556 if (ShouldDisplayExtensionInfoDialog()) { | 543 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 544 switches::kEnableExtensionInfoDialog)) { |
557 source->AddString("extensionSettingsPermissions", | 545 source->AddString("extensionSettingsPermissions", |
558 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INFO_LINK)); | 546 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INFO_LINK)); |
559 } else { | 547 } else { |
560 source->AddString( | 548 source->AddString( |
561 "extensionSettingsPermissions", | 549 "extensionSettingsPermissions", |
562 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK)); | 550 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK)); |
563 } | 551 } |
564 source->AddString("extensionSettingsVisitWebsite", | 552 source->AddString("extensionSettingsVisitWebsite", |
565 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); | 553 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); |
566 source->AddString("extensionSettingsVisitWebStore", | 554 source->AddString("extensionSettingsVisitWebStore", |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1207 if (!extension) | 1195 if (!extension) |
1208 return; | 1196 return; |
1209 | 1197 |
1210 if (!extension_id_prompting_.empty()) | 1198 if (!extension_id_prompting_.empty()) |
1211 return; // Only one prompt at a time. | 1199 return; // Only one prompt at a time. |
1212 | 1200 |
1213 extension_id_prompting_ = extension->id(); | 1201 extension_id_prompting_ = extension->id(); |
1214 | 1202 |
1215 // Show the new-style extensions dialog when the flag is set. The flag cannot | 1203 // Show the new-style extensions dialog when the flag is set. The flag cannot |
1216 // be set on Mac platforms. | 1204 // be set on Mac platforms. |
1217 if (ShouldDisplayExtensionInfoDialog()) { | 1205 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 1206 switches::kEnableExtensionInfoDialog)) { |
1218 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches", | 1207 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches", |
1219 AppInfoLaunchSource::FROM_EXTENSIONS_PAGE, | 1208 AppInfoLaunchSource::FROM_EXTENSIONS_PAGE, |
1220 AppInfoLaunchSource::NUM_LAUNCH_SOURCES); | 1209 AppInfoLaunchSource::NUM_LAUNCH_SOURCES); |
1221 | 1210 |
1222 // Display the dialog at a size similar to the app list. | 1211 // Display the dialog at a size similar to the app list. |
1223 const int kAppInfoDialogWidth = 380; | 1212 const int kAppInfoDialogWidth = 380; |
1224 const int kAppInfoDialogHeight = 490; | 1213 const int kAppInfoDialogHeight = 490; |
1225 ShowAppInfoInNativeDialog( | 1214 ShowAppInfoInNativeDialog( |
1226 web_contents()->GetTopLevelNativeWindow(), | 1215 web_contents()->GetTopLevelNativeWindow(), |
1227 gfx::Size(kAppInfoDialogWidth, kAppInfoDialogHeight), | 1216 gfx::Size(kAppInfoDialogWidth, kAppInfoDialogHeight), |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 extension_service_->EnableExtension(extension_id); | 1502 extension_service_->EnableExtension(extension_id); |
1514 } else { | 1503 } else { |
1515 ExtensionErrorReporter::GetInstance()->ReportError( | 1504 ExtensionErrorReporter::GetInstance()->ReportError( |
1516 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), | 1505 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), |
1517 true); // Be noisy. | 1506 true); // Be noisy. |
1518 } | 1507 } |
1519 requirements_checker_.reset(); | 1508 requirements_checker_.reset(); |
1520 } | 1509 } |
1521 | 1510 |
1522 } // namespace extensions | 1511 } // namespace extensions |
OLD | NEW |