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/aura/wm_window_aura.h" | 8 #include "ash/aura/wm_window_aura.h" |
9 #include "ash/common/ash_constants.h" | 9 #include "ash/common/ash_constants.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/shell_window_ids.h" | 11 #include "ash/common/shell_window_ids.h" |
12 #include "ash/common/wm/window_state.h" | 12 #include "ash/common/wm/window_state.h" |
13 #include "ash/common/wm/window_state_delegate.h" | 13 #include "ash/common/wm/window_state_delegate.h" |
14 #include "ash/common/wm/window_state_observer.h" | 14 #include "ash/common/wm/window_state_observer.h" |
15 #include "ash/screen_util.h" | 15 #include "ash/screen_util.h" |
| 16 #include "ash/shared/app_types.h" |
16 #include "ash/shared/immersive_fullscreen_controller.h" | 17 #include "ash/shared/immersive_fullscreen_controller.h" |
17 #include "ash/shell.h" | 18 #include "ash/shell.h" |
18 #include "ash/wm/panels/panel_frame_view.h" | 19 #include "ash/wm/panels/panel_frame_view.h" |
19 #include "ash/wm/window_properties.h" | 20 #include "ash/wm/window_properties.h" |
20 #include "ash/wm/window_state_aura.h" | 21 #include "ash/wm/window_state_aura.h" |
| 22 #include "chrome/browser/chromeos/note_taking_app_utils.h" |
| 23 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/ui/ash/ash_util.h" | 24 #include "chrome/browser/ui/ash/ash_util.h" |
22 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" | 25 #include "chrome/browser/ui/ash/multi_user/multi_user_context_menu.h" |
23 #include "services/ui/public/cpp/property_type_converters.h" | 26 #include "services/ui/public/cpp/property_type_converters.h" |
24 #include "services/ui/public/cpp/window.h" | 27 #include "services/ui/public/cpp/window.h" |
25 #include "services/ui/public/interfaces/window_manager.mojom.h" | 28 #include "services/ui/public/interfaces/window_manager.mojom.h" |
26 #include "ui/aura/client/aura_constants.h" | 29 #include "ui/aura/client/aura_constants.h" |
27 #include "ui/aura/mus/mus_util.h" | 30 #include "ui/aura/mus/mus_util.h" |
28 #include "ui/aura/window.h" | 31 #include "ui/aura/window.h" |
29 #include "ui/aura/window_observer.h" | 32 #include "ui/aura/window_observer.h" |
30 #include "ui/base/hit_test.h" | 33 #include "ui/base/hit_test.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 128 |
126 void ChromeNativeAppWindowViewsAuraAsh::InitializeWindow( | 129 void ChromeNativeAppWindowViewsAuraAsh::InitializeWindow( |
127 AppWindow* app_window, | 130 AppWindow* app_window, |
128 const AppWindow::CreateParams& create_params) { | 131 const AppWindow::CreateParams& create_params) { |
129 ChromeNativeAppWindowViewsAura::InitializeWindow(app_window, create_params); | 132 ChromeNativeAppWindowViewsAura::InitializeWindow(app_window, create_params); |
130 // Restore docked state on ash desktop. | 133 // Restore docked state on ash desktop. |
131 if (create_params.state == ui::SHOW_STATE_DOCKED) { | 134 if (create_params.state == ui::SHOW_STATE_DOCKED) { |
132 widget()->GetNativeWindow()->SetProperty(aura::client::kShowStateKey, | 135 widget()->GetNativeWindow()->SetProperty(aura::client::kShowStateKey, |
133 create_params.state); | 136 create_params.state); |
134 } | 137 } |
| 138 |
| 139 if (!app_window->window_type_is_panel()) { |
| 140 ash::AppType app_type = ash::AppType::CHROME_APP; |
| 141 Profile* profile = |
| 142 Profile::FromBrowserContext(app_window->browser_context()); |
| 143 if (profile && chromeos::IsNoteTakingAppWindow(app_window, profile)) |
| 144 app_type = ash::AppType::DEFAULT_NOTE_TAKING_APP; |
| 145 widget()->GetNativeWindow()->SetProperty(aura::client::kAppType, |
| 146 static_cast<int>(app_type)); |
| 147 } |
135 } | 148 } |
136 | 149 |
137 void ChromeNativeAppWindowViewsAuraAsh::OnBeforeWidgetInit( | 150 void ChromeNativeAppWindowViewsAuraAsh::OnBeforeWidgetInit( |
138 const AppWindow::CreateParams& create_params, | 151 const AppWindow::CreateParams& create_params, |
139 views::Widget::InitParams* init_params, | 152 views::Widget::InitParams* init_params, |
140 views::Widget* widget) { | 153 views::Widget* widget) { |
141 ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit(create_params, init_params, | 154 ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit(create_params, init_params, |
142 widget); | 155 widget); |
143 if (create_params.is_ime_window) { | 156 if (create_params.is_ime_window) { |
144 // Puts ime windows into ime window container. | 157 // Puts ime windows into ime window container. |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 GetMusWindow(widget()->GetNativeWindow()) | 362 GetMusWindow(widget()->GetNativeWindow()) |
350 ->SetClientArea(insets, std::move(additional_client_regions)); | 363 ->SetClientArea(insets, std::move(additional_client_regions)); |
351 } | 364 } |
352 } | 365 } |
353 | 366 |
354 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { | 367 void ChromeNativeAppWindowViewsAuraAsh::OnMenuClosed() { |
355 menu_runner_.reset(); | 368 menu_runner_.reset(); |
356 menu_model_adapter_.reset(); | 369 menu_model_adapter_.reset(); |
357 menu_model_.reset(); | 370 menu_model_.reset(); |
358 } | 371 } |
OLD | NEW |