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/chrome_views_delegate.h" | 5 #include "chrome/browser/ui/views/chrome_views_delegate.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/prefs/scoped_user_pref_update.h" | 9 #include "base/prefs/scoped_user_pref_update.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
15 #include "chrome/browser/ui/browser_window_state.h" | 15 #include "chrome/browser/ui/browser_window_state.h" |
16 #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views
.h" | 16 #include "chrome/browser/ui/views/accessibility/accessibility_event_router_views
.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
| 18 #include "content/public/browser/context_factory.h" |
18 #include "grit/chrome_unscaled_resources.h" | 19 #include "grit/chrome_unscaled_resources.h" |
19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
20 #include "ui/base/ui_base_switches.h" | 21 #include "ui/base/ui_base_switches.h" |
21 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
22 #include "ui/gfx/screen.h" | 23 #include "ui/gfx/screen.h" |
23 #include "ui/views/widget/native_widget.h" | 24 #include "ui/views/widget/native_widget.h" |
24 #include "ui/views/widget/widget.h" | 25 #include "ui/views/widget/widget.h" |
25 | 26 |
26 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
27 #include <dwmapi.h> | 28 #include <dwmapi.h> |
28 #include <shellapi.h> | 29 #include <shellapi.h> |
29 #include "base/task_runner_util.h" | 30 #include "base/task_runner_util.h" |
30 #include "base/win/windows_version.h" | 31 #include "base/win/windows_version.h" |
31 #include "chrome/browser/app_icon_win.h" | 32 #include "chrome/browser/app_icon_win.h" |
32 #include "content/public/browser/browser_thread.h" | 33 #include "content/public/browser/browser_thread.h" |
33 #include "ui/base/win/shell.h" | 34 #include "ui/base/win/shell.h" |
34 #endif | 35 #endif |
35 | 36 |
36 #if defined(USE_AURA) | 37 #if defined(USE_AURA) |
37 #include "content/public/browser/context_factory.h" | |
38 #include "ui/aura/window.h" | 38 #include "ui/aura/window.h" |
39 #include "ui/aura/window_event_dispatcher.h" | 39 #include "ui/aura/window_event_dispatcher.h" |
40 #endif | 40 #endif |
41 | 41 |
42 #if defined(USE_AURA) && !defined(OS_CHROMEOS) | 42 #if defined(USE_AURA) && !defined(OS_CHROMEOS) |
43 #include "chrome/browser/ui/host_desktop.h" | 43 #include "chrome/browser/ui/host_desktop.h" |
44 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" | 44 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" |
45 #include "ui/views/widget/native_widget_aura.h" | 45 #include "ui/views/widget/native_widget_aura.h" |
46 #endif | 46 #endif |
47 | 47 |
48 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 48 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
49 #include "ui/views/linux_ui/linux_ui.h" | 49 #include "ui/views/linux_ui/linux_ui.h" |
50 #endif | 50 #endif |
51 | 51 |
52 #if defined(USE_ASH) | 52 #if defined(USE_ASH) |
53 #include "ash/shell.h" | 53 #include "ash/shell.h" |
54 #include "ash/wm/window_state.h" | 54 #include "ash/wm/window_state.h" |
55 #include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" | 55 #include "chrome/browser/ui/ash/accessibility/automation_manager_ash.h" |
56 #include "chrome/browser/ui/ash/ash_init.h" | 56 #include "chrome/browser/ui/ash/ash_init.h" |
57 #include "chrome/browser/ui/ash/ash_util.h" | 57 #include "chrome/browser/ui/ash/ash_util.h" |
58 #endif | 58 #endif |
59 | 59 |
60 | |
61 // Helpers -------------------------------------------------------------------- | 60 // Helpers -------------------------------------------------------------------- |
62 | 61 |
63 namespace { | 62 namespace { |
64 | 63 |
65 Profile* GetProfileForWindow(const views::Widget* window) { | 64 Profile* GetProfileForWindow(const views::Widget* window) { |
66 if (!window) | 65 if (!window) |
67 return NULL; | 66 return NULL; |
68 return reinterpret_cast<Profile*>( | 67 return reinterpret_cast<Profile*>( |
69 window->GetNativeWindowProperty(Profile::kProfileKey)); | 68 window->GetNativeWindowProperty(Profile::kProfileKey)); |
70 } | 69 } |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 375 |
377 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) | 376 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
378 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { | 377 bool ChromeViewsDelegate::WindowManagerProvidesTitleBar(bool maximized) { |
379 // On Ubuntu Unity, the system always provides a title bar for maximized | 378 // On Ubuntu Unity, the system always provides a title bar for maximized |
380 // windows. | 379 // windows. |
381 views::LinuxUI* ui = views::LinuxUI::instance(); | 380 views::LinuxUI* ui = views::LinuxUI::instance(); |
382 return maximized && ui && ui->UnityIsRunning(); | 381 return maximized && ui && ui->UnityIsRunning(); |
383 } | 382 } |
384 #endif | 383 #endif |
385 | 384 |
386 #if defined(USE_AURA) | |
387 ui::ContextFactory* ChromeViewsDelegate::GetContextFactory() { | 385 ui::ContextFactory* ChromeViewsDelegate::GetContextFactory() { |
388 return content::GetContextFactory(); | 386 return content::GetContextFactory(); |
389 } | 387 } |
390 #endif | |
391 | 388 |
392 #if defined(OS_WIN) | 389 #if defined(OS_WIN) |
393 int ChromeViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor, | 390 int ChromeViewsDelegate::GetAppbarAutohideEdges(HMONITOR monitor, |
394 const base::Closure& callback) { | 391 const base::Closure& callback) { |
395 // Initialize the map with EDGE_BOTTOM. This is important, as if we return an | 392 // Initialize the map with EDGE_BOTTOM. This is important, as if we return an |
396 // initial value of 0 (no auto-hide edges) then we'll go fullscreen and | 393 // initial value of 0 (no auto-hide edges) then we'll go fullscreen and |
397 // windows will automatically remove WS_EX_TOPMOST from the appbar resulting | 394 // windows will automatically remove WS_EX_TOPMOST from the appbar resulting |
398 // in us thinking there is no auto-hide edges. By returning at least one edge | 395 // in us thinking there is no auto-hide edges. By returning at least one edge |
399 // we don't initially go fullscreen until we figure out the real auto-hide | 396 // we don't initially go fullscreen until we figure out the real auto-hide |
400 // edges. | 397 // edges. |
(...skipping 28 matching lines...) Expand all Loading... |
429 } | 426 } |
430 #endif | 427 #endif |
431 | 428 |
432 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) | 429 #if !defined(USE_AURA) && !defined(USE_CHROMEOS) |
433 views::Widget::InitParams::WindowOpacity | 430 views::Widget::InitParams::WindowOpacity |
434 ChromeViewsDelegate::GetOpacityForInitParams( | 431 ChromeViewsDelegate::GetOpacityForInitParams( |
435 const views::Widget::InitParams& params) { | 432 const views::Widget::InitParams& params) { |
436 return views::Widget::InitParams::OPAQUE_WINDOW; | 433 return views::Widget::InitParams::OPAQUE_WINDOW; |
437 } | 434 } |
438 #endif | 435 #endif |
OLD | NEW |