OLD | NEW |
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/display/shared_display_edge_indicator.h" | 5 #include "ash/display/shared_display_edge_indicator.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_window_ids.h" | 8 #include "ash/shell_window_ids.h" |
9 #include "ash/wm/coordinate_conversion.h" | 9 #include "ash/wm/coordinate_conversion.h" |
10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
11 #include "ui/aura/client/screen_position_client.h" | 11 #include "ui/aura/client/screen_position_client.h" |
| 12 #include "ui/aura/root_window.h" |
12 #include "ui/base/animation/throb_animation.h" | 13 #include "ui/base/animation/throb_animation.h" |
13 #include "ui/gfx/canvas.h" | 14 #include "ui/gfx/canvas.h" |
14 #include "ui/gfx/display.h" | 15 #include "ui/gfx/display.h" |
15 #include "ui/gfx/screen.h" | 16 #include "ui/gfx/screen.h" |
16 #include "ui/views/view.h" | 17 #include "ui/views/view.h" |
17 #include "ui/views/widget/widget.h" | 18 #include "ui/views/widget/widget.h" |
18 | 19 |
19 namespace ash { | 20 namespace ash { |
20 namespace internal { | 21 namespace internal { |
21 namespace { | 22 namespace { |
(...skipping 22 matching lines...) Expand all Loading... |
44 DISALLOW_COPY_AND_ASSIGN(IndicatorView); | 45 DISALLOW_COPY_AND_ASSIGN(IndicatorView); |
45 }; | 46 }; |
46 | 47 |
47 views::Widget* CreateWidget(const gfx::Rect& bounds, | 48 views::Widget* CreateWidget(const gfx::Rect& bounds, |
48 views::View* contents_view) { | 49 views::View* contents_view) { |
49 views::Widget* widget = new views::Widget; | 50 views::Widget* widget = new views::Widget; |
50 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); | 51 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); |
51 params.transparent = true; | 52 params.transparent = true; |
52 params.can_activate = false; | 53 params.can_activate = false; |
53 params.keep_on_top = true; | 54 params.keep_on_top = true; |
| 55 // We set the context to the primary root window; this is OK because the ash |
| 56 // stacking controller will still place us in the correct RootWindow. |
| 57 params.context = Shell::GetPrimaryRootWindow(); |
54 widget->set_focus_on_creation(false); | 58 widget->set_focus_on_creation(false); |
55 widget->Init(params); | 59 widget->Init(params); |
56 widget->SetVisibilityChangedAnimationsEnabled(false); | 60 widget->SetVisibilityChangedAnimationsEnabled(false); |
57 widget->GetNativeWindow()->SetName("SharedEdgeIndicator"); | 61 widget->GetNativeWindow()->SetName("SharedEdgeIndicator"); |
58 widget->SetContentsView(contents_view); | 62 widget->SetContentsView(contents_view); |
59 gfx::Display display = Shell::GetScreen()->GetDisplayMatching(bounds); | 63 gfx::Display display = Shell::GetScreen()->GetDisplayMatching(bounds); |
60 aura::Window* window = widget->GetNativeWindow(); | 64 aura::Window* window = widget->GetNativeWindow(); |
61 aura::client::ScreenPositionClient* screen_position_client = | 65 aura::client::ScreenPositionClient* screen_position_client = |
62 aura::client::GetScreenPositionClient(window->GetRootWindow()); | 66 aura::client::GetScreenPositionClient(window->GetRootWindow()); |
63 screen_position_client->SetBounds(window, bounds, display); | 67 screen_position_client->SetBounds(window, bounds, display); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 SkColor color = SkColorSetARGB(0xFF, value, value, value); | 108 SkColor color = SkColorSetARGB(0xFF, value, value, value); |
105 if (src_indicator_) | 109 if (src_indicator_) |
106 static_cast<IndicatorView*>(src_indicator_)->SetColor(color); | 110 static_cast<IndicatorView*>(src_indicator_)->SetColor(color); |
107 if (dst_indicator_) | 111 if (dst_indicator_) |
108 static_cast<IndicatorView*>(dst_indicator_)->SetColor(color); | 112 static_cast<IndicatorView*>(dst_indicator_)->SetColor(color); |
109 | 113 |
110 } | 114 } |
111 | 115 |
112 } // namespace internal | 116 } // namespace internal |
113 } // namespace ash | 117 } // namespace ash |
OLD | NEW |