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

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

Powered by Google App Engine
This is Rietveld 408576698