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

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

Issue 10387224: Rename ExtensionCommand* to Command* within the extension namespace. (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"
11 #include "base/i18n/rtl.h" 11 #include "base/i18n/rtl.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/extensions/api/commands/extension_command_service.h" 14 #include "chrome/browser/extensions/api/commands/command_service.h"
15 #include "chrome/browser/extensions/api/commands/extension_command_service_facto ry.h" 15 #include "chrome/browser/extensions/api/commands/command_service_factory.h"
16 #include "chrome/browser/extensions/extension_install_ui.h" 16 #include "chrome/browser/extensions/extension_install_ui.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/browser/ui/views/browser_actions_container.h" 20 #include "chrome/browser/ui/views/browser_actions_container.h"
21 #include "chrome/browser/ui/views/frame/browser_view.h" 21 #include "chrome/browser/ui/views/frame/browser_view.h"
22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 22 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
23 #include "chrome/browser/ui/views/tabs/tab_strip.h" 23 #include "chrome/browser/ui/views/tabs/tab_strip.h"
24 #include "chrome/browser/ui/views/toolbar_view.h" 24 #include "chrome/browser/ui/views/toolbar_view.h"
25 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" 25 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h"
(...skipping 113 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 extensions::ExtensionCommandService* command_service = 149 extensions::CommandService* command_service =
150 extensions::ExtensionCommandServiceFactory::GetForProfile( 150 extensions::CommandServiceFactory::GetForProfile(
151 browser_->profile()); 151 browser_->profile());
152 const extensions::Command* browser_action_command = 152 const extensions::Command* browser_action_command =
153 command_service->GetBrowserActionCommand( 153 command_service->GetBrowserActionCommand(
154 extension->id(), 154 extension->id(),
155 extensions::ExtensionCommandService::ACTIVE_ONLY); 155 extensions::CommandService::ACTIVE_ONLY);
156 if (!browser_action_command) { 156 if (!browser_action_command) {
157 info_ = new views::Label(l10n_util::GetStringUTF16( 157 info_ = new views::Label(l10n_util::GetStringUTF16(
158 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO)); 158 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO));
159 } else { 159 } else {
160 has_keybinding = true; 160 has_keybinding = true;
161 info_ = new views::Label(l10n_util::GetStringFUTF16( 161 info_ = new views::Label(l10n_util::GetStringFUTF16(
162 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, 162 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT,
163 browser_action_command->accelerator().GetShortcutText())); 163 browser_action_command->accelerator().GetShortcutText()));
164 } 164 }
165 165
166 info_->SetFont(font); 166 info_->SetFont(font);
167 info_->SetMultiLine(true); 167 info_->SetMultiLine(true);
168 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 168 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
169 AddChildView(info_); 169 AddChildView(info_);
170 break; 170 break;
171 } 171 }
172 case ExtensionInstalledBubble::PAGE_ACTION: { 172 case ExtensionInstalledBubble::PAGE_ACTION: {
173 extensions::ExtensionCommandService* command_service = 173 extensions::CommandService* command_service =
174 extensions::ExtensionCommandServiceFactory::GetForProfile( 174 extensions::CommandServiceFactory::GetForProfile(
175 browser_->profile()); 175 browser_->profile());
176 const extensions::Command* page_action_command = 176 const extensions::Command* page_action_command =
177 command_service->GetPageActionCommand( 177 command_service->GetPageActionCommand(
178 extension->id(), 178 extension->id(),
179 extensions::ExtensionCommandService::ACTIVE_ONLY); 179 extensions::CommandService::ACTIVE_ONLY);
180 if (!page_action_command) { 180 if (!page_action_command) {
181 info_ = new views::Label(l10n_util::GetStringUTF16( 181 info_ = new views::Label(l10n_util::GetStringUTF16(
182 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); 182 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO));
183 } else { 183 } else {
184 has_keybinding = true; 184 has_keybinding = true;
185 info_ = new views::Label(l10n_util::GetStringFUTF16( 185 info_ = new views::Label(l10n_util::GetStringFUTF16(
186 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT, 186 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT,
187 page_action_command->accelerator().GetShortcutText())); 187 page_action_command->accelerator().GetShortcutText()));
188 } 188 }
189 189
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 } 480 }
481 481
482 void ExtensionInstalledBubble::WindowClosing() { 482 void ExtensionInstalledBubble::WindowClosing() {
483 if (extension_ && type_ == PAGE_ACTION) { 483 if (extension_ && type_ == PAGE_ACTION) {
484 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); 484 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
485 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( 485 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
486 extension_->page_action(), 486 extension_->page_action(),
487 false); // preview_enabled 487 false); // preview_enabled
488 } 488 }
489 } 489 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698