OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" | 5 #include "chrome/browser/ui/views/frame/immersive_mode_controller_ash.h" |
6 | 6 |
7 #include "ash/common/material_design/material_design_controller.h" | 7 #include "ash/common/material_design/material_design_controller.h" |
8 #include "ash/common/wm/window_state.h" | 8 #include "ash/common/wm/window_state.h" |
9 #include "ash/shared/immersive_revealed_lock.h" | 9 #include "ash/shared/immersive_revealed_lock.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
11 #include "ash/wm/window_state_aura.h" | 11 #include "ash/wm/window_state_aura.h" |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/ui/ash/ash_util.h" | 14 #include "chrome/browser/ui/ash/ash_util.h" |
15 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" | 15 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" |
16 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 16 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
17 #include "chrome/browser/ui/views/frame/browser_view.h" | 17 #include "chrome/browser/ui/views/frame/browser_view.h" |
18 #include "chrome/browser/ui/views/frame/top_container_view.h" | 18 #include "chrome/browser/ui/views/frame/top_container_view.h" |
19 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 19 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
22 #include "services/ui/public/cpp/property_type_converters.h" | 22 #include "services/ui/public/cpp/property_type_converters.h" |
| 23 #include "services/ui/public/cpp/window_tree_client.h" |
23 #include "services/ui/public/interfaces/window_manager.mojom.h" | 24 #include "services/ui/public/interfaces/window_manager.mojom.h" |
24 #include "ui/aura/mus/mus_util.h" | 25 #include "ui/aura/mus/mus_util.h" |
25 #include "ui/aura/mus/property_converter.h" | 26 #include "ui/aura/mus/property_converter.h" |
26 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
27 #include "ui/compositor/paint_context.h" | 28 #include "ui/compositor/paint_context.h" |
28 #include "ui/compositor/paint_recorder.h" | 29 #include "ui/compositor/paint_recorder.h" |
29 #include "ui/views/mus/mus_client.h" | 30 #include "ui/views/mus/native_widget_mus.h" |
| 31 #include "ui/views/mus/window_manager_connection.h" |
30 #include "ui/views/view.h" | 32 #include "ui/views/view.h" |
31 #include "ui/views/widget/widget.h" | 33 #include "ui/views/widget/widget.h" |
32 #include "ui/views/window/non_client_view.h" | 34 #include "ui/views/window/non_client_view.h" |
33 | 35 |
34 namespace { | 36 namespace { |
35 | 37 |
36 // Revealing the TopContainerView looks better if the animation starts and ends | 38 // Revealing the TopContainerView looks better if the animation starts and ends |
37 // just a few pixels before the view goes offscreen, which reduces the visual | 39 // just a few pixels before the view goes offscreen, which reduces the visual |
38 // "pop" as the 3-pixel tall "light bar" style tab strip becomes visible. | 40 // "pop" as the 3-pixel tall "light bar" style tab strip becomes visible. |
39 const int kAnimationOffsetY = 3; | 41 const int kAnimationOffsetY = 3; |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 return true; | 223 return true; |
222 } | 224 } |
223 return false; | 225 return false; |
224 } | 226 } |
225 | 227 |
226 void ImmersiveModeControllerAsh::CreateMashRevealWidget() { | 228 void ImmersiveModeControllerAsh::CreateMashRevealWidget() { |
227 if (!chrome::IsRunningInMash()) | 229 if (!chrome::IsRunningInMash()) |
228 return; | 230 return; |
229 | 231 |
230 DCHECK(!mash_reveal_widget_); | 232 DCHECK(!mash_reveal_widget_); |
231 mash_reveal_widget_ = base::MakeUnique<views::Widget>(); | 233 mash_reveal_widget_.reset(new views::Widget); |
232 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_POPUP); | 234 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_POPUP); |
233 init_params.mus_properties | 235 std::map<std::string, std::vector<uint8_t>> window_properties; |
234 [ui::mojom::WindowManager::kRenderParentTitleArea_Property] = | 236 window_properties[ui::mojom::WindowManager::kRenderParentTitleArea_Property] = |
235 mojo::ConvertTo<std::vector<uint8_t>>( | 237 mojo::ConvertTo<std::vector<uint8_t>>( |
236 static_cast<aura::PropertyConverter::PrimitiveType>(true)); | 238 static_cast<aura::PropertyConverter::PrimitiveType>(true)); |
237 init_params.name = "ChromeImmersiveRevealWindow"; | 239 window_properties[ui::mojom::WindowManager::kName_Property] = |
| 240 mojo::ConvertTo<std::vector<uint8_t>>( |
| 241 std::string("ChromeImmersiveRevealWindow")); |
| 242 init_params.native_widget = new views::NativeWidgetMus( |
| 243 mash_reveal_widget_.get(), |
| 244 views::WindowManagerConnection::Get()->client()->NewWindow( |
| 245 &window_properties), |
| 246 ui::mojom::CompositorFrameSinkType::DEFAULT); |
238 init_params.accept_events = false; | 247 init_params.accept_events = false; |
239 init_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 248 init_params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
240 init_params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; | 249 init_params.activatable = views::Widget::InitParams::ACTIVATABLE_NO; |
241 init_params.parent = native_window_; | 250 init_params.parent_mus = GetMusWindow(native_window_); |
242 const gfx::Rect& top_container_bounds = | 251 const gfx::Rect& top_container_bounds = |
243 browser_view_->top_container()->bounds(); | 252 browser_view_->top_container()->bounds(); |
244 init_params.bounds = | 253 init_params.bounds = |
245 gfx::Rect(0, -top_container_bounds.height(), top_container_bounds.width(), | 254 gfx::Rect(0, -top_container_bounds.height(), top_container_bounds.width(), |
246 top_container_bounds.height()); | 255 top_container_bounds.height()); |
247 mash_reveal_widget_->Init(init_params); | 256 mash_reveal_widget_->Init(init_params); |
248 mash_reveal_widget_->SetContentsView( | 257 mash_reveal_widget_->SetContentsView( |
249 new DelegatingPaintView(browser_view_->top_container())); | 258 new DelegatingPaintView(browser_view_->top_container())); |
250 mash_reveal_widget_->StackAtTop(); | 259 mash_reveal_widget_->StackAtTop(); |
251 mash_reveal_widget_->Show(); | 260 mash_reveal_widget_->Show(); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
350 // the shelf completely and prevent it from being revealed. | 359 // the shelf completely and prevent it from being revealed. |
351 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> | 360 bool in_tab_fullscreen = content::Source<FullscreenController>(source)-> |
352 IsWindowFullscreenForTabOrPending(); | 361 IsWindowFullscreenForTabOrPending(); |
353 ash::wm::GetWindowState(native_window_) | 362 ash::wm::GetWindowState(native_window_) |
354 ->set_hide_shelf_when_fullscreen(in_tab_fullscreen); | 363 ->set_hide_shelf_when_fullscreen(in_tab_fullscreen); |
355 ash::Shell::GetInstance()->UpdateShelfVisibility(); | 364 ash::Shell::GetInstance()->UpdateShelfVisibility(); |
356 | 365 |
357 if (tab_indicator_visibility_changed) | 366 if (tab_indicator_visibility_changed) |
358 LayoutBrowserRootView(); | 367 LayoutBrowserRootView(); |
359 } | 368 } |
OLD | NEW |