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

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

Issue 947343003: Split out Ash/Aura parts of ChromeNativeAppWindowViews. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ready for review. Created 5 years, 9 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 "ash/shell.h" 8 #include "ash/shell.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 // The default views / Aura implementation will remove this if we are using 70 // The default views / Aura implementation will remove this if we are using
71 // frameless or colored windows, so we put it back here. 71 // frameless or colored windows, so we put it back here.
72 HWND hwnd = GetNativeAppWindowHWND(); 72 HWND hwnd = GetNativeAppWindowHWND();
73 int current_style = ::GetWindowLong(hwnd, GWL_STYLE); 73 int current_style = ::GetWindowLong(hwnd, GWL_STYLE);
74 ::SetWindowLong(hwnd, GWL_STYLE, current_style | WS_CAPTION); 74 ::SetWindowLong(hwnd, GWL_STYLE, current_style | WS_CAPTION);
75 } 75 }
76 76
77 void ChromeNativeAppWindowViewsWin::OnBeforeWidgetInit( 77 void ChromeNativeAppWindowViewsWin::OnBeforeWidgetInit(
78 views::Widget::InitParams* init_params, 78 views::Widget::InitParams* init_params,
79 views::Widget* widget) { 79 views::Widget* widget) {
80 content::BrowserContext* browser_context = app_window()->browser_context(); 80 content::BrowserContext* browser_context = app_window()->browser_context();
tapted 2015/02/25 05:54:35 note you'll need to call ChromeNativeAppWindowView
jackhou1 2015/02/25 22:57:52 Done.
81 std::string extension_id = app_window()->extension_id(); 81 std::string extension_id = app_window()->extension_id();
82 // If an app has any existing windows, ensure new ones are created on the 82 // If an app has any existing windows, ensure new ones are created on the
83 // same desktop. 83 // same desktop.
84 extensions::AppWindow* any_existing_window = 84 extensions::AppWindow* any_existing_window =
85 extensions::AppWindowRegistry::Get(browser_context) 85 extensions::AppWindowRegistry::Get(browser_context)
86 ->GetCurrentAppWindowForApp(extension_id); 86 ->GetCurrentAppWindowForApp(extension_id);
87 chrome::HostDesktopType desktop_type; 87 chrome::HostDesktopType desktop_type;
88 if (any_existing_window) { 88 if (any_existing_window) {
89 desktop_type = chrome::GetHostDesktopTypeForNativeWindow( 89 desktop_type = chrome::GetHostDesktopTypeForNativeWindow(
90 any_existing_window->GetNativeWindow()); 90 any_existing_window->GetNativeWindow());
(...skipping 12 matching lines...) Expand all
103 init_params->context = ash::Shell::GetPrimaryRootWindow(); 103 init_params->context = ash::Shell::GetPrimaryRootWindow();
104 else 104 else
105 init_params->native_widget = new AppWindowDesktopNativeWidgetAuraWin(this); 105 init_params->native_widget = new AppWindowDesktopNativeWidgetAuraWin(this);
106 106
107 is_translucent_ = 107 is_translucent_ =
108 init_params->opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW; 108 init_params->opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW;
109 } 109 }
110 110
111 void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow( 111 void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow(
112 const extensions::AppWindow::CreateParams& create_params) { 112 const extensions::AppWindow::CreateParams& create_params) {
113 ChromeNativeAppWindowViews::InitializeDefaultWindow(create_params); 113 ChromeNativeAppWindowViewsAura::InitializeDefaultWindow(create_params);
114 114
115 // Remaining initialization is for Windows shell integration, which doesn't 115 // Remaining initialization is for Windows shell integration, which doesn't
116 // apply to app windows in Ash. 116 // apply to app windows in Ash.
117 if (IsRunningInAsh()) 117 if (IsRunningInAsh())
118 return; 118 return;
119 119
120 const extensions::Extension* extension = app_window()->GetExtension(); 120 const extensions::Extension* extension = app_window()->GetExtension();
121 if (!extension) 121 if (!extension)
122 return; 122 return;
123 123
(...skipping 14 matching lines...) Expand all
138 UpdateShelfMenu(); 138 UpdateShelfMenu();
139 } 139 }
140 140
141 views::NonClientFrameView* 141 views::NonClientFrameView*
142 ChromeNativeAppWindowViewsWin::CreateStandardDesktopAppFrame() { 142 ChromeNativeAppWindowViewsWin::CreateStandardDesktopAppFrame() {
143 glass_frame_view_ = NULL; 143 glass_frame_view_ = NULL;
144 if (ui::win::IsAeroGlassEnabled()) { 144 if (ui::win::IsAeroGlassEnabled()) {
145 glass_frame_view_ = new GlassAppWindowFrameViewWin(this, widget()); 145 glass_frame_view_ = new GlassAppWindowFrameViewWin(this, widget());
146 return glass_frame_view_; 146 return glass_frame_view_;
147 } 147 }
148 return ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame(); 148 return ChromeNativeAppWindowViewsAura::CreateStandardDesktopAppFrame();
149 } 149 }
150 150
151 void ChromeNativeAppWindowViewsWin::Show() { 151 void ChromeNativeAppWindowViewsWin::Show() {
152 ActivateParentDesktopIfNecessary(); 152 ActivateParentDesktopIfNecessary();
153 ChromeNativeAppWindowViews::Show(); 153 ChromeNativeAppWindowViewsAura::Show();
154 } 154 }
155 155
156 void ChromeNativeAppWindowViewsWin::Activate() { 156 void ChromeNativeAppWindowViewsWin::Activate() {
157 ActivateParentDesktopIfNecessary(); 157 ActivateParentDesktopIfNecessary();
158 ChromeNativeAppWindowViews::Activate(); 158 ChromeNativeAppWindowViewsAura::Activate();
159 } 159 }
160 160
161 bool ChromeNativeAppWindowViewsWin::CanMinimize() const { 161 bool ChromeNativeAppWindowViewsWin::CanMinimize() const {
162 // Resizing on Windows breaks translucency if the window also has shape. 162 // Resizing on Windows breaks translucency if the window also has shape.
163 // See http://crbug.com/417947. 163 // See http://crbug.com/417947.
164 return ChromeNativeAppWindowViews::CanMinimize() && 164 return ChromeNativeAppWindowViewsAura::CanMinimize() &&
165 !(WidgetHasHitTestMask() && is_translucent_); 165 !(WidgetHasHitTestMask() && is_translucent_);
166 } 166 }
167 167
168 void ChromeNativeAppWindowViewsWin::UpdateShelfMenu() { 168 void ChromeNativeAppWindowViewsWin::UpdateShelfMenu() {
169 if (!JumpListUpdater::IsEnabled() || IsRunningInAsh()) 169 if (!JumpListUpdater::IsEnabled() || IsRunningInAsh())
170 return; 170 return;
171 171
172 // Currently the only option is related to ephemeral apps, so avoid updating 172 // Currently the only option is related to ephemeral apps, so avoid updating
173 // the app's jump list when the feature is not enabled. 173 // the app's jump list when the feature is not enabled.
174 if (!EphemeralAppLauncher::IsFeatureEnabled()) 174 if (!EphemeralAppLauncher::IsFeatureEnabled())
(...skipping 27 matching lines...) Expand all
202 switches::kInstallEphemeralAppFromWebstore, extension->id()); 202 switches::kInstallEphemeralAppFromWebstore, extension->id());
203 203
204 ShellLinkItemList items; 204 ShellLinkItemList items;
205 items.push_back(link); 205 items.push_back(link);
206 jumplist_updater.AddTasks(items); 206 jumplist_updater.AddTasks(items);
207 } 207 }
208 208
209 // Note that an empty jumplist must still be committed to clear all items. 209 // Note that an empty jumplist must still be committed to clear all items.
210 jumplist_updater.CommitUpdate(); 210 jumplist_updater.CommitUpdate();
211 } 211 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698