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

Side by Side Diff: ui/aura_shell/launcher/launcher.cc

Issue 8873036: Create a visible shelf and constrain window movement (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added image Created 9 years 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 | « no previous file | ui/aura_shell/launcher/launcher_view.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) 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 "ui/aura_shell/launcher/launcher.h" 5 #include "ui/aura_shell/launcher/launcher.h"
6 6
7 #include "ui/aura/window.h" 7 #include "ui/aura/window.h"
8 #include "ui/aura_shell/launcher/launcher_model.h" 8 #include "ui/aura_shell/launcher/launcher_model.h"
9 #include "ui/aura_shell/launcher/launcher_view.h" 9 #include "ui/aura_shell/launcher/launcher_view.h"
10 #include "ui/aura_shell/shell.h" 10 #include "ui/aura_shell/shell.h"
11 #include "ui/aura_shell/shell_delegate.h" 11 #include "ui/aura_shell/shell_delegate.h"
12 #include "ui/aura_shell/shell_window_ids.h" 12 #include "ui/aura_shell/shell_window_ids.h"
13 #include "ui/gfx/compositor/layer.h" 13 #include "ui/gfx/compositor/layer.h"
14 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
15 15
16 namespace aura_shell { 16 namespace aura_shell {
17 17
18 Launcher::Launcher(aura::Window* window_container) 18 Launcher::Launcher(aura::Window* window_container)
19 : widget_(NULL), 19 : widget_(NULL),
20 window_container_(window_container) { 20 window_container_(window_container) {
21 window_container->AddObserver(this); 21 window_container->AddObserver(this);
22 22
23 model_.reset(new LauncherModel); 23 model_.reset(new LauncherModel);
24 24
25 widget_ = new views::Widget; 25 widget_ = new views::Widget;
26 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL); 26 views::Widget::InitParams params(views::Widget::InitParams::TYPE_CONTROL);
27 // All the content is drawn by the launcher buttons. Turn off the widget's 27 params.create_texture_for_layer = true;
28 // layer's texture to avoid unnecessary memory use. 28 params.transparent = true;
29 params.create_texture_for_layer = false;
30 params.parent = Shell::GetInstance()->GetContainer( 29 params.parent = Shell::GetInstance()->GetContainer(
31 aura_shell::internal::kShellWindowId_LauncherContainer); 30 aura_shell::internal::kShellWindowId_LauncherContainer);
32 internal::LauncherView* launcher_view = 31 internal::LauncherView* launcher_view =
33 new internal::LauncherView(model_.get()); 32 new internal::LauncherView(model_.get());
34 launcher_view->Init(); 33 launcher_view->Init();
35 params.delegate = launcher_view; 34 params.delegate = launcher_view;
36 widget_->Init(params); 35 widget_->Init(params);
37 gfx::Size pref = static_cast<views::View*>(launcher_view)->GetPreferredSize(); 36 gfx::Size pref = static_cast<views::View*>(launcher_view)->GetPreferredSize();
38 widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height())); 37 widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height()));
39 widget_->SetContentsView(launcher_view); 38 widget_->SetContentsView(launcher_view);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 model_->RemoveItemAt(i - model_->items().begin()); 89 model_->RemoveItemAt(i - model_->items().begin());
91 } 90 }
92 91
93 void Launcher::OnWindowVisibilityChanged(aura::Window* window, 92 void Launcher::OnWindowVisibilityChanged(aura::Window* window,
94 bool visibile) { 93 bool visibile) {
95 if (visibile && !known_windows_[window]) 94 if (visibile && !known_windows_[window])
96 MaybeAdd(window); 95 MaybeAdd(window);
97 } 96 }
98 97
99 } // namespace aura_shell 98 } // namespace aura_shell
OLDNEW
« no previous file with comments | « no previous file | ui/aura_shell/launcher/launcher_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698