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

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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 AddChildView(heading_); 141 AddChildView(heading_);
142 142
143 bool has_keybinding = false; 143 bool has_keybinding = false;
144 144
145 switch (type_) { 145 switch (type_) {
146 case ExtensionInstalledBubble::BROWSER_ACTION: { 146 case ExtensionInstalledBubble::BROWSER_ACTION: {
147 ExtensionCommandService* command_service = 147 ExtensionCommandService* command_service =
148 ExtensionCommandServiceFactory::GetForProfile( 148 ExtensionCommandServiceFactory::GetForProfile(
149 browser_->profile()); 149 browser_->profile());
150 const extensions::Command* browser_action_command = 150 const extensions::Command* browser_action_command =
151 command_service->GetActiveBrowserActionCommand(extension->id()); 151 command_service->GetBrowserActionCommand(
152 extension->id(), ExtensionCommandService::ACTIVE_ONLY);
152 if (!browser_action_command) { 153 if (!browser_action_command) {
153 info_ = new views::Label(l10n_util::GetStringUTF16( 154 info_ = new views::Label(l10n_util::GetStringUTF16(
154 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO)); 155 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO));
155 } else { 156 } else {
156 has_keybinding = true; 157 has_keybinding = true;
157 info_ = new views::Label(l10n_util::GetStringFUTF16( 158 info_ = new views::Label(l10n_util::GetStringFUTF16(
158 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, 159 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT,
159 browser_action_command->accelerator().GetShortcutText())); 160 browser_action_command->accelerator().GetShortcutText()));
160 } 161 }
161 162
162 info_->SetFont(font); 163 info_->SetFont(font);
163 info_->SetMultiLine(true); 164 info_->SetMultiLine(true);
164 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 165 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
165 AddChildView(info_); 166 AddChildView(info_);
166 break; 167 break;
167 } 168 }
168 case ExtensionInstalledBubble::PAGE_ACTION: { 169 case ExtensionInstalledBubble::PAGE_ACTION: {
169 ExtensionCommandService* command_service = 170 ExtensionCommandService* command_service =
170 ExtensionCommandServiceFactory::GetForProfile( 171 ExtensionCommandServiceFactory::GetForProfile(
171 browser_->profile()); 172 browser_->profile());
172 const extensions::Command* page_action_command = 173 const extensions::Command* page_action_command =
173 command_service->GetActivePageActionCommand(extension->id()); 174 command_service->GetPageActionCommand(
175 extension->id(), ExtensionCommandService::ACTIVE_ONLY);
174 if (!page_action_command) { 176 if (!page_action_command) {
175 info_ = new views::Label(l10n_util::GetStringUTF16( 177 info_ = new views::Label(l10n_util::GetStringUTF16(
176 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); 178 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO));
177 } else { 179 } else {
178 has_keybinding = true; 180 has_keybinding = true;
179 info_ = new views::Label(l10n_util::GetStringFUTF16( 181 info_ = new views::Label(l10n_util::GetStringFUTF16(
180 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT, 182 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT,
181 page_action_command->accelerator().GetShortcutText())); 183 page_action_command->accelerator().GetShortcutText()));
182 } 184 }
183 185
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 476 }
475 477
476 void ExtensionInstalledBubble::WindowClosing() { 478 void ExtensionInstalledBubble::WindowClosing() {
477 if (extension_ && type_ == PAGE_ACTION) { 479 if (extension_ && type_ == PAGE_ACTION) {
478 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); 480 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
479 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( 481 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
480 extension_->page_action(), 482 extension_->page_action(),
481 false); // preview_enabled 483 false); // preview_enabled
482 } 484 }
483 } 485 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698