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

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

Issue 899173002: Replace Webstore link with app info dialog link in chrome://apps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement mac AppInfoDialog methods Created 5 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
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/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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 using base::DictionaryValue; 103 using base::DictionaryValue;
104 using base::ListValue; 104 using base::ListValue;
105 using content::RenderViewHost; 105 using content::RenderViewHost;
106 using content::WebContents; 106 using content::WebContents;
107 107
108 namespace { 108 namespace {
109 109
110 const char kAppsDeveloperToolsExtensionId[] = 110 const char kAppsDeveloperToolsExtensionId[] =
111 "ohmmkhmmmpcnpikjeljgnaoabkaalbgc"; 111 "ohmmkhmmmpcnpikjeljgnaoabkaalbgc";
112 112
113 // Returns true if the extensions page should display the new-style extension
114 // info dialog. If false, display the old permissions dialog.
115 bool ShouldDisplayExtensionInfoDialog() {
116 #if defined(OS_MACOSX)
117 return false;
118 #else
119 return true;
120 #endif
121 }
122
123 } // namespace 113 } // namespace
124 114
125 namespace extensions { 115 namespace extensions {
126 116
127 ExtensionPage::ExtensionPage(const GURL& url, 117 ExtensionPage::ExtensionPage(const GURL& url,
128 int render_process_id, 118 int render_process_id,
129 int render_view_id, 119 int render_view_id,
130 bool incognito, 120 bool incognito,
131 bool generated_background_page) 121 bool generated_background_page)
132 : url(url), 122 : url(url),
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 Manifest::IsUnpackedLocation(extension->location())); 295 Manifest::IsUnpackedLocation(extension->location()));
306 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); 296 extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app());
307 extension_data->SetBoolean("is_platform_app", extension->is_platform_app()); 297 extension_data->SetBoolean("is_platform_app", extension->is_platform_app());
308 extension_data->SetBoolean("homepageProvided", 298 extension_data->SetBoolean("homepageProvided",
309 ManifestURL::SpecifiedHomepageURL(extension)); 299 ManifestURL::SpecifiedHomepageURL(extension));
310 extension_data->SetBoolean("optionsOpenInTab", 300 extension_data->SetBoolean("optionsOpenInTab",
311 OptionsPageInfo::ShouldOpenInTab(extension)); 301 OptionsPageInfo::ShouldOpenInTab(extension));
312 extension_data->SetString("optionsPageHref", 302 extension_data->SetString("optionsPageHref",
313 OptionsPageInfo::GetOptionsPage(extension).spec()); 303 OptionsPageInfo::GetOptionsPage(extension).spec());
314 extension_data->SetBoolean("enableExtensionInfoDialog", 304 extension_data->SetBoolean("enableExtensionInfoDialog",
315 ShouldDisplayExtensionInfoDialog()); 305 CanShowAppInfoDialog());
316 306
317 // Add dependent extensions. 307 // Add dependent extensions.
318 base::ListValue* dependents_list = new base::ListValue; 308 base::ListValue* dependents_list = new base::ListValue;
319 if (extension->is_shared_module()) { 309 if (extension->is_shared_module()) {
320 scoped_ptr<ExtensionSet> dependent_extensions = 310 scoped_ptr<ExtensionSet> dependent_extensions =
321 extension_service_->shared_module_service()->GetDependentExtensions( 311 extension_service_->shared_module_service()->GetDependentExtensions(
322 extension); 312 extension);
323 for (ExtensionSet::const_iterator i = dependent_extensions->begin(); 313 for (ExtensionSet::const_iterator i = dependent_extensions->begin();
324 i != dependent_extensions->end(); 314 i != dependent_extensions->end();
325 i++) { 315 i++) {
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 source->AddString("extensionSettingsReloadTerminated", 552 source->AddString("extensionSettingsReloadTerminated",
563 l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD_TERMINATED)); 553 l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD_TERMINATED));
564 source->AddString("extensionSettingsRepairCorrupted", 554 source->AddString("extensionSettingsRepairCorrupted",
565 l10n_util::GetStringUTF16(IDS_EXTENSIONS_REPAIR_CORRUPTED)); 555 l10n_util::GetStringUTF16(IDS_EXTENSIONS_REPAIR_CORRUPTED));
566 source->AddString("extensionSettingsLaunch", 556 source->AddString("extensionSettingsLaunch",
567 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LAUNCH)); 557 l10n_util::GetStringUTF16(IDS_EXTENSIONS_LAUNCH));
568 source->AddString("extensionSettingsReloadUnpacked", 558 source->AddString("extensionSettingsReloadUnpacked",
569 l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD_UNPACKED)); 559 l10n_util::GetStringUTF16(IDS_EXTENSIONS_RELOAD_UNPACKED));
570 source->AddString("extensionSettingsOptions", 560 source->AddString("extensionSettingsOptions",
571 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK)); 561 l10n_util::GetStringUTF16(IDS_EXTENSIONS_OPTIONS_LINK));
572 if (ShouldDisplayExtensionInfoDialog()) { 562 if (CanShowAppInfoDialog()) {
573 source->AddString("extensionSettingsPermissions", 563 source->AddString("extensionSettingsPermissions",
574 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INFO_LINK)); 564 l10n_util::GetStringUTF16(IDS_EXTENSIONS_INFO_LINK));
575 } else { 565 } else {
576 source->AddString( 566 source->AddString(
577 "extensionSettingsPermissions", 567 "extensionSettingsPermissions",
578 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK)); 568 l10n_util::GetStringUTF16(IDS_EXTENSIONS_PERMISSIONS_LINK));
579 } 569 }
580 source->AddString("extensionSettingsVisitWebsite", 570 source->AddString("extensionSettingsVisitWebsite",
581 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE)); 571 l10n_util::GetStringUTF16(IDS_EXTENSIONS_VISIT_WEBSITE));
582 source->AddString("extensionSettingsVisitWebStore", 572 source->AddString("extensionSettingsVisitWebStore",
(...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 1221
1232 if (!extension_id_prompting_.empty()) 1222 if (!extension_id_prompting_.empty())
1233 return; // Only one prompt at a time. 1223 return; // Only one prompt at a time.
1234 extension_id_prompting_ = extension->id(); 1224 extension_id_prompting_ = extension->id();
1235 1225
1236 // The BrokerDelegate manages its own lifetime. 1226 // The BrokerDelegate manages its own lifetime.
1237 BrokerDelegate* broker_delegate = new BrokerDelegate(AsWeakPtr()); 1227 BrokerDelegate* broker_delegate = new BrokerDelegate(AsWeakPtr());
1238 1228
1239 // Show the new-style extensions dialog when the flag is set. The flag cannot 1229 // Show the new-style extensions dialog when the flag is set. The flag cannot
1240 // be set on Mac platforms. 1230 // be set on Mac platforms.
1241 if (ShouldDisplayExtensionInfoDialog()) { 1231 if (CanShowAppInfoDialog()) {
1242 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches", 1232 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialog.Launches",
1243 AppInfoLaunchSource::FROM_EXTENSIONS_PAGE, 1233 AppInfoLaunchSource::FROM_EXTENSIONS_PAGE,
1244 AppInfoLaunchSource::NUM_LAUNCH_SOURCES); 1234 AppInfoLaunchSource::NUM_LAUNCH_SOURCES);
1245 1235
1246 // Display the dialog at a size similar to the app list. 1236 // Display the dialog at a size similar to the app list.
1247 const int kAppInfoDialogWidth = 380;
1248 const int kAppInfoDialogHeight = 490;
1249
1250 ShowAppInfoInNativeDialog( 1237 ShowAppInfoInNativeDialog(
1251 web_contents()->GetTopLevelNativeWindow(), 1238 web_contents()->GetTopLevelNativeWindow(),
1252 gfx::Size(kAppInfoDialogWidth, kAppInfoDialogHeight), 1239 GetAppInfoNativeDialogSize(),
1253 Profile::FromWebUI(web_ui()), extension, 1240 Profile::FromWebUI(web_ui()), extension,
1254 base::Bind(&BrokerDelegate::AppInfoDialogClosed, 1241 base::Bind(&BrokerDelegate::AppInfoDialogClosed,
1255 base::Unretained(broker_delegate))); 1242 base::Unretained(broker_delegate)));
1256 } else { 1243 } else {
1257 prompt_.reset(new ExtensionInstallPrompt(web_contents())); 1244 prompt_.reset(new ExtensionInstallPrompt(web_contents()));
1258 std::vector<base::FilePath> retained_file_paths; 1245 std::vector<base::FilePath> retained_file_paths;
1259 if (extension->permissions_data()->HasAPIPermission( 1246 if (extension->permissions_data()->HasAPIPermission(
1260 APIPermission::kFileSystem)) { 1247 APIPermission::kFileSystem)) {
1261 std::vector<apps::SavedFileEntry> retained_file_entries = 1248 std::vector<apps::SavedFileEntry> retained_file_entries =
1262 apps::SavedFilesService::Get(Profile::FromWebUI(web_ui())) 1249 apps::SavedFilesService::Get(Profile::FromWebUI(web_ui()))
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 extension_service_->EnableExtension(extension_id); 1515 extension_service_->EnableExtension(extension_id);
1529 } else { 1516 } else {
1530 ExtensionErrorReporter::GetInstance()->ReportError( 1517 ExtensionErrorReporter::GetInstance()->ReportError(
1531 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')), 1518 base::UTF8ToUTF16(JoinString(requirement_errors, ' ')),
1532 true); // Be noisy. 1519 true); // Be noisy.
1533 } 1520 }
1534 requirements_checker_.reset(); 1521 requirements_checker_.reset();
1535 } 1522 }
1536 1523
1537 } // namespace extensions 1524 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698