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

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

Issue 1588853002: Removal of ash related code from chrome_native_app_window_views_win (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/shell.h"
9 #include "base/command_line.h" 8 #include "base/command_line.h"
10 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
11 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
12 #include "base/threading/sequenced_worker_pool.h" 11 #include "base/threading/sequenced_worker_pool.h"
13 #include "chrome/browser/apps/per_app_settings_service.h" 12 #include "chrome/browser/apps/per_app_settings_service.h"
14 #include "chrome/browser/apps/per_app_settings_service_factory.h" 13 #include "chrome/browser/apps/per_app_settings_service_factory.h"
15 #include "chrome/browser/profiles/profile.h" 14 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/shell_integration.h" 15 #include "chrome/browser/shell_integration.h"
17 #include "chrome/browser/ui/views/apps/app_window_desktop_native_widget_aura_win .h" 16 #include "chrome/browser/ui/views/apps/app_window_desktop_native_widget_aura_win .h"
18 #include "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h" 17 #include "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h"
(...skipping 16 matching lines...) Expand all
35 : glass_frame_view_(NULL), is_translucent_(false), weak_ptr_factory_(this) { 34 : glass_frame_view_(NULL), is_translucent_(false), weak_ptr_factory_(this) {
36 } 35 }
37 36
38 ChromeNativeAppWindowViewsWin::~ChromeNativeAppWindowViewsWin() { 37 ChromeNativeAppWindowViewsWin::~ChromeNativeAppWindowViewsWin() {
39 } 38 }
40 39
41 HWND ChromeNativeAppWindowViewsWin::GetNativeAppWindowHWND() const { 40 HWND ChromeNativeAppWindowViewsWin::GetNativeAppWindowHWND() const {
42 return views::HWNDForWidget(widget()->GetTopLevelWidget()); 41 return views::HWNDForWidget(widget()->GetTopLevelWidget());
43 } 42 }
44 43
45 bool ChromeNativeAppWindowViewsWin::IsRunningInAsh() {
46 if (!ash::Shell::HasInstance())
47 return false;
48
49 views::Widget* widget = GetWidget();
50 chrome::HostDesktopType host_desktop_type =
51 chrome::GetHostDesktopTypeForNativeWindow(widget->GetNativeWindow());
52 return host_desktop_type == chrome::HOST_DESKTOP_TYPE_ASH;
53 }
54
55 void ChromeNativeAppWindowViewsWin::EnsureCaptionStyleSet() { 44 void ChromeNativeAppWindowViewsWin::EnsureCaptionStyleSet() {
56 // Windows seems to have issues maximizing windows without WS_CAPTION. 45 // Windows seems to have issues maximizing windows without WS_CAPTION.
57 // The default views / Aura implementation will remove this if we are using 46 // The default views / Aura implementation will remove this if we are using
58 // frameless or colored windows, so we put it back here. 47 // frameless or colored windows, so we put it back here.
59 HWND hwnd = GetNativeAppWindowHWND(); 48 HWND hwnd = GetNativeAppWindowHWND();
60 int current_style = ::GetWindowLong(hwnd, GWL_STYLE); 49 int current_style = ::GetWindowLong(hwnd, GWL_STYLE);
61 ::SetWindowLong(hwnd, GWL_STYLE, current_style | WS_CAPTION); 50 ::SetWindowLong(hwnd, GWL_STYLE, current_style | WS_CAPTION);
62 } 51 }
63 52
64 void ChromeNativeAppWindowViewsWin::OnBeforeWidgetInit( 53 void ChromeNativeAppWindowViewsWin::OnBeforeWidgetInit(
(...skipping 18 matching lines...) Expand all
83 PerAppSettingsService* settings = 72 PerAppSettingsService* settings =
84 PerAppSettingsServiceFactory::GetForBrowserContext(browser_context); 73 PerAppSettingsServiceFactory::GetForBrowserContext(browser_context);
85 if (settings->HasDesktopLastLaunchedFrom(extension_id)) { 74 if (settings->HasDesktopLastLaunchedFrom(extension_id)) {
86 desktop_type = settings->GetDesktopLastLaunchedFrom(extension_id); 75 desktop_type = settings->GetDesktopLastLaunchedFrom(extension_id);
87 } else { 76 } else {
88 // We don't know what desktop this app was last launched from, so take our 77 // We don't know what desktop this app was last launched from, so take our
89 // best guess as to what desktop the user is on. 78 // best guess as to what desktop the user is on.
90 desktop_type = chrome::GetActiveDesktop(); 79 desktop_type = chrome::GetActiveDesktop();
91 } 80 }
92 } 81 }
93 if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) 82 init_params->native_widget = new AppWindowDesktopNativeWidgetAuraWin(this);
94 init_params->context = ash::Shell::GetPrimaryRootWindow();
95 else
96 init_params->native_widget = new AppWindowDesktopNativeWidgetAuraWin(this);
97 83
98 is_translucent_ = 84 is_translucent_ =
99 init_params->opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW; 85 init_params->opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW;
100 } 86 }
101 87
102 void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow( 88 void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow(
103 const extensions::AppWindow::CreateParams& create_params) { 89 const extensions::AppWindow::CreateParams& create_params) {
104 ChromeNativeAppWindowViewsAura::InitializeDefaultWindow(create_params); 90 ChromeNativeAppWindowViewsAura::InitializeDefaultWindow(create_params);
105 91
106 // Remaining initialization is for Windows shell integration, which doesn't
107 // apply to app windows in Ash.
108 if (IsRunningInAsh())
109 return;
110
111 const extensions::Extension* extension = app_window()->GetExtension(); 92 const extensions::Extension* extension = app_window()->GetExtension();
112 if (!extension) 93 if (!extension)
113 return; 94 return;
114 95
115 std::string app_name = 96 std::string app_name =
116 web_app::GenerateApplicationNameFromExtensionId(extension->id()); 97 web_app::GenerateApplicationNameFromExtensionId(extension->id());
117 base::string16 app_name_wide = base::UTF8ToWide(app_name); 98 base::string16 app_name_wide = base::UTF8ToWide(app_name);
118 HWND hwnd = GetNativeAppWindowHWND(); 99 HWND hwnd = GetNativeAppWindowHWND();
119 Profile* profile = 100 Profile* profile =
120 Profile::FromBrowserContext(app_window()->browser_context()); 101 Profile::FromBrowserContext(app_window()->browser_context());
(...skipping 16 matching lines...) Expand all
137 } 118 }
138 return ChromeNativeAppWindowViewsAura::CreateStandardDesktopAppFrame(); 119 return ChromeNativeAppWindowViewsAura::CreateStandardDesktopAppFrame();
139 } 120 }
140 121
141 bool ChromeNativeAppWindowViewsWin::CanMinimize() const { 122 bool ChromeNativeAppWindowViewsWin::CanMinimize() const {
142 // Resizing on Windows breaks translucency if the window also has shape. 123 // Resizing on Windows breaks translucency if the window also has shape.
143 // See http://crbug.com/417947. 124 // See http://crbug.com/417947.
144 return ChromeNativeAppWindowViewsAura::CanMinimize() && 125 return ChromeNativeAppWindowViewsAura::CanMinimize() &&
145 !(WidgetHasHitTestMask() && is_translucent_); 126 !(WidgetHasHitTestMask() && is_translucent_);
146 } 127 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/apps/chrome_native_app_window_views_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698