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

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

Issue 10701051: Polish launcher tooltip visibility (2nd try). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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
« no previous file with comments | « ash/launcher/launcher.h ('k') | ash/launcher/launcher_tooltip_manager.h » ('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.h" 5 #include "ash/launcher/launcher.h"
6 6
7 #include "ash/focus_cycler.h" 7 #include "ash/focus_cycler.h"
8 #include "ash/launcher/launcher_delegate.h" 8 #include "ash/launcher/launcher_delegate.h"
9 #include "ash/launcher/launcher_model.h" 9 #include "ash/launcher/launcher_model.h"
10 #include "ash/launcher/launcher_navigator.h" 10 #include "ash/launcher/launcher_navigator.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 int w = std::max(0, width() - launcher_->status_size_.width()); 88 int w = std::max(0, width() - launcher_->status_size_.width());
89 child_at(0)->SetBounds(0, 0, w, height()); 89 child_at(0)->SetBounds(0, 0, w, height());
90 } else { 90 } else {
91 int h = std::max(0, height() - launcher_->status_size_.height()); 91 int h = std::max(0, height() - launcher_->status_size_.height());
92 child_at(0)->SetBounds(0, 0, width(), h); 92 child_at(0)->SetBounds(0, 0, width(), h);
93 } 93 }
94 } 94 }
95 95
96 // Launcher -------------------------------------------------------------------- 96 // Launcher --------------------------------------------------------------------
97 97
98 Launcher::Launcher(aura::Window* window_container) 98 Launcher::Launcher(aura::Window* window_container,
99 internal::ShelfLayoutManager* shelf_layout_manager)
99 : widget_(NULL), 100 : widget_(NULL),
100 window_container_(window_container), 101 window_container_(window_container),
101 delegate_view_(NULL), 102 delegate_view_(NULL),
102 launcher_view_(NULL), 103 launcher_view_(NULL),
103 alignment_(SHELF_ALIGNMENT_BOTTOM), 104 alignment_(SHELF_ALIGNMENT_BOTTOM),
104 ALLOW_THIS_IN_INITIALIZER_LIST( 105 ALLOW_THIS_IN_INITIALIZER_LIST(
105 background_animator_(this, 0, kBackgroundAlpha)) { 106 background_animator_(this, 0, kBackgroundAlpha)) {
106 model_.reset(new LauncherModel); 107 model_.reset(new LauncherModel);
107 if (Shell::GetInstance()->delegate()) { 108 if (Shell::GetInstance()->delegate()) {
108 delegate_.reset( 109 delegate_.reset(
109 Shell::GetInstance()->delegate()->CreateLauncherDelegate(model_.get())); 110 Shell::GetInstance()->delegate()->CreateLauncherDelegate(model_.get()));
110 } 111 }
111 112
112 widget_.reset(new views::Widget); 113 widget_.reset(new views::Widget);
113 views::Widget::InitParams params( 114 views::Widget::InitParams params(
114 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 115 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
115 // The launcher only ever draws a solid color. 116 // The launcher only ever draws a solid color.
116 params.layer_type = ui::LAYER_SOLID_COLOR; 117 params.layer_type = ui::LAYER_SOLID_COLOR;
117 params.transparent = true; 118 params.transparent = true;
118 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 119 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
119 params.parent = Shell::GetContainer( 120 params.parent = Shell::GetContainer(
120 window_container_->GetRootWindow(), 121 window_container_->GetRootWindow(),
121 ash::internal::kShellWindowId_LauncherContainer); 122 ash::internal::kShellWindowId_LauncherContainer);
122 launcher_view_ = new internal::LauncherView(model_.get(), delegate_.get()); 123 launcher_view_ = new internal::LauncherView(
124 model_.get(), delegate_.get(), shelf_layout_manager);
123 launcher_view_->Init(); 125 launcher_view_->Init();
124 delegate_view_ = new DelegateView(this); 126 delegate_view_ = new DelegateView(this);
125 delegate_view_->AddChildView(launcher_view_); 127 delegate_view_->AddChildView(launcher_view_);
126 params.delegate = delegate_view_; 128 params.delegate = delegate_view_;
127 widget_->Init(params); 129 widget_->Init(params);
128 widget_->GetNativeWindow()->SetName("LauncherWindow"); 130 widget_->GetNativeWindow()->SetName("LauncherWindow");
129 gfx::Size pref = 131 gfx::Size pref =
130 static_cast<views::View*>(launcher_view_)->GetPreferredSize(); 132 static_cast<views::View*>(launcher_view_)->GetPreferredSize();
131 widget_->SetBounds(gfx::Rect(pref)); 133 widget_->SetBounds(gfx::Rect(pref));
132 // The launcher should not take focus when it is initially shown. 134 // The launcher should not take focus when it is initially shown.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 internal::LauncherView* Launcher::GetLauncherViewForTest() { 218 internal::LauncherView* Launcher::GetLauncherViewForTest() {
217 return launcher_view_; 219 return launcher_view_;
218 } 220 }
219 221
220 void Launcher::UpdateBackground(int alpha) { 222 void Launcher::UpdateBackground(int alpha) {
221 ui::Layer* layer = widget_->GetNativeView()->layer(); 223 ui::Layer* layer = widget_->GetNativeView()->layer();
222 layer->SetColor(SkColorSetARGB(alpha, 0, 0, 0)); 224 layer->SetColor(SkColorSetARGB(alpha, 0, 0, 0));
223 } 225 }
224 226
225 } // namespace ash 227 } // namespace ash
OLDNEW
« no previous file with comments | « ash/launcher/launcher.h ('k') | ash/launcher/launcher_tooltip_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698