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