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

Unified Diff: chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc

Issue 653293004: Made the 'Licenses' link in the App Info dialog open all licenses (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Small bugfix for shared modules with no license page Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc
index cbb9b1f22113d6af63f3537ee56b542afb2c2396..5371a62ac9be40da7160ca3535e13ddaa0d1087d 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.cc
@@ -173,6 +173,7 @@ void AppInfoHeaderPanel::ShowAppInWebStore() {
extensions::ManifestURL::GetDetailsURL(app_),
extension_urls::kWebstoreSourceField,
extension_urls::kLaunchSourceAppListInfoDialog));
+ Close();
}
bool AppInfoHeaderPanel::CanShowAppInWebStore() const {
@@ -182,6 +183,7 @@ bool AppInfoHeaderPanel::CanShowAppInWebStore() const {
void AppInfoHeaderPanel::ShowAppHomePage() {
DCHECK(CanShowAppHomePage());
OpenLink(extensions::ManifestURL::GetHomepageURL(app_));
+ Close();
}
bool AppInfoHeaderPanel::CanShowAppHomePage() const {
@@ -190,34 +192,40 @@ bool AppInfoHeaderPanel::CanShowAppHomePage() const {
void AppInfoHeaderPanel::DisplayLicenses() {
DCHECK(CanDisplayLicenses());
- OpenLink(GetLicenseUrl());
+ for (const auto& license_url : GetLicenseUrls())
+ OpenLink(license_url);
+ Close();
}
bool AppInfoHeaderPanel::CanDisplayLicenses() const {
- return !GetLicenseUrl().is_empty();
+ return !GetLicenseUrls().empty();
}
-const GURL& AppInfoHeaderPanel::GetLicenseUrl() const {
- // Find the first shared module for this app, and return its URL.
- // TODO(sashab): Support multiple shared modules with licenses once shared
- // module usage becomes more common.
+const std::vector<GURL> AppInfoHeaderPanel::GetLicenseUrls() const {
if (!extensions::SharedModuleInfo::ImportsModules(app_))
- return GURL::EmptyGURL();
+ return std::vector<GURL>();
+ std::vector<GURL> license_urls;
ExtensionService* service =
extensions::ExtensionSystem::Get(profile_)->extension_service();
DCHECK(service);
const std::vector<extensions::SharedModuleInfo::ImportInfo>& imports =
extensions::SharedModuleInfo::GetImports(app_);
- const extensions::Extension* imported_module =
- service->GetExtensionById(imports[0].extension_id, true);
- DCHECK(imported_module);
- return extensions::ManifestURL::GetAboutPage(imported_module);
+
+ for (const auto& shared_module : imports) {
+ const extensions::Extension* imported_module =
+ service->GetExtensionById(shared_module.extension_id, true);
+ DCHECK(imported_module);
+
+ GURL about_page = extensions::ManifestURL::GetAboutPage(imported_module);
+ if (about_page != GURL::EmptyGURL())
+ license_urls.push_back(about_page);
+ }
+ return license_urls;
}
void AppInfoHeaderPanel::OpenLink(const GURL& url) {
DCHECK(!url.is_empty());
chrome::NavigateParams params(profile_, url, ui::PAGE_TRANSITION_LINK);
chrome::Navigate(&params);
- Close();
}
« no previous file with comments | « chrome/browser/ui/views/apps/app_info_dialog/app_info_header_panel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698