Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Side by Side Diff: chrome/browser/ui/views/apps/chrome_native_app_window_views_win.cc

Issue 1682183002: Remove PerAppSettingsService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_win.h" 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views_win.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 "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
11 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
12 #include "chrome/browser/apps/per_app_settings_service.h"
13 #include "chrome/browser/apps/per_app_settings_service_factory.h"
14 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/browser/shell_integration.h" 13 #include "chrome/browser/shell_integration.h"
16 #include "chrome/browser/ui/views/apps/app_window_desktop_native_widget_aura_win .h" 14 #include "chrome/browser/ui/views/apps/app_window_desktop_native_widget_aura_win .h"
17 #include "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h" 15 #include "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h"
18 #include "chrome/browser/web_applications/web_app.h" 16 #include "chrome/browser/web_applications/web_app.h"
19 #include "chrome/browser/web_applications/web_app_win.h" 17 #include "chrome/browser/web_applications/web_app_win.h"
20 #include "chrome/common/chrome_icon_resources_win.h" 18 #include "chrome/common/chrome_icon_resources_win.h"
21 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
22 #include "chrome/grit/generated_resources.h" 20 #include "chrome/grit/generated_resources.h"
23 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
(...skipping 24 matching lines...) Expand all
48 int current_style = ::GetWindowLong(hwnd, GWL_STYLE); 46 int current_style = ::GetWindowLong(hwnd, GWL_STYLE);
49 ::SetWindowLong(hwnd, GWL_STYLE, current_style | WS_CAPTION); 47 ::SetWindowLong(hwnd, GWL_STYLE, current_style | WS_CAPTION);
50 } 48 }
51 49
52 void ChromeNativeAppWindowViewsWin::OnBeforeWidgetInit( 50 void ChromeNativeAppWindowViewsWin::OnBeforeWidgetInit(
53 const extensions::AppWindow::CreateParams& create_params, 51 const extensions::AppWindow::CreateParams& create_params,
54 views::Widget::InitParams* init_params, 52 views::Widget::InitParams* init_params,
55 views::Widget* widget) { 53 views::Widget* widget) {
56 ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit(create_params, init_params, 54 ChromeNativeAppWindowViewsAura::OnBeforeWidgetInit(create_params, init_params,
57 widget); 55 widget);
58
59 content::BrowserContext* browser_context = app_window()->browser_context();
60 std::string extension_id = app_window()->extension_id();
61 // If an app has any existing windows, ensure new ones are created on the
62 // same desktop.
63 extensions::AppWindow* any_existing_window =
64 extensions::AppWindowRegistry::Get(browser_context)
65 ->GetCurrentAppWindowForApp(extension_id);
66 chrome::HostDesktopType desktop_type;
67 if (any_existing_window) {
68 desktop_type = chrome::GetHostDesktopTypeForNativeWindow(
69 any_existing_window->GetNativeWindow());
70 } else {
71 PerAppSettingsService* settings =
72 PerAppSettingsServiceFactory::GetForBrowserContext(browser_context);
73 if (settings->HasDesktopLastLaunchedFrom(extension_id)) {
74 desktop_type = settings->GetDesktopLastLaunchedFrom(extension_id);
75 } else {
76 // We don't know what desktop this app was last launched from, so take our
77 // best guess as to what desktop the user is on.
78 desktop_type = chrome::GetActiveDesktop();
79 }
80 }
81 init_params->native_widget = new AppWindowDesktopNativeWidgetAuraWin(this); 56 init_params->native_widget = new AppWindowDesktopNativeWidgetAuraWin(this);
82 57
83 is_translucent_ = 58 is_translucent_ =
84 init_params->opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW; 59 init_params->opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW;
85 } 60 }
86 61
87 void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow( 62 void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow(
88 const extensions::AppWindow::CreateParams& create_params) { 63 const extensions::AppWindow::CreateParams& create_params) {
89 ChromeNativeAppWindowViewsAura::InitializeDefaultWindow(create_params); 64 ChromeNativeAppWindowViewsAura::InitializeDefaultWindow(create_params);
90 65
(...skipping 26 matching lines...) Expand all
117 } 92 }
118 return ChromeNativeAppWindowViewsAura::CreateStandardDesktopAppFrame(); 93 return ChromeNativeAppWindowViewsAura::CreateStandardDesktopAppFrame();
119 } 94 }
120 95
121 bool ChromeNativeAppWindowViewsWin::CanMinimize() const { 96 bool ChromeNativeAppWindowViewsWin::CanMinimize() const {
122 // Resizing on Windows breaks translucency if the window also has shape. 97 // Resizing on Windows breaks translucency if the window also has shape.
123 // See http://crbug.com/417947. 98 // See http://crbug.com/417947.
124 return ChromeNativeAppWindowViewsAura::CanMinimize() && 99 return ChromeNativeAppWindowViewsAura::CanMinimize() &&
125 !(WidgetHasHitTestMask() && is_translucent_); 100 !(WidgetHasHitTestMask() && is_translucent_);
126 } 101 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/extensions/application_launch.cc ('k') | chrome/chrome_browser_extensions.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698