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

Side by Side Diff: chrome/browser/ui/views/extensions/extension_installed_bubble.cc

Issue 10383240: This adds a webui overlay on the extensions page for showing what Extension keybindings are active.… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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 | Annotate | Revision Log
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/views/extensions/extension_installed_bubble.h" 5 #include "chrome/browser/ui/views/extensions/extension_installed_bubble.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 IDS_EXTENSION_INSTALLED_HEADING, extension_name)); 139 IDS_EXTENSION_INSTALLED_HEADING, extension_name));
140 heading_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 140 heading_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
141 heading_->SetMultiLine(true); 141 heading_->SetMultiLine(true);
142 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 142 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
143 AddChildView(heading_); 143 AddChildView(heading_);
144 144
145 bool has_keybinding = false; 145 bool has_keybinding = false;
146 146
147 switch (type_) { 147 switch (type_) {
148 case ExtensionInstalledBubble::BROWSER_ACTION: { 148 case ExtensionInstalledBubble::BROWSER_ACTION: {
149 ExtensionCommandService* command_service = 149 extensions::ExtensionCommandService* command_service =
150 ExtensionCommandServiceFactory::GetForProfile( 150 extensions::ExtensionCommandServiceFactory::GetForProfile(
151 browser_->profile()); 151 browser_->profile());
152 const extensions::Command* browser_action_command = 152 const extensions::Command* browser_action_command =
153 command_service->GetActiveBrowserActionCommand(extension->id()); 153 command_service->GetBrowserActionCommand(
154 extension->id(),
155 extensions::ExtensionCommandService::ACTIVE_ONLY);
154 if (!browser_action_command) { 156 if (!browser_action_command) {
155 info_ = new views::Label(l10n_util::GetStringUTF16( 157 info_ = new views::Label(l10n_util::GetStringUTF16(
156 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO)); 158 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO));
157 } else { 159 } else {
158 has_keybinding = true; 160 has_keybinding = true;
159 info_ = new views::Label(l10n_util::GetStringFUTF16( 161 info_ = new views::Label(l10n_util::GetStringFUTF16(
160 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, 162 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT,
161 browser_action_command->accelerator().GetShortcutText())); 163 browser_action_command->accelerator().GetShortcutText()));
162 } 164 }
163 165
164 info_->SetFont(font); 166 info_->SetFont(font);
165 info_->SetMultiLine(true); 167 info_->SetMultiLine(true);
166 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 168 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
167 AddChildView(info_); 169 AddChildView(info_);
168 break; 170 break;
169 } 171 }
170 case ExtensionInstalledBubble::PAGE_ACTION: { 172 case ExtensionInstalledBubble::PAGE_ACTION: {
171 ExtensionCommandService* command_service = 173 extensions::ExtensionCommandService* command_service =
172 ExtensionCommandServiceFactory::GetForProfile( 174 extensions::ExtensionCommandServiceFactory::GetForProfile(
173 browser_->profile()); 175 browser_->profile());
174 const extensions::Command* page_action_command = 176 const extensions::Command* page_action_command =
175 command_service->GetActivePageActionCommand(extension->id()); 177 command_service->GetPageActionCommand(
178 extension->id(),
179 extensions::ExtensionCommandService::ACTIVE_ONLY);
176 if (!page_action_command) { 180 if (!page_action_command) {
177 info_ = new views::Label(l10n_util::GetStringUTF16( 181 info_ = new views::Label(l10n_util::GetStringUTF16(
178 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); 182 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO));
179 } else { 183 } else {
180 has_keybinding = true; 184 has_keybinding = true;
181 info_ = new views::Label(l10n_util::GetStringFUTF16( 185 info_ = new views::Label(l10n_util::GetStringFUTF16(
182 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT, 186 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT,
183 page_action_command->accelerator().GetShortcutText())); 187 page_action_command->accelerator().GetShortcutText()));
184 } 188 }
185 189
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 480 }
477 481
478 void ExtensionInstalledBubble::WindowClosing() { 482 void ExtensionInstalledBubble::WindowClosing() {
479 if (extension_ && type_ == PAGE_ACTION) { 483 if (extension_ && type_ == PAGE_ACTION) {
480 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); 484 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
481 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( 485 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
482 extension_->page_action(), 486 extension_->page_action(),
483 false); // preview_enabled 487 false); // preview_enabled
484 } 488 }
485 } 489 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698