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

Side by Side Diff: chrome/browser/ui/views/avatar_menu_bubble_view.cc

Issue 8508055: Move views::Accelerator to ui in order to use it from aura code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 9 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/avatar_menu_bubble_view.h" 5 #include "chrome/browser/ui/views/avatar_menu_bubble_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/browser_process.h" 10 #include "chrome/browser/browser_process.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 y += kSeparatorPaddingY; 380 y += kSeparatorPaddingY;
381 int separator_height = separator_->GetPreferredSize().height(); 381 int separator_height = separator_->GetPreferredSize().height();
382 separator_->SetBounds(0, y, width(), separator_height); 382 separator_->SetBounds(0, y, width(), separator_height);
383 y += kSeparatorPaddingY + separator_height; 383 y += kSeparatorPaddingY + separator_height;
384 384
385 add_profile_link_->SetBounds(kIconWidth + kIconMarginX, y, width(), 385 add_profile_link_->SetBounds(kIconWidth + kIconMarginX, y, width(),
386 add_profile_link_->GetPreferredSize().height()); 386 add_profile_link_->GetPreferredSize().height());
387 } 387 }
388 388
389 bool AvatarMenuBubbleView::AcceleratorPressed( 389 bool AvatarMenuBubbleView::AcceleratorPressed(
390 const views::Accelerator& accelerator) { 390 const ui::Accelerator& accelerator) {
391 if (accelerator.key_code() != ui::VKEY_DOWN && 391 if (accelerator.key_code() != ui::VKEY_DOWN &&
392 accelerator.key_code() != ui::VKEY_UP) { 392 accelerator.key_code() != ui::VKEY_UP) {
393 return false; 393 return false;
394 } 394 }
395 395
396 if (item_views_.empty()) 396 if (item_views_.empty())
397 return true; 397 return true;
398 398
399 // Find the currently focused item. Note that if there is no focused item, the 399 // Find the currently focused item. Note that if there is no focused item, the
400 // code below correctly handles a |focus_index| of -1. 400 // code below correctly handles a |focus_index| of -1.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 ProfileItemView* item_view = static_cast<ProfileItemView*>(item_views_[i]); 439 ProfileItemView* item_view = static_cast<ProfileItemView*>(item_views_[i]);
440 if (source == item_view->edit_link()) { 440 if (source == item_view->edit_link()) {
441 avatar_menu_model_->EditProfile(i); 441 avatar_menu_model_->EditProfile(i);
442 return; 442 return;
443 } 443 }
444 } 444 }
445 } 445 }
446 446
447 void AvatarMenuBubbleView::BubbleShown() { 447 void AvatarMenuBubbleView::BubbleShown() {
448 GetFocusManager()->RegisterAccelerator( 448 GetFocusManager()->RegisterAccelerator(
449 views::Accelerator(ui::VKEY_DOWN, false, false, false), this); 449 ui::Accelerator(ui::VKEY_DOWN, false, false, false), this);
450 GetFocusManager()->RegisterAccelerator( 450 GetFocusManager()->RegisterAccelerator(
451 views::Accelerator(ui::VKEY_UP, false, false, false), this); 451 ui::Accelerator(ui::VKEY_UP, false, false, false), this);
452 } 452 }
453 453
454 void AvatarMenuBubbleView::BubbleClosing(Bubble* bubble, 454 void AvatarMenuBubbleView::BubbleClosing(Bubble* bubble,
455 bool closed_by_escape) { 455 bool closed_by_escape) {
456 } 456 }
457 457
458 bool AvatarMenuBubbleView::CloseOnEscape() { 458 bool AvatarMenuBubbleView::CloseOnEscape() {
459 return true; 459 return true;
460 } 460 }
461 461
(...skipping 25 matching lines...) Expand all
487 add_profile_link_ = new views::Link( 487 add_profile_link_ = new views::Link(
488 l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK)); 488 l10n_util::GetStringUTF16(IDS_PROFILES_CREATE_NEW_PROFILE_LINK));
489 add_profile_link_->set_listener(this); 489 add_profile_link_->set_listener(this);
490 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT); 490 add_profile_link_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
491 add_profile_link_->SetBackgroundColor(Bubble::kBackgroundColor); 491 add_profile_link_->SetBackgroundColor(Bubble::kBackgroundColor);
492 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6)); 492 add_profile_link_->SetEnabledColor(SkColorSetRGB(0xe3, 0xed, 0xf6));
493 AddChildView(add_profile_link_); 493 AddChildView(add_profile_link_);
494 494
495 PreferredSizeChanged(); 495 PreferredSizeChanged();
496 } 496 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/avatar_menu_bubble_view.h ('k') | chrome/browser/ui/views/bookmarks/bookmark_bubble_view.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698