OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/native_app_window_views.h" | 5 #include "chrome/browser/ui/views/extensions/native_app_window_views.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
11 #include "chrome/app/chrome_command_ids.h" | 11 #include "chrome/app/chrome_command_ids.h" |
12 #include "chrome/browser/extensions/extension_host.h" | 12 #include "chrome/browser/extensions/extension_host.h" |
13 #include "chrome/browser/favicon/favicon_tab_helper.h" | 13 #include "chrome/browser/favicon/favicon_tab_helper.h" |
14 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" | 15 #include "chrome/browser/ui/views/extensions/extension_keybinding_registry_views
.h" |
16 #include "chrome/browser/ui/views/extensions/shell_window_frame_view.h" | 16 #include "chrome/browser/ui/views/extensions/shell_window_frame_view.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/extensions/extension.h" | 18 #include "chrome/common/extensions/extension.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/render_view_host.h" | 20 #include "content/public/browser/render_view_host.h" |
21 #include "content/public/browser/render_widget_host_view.h" | 21 #include "content/public/browser/render_widget_host_view.h" |
22 #include "content/public/browser/web_contents.h" | 22 #include "content/public/browser/web_contents.h" |
23 #include "content/public/browser/web_contents_view.h" | 23 #include "content/public/browser/web_contents_view.h" |
24 #include "extensions/common/draggable_region.h" | 24 #include "extensions/common/draggable_region.h" |
| 25 #include "ui/gfx/screen.h" |
25 #include "ui/views/controls/webview/webview.h" | 26 #include "ui/views/controls/webview/webview.h" |
26 #include "ui/views/widget/widget.h" | 27 #include "ui/views/widget/widget.h" |
27 #include "ui/views/window/non_client_view.h" | 28 #include "ui/views/window/non_client_view.h" |
28 | 29 |
29 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
30 #include "base/strings/utf_string_conversions.h" | 31 #include "base/strings/utf_string_conversions.h" |
31 #include "chrome/browser/ui/web_applications/web_app_ui.h" | 32 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
32 #include "chrome/browser/web_applications/web_app.h" | 33 #include "chrome/browser/web_applications/web_app.h" |
33 #include "ui/base/win/shell.h" | 34 #include "ui/base/win/shell.h" |
34 #include "ui/views/win/hwnd_util.h" | 35 #include "ui/views/win/hwnd_util.h" |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // the specified amount of space to fit the window controls in, and return a | 400 // the specified amount of space to fit the window controls in, and return a |
400 // number larger than the real frame insets. Most window controls are smaller | 401 // number larger than the real frame insets. Most window controls are smaller |
401 // than 1000x1000px, so this should be big enough. | 402 // than 1000x1000px, so this should be big enough. |
402 gfx::Rect client_bounds = gfx::Rect(1000, 1000); | 403 gfx::Rect client_bounds = gfx::Rect(1000, 1000); |
403 gfx::Rect window_bounds = | 404 gfx::Rect window_bounds = |
404 window_->non_client_view()->GetWindowBoundsForClientBounds( | 405 window_->non_client_view()->GetWindowBoundsForClientBounds( |
405 client_bounds); | 406 client_bounds); |
406 return window_bounds.InsetsFrom(client_bounds); | 407 return window_bounds.InsetsFrom(client_bounds); |
407 } | 408 } |
408 | 409 |
| 410 gfx::Rect NativeAppWindowViews::GetWindowWorkArea() const { |
| 411 return gfx::Screen::GetScreenFor(window_->GetNativeView())-> |
| 412 GetDisplayMatching(GetBounds()).work_area(); |
| 413 } |
| 414 |
409 gfx::NativeView NativeAppWindowViews::GetHostView() const { | 415 gfx::NativeView NativeAppWindowViews::GetHostView() const { |
410 return window_->GetNativeView(); | 416 return window_->GetNativeView(); |
411 } | 417 } |
412 | 418 |
413 gfx::Point NativeAppWindowViews::GetDialogPosition(const gfx::Size& size) { | 419 gfx::Point NativeAppWindowViews::GetDialogPosition(const gfx::Size& size) { |
414 gfx::Size shell_window_size = window_->GetWindowBoundsInScreen().size(); | 420 gfx::Size shell_window_size = window_->GetWindowBoundsInScreen().size(); |
415 return gfx::Point(shell_window_size.width() / 2 - size.width() / 2, | 421 return gfx::Point(shell_window_size.width() / 2 - size.width() / 2, |
416 shell_window_size.height() / 2 - size.height() / 2); | 422 shell_window_size.height() / 2 - size.height() / 2); |
417 } | 423 } |
418 | 424 |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
745 } | 751 } |
746 | 752 |
747 //------------------------------------------------------------------------------ | 753 //------------------------------------------------------------------------------ |
748 // NativeAppWindow::Create | 754 // NativeAppWindow::Create |
749 | 755 |
750 // static | 756 // static |
751 NativeAppWindow* NativeAppWindow::Create( | 757 NativeAppWindow* NativeAppWindow::Create( |
752 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { | 758 ShellWindow* shell_window, const ShellWindow::CreateParams& params) { |
753 return new NativeAppWindowViews(shell_window, params); | 759 return new NativeAppWindowViews(shell_window, params); |
754 } | 760 } |
OLD | NEW |