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

Side by Side Diff: ash/touch/touch_observer_hud.cc

Issue 224113005: Eliminate ash::internal namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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/touch/touch_observer_hud.h ('k') | ash/touch/touch_observer_hud_unittest.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/touch/touch_observer_hud.h" 5 #include "ash/touch/touch_observer_hud.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/root_window_settings.h" 8 #include "ash/root_window_settings.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
11 #include "ui/aura/window_event_dispatcher.h" 11 #include "ui/aura/window_event_dispatcher.h"
12 #include "ui/gfx/display.h" 12 #include "ui/gfx/display.h"
13 #include "ui/gfx/rect.h" 13 #include "ui/gfx/rect.h"
14 #include "ui/gfx/screen.h" 14 #include "ui/gfx/screen.h"
15 #include "ui/gfx/size.h" 15 #include "ui/gfx/size.h"
16 #include "ui/views/widget/widget.h" 16 #include "ui/views/widget/widget.h"
17 17
18 namespace ash { 18 namespace ash {
19 namespace internal {
20 19
21 TouchObserverHUD::TouchObserverHUD(aura::Window* initial_root) 20 TouchObserverHUD::TouchObserverHUD(aura::Window* initial_root)
22 : display_id_(GetRootWindowSettings(initial_root)->display_id), 21 : display_id_(GetRootWindowSettings(initial_root)->display_id),
23 root_window_(initial_root), 22 root_window_(initial_root),
24 widget_(NULL) { 23 widget_(NULL) {
25 const gfx::Display& display = 24 const gfx::Display& display =
26 Shell::GetInstance()->display_manager()->GetDisplayForId(display_id_); 25 Shell::GetInstance()->display_manager()->GetDisplayForId(display_id_);
27 26
28 views::View* content = new views::View; 27 views::View* content = new views::View;
29 28
30 const gfx::Size& display_size = display.size(); 29 const gfx::Size& display_size = display.size();
31 content->SetSize(display_size); 30 content->SetSize(display_size);
32 31
33 widget_ = new views::Widget(); 32 widget_ = new views::Widget();
34 views::Widget::InitParams 33 views::Widget::InitParams
35 params(views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 34 params(views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
36 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 35 params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
37 params.can_activate = false; 36 params.can_activate = false;
38 params.accept_events = false; 37 params.accept_events = false;
39 params.bounds = display.bounds(); 38 params.bounds = display.bounds();
40 params.parent = Shell::GetContainer( 39 params.parent =
41 root_window_, 40 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer);
42 internal::kShellWindowId_OverlayContainer);
43 widget_->Init(params); 41 widget_->Init(params);
44 widget_->SetContentsView(content); 42 widget_->SetContentsView(content);
45 widget_->StackAtTop(); 43 widget_->StackAtTop();
46 widget_->Show(); 44 widget_->Show();
47 45
48 widget_->AddObserver(this); 46 widget_->AddObserver(this);
49 47
50 // Observe changes in display size and mode to update touch HUD. 48 // Observe changes in display size and mode to update touch HUD.
51 Shell::GetScreen()->AddObserver(this); 49 Shell::GetScreen()->AddObserver(this);
52 #if defined(OS_CHROMEOS) 50 #if defined(OS_CHROMEOS)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 return; 118 return;
121 119
122 root_window_->RemovePreTargetHandler(this); 120 root_window_->RemovePreTargetHandler(this);
123 121
124 RootWindowController* controller = GetRootWindowController(root_window_); 122 RootWindowController* controller = GetRootWindowController(root_window_);
125 UnsetHudForRootWindowController(controller); 123 UnsetHudForRootWindowController(controller);
126 124
127 views::Widget::ReparentNativeView( 125 views::Widget::ReparentNativeView(
128 widget_->GetNativeView(), 126 widget_->GetNativeView(),
129 Shell::GetContainer(root_window_, 127 Shell::GetContainer(root_window_,
130 internal::kShellWindowId_UnparentedControlContainer)); 128 kShellWindowId_UnparentedControlContainer));
131 129
132 root_window_ = NULL; 130 root_window_ = NULL;
133 } 131 }
134 132
135 void TouchObserverHUD::OnDisplayConfigurationChanged() { 133 void TouchObserverHUD::OnDisplayConfigurationChanged() {
136 if (root_window_) 134 if (root_window_)
137 return; 135 return;
138 136
139 root_window_ = Shell::GetInstance()->display_controller()-> 137 root_window_ = Shell::GetInstance()->display_controller()->
140 GetRootWindowForDisplayId(display_id_); 138 GetRootWindowForDisplayId(display_id_);
141 139
142 views::Widget::ReparentNativeView( 140 views::Widget::ReparentNativeView(
143 widget_->GetNativeView(), 141 widget_->GetNativeView(),
144 Shell::GetContainer(root_window_, 142 Shell::GetContainer(root_window_, kShellWindowId_OverlayContainer));
145 internal::kShellWindowId_OverlayContainer));
146 143
147 RootWindowController* controller = GetRootWindowController(root_window_); 144 RootWindowController* controller = GetRootWindowController(root_window_);
148 SetHudForRootWindowController(controller); 145 SetHudForRootWindowController(controller);
149 146
150 root_window_->AddPreTargetHandler(this); 147 root_window_->AddPreTargetHandler(this);
151 } 148 }
152 149
153 } // namespace internal
154 } // namespace ash 150 } // namespace ash
OLDNEW
« no previous file with comments | « ash/touch/touch_observer_hud.h ('k') | ash/touch/touch_observer_hud_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698