| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser_frame_mus.h" | 5 #include "chrome/browser/ui/views/frame/browser_frame_mus.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "chrome/browser/ui/views/frame/browser_frame.h" | 9 #include "chrome/browser/ui/views/frame/browser_frame.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 11 #include "chrome/common/extensions/extension_constants.h" | 11 #include "chrome/common/extensions/extension_constants.h" |
| 12 #include "services/ui/public/cpp/property_type_converters.h" | 12 #include "services/ui/public/cpp/property_type_converters.h" |
| 13 #include "services/ui/public/cpp/window.h" | |
| 14 #include "services/ui/public/interfaces/window_tree.mojom.h" | 13 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 15 #include "ui/views/mus/window_manager_connection.h" | 14 #include "ui/views/mus/desktop_window_tree_host_mus.h" |
| 15 #include "ui/views/mus/mus_client.h" |
| 16 #include "ui/views/mus/window_manager_frame_values.h" | 16 #include "ui/views/mus/window_manager_frame_values.h" |
| 17 | 17 |
| 18 namespace { | 18 BrowserFrameMus::BrowserFrameMus(BrowserFrame* browser_frame, |
| 19 BrowserView* browser_view) |
| 20 : views::DesktopNativeWidgetAura(browser_frame), |
| 21 browser_frame_(browser_frame), |
| 22 browser_view_(browser_view) {} |
| 19 | 23 |
| 20 views::Widget::InitParams GetWidgetParamsImpl(BrowserView* browser_view) { | 24 BrowserFrameMus::~BrowserFrameMus() {} |
| 25 |
| 26 views::Widget::InitParams BrowserFrameMus::GetWidgetParams() { |
| 21 views::Widget::InitParams params; | 27 views::Widget::InitParams params; |
| 28 params.native_widget = this; |
| 22 params.bounds = gfx::Rect(10, 10, 640, 480); | 29 params.bounds = gfx::Rect(10, 10, 640, 480); |
| 23 params.delegate = browser_view; | 30 params.delegate = browser_view_; |
| 24 return params; | 31 std::map<std::string, std::vector<uint8_t>> properties = |
| 25 } | 32 views::MusClient::ConfigurePropertiesFromParams(params); |
| 26 | |
| 27 ui::Window* CreateMusWindow(BrowserView* browser_view) { | |
| 28 std::map<std::string, std::vector<uint8_t>> properties; | |
| 29 views::NativeWidgetMus::ConfigurePropertiesForNewWindow( | |
| 30 GetWidgetParamsImpl(browser_view), &properties); | |
| 31 const std::string chrome_app_id(extension_misc::kChromeAppId); | 33 const std::string chrome_app_id(extension_misc::kChromeAppId); |
| 32 // Indicates mash shouldn't handle immersive, rather we will. | 34 // Indicates mash shouldn't handle immersive, rather we will. |
| 33 properties[ui::mojom::WindowManager::kDisableImmersive_InitProperty] = | 35 properties[ui::mojom::WindowManager::kDisableImmersive_InitProperty] = |
| 34 mojo::ConvertTo<std::vector<uint8_t>>(true); | 36 mojo::ConvertTo<std::vector<uint8_t>>(true); |
| 35 properties[ui::mojom::WindowManager::kAppID_Property] = | 37 properties[ui::mojom::WindowManager::kAppID_Property] = |
| 36 mojo::ConvertTo<std::vector<uint8_t>>(chrome_app_id); | 38 mojo::ConvertTo<std::vector<uint8_t>>(chrome_app_id); |
| 37 return views::WindowManagerConnection::Get()->NewTopLevelWindow(properties); | 39 std::unique_ptr<views::DesktopWindowTreeHostMus> desktop_window_tree_host = |
| 38 } | 40 base::MakeUnique<views::DesktopWindowTreeHostMus>(browser_frame_, this, |
| 39 | 41 &properties); |
| 40 } // namespace | 42 // BrowserNonClientFrameViewMus::OnBoundsChanged() takes care of updating |
| 41 | 43 // the insets. |
| 42 BrowserFrameMus::BrowserFrameMus(BrowserFrame* browser_frame, | 44 desktop_window_tree_host->set_auto_update_client_area(false); |
| 43 BrowserView* browser_view) | 45 SetDesktopWindowTreeHost(std::move(desktop_window_tree_host)); |
| 44 : views::NativeWidgetMus(browser_frame, | |
| 45 CreateMusWindow(browser_view), | |
| 46 ui::mojom::CompositorFrameSinkType::DEFAULT), | |
| 47 browser_view_(browser_view) {} | |
| 48 | |
| 49 BrowserFrameMus::~BrowserFrameMus() {} | |
| 50 | |
| 51 views::Widget::InitParams BrowserFrameMus::GetWidgetParams() { | |
| 52 views::Widget::InitParams params(GetWidgetParamsImpl(browser_view_)); | |
| 53 params.native_widget = this; | |
| 54 return params; | 46 return params; |
| 55 } | 47 } |
| 56 | 48 |
| 57 bool BrowserFrameMus::UseCustomFrame() const { | 49 bool BrowserFrameMus::UseCustomFrame() const { |
| 58 return true; | 50 return true; |
| 59 } | 51 } |
| 60 | 52 |
| 61 bool BrowserFrameMus::UsesNativeSystemMenu() const { | 53 bool BrowserFrameMus::UsesNativeSystemMenu() const { |
| 62 return false; | 54 return false; |
| 63 } | 55 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 78 } | 70 } |
| 79 | 71 |
| 80 bool BrowserFrameMus::HandleKeyboardEvent( | 72 bool BrowserFrameMus::HandleKeyboardEvent( |
| 81 const content::NativeWebKeyboardEvent& event) { | 73 const content::NativeWebKeyboardEvent& event) { |
| 82 return false; | 74 return false; |
| 83 } | 75 } |
| 84 | 76 |
| 85 int BrowserFrameMus::GetMinimizeButtonOffset() const { | 77 int BrowserFrameMus::GetMinimizeButtonOffset() const { |
| 86 return 0; | 78 return 0; |
| 87 } | 79 } |
| 88 | |
| 89 void BrowserFrameMus::UpdateClientArea() { | |
| 90 // BrowserNonClientFrameViewMus::OnBoundsChanged() takes care of updating | |
| 91 // the insets. | |
| 92 } | |
| OLD | NEW |