| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/native_app_window_views_win.h" | 5 #include "chrome/browser/ui/views/apps/native_app_window_views_win.h" |
| 6 | 6 |
| 7 #include "apps/shell_window.h" | 7 #include "apps/app_window.h" |
| 8 #include "apps/shell_window_registry.h" | 8 #include "apps/app_window_registry.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "chrome/browser/apps/per_app_settings_service.h" | 10 #include "chrome/browser/apps/per_app_settings_service.h" |
| 11 #include "chrome/browser/apps/per_app_settings_service_factory.h" | 11 #include "chrome/browser/apps/per_app_settings_service_factory.h" |
| 12 #include "chrome/browser/metro_utils/metro_chrome_win.h" | 12 #include "chrome/browser/metro_utils/metro_chrome_win.h" |
| 13 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 14 #include "ui/aura/remote_window_tree_host_win.h" | 14 #include "ui/aura/remote_window_tree_host_win.h" |
| 15 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 15 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
| 16 | 16 |
| 17 NativeAppWindowViewsWin::NativeAppWindowViewsWin() { | 17 NativeAppWindowViewsWin::NativeAppWindowViewsWin() { |
| 18 } | 18 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 31 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH && | 31 if (host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH && |
| 32 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_NATIVE) { | 32 chrome::GetActiveDesktop() == chrome::HOST_DESKTOP_TYPE_NATIVE) { |
| 33 chrome::ActivateMetroChrome(); | 33 chrome::ActivateMetroChrome(); |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 void NativeAppWindowViewsWin::OnBeforeWidgetInit( | 37 void NativeAppWindowViewsWin::OnBeforeWidgetInit( |
| 38 views::Widget::InitParams* init_params, views::Widget* widget) { | 38 views::Widget::InitParams* init_params, views::Widget* widget) { |
| 39 // If an app has any existing windows, ensure new ones are created on the | 39 // If an app has any existing windows, ensure new ones are created on the |
| 40 // same desktop. | 40 // same desktop. |
| 41 apps::ShellWindow* any_existing_window = | 41 apps::AppWindow* any_existing_window = |
| 42 apps::ShellWindowRegistry::Get(browser_context()) | 42 apps::AppWindowRegistry::Get(browser_context()) |
| 43 ->GetCurrentShellWindowForApp(extension()->id()); | 43 ->GetCurrentAppWindowForApp(extension()->id()); |
| 44 chrome::HostDesktopType desktop_type; | 44 chrome::HostDesktopType desktop_type; |
| 45 if (any_existing_window) { | 45 if (any_existing_window) { |
| 46 desktop_type = chrome::GetHostDesktopTypeForNativeWindow( | 46 desktop_type = chrome::GetHostDesktopTypeForNativeWindow( |
| 47 any_existing_window->GetNativeWindow()); | 47 any_existing_window->GetNativeWindow()); |
| 48 } else { | 48 } else { |
| 49 PerAppSettingsService* settings = | 49 PerAppSettingsService* settings = |
| 50 PerAppSettingsServiceFactory::GetForBrowserContext(browser_context()); | 50 PerAppSettingsServiceFactory::GetForBrowserContext(browser_context()); |
| 51 if (settings->HasDesktopLastLaunchedFrom(extension()->id())) { | 51 if (settings->HasDesktopLastLaunchedFrom(extension()->id())) { |
| 52 desktop_type = settings->GetDesktopLastLaunchedFrom(extension()->id()); | 52 desktop_type = settings->GetDesktopLastLaunchedFrom(extension()->id()); |
| 53 } else { | 53 } else { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 64 | 64 |
| 65 void NativeAppWindowViewsWin::Show() { | 65 void NativeAppWindowViewsWin::Show() { |
| 66 ActivateParentDesktopIfNecessary(); | 66 ActivateParentDesktopIfNecessary(); |
| 67 NativeAppWindowViews::Show(); | 67 NativeAppWindowViews::Show(); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void NativeAppWindowViewsWin::Activate() { | 70 void NativeAppWindowViewsWin::Activate() { |
| 71 ActivateParentDesktopIfNecessary(); | 71 ActivateParentDesktopIfNecessary(); |
| 72 NativeAppWindowViews::Activate(); | 72 NativeAppWindowViews::Activate(); |
| 73 } | 73 } |
| OLD | NEW |