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