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

Side by Side Diff: ash/launcher/launcher_view.cc

Issue 11306012: Use the same blue solid border among tray and launcher, for focus. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « ash/ash_constants.cc ('k') | ash/system/audio/tray_volume.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/launcher/launcher_view.h" 5 #include "ash/launcher/launcher_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "ash/ash_constants.h"
9 #include "ash/launcher/app_list_button.h" 10 #include "ash/launcher/app_list_button.h"
10 #include "ash/launcher/launcher_button.h" 11 #include "ash/launcher/launcher_button.h"
11 #include "ash/launcher/launcher_delegate.h" 12 #include "ash/launcher/launcher_delegate.h"
12 #include "ash/launcher/launcher_icon_observer.h" 13 #include "ash/launcher/launcher_icon_observer.h"
13 #include "ash/launcher/launcher_model.h" 14 #include "ash/launcher/launcher_model.h"
14 #include "ash/launcher/launcher_tooltip_manager.h" 15 #include "ash/launcher/launcher_tooltip_manager.h"
15 #include "ash/launcher/overflow_bubble.h" 16 #include "ash/launcher/overflow_bubble.h"
16 #include "ash/launcher/overflow_button.h" 17 #include "ash/launcher/overflow_button.h"
17 #include "ash/launcher/tabbed_launcher_button.h" 18 #include "ash/launcher/tabbed_launcher_button.h"
18 #include "ash/shell.h" 19 #include "ash/shell.h"
19 #include "ash/shell_delegate.h" 20 #include "ash/shell_delegate.h"
20 #include "base/auto_reset.h" 21 #include "base/auto_reset.h"
21 #include "base/memory/scoped_ptr.h" 22 #include "base/memory/scoped_ptr.h"
22 #include "grit/ash_strings.h" 23 #include "grit/ash_strings.h"
23 #include "grit/ash_resources.h" 24 #include "grit/ash_resources.h"
24 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
25 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
26 #include "ui/base/models/simple_menu_model.h" 27 #include "ui/base/models/simple_menu_model.h"
27 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
28 #include "ui/compositor/layer.h" 29 #include "ui/compositor/layer.h"
29 #include "ui/compositor/layer_animator.h" 30 #include "ui/compositor/layer_animator.h"
30 #include "ui/gfx/canvas.h" 31 #include "ui/gfx/canvas.h"
31 #include "ui/views/animation/bounds_animator.h" 32 #include "ui/views/animation/bounds_animator.h"
32 #include "ui/views/border.h" 33 #include "ui/views/border.h"
33 #include "ui/views/controls/menu/menu_model_adapter.h" 34 #include "ui/views/controls/menu/menu_model_adapter.h"
34 #include "ui/views/controls/menu/menu_runner.h" 35 #include "ui/views/controls/menu/menu_runner.h"
35 #include "ui/views/focus/focus_search.h" 36 #include "ui/views/focus/focus_search.h"
37 #include "ui/views/focus_border.h"
36 #include "ui/views/view_model.h" 38 #include "ui/views/view_model.h"
37 #include "ui/views/view_model_utils.h" 39 #include "ui/views/view_model_utils.h"
38 #include "ui/views/widget/widget.h" 40 #include "ui/views/widget/widget.h"
39 41
40 using ui::Animation; 42 using ui::Animation;
41 using views::View; 43 using views::View;
42 44
43 namespace ash { 45 namespace ash {
44 namespace internal { 46 namespace internal {
45 47
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 88 }
87 return view_model_->view_at(index); 89 return view_model_->view_at(index);
88 } 90 }
89 91
90 private: 92 private:
91 views::ViewModel* view_model_; 93 views::ViewModel* view_model_;
92 94
93 DISALLOW_COPY_AND_ASSIGN(LauncherFocusSearch); 95 DISALLOW_COPY_AND_ASSIGN(LauncherFocusSearch);
94 }; 96 };
95 97
98 class LauncherButtonFocusBorder : public views::FocusBorder {
99 public:
100 LauncherButtonFocusBorder() {}
101 virtual ~LauncherButtonFocusBorder() {}
102
103 private:
104 // views::FocusBorder overrides:
105 virtual void Paint(const View& view, gfx::Canvas* canvas) const OVERRIDE {
106 gfx::Rect rect(view.GetLocalBounds());
107 rect.Inset(1, 1);
108 canvas->DrawRect(rect, kFocusBorderColor);
109 }
110
111 DISALLOW_COPY_AND_ASSIGN(LauncherButtonFocusBorder);
112 };
113
96 // ui::SimpleMenuModel::Delegate implementation that remembers the id of the 114 // ui::SimpleMenuModel::Delegate implementation that remembers the id of the
97 // menu that was activated. 115 // menu that was activated.
98 class MenuDelegateImpl : public ui::SimpleMenuModel::Delegate { 116 class MenuDelegateImpl : public ui::SimpleMenuModel::Delegate {
99 public: 117 public:
100 MenuDelegateImpl() : activated_command_id_(-1) {} 118 MenuDelegateImpl() : activated_command_id_(-1) {}
101 119
102 int activated_command_id() const { return activated_command_id_; } 120 int activated_command_id() const { return activated_command_id_; }
103 121
104 // ui::SimpleMenuModel::Delegate overrides: 122 // ui::SimpleMenuModel::Delegate overrides:
105 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { 123 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE {
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 IDR_AURA_LAUNCHER_BROWSER_SHORTCUT; 543 IDR_AURA_LAUNCHER_BROWSER_SHORTCUT;
526 button->SetImage(*rb.GetImageNamed(image_id).ToImageSkia()); 544 button->SetImage(*rb.GetImageNamed(image_id).ToImageSkia());
527 view = button; 545 view = button;
528 break; 546 break;
529 } 547 }
530 548
531 default: 549 default:
532 break; 550 break;
533 } 551 }
534 view->set_context_menu_controller(this); 552 view->set_context_menu_controller(this);
553 view->set_focus_border(new LauncherButtonFocusBorder);
535 554
536 DCHECK(view); 555 DCHECK(view);
537 ConfigureChildView(view); 556 ConfigureChildView(view);
538 return view; 557 return view;
539 } 558 }
540 559
541 void LauncherView::FadeIn(views::View* view) { 560 void LauncherView::FadeIn(views::View* view) {
542 view->SetVisible(true); 561 view->SetVisible(true);
543 view->layer()->SetOpacity(0); 562 view->layer()->SetOpacity(0);
544 AnimateToIdealBounds(); 563 AnimateToIdealBounds();
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 FOR_EACH_OBSERVER(LauncherIconObserver, observers_, 1092 FOR_EACH_OBSERVER(LauncherIconObserver, observers_,
1074 OnLauncherIconPositionsChanged()); 1093 OnLauncherIconPositionsChanged());
1075 PreferredSizeChanged(); 1094 PreferredSizeChanged();
1076 } 1095 }
1077 1096
1078 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) { 1097 void LauncherView::OnBoundsAnimatorDone(views::BoundsAnimator* animator) {
1079 } 1098 }
1080 1099
1081 } // namespace internal 1100 } // namespace internal
1082 } // namespace ash 1101 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash_constants.cc ('k') | ash/system/audio/tray_volume.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698