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

Unified Diff: chrome/browser/ui/views/extensions/extension_installed_bubble.cc

Issue 10910064: Extension Commands: Add [Manage Shortcuts] link to the Extension Install Bubble (Views and GTK only) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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/gtk/extensions/extension_installed_bubble_gtk.cc ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/extensions/extension_installed_bubble.cc
===================================================================
--- chrome/browser/ui/views/extensions/extension_installed_bubble.cc (revision 154673)
+++ chrome/browser/ui/views/extensions/extension_installed_bubble.cc (working copy)
@@ -17,6 +17,7 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/singleton_tabs.h"
#include "chrome/browser/ui/views/browser_action_view.h"
#include "chrome/browser/ui/views/browser_actions_container.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
@@ -27,6 +28,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_action.h"
+#include "chrome/common/url_constants.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "grit/chromium_strings.h"
@@ -102,7 +104,8 @@
bubble_(bubble),
type_(type),
info_(NULL),
- manage_(NULL) {
+ manage_(NULL),
+ manage_shortcut_(NULL) {
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
const gfx::Font& font = rb.GetFont(ui::ResourceBundle::BaseFont);
@@ -167,6 +170,10 @@
info_->SetMultiLine(true);
info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
AddChildView(info_);
+
+ manage_shortcut_ = new views::Link(
+ l10n_util::GetStringUTF16(
+ IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS));
break;
}
case ExtensionInstalledBubble::PAGE_ACTION: {
@@ -186,6 +193,9 @@
info_ = new views::Label(l10n_util::GetStringFUTF16(
IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT,
page_action_command.accelerator().GetShortcutText()));
+ manage_shortcut_ = new views::Link(
+ l10n_util::GetStringUTF16(
+ IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS));
}
info_->SetFont(font);
@@ -220,7 +230,8 @@
}
if (has_keybinding) {
- // TODO(finnur): Show the shortcut link.
+ manage_shortcut_->set_listener(this);
+ AddChildView(manage_shortcut_);
} else if (type_ != ExtensionInstalledBubble::APP) {
manage_ = new views::Label(
l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO));
@@ -250,7 +261,16 @@
// Implements the views::LinkListener interface.
virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE {
GetWidget()->Close();
- ExtensionInstallUI::OpenAppInstalledUI(browser_, extension_id_);
+ if (source == manage_shortcut_) {
+ std::string configure_url = chrome::kChromeUIExtensionsURL;
+ configure_url += chrome::kExtensionConfigureCommandsSubPage;
+ chrome::NavigateParams params(
+ chrome::GetSingletonTabNavigateParams(
+ browser_, GURL(configure_url.c_str())));
+ chrome::Navigate(&params);
+ } else {
+ ExtensionInstallUI::OpenAppInstalledUI(browser_, extension_id_);
+ }
}
private:
@@ -275,6 +295,11 @@
height += kVertOuterMargin;
}
+ if (manage_shortcut_) {
+ height += manage_shortcut_->GetHeightForWidth(kRightColumnWidth);
+ height += kVertOuterMargin;
+ }
+
return gfx::Size(width, std::max(height, kIconSize + 2 * kVertOuterMargin));
}
@@ -309,6 +334,16 @@
y += kVertInnerMargin;
}
+ if (manage_shortcut_) {
+ gfx::Size sz = manage_shortcut_->GetPreferredSize();
+ manage_shortcut_->SetBounds(width() - 2 * kHorizOuterMargin - sz.width(),
+ y,
+ sz.width(),
+ sz.height());
+ y += manage_shortcut_->height();
+ y += kVertInnerMargin;
+ }
+
gfx::Size sz;
x += kRightColumnWidth + 2 * views::kPanelHorizMargin + kHorizOuterMargin -
close_button_->GetPreferredSize().width();
@@ -333,6 +368,7 @@
views::Label* heading_;
views::Label* info_;
views::Label* manage_;
+ views::Link* manage_shortcut_;
views::ImageButton* close_button_;
DISALLOW_COPY_AND_ASSIGN(InstalledBubbleContent);
« no previous file with comments | « chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc ('k') | chrome/common/url_constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698