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

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

Issue 11377005: Replace Label::Alignment with gfx::HorizontalAlignment (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix remaining Label::Alignment references. Created 8 years, 1 month 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // ... for Apps: a link that opens the App Install UI. 135 // ... for Apps: a link that opens the App Install UI.
136 // ... for other types, either a description of how to manage the extension 136 // ... for other types, either a description of how to manage the extension
137 // or a link to configure the keybinding shortcut (if one exists). 137 // or a link to configure the keybinding shortcut (if one exists).
138 138
139 string16 extension_name = UTF8ToUTF16(extension->name()); 139 string16 extension_name = UTF8ToUTF16(extension->name());
140 base::i18n::AdjustStringForLocaleDirection(&extension_name); 140 base::i18n::AdjustStringForLocaleDirection(&extension_name);
141 heading_ = new views::Label(l10n_util::GetStringFUTF16( 141 heading_ = new views::Label(l10n_util::GetStringFUTF16(
142 IDS_EXTENSION_INSTALLED_HEADING, extension_name)); 142 IDS_EXTENSION_INSTALLED_HEADING, extension_name));
143 heading_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont)); 143 heading_->SetFont(rb.GetFont(ui::ResourceBundle::MediumFont));
144 heading_->SetMultiLine(true); 144 heading_->SetMultiLine(true);
145 heading_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 145 heading_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
146 AddChildView(heading_); 146 AddChildView(heading_);
147 147
148 bool has_keybinding = false; 148 bool has_keybinding = false;
149 149
150 switch (type_) { 150 switch (type_) {
151 case ExtensionInstalledBubble::BROWSER_ACTION: { 151 case ExtensionInstalledBubble::BROWSER_ACTION: {
152 extensions::CommandService* command_service = 152 extensions::CommandService* command_service =
153 extensions::CommandServiceFactory::GetForProfile( 153 extensions::CommandServiceFactory::GetForProfile(
154 browser_->profile()); 154 browser_->profile());
155 extensions::Command browser_action_command; 155 extensions::Command browser_action_command;
156 if (!command_service->GetBrowserActionCommand( 156 if (!command_service->GetBrowserActionCommand(
157 extension->id(), 157 extension->id(),
158 extensions::CommandService::ACTIVE_ONLY, 158 extensions::CommandService::ACTIVE_ONLY,
159 &browser_action_command, 159 &browser_action_command,
160 NULL)) { 160 NULL)) {
161 info_ = new views::Label(l10n_util::GetStringUTF16( 161 info_ = new views::Label(l10n_util::GetStringUTF16(
162 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO)); 162 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO));
163 } else { 163 } else {
164 has_keybinding = true; 164 has_keybinding = true;
165 info_ = new views::Label(l10n_util::GetStringFUTF16( 165 info_ = new views::Label(l10n_util::GetStringFUTF16(
166 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT, 166 IDS_EXTENSION_INSTALLED_BROWSER_ACTION_INFO_WITH_SHORTCUT,
167 browser_action_command.accelerator().GetShortcutText())); 167 browser_action_command.accelerator().GetShortcutText()));
168 } 168 }
169 169
170 info_->SetFont(font); 170 info_->SetFont(font);
171 info_->SetMultiLine(true); 171 info_->SetMultiLine(true);
172 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 172 info_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
173 AddChildView(info_); 173 AddChildView(info_);
174 174
175 manage_shortcut_ = new views::Link( 175 manage_shortcut_ = new views::Link(
176 l10n_util::GetStringUTF16( 176 l10n_util::GetStringUTF16(
177 IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS)); 177 IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS));
178 break; 178 break;
179 } 179 }
180 case ExtensionInstalledBubble::PAGE_ACTION: { 180 case ExtensionInstalledBubble::PAGE_ACTION: {
181 extensions::CommandService* command_service = 181 extensions::CommandService* command_service =
182 extensions::CommandServiceFactory::GetForProfile( 182 extensions::CommandServiceFactory::GetForProfile(
(...skipping 11 matching lines...) Expand all
194 info_ = new views::Label(l10n_util::GetStringFUTF16( 194 info_ = new views::Label(l10n_util::GetStringFUTF16(
195 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT, 195 IDS_EXTENSION_INSTALLED_PAGE_ACTION_INFO_WITH_SHORTCUT,
196 page_action_command.accelerator().GetShortcutText())); 196 page_action_command.accelerator().GetShortcutText()));
197 manage_shortcut_ = new views::Link( 197 manage_shortcut_ = new views::Link(
198 l10n_util::GetStringUTF16( 198 l10n_util::GetStringUTF16(
199 IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS)); 199 IDS_EXTENSION_INSTALLED_MANAGE_SHORTCUTS));
200 } 200 }
201 201
202 info_->SetFont(font); 202 info_->SetFont(font);
203 info_->SetMultiLine(true); 203 info_->SetMultiLine(true);
204 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 204 info_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
205 AddChildView(info_); 205 AddChildView(info_);
206 break; 206 break;
207 } 207 }
208 case ExtensionInstalledBubble::OMNIBOX_KEYWORD: { 208 case ExtensionInstalledBubble::OMNIBOX_KEYWORD: {
209 info_ = new views::Label(l10n_util::GetStringFUTF16( 209 info_ = new views::Label(l10n_util::GetStringFUTF16(
210 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO, 210 IDS_EXTENSION_INSTALLED_OMNIBOX_KEYWORD_INFO,
211 UTF8ToUTF16(extension->omnibox_keyword()))); 211 UTF8ToUTF16(extension->omnibox_keyword())));
212 info_->SetFont(font); 212 info_->SetFont(font);
213 info_->SetMultiLine(true); 213 info_->SetMultiLine(true);
214 info_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 214 info_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
215 AddChildView(info_); 215 AddChildView(info_);
216 break; 216 break;
217 } 217 }
218 case ExtensionInstalledBubble::APP: { 218 case ExtensionInstalledBubble::APP: {
219 views::Link* link = new views::Link( 219 views::Link* link = new views::Link(
220 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_APP_INFO)); 220 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_APP_INFO));
221 link->set_listener(this); 221 link->set_listener(this);
222 manage_ = link; 222 manage_ = link;
223 manage_->SetFont(font); 223 manage_->SetFont(font);
224 manage_->SetMultiLine(true); 224 manage_->SetMultiLine(true);
225 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 225 manage_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
226 AddChildView(manage_); 226 AddChildView(manage_);
227 break; 227 break;
228 } 228 }
229 default: 229 default:
230 break; 230 break;
231 } 231 }
232 232
233 if (has_keybinding) { 233 if (has_keybinding) {
234 manage_shortcut_->set_listener(this); 234 manage_shortcut_->set_listener(this);
235 AddChildView(manage_shortcut_); 235 AddChildView(manage_shortcut_);
236 } else if (type_ != ExtensionInstalledBubble::APP) { 236 } else if (type_ != ExtensionInstalledBubble::APP) {
237 manage_ = new views::Label( 237 manage_ = new views::Label(
238 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO)); 238 l10n_util::GetStringUTF16(IDS_EXTENSION_INSTALLED_MANAGE_INFO));
239 manage_->SetFont(font); 239 manage_->SetFont(font);
240 manage_->SetMultiLine(true); 240 manage_->SetMultiLine(true);
241 manage_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 241 manage_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
242 AddChildView(manage_); 242 AddChildView(manage_);
243 } 243 }
244 244
245 close_button_ = new views::ImageButton(this); 245 close_button_ = new views::ImageButton(this);
246 close_button_->SetImage(views::CustomButton::BS_NORMAL, 246 close_button_->SetImage(views::CustomButton::BS_NORMAL,
247 rb.GetImageSkiaNamed(IDR_CLOSE_BAR)); 247 rb.GetImageSkiaNamed(IDR_CLOSE_BAR));
248 close_button_->SetImage(views::CustomButton::BS_HOT, 248 close_button_->SetImage(views::CustomButton::BS_HOT,
249 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H)); 249 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_H));
250 close_button_->SetImage(views::CustomButton::BS_PUSHED, 250 close_button_->SetImage(views::CustomButton::BS_PUSHED,
251 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P)); 251 rb.GetImageSkiaNamed(IDR_CLOSE_BAR_P));
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 void ExtensionInstalledBubble::WindowClosing() { 524 void ExtensionInstalledBubble::WindowClosing() {
525 if (extension_ && type_ == PAGE_ACTION) { 525 if (extension_ && type_ == PAGE_ACTION) {
526 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_); 526 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser_);
527 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction( 527 browser_view->GetLocationBarView()->SetPreviewEnabledPageAction(
528 extensions::ExtensionActionManager::Get(browser_->profile())-> 528 extensions::ExtensionActionManager::Get(browser_->profile())->
529 GetPageAction(*extension_), 529 GetPageAction(*extension_),
530 false); // preview_enabled 530 false); // preview_enabled
531 } 531 }
532 } 532 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698