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

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

Issue 952103002: Use Widget::InitParams::shadow_type instead of calling wm::SetShadowType. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « no previous file | 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.h" 5 #include "chrome/browser/ui/views/apps/chrome_native_app_window_views.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 "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/app_mode/app_mode_utils.h" 10 #include "chrome/browser/app_mode/app_mode_utils.h"
(...skipping 10 matching lines...) Expand all
21 #include "components/ui/zoom/zoom_controller.h" 21 #include "components/ui/zoom/zoom_controller.h"
22 #include "extensions/common/extension.h" 22 #include "extensions/common/extension.h"
23 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
24 #include "ui/base/hit_test.h" 24 #include "ui/base/hit_test.h"
25 #include "ui/base/models/simple_menu_model.h" 25 #include "ui/base/models/simple_menu_model.h"
26 #include "ui/gfx/image/image_skia.h" 26 #include "ui/gfx/image/image_skia.h"
27 #include "ui/views/controls/menu/menu_runner.h" 27 #include "ui/views/controls/menu/menu_runner.h"
28 #include "ui/views/controls/webview/webview.h" 28 #include "ui/views/controls/webview/webview.h"
29 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
30 #include "ui/wm/core/easy_resize_window_targeter.h" 30 #include "ui/wm/core/easy_resize_window_targeter.h"
31 #include "ui/wm/core/shadow_types.h"
32 31
33 #if defined(OS_LINUX) 32 #if defined(OS_LINUX)
34 #include "chrome/browser/shell_integration_linux.h" 33 #include "chrome/browser/shell_integration_linux.h"
35 #endif 34 #endif
36 35
37 #if defined(USE_ASH) 36 #if defined(USE_ASH)
38 #include "ash/ash_constants.h" 37 #include "ash/ash_constants.h"
39 #include "ash/ash_switches.h" 38 #include "ash/ash_switches.h"
40 #include "ash/frame/custom_frame_view_ash.h" 39 #include "ash/frame/custom_frame_view_ash.h"
41 #include "ash/screen_util.h" 40 #include "ash/screen_util.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 209
211 void ChromeNativeAppWindowViews::InitializeDefaultWindow( 210 void ChromeNativeAppWindowViews::InitializeDefaultWindow(
212 const AppWindow::CreateParams& create_params) { 211 const AppWindow::CreateParams& create_params) {
213 std::string app_name = web_app::GenerateApplicationNameFromExtensionId( 212 std::string app_name = web_app::GenerateApplicationNameFromExtensionId(
214 app_window()->extension_id()); 213 app_window()->extension_id());
215 214
216 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW); 215 views::Widget::InitParams init_params(views::Widget::InitParams::TYPE_WINDOW);
217 init_params.delegate = this; 216 init_params.delegate = this;
218 init_params.remove_standard_frame = IsFrameless() || has_frame_color_; 217 init_params.remove_standard_frame = IsFrameless() || has_frame_color_;
219 init_params.use_system_default_icon = true; 218 init_params.use_system_default_icon = true;
220 if (create_params.alpha_enabled) 219 if (create_params.alpha_enabled) {
221 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; 220 init_params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
221
222 // The given window is most likely not rectangular since it uses
223 // transparency and has no standard frame, don't show a shadow for it.
224 // TODO(skuhne): If we run into an application which should have a shadow
225 // but does not have, a new attribute has to be added.
226 if (IsFrameless())
227 init_params.shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE;
228 }
222 init_params.keep_on_top = create_params.always_on_top; 229 init_params.keep_on_top = create_params.always_on_top;
223 init_params.visible_on_all_workspaces = 230 init_params.visible_on_all_workspaces =
224 create_params.visible_on_all_workspaces; 231 create_params.visible_on_all_workspaces;
225 232
226 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) 233 #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
227 // Set up a custom WM_CLASS for app windows. This allows task switchers in 234 // Set up a custom WM_CLASS for app windows. This allows task switchers in
228 // X11 environments to distinguish them from main browser windows. 235 // X11 environments to distinguish them from main browser windows.
229 init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name); 236 init_params.wm_class_name = web_app::GetWMClassFromAppName(app_name);
230 init_params.wm_class_class = shell_integration_linux::GetProgramClassName(); 237 init_params.wm_class_class = shell_integration_linux::GetProgramClassName();
231 const char kX11WindowRoleApp[] = "app"; 238 const char kX11WindowRoleApp[] = "app";
(...skipping 21 matching lines...) Expand all
253 typedef AppWindow::BoundsSpecification BoundsSpecification; 260 typedef AppWindow::BoundsSpecification BoundsSpecification;
254 bool position_specified = 261 bool position_specified =
255 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition && 262 window_bounds.x() != BoundsSpecification::kUnspecifiedPosition &&
256 window_bounds.y() != BoundsSpecification::kUnspecifiedPosition; 263 window_bounds.y() != BoundsSpecification::kUnspecifiedPosition;
257 if (!position_specified) 264 if (!position_specified)
258 widget()->CenterWindow(window_bounds.size()); 265 widget()->CenterWindow(window_bounds.size());
259 else 266 else
260 widget()->SetBounds(window_bounds); 267 widget()->SetBounds(window_bounds);
261 } 268 }
262 269
263 if (IsFrameless() &&
264 init_params.opacity == views::Widget::InitParams::TRANSLUCENT_WINDOW) {
265 // The given window is most likely not rectangular since it uses
266 // transparency and has no standard frame, don't show a shadow for it.
267 // TODO(skuhne): If we run into an application which should have a shadow
268 // but does not have, a new attribute has to be added.
269 wm::SetShadowType(widget()->GetNativeWindow(), wm::SHADOW_TYPE_NONE);
270 }
271
272 #if defined(OS_CHROMEOS) 270 #if defined(OS_CHROMEOS)
273 if (create_params.is_ime_window) 271 if (create_params.is_ime_window)
274 return; 272 return;
275 #endif 273 #endif
276 274
277 // Register accelarators supported by app windows. 275 // Register accelarators supported by app windows.
278 // TODO(jeremya/stevenjb): should these be registered for panels too? 276 // TODO(jeremya/stevenjb): should these be registered for panels too?
279 views::FocusManager* focus_manager = GetFocusManager(); 277 views::FocusManager* focus_manager = GetFocusManager();
280 const std::map<ui::Accelerator, int>& accelerator_table = 278 const std::map<ui::Accelerator, int>& accelerator_table =
281 GetAcceleratorTable(); 279 GetAcceleratorTable();
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 // Add the EasyResizeWindowTargeter on the window, not its root window. The 704 // Add the EasyResizeWindowTargeter on the window, not its root window. The
707 // root window does not have a delegate, which is needed to handle the event 705 // root window does not have a delegate, which is needed to handle the event
708 // in Linux. 706 // in Linux.
709 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>( 707 window->SetEventTargeter(scoped_ptr<ui::EventTargeter>(
710 new wm::EasyResizeWindowTargeter(window, inset, inset))); 708 new wm::EasyResizeWindowTargeter(window, inset, inset)));
711 } 709 }
712 #endif 710 #endif
713 711
714 return frame; 712 return frame;
715 } 713 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698