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/screensaver/screensaver_view.h" | 5 #include "ash/screensaver/screensaver_view.h" |
6 | 6 |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/shell_delegate.h" | 8 #include "ash/shell_delegate.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "content/public/browser/browser_context.h" | 11 #include "content/public/browser/browser_context.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
| 13 #include "ui/aura/root_window.h" |
13 #include "ui/gfx/screen.h" | 14 #include "ui/gfx/screen.h" |
14 #include "ui/aura/root_window.h" | 15 #include "ui/views/controls/webview/webview.h" |
15 #include "ui/views/layout/fill_layout.h" | 16 #include "ui/views/layout/fill_layout.h" |
16 #include "ui/views/controls/webview/webview.h" | |
17 #include "ui/views/widget/widget.h" | 17 #include "ui/views/widget/widget.h" |
18 | 18 |
19 using content::BrowserThread; | 19 using content::BrowserThread; |
20 | 20 |
21 namespace { | 21 namespace { |
22 | 22 |
23 ash::internal::ScreensaverView* g_instance = NULL; | 23 ash::internal::ScreensaverView* g_instance = NULL; |
24 | 24 |
25 // Do not restart the screensaver again if it has | 25 // Do not restart the screensaver again if it has |
26 // terminated kMaxTerminations times already. | 26 // terminated kMaxTerminations times already. |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 screensaver_webview_->GetWebContents()->GetController().LoadURL( | 122 screensaver_webview_->GetWebContents()->GetController().LoadURL( |
123 url_, | 123 url_, |
124 content::Referrer(), | 124 content::Referrer(), |
125 content::PAGE_TRANSITION_START_PAGE, | 125 content::PAGE_TRANSITION_START_PAGE, |
126 std::string()); | 126 std::string()); |
127 } | 127 } |
128 | 128 |
129 void ScreensaverView::ShowWindow() { | 129 void ScreensaverView::ShowWindow() { |
130 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); | 130 aura::RootWindow* root_window = ash::Shell::GetPrimaryRootWindow(); |
131 gfx::Rect screen_rect = | 131 gfx::Rect screen_rect = |
132 gfx::Screen::GetMonitorNearestWindow(root_window).bounds(); | 132 gfx::Screen::GetDisplayNearestWindow(root_window).bounds(); |
133 | 133 |
134 // We want to be the fullscreen topmost child of the root window. | 134 // We want to be the fullscreen topmost child of the root window. |
135 // There should be nothing ever really that should show up on top of us. | 135 // There should be nothing ever really that should show up on top of us. |
136 container_window_ = new views::Widget(); | 136 container_window_ = new views::Widget(); |
137 views::Widget::InitParams params( | 137 views::Widget::InitParams params( |
138 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 138 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
139 params.delegate = this; | 139 params.delegate = this; |
140 params.parent = root_window; | 140 params.parent = root_window; |
141 container_window_->Init(params); | 141 container_window_->Init(params); |
142 | 142 |
143 container_window_->StackAtTop(); | 143 container_window_->StackAtTop(); |
144 container_window_->SetBounds(screen_rect); | 144 container_window_->SetBounds(screen_rect); |
145 container_window_->Show(); | 145 container_window_->Show(); |
146 } | 146 } |
147 | 147 |
148 // static | 148 // static |
149 ScreensaverView* ScreensaverView::GetInstance() { | 149 ScreensaverView* ScreensaverView::GetInstance() { |
150 return g_instance; | 150 return g_instance; |
151 } | 151 } |
152 | 152 |
153 } // namespace internal | 153 } // namespace internal |
154 } // namespace ash | 154 } // namespace ash |
OLD | NEW |