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

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

Issue 10317014: Move Command class out of the Extension class and into its own location (under chrome/common/exten… (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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 140 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
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 Extension::Command* browser_action_command = 150 const extensions::Command* browser_action_command =
151 command_service->GetActiveBrowserActionCommand(extension->id()); 151 command_service->GetActiveBrowserActionCommand(extension->id());
152 if (!browser_action_command) { 152 if (!browser_action_command) {
153 info_ = new views::Label(l10n_util::GetStringUTF16( 153 info_ = new views::Label(l10n_util::GetStringUTF16(
154 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO)); 154 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO));
155 } else { 155 } else {
156 has_keybinding = true; 156 has_keybinding = true;
157 info_ = new views::Label(l10n_util::GetStringFUTF16( 157 info_ = new views::Label(l10n_util::GetStringFUTF16(
158 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, 158 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT,
159 browser_action_command->accelerator().GetShortcutText())); 159 browser_action_command->accelerator().GetShortcutText()));
160 } 160 }
161 161
162 info_->SetFont(font); 162 info_->SetFont(font);
163 info_->SetMultiLine(true); 163 info_->SetMultiLine(true);
164 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 164 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
165 AddChildView(info_); 165 AddChildView(info_);
166 break; 166 break;
167 } 167 }
168 case ExtensionInstalledBubble::PAGE_ACTION: { 168 case ExtensionInstalledBubble::PAGE_ACTION: {
169 ExtensionCommandService* command_service = 169 ExtensionCommandService* command_service =
170 ExtensionCommandServiceFactory::GetForProfile( 170 ExtensionCommandServiceFactory::GetForProfile(
171 browser_->profile()); 171 browser_->profile());
172 const Extension::Command* page_action_command = 172 const extensions::Command* page_action_command =
173 command_service->GetActivePageActionCommand(extension->id()); 173 command_service->GetActivePageActionCommand(extension->id());
174 if (!page_action_command) { 174 if (!page_action_command) {
175 info_ = new views::Label(l10n_util::GetStringUTF16( 175 info_ = new views::Label(l10n_util::GetStringUTF16(
176 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO)); 176 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO));
177 } else { 177 } else {
178 has_keybinding = true; 178 has_keybinding = true;
179 info_ = new views::Label(l10n_util::GetStringFUTF16( 179 info_ = new views::Label(l10n_util::GetStringFUTF16(
180 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT, 180 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT,
181 page_action_command->accelerator().GetShortcutText())); 181 page_action_command->accelerator().GetShortcutText()));
182 } 182 }
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 } 474 }
475 475
476 void ExtensionInstalledBubble::WindowClosing() { 476 void ExtensionInstalledBubble::WindowClosing() {
477 if (extension_ && type_ == PAGE_ACTION) { 477 if (extension_ && type_ == PAGE_ACTION) {
478 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); 478 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
479 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( 479 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
480 extension_->page_action(), 480 extension_->page_action(),
481 false); // preview_enabled 481 false); // preview_enabled
482 } 482 }
483 } 483 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698