OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/apps/chrome_native_app_window_views_aura_ash.h
" | 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_aura_ash.h
" |
6 | 6 |
7 #include "apps/ui/views/app_window_frame_view.h" | 7 #include "apps/ui/views/app_window_frame_view.h" |
8 #include "ash/common/ash_constants.h" | 8 #include "ash/common/ash_constants.h" |
9 #include "ash/common/ash_switches.h" | 9 #include "ash/common/ash_switches.h" |
10 #include "ash/common/frame/custom_frame_view_ash.h" | 10 #include "ash/common/frame/custom_frame_view_ash.h" |
11 #include "ash/common/shelf/shelf_item_types.h" | 11 #include "ash/common/shelf/shelf_item_types.h" |
12 #include "ash/common/wm/panels/panel_frame_view.h" | 12 #include "ash/common/wm/panels/panel_frame_view.h" |
13 #include "ash/common/wm/window_state.h" | 13 #include "ash/common/wm/window_state.h" |
14 #include "ash/common/wm/window_state_delegate.h" | 14 #include "ash/common/wm/window_state_delegate.h" |
15 #include "ash/common/wm/window_state_observer.h" | 15 #include "ash/common/wm/window_state_observer.h" |
16 #include "ash/common/wm_window.h" | 16 #include "ash/common/wm_window.h" |
17 #include "ash/public/cpp/shell_window_ids.h" | 17 #include "ash/public/cpp/shell_window_ids.h" |
18 #include "ash/public/cpp/window_properties.h" | 18 #include "ash/public/cpp/window_properties.h" |
19 #include "ash/screen_util.h" | |
20 #include "ash/shared/app_types.h" | 19 #include "ash/shared/app_types.h" |
21 #include "ash/shared/immersive_fullscreen_controller.h" | 20 #include "ash/shared/immersive_fullscreen_controller.h" |
22 #include "ash/shell.h" | 21 #include "ash/shell.h" |
23 #include "ash/wm/window_properties.h" | 22 #include "ash/wm/window_properties.h" |
24 #include "ash/wm/window_state_aura.h" | 23 #include "ash/wm/window_state_aura.h" |
25 #include "chrome/browser/chromeos/note_taking_helper.h" | 24 #include "chrome/browser/chromeos/note_taking_helper.h" |
26 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/ui/ash/ash_util.h" | 26 #include "chrome/browser/ui/ash/ash_util.h" |
28 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" | 27 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" |
29 #include "services/service_manager/runner/common/client_util.h" | 28 #include "services/service_manager/runner/common/client_util.h" |
30 #include "services/ui/public/cpp/property_type_converters.h" | 29 #include "services/ui/public/cpp/property_type_converters.h" |
31 #include "services/ui/public/interfaces/window_manager.mojom.h" | 30 #include "services/ui/public/interfaces/window_manager.mojom.h" |
32 #include "ui/aura/client/aura_constants.h" | 31 #include "ui/aura/client/aura_constants.h" |
33 #include "ui/aura/mus/property_converter.h" | 32 #include "ui/aura/mus/property_converter.h" |
34 #include "ui/aura/mus/window_tree_host_mus.h" | 33 #include "ui/aura/mus/window_tree_host_mus.h" |
35 #include "ui/aura/window.h" | 34 #include "ui/aura/window.h" |
36 #include "ui/aura/window_observer.h" | 35 #include "ui/aura/window_observer.h" |
37 #include "ui/base/hit_test.h" | 36 #include "ui/base/hit_test.h" |
38 #include "ui/base/models/simple_menu_model.h" | 37 #include "ui/base/models/simple_menu_model.h" |
39 #include "ui/gfx/skia_util.h" | 38 #include "ui/gfx/skia_util.h" |
40 #include "ui/views/controls/menu/menu_model_adapter.h" | 39 #include "ui/views/controls/menu/menu_model_adapter.h" |
41 #include "ui/views/controls/menu/menu_runner.h" | 40 #include "ui/views/controls/menu/menu_runner.h" |
42 #include "ui/views/widget/widget.h" | 41 #include "ui/views/widget/widget.h" |
| 42 #include "ui/wm/core/coordinate_conversion.h" |
43 | 43 |
44 using extensions::AppWindow; | 44 using extensions::AppWindow; |
45 | 45 |
46 namespace { | 46 namespace { |
47 | 47 |
48 // This class handles a user's fullscreen request (Shift+F4/F4). | 48 // This class handles a user's fullscreen request (Shift+F4/F4). |
49 class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate, | 49 class NativeAppWindowStateDelegate : public ash::wm::WindowStateDelegate, |
50 public ash::wm::WindowStateObserver, | 50 public ash::wm::WindowStateObserver, |
51 public aura::WindowObserver { | 51 public aura::WindowObserver { |
52 public: | 52 public: |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 if (chrome::IsRunningInMash()) { | 193 if (chrome::IsRunningInMash()) { |
194 // Ash's ShelfWindowWatcher handles app panel windows once this type is set. | 194 // Ash's ShelfWindowWatcher handles app panel windows once this type is set. |
195 init_params | 195 init_params |
196 ->mus_properties[ui::mojom::WindowManager::kShelfItemType_Property] = | 196 ->mus_properties[ui::mojom::WindowManager::kShelfItemType_Property] = |
197 mojo::ConvertTo<std::vector<uint8_t>>( | 197 mojo::ConvertTo<std::vector<uint8_t>>( |
198 static_cast<aura::PropertyConverter::PrimitiveType>( | 198 static_cast<aura::PropertyConverter::PrimitiveType>( |
199 ash::TYPE_APP_PANEL)); | 199 ash::TYPE_APP_PANEL)); |
200 } else if (ash::Shell::HasInstance() && use_default_bounds) { | 200 } else if (ash::Shell::HasInstance() && use_default_bounds) { |
201 // Open a new panel on the target root. | 201 // Open a new panel on the target root. |
202 init_params->context = ash::Shell::GetTargetRootWindow(); | 202 init_params->context = ash::Shell::GetTargetRootWindow(); |
203 init_params->bounds = ash::ScreenUtil::ConvertRectToScreen( | 203 init_params->bounds = gfx::Rect(GetPreferredSize()); |
204 ash::Shell::GetTargetRootWindow(), gfx::Rect(GetPreferredSize())); | 204 wm::ConvertRectToScreen(ash::Shell::GetTargetRootWindow(), |
| 205 &init_params->bounds); |
205 } | 206 } |
206 } | 207 } |
207 | 208 |
208 views::NonClientFrameView* | 209 views::NonClientFrameView* |
209 ChromeNativeAppWindowViewsAuraAsh::CreateNonStandardAppFrame() { | 210 ChromeNativeAppWindowViewsAuraAsh::CreateNonStandardAppFrame() { |
210 apps::AppWindowFrameView* frame = new apps::AppWindowFrameView(widget(), this, | 211 apps::AppWindowFrameView* frame = new apps::AppWindowFrameView(widget(), this, |
211 HasFrameColor(), ActiveFrameColor(), InactiveFrameColor()); | 212 HasFrameColor(), ActiveFrameColor(), InactiveFrameColor()); |
212 frame->Init(); | 213 frame->Init(); |
213 | 214 |
214 // For Aura windows on the Ash desktop the sizes are different and the user | 215 // For Aura windows on the Ash desktop the sizes are different and the user |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 window_tree_host->SetClientArea(insets, | 394 window_tree_host->SetClientArea(insets, |
394 std::move(additional_client_regions)); | 395 std::move(additional_client_regions)); |
395 } | 396 } |
396 } | 397 } |
397 | 398 |
398 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { | 399 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { |
399 menu_runner_.reset(); | 400 menu_runner_.reset(); |
400 menu_model_adapter_.reset(); | 401 menu_model_adapter_.reset(); |
401 menu_model_.reset(); | 402 menu_model_.reset(); |
402 } | 403 } |
OLD | NEW |