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

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

Issue 213743017: Remove title and icon from chrome apps native style title bars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed leak in test Created 6 years, 8 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/app_window.h" 7 #include "apps/app_window.h"
8 #include "apps/app_window_registry.h" 8 #include "apps/app_window_registry.h"
9 #include "apps/ui/views/app_window_frame_view.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "base/command_line.h" 11 #include "base/command_line.h"
11 #include "base/file_util.h" 12 #include "base/file_util.h"
12 #include "base/path_service.h" 13 #include "base/path_service.h"
13 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
14 #include "base/threading/sequenced_worker_pool.h" 15 #include "base/threading/sequenced_worker_pool.h"
15 #include "chrome/browser/apps/per_app_settings_service.h" 16 #include "chrome/browser/apps/per_app_settings_service.h"
16 #include "chrome/browser/apps/per_app_settings_service_factory.h" 17 #include "chrome/browser/apps/per_app_settings_service_factory.h"
17 #include "chrome/browser/jumplist_updater_win.h" 18 #include "chrome/browser/jumplist_updater_win.h"
18 #include "chrome/browser/metro_utils/metro_chrome_win.h" 19 #include "chrome/browser/metro_utils/metro_chrome_win.h"
19 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
20 #include "chrome/browser/shell_integration.h" 21 #include "chrome/browser/shell_integration.h"
22 #include "chrome/browser/ui/views/apps/app_window_desktop_native_widget_aura_win .h"
23 #include "chrome/browser/ui/views/apps/glass_app_window_frame_view_win.h"
21 #include "chrome/browser/web_applications/web_app.h" 24 #include "chrome/browser/web_applications/web_app.h"
22 #include "chrome/browser/web_applications/web_app_win.h" 25 #include "chrome/browser/web_applications/web_app_win.h"
23 #include "chrome/common/chrome_icon_resources_win.h" 26 #include "chrome/common/chrome_icon_resources_win.h"
24 #include "chrome/common/chrome_switches.h" 27 #include "chrome/common/chrome_switches.h"
25 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
26 #include "extensions/common/extension.h" 29 #include "extensions/common/extension.h"
27 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
28 #include "ui/aura/remote_window_tree_host_win.h" 31 #include "ui/aura/remote_window_tree_host_win.h"
29 #include "ui/base/l10n/l10n_util.h" 32 #include "ui/base/l10n/l10n_util.h"
30 #include "ui/base/win/shell.h" 33 #include "ui/base/win/shell.h"
(...skipping 30 matching lines...) Expand all
61 return; 64 return;
62 } 65 }
63 66
64 ui::win::SetAppIconForWindow(icon_file.value(), hwnd); 67 ui::win::SetAppIconForWindow(icon_file.value(), hwnd);
65 web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon); 68 web_app::internals::CheckAndSaveIcon(icon_file, shortcut_info.favicon);
66 } 69 }
67 70
68 } // namespace 71 } // namespace
69 72
70 ChromeNativeAppWindowViewsWin::ChromeNativeAppWindowViewsWin() 73 ChromeNativeAppWindowViewsWin::ChromeNativeAppWindowViewsWin()
71 : weak_ptr_factory_(this) {} 74 : weak_ptr_factory_(this), glass_frame_view_(NULL) {
75 }
72 76
73 void ChromeNativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() { 77 void ChromeNativeAppWindowViewsWin::ActivateParentDesktopIfNecessary() {
74 if (!ash::Shell::HasInstance()) 78 if (!ash::Shell::HasInstance())
75 return; 79 return;
76 80
77 views::Widget* widget = 81 views::Widget* widget =
78 implicit_cast<views::WidgetDelegate*>(this)->GetWidget(); 82 implicit_cast<views::WidgetDelegate*>(this)->GetWidget();
79 chrome::HostDesktopType host_desktop_type = 83 chrome::HostDesktopType host_desktop_type =
80 chrome::GetHostDesktopTypeForNativeWindow(widget->GetNativeWindow()); 84 chrome::GetHostDesktopTypeForNativeWindow(widget->GetNativeWindow());
81 // Only switching into Ash from Native is supported. Tearing the user out of 85 // Only switching into Ash from Native is supported. Tearing the user out of
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 desktop_type = settings->GetDesktopLastLaunchedFrom(extension->id()); 137 desktop_type = settings->GetDesktopLastLaunchedFrom(extension->id());
134 } else { 138 } else {
135 // We don't know what desktop this app was last launched from, so take our 139 // We don't know what desktop this app was last launched from, so take our
136 // best guess as to what desktop the user is on. 140 // best guess as to what desktop the user is on.
137 desktop_type = chrome::GetActiveDesktop(); 141 desktop_type = chrome::GetActiveDesktop();
138 } 142 }
139 } 143 }
140 if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH) 144 if (desktop_type == chrome::HOST_DESKTOP_TYPE_ASH)
141 init_params->context = ash::Shell::GetPrimaryRootWindow(); 145 init_params->context = ash::Shell::GetPrimaryRootWindow();
142 else 146 else
143 init_params->native_widget = new views::DesktopNativeWidgetAura(widget); 147 init_params->native_widget = new AppWindowDesktopNativeWidgetAuraWin(this);
144 } 148 }
145 149
146 void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow( 150 void ChromeNativeAppWindowViewsWin::InitializeDefaultWindow(
147 const apps::AppWindow::CreateParams& create_params) { 151 const apps::AppWindow::CreateParams& create_params) {
148 ChromeNativeAppWindowViews::InitializeDefaultWindow(create_params); 152 ChromeNativeAppWindowViews::InitializeDefaultWindow(create_params);
149 153
150 const extensions::Extension* extension = app_window()->extension(); 154 const extensions::Extension* extension = app_window()->extension();
151 std::string app_name = 155 std::string app_name =
152 web_app::GenerateApplicationNameFromExtensionId(extension->id()); 156 web_app::GenerateApplicationNameFromExtensionId(extension->id());
153 base::string16 app_name_wide = base::UTF8ToWide(app_name); 157 base::string16 app_name_wide = base::UTF8ToWide(app_name);
154 HWND hwnd = GetNativeAppWindowHWND(); 158 HWND hwnd = GetNativeAppWindowHWND();
155 Profile* profile = 159 Profile* profile =
156 Profile::FromBrowserContext(app_window()->browser_context()); 160 Profile::FromBrowserContext(app_window()->browser_context());
157 app_model_id_ = 161 app_model_id_ =
158 ShellIntegration::GetAppModelIdForProfile(app_name_wide, 162 ShellIntegration::GetAppModelIdForProfile(app_name_wide,
159 profile->GetPath()); 163 profile->GetPath());
160 ui::win::SetAppIdForWindow(app_model_id_, hwnd); 164 ui::win::SetAppIdForWindow(app_model_id_, hwnd);
161 165
162 web_app::UpdateShortcutInfoAndIconForApp( 166 web_app::UpdateShortcutInfoAndIconForApp(
163 extension, 167 extension,
164 profile, 168 profile,
165 base::Bind(&ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded, 169 base::Bind(&ChromeNativeAppWindowViewsWin::OnShortcutInfoLoaded,
166 weak_ptr_factory_.GetWeakPtr())); 170 weak_ptr_factory_.GetWeakPtr()));
167 171
168 UpdateShelfMenu(); 172 UpdateShelfMenu();
169 } 173 }
170 174
175 views::NonClientFrameView*
176 ChromeNativeAppWindowViewsWin::CreateStandardDesktopAppFrame() {
177 glass_frame_view_ = NULL;
178 if (ui::win::IsAeroGlassEnabled()) {
179 glass_frame_view_ = new GlassAppWindowFrameViewWin(this, widget());
180 return glass_frame_view_;
181 }
182 return ChromeNativeAppWindowViews::CreateStandardDesktopAppFrame();
183 }
184
171 void ChromeNativeAppWindowViewsWin::Show() { 185 void ChromeNativeAppWindowViewsWin::Show() {
172 ActivateParentDesktopIfNecessary(); 186 ActivateParentDesktopIfNecessary();
173 ChromeNativeAppWindowViews::Show(); 187 ChromeNativeAppWindowViews::Show();
174 } 188 }
175 189
176 void ChromeNativeAppWindowViewsWin::Activate() { 190 void ChromeNativeAppWindowViewsWin::Activate() {
177 ActivateParentDesktopIfNecessary(); 191 ActivateParentDesktopIfNecessary();
178 ChromeNativeAppWindowViews::Activate(); 192 ChromeNativeAppWindowViews::Activate();
179 } 193 }
180 194
(...skipping 30 matching lines...) Expand all
211 link->GetCommandLine()->AppendSwitchASCII(switches::kInstallFromWebstore, 225 link->GetCommandLine()->AppendSwitchASCII(switches::kInstallFromWebstore,
212 extension->id()); 226 extension->id());
213 227
214 ShellLinkItemList items; 228 ShellLinkItemList items;
215 items.push_back(link); 229 items.push_back(link);
216 jumplist_updater.AddTasks(items); 230 jumplist_updater.AddTasks(items);
217 } 231 }
218 232
219 jumplist_updater.CommitUpdate(); 233 jumplist_updater.CommitUpdate();
220 } 234 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698