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/panels/panel_manager.h" | 5 #include "chrome/browser/ui/panels/panel_manager.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "chrome/browser/ui/panels/detached_panel_strip.h" | 12 #include "chrome/browser/ui/panels/detached_panel_strip.h" |
13 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 13 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
14 #include "chrome/browser/ui/panels/panel_drag_controller.h" | 14 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
15 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 15 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
16 #include "chrome/browser/ui/panels/panel_resize_controller.h" | 16 #include "chrome/browser/ui/panels/panel_resize_controller.h" |
17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/chrome_version_info.h" | 19 #include "chrome/common/chrome_version_info.h" |
20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
21 #include "content/public/browser/notification_source.h" | 21 #include "content/public/browser/notification_source.h" |
22 | 22 |
23 #if defined(TOOLKIT_GTK) | 23 #if defined(TOOLKIT_GTK) |
24 #include "ui/base/x/x11_util.h" | 24 #include "ui/base/x/x11_util.h" |
25 #endif | 25 #endif |
26 | 26 |
27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
28 #include "base/win/metro.h" | 28 #include "win8/util/win8_util.h" |
29 #endif | 29 #endif |
30 | 30 |
31 namespace { | 31 namespace { |
32 // Width of spacing around panel strip and the left/right edges of the screen. | 32 // Width of spacing around panel strip and the left/right edges of the screen. |
33 const int kPanelStripLeftMargin = 6; | 33 const int kPanelStripLeftMargin = 6; |
34 const int kPanelStripRightMargin = 24; | 34 const int kPanelStripRightMargin = 24; |
35 | 35 |
36 // Maxmium width of a panel is based on a factor of the working area. | 36 // Maxmium width of a panel is based on a factor of the working area. |
37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
38 // ChromeOS device screens are relatively small and limiting the width | 38 // ChromeOS device screens are relatively small and limiting the width |
(...skipping 30 matching lines...) Expand all Loading... |
69 wm_type != ui::WM_KWIN && | 69 wm_type != ui::WM_KWIN && |
70 wm_type != ui::WM_METACITY && | 70 wm_type != ui::WM_METACITY && |
71 wm_type != ui::WM_MUTTER && | 71 wm_type != ui::WM_MUTTER && |
72 wm_type != ui::WM_XFWM4) { | 72 wm_type != ui::WM_XFWM4) { |
73 return false; | 73 return false; |
74 } | 74 } |
75 #endif // TOOLKIT_GTK | 75 #endif // TOOLKIT_GTK |
76 | 76 |
77 #if defined(OS_WIN) | 77 #if defined(OS_WIN) |
78 // No panels in Metro mode. | 78 // No panels in Metro mode. |
79 if (base::win::IsMetroProcess()) | 79 if (win8::IsSingleWindowMetroMode()) |
80 return false; | 80 return false; |
81 #endif // OS_WIN | 81 #endif // OS_WIN |
82 | 82 |
83 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 83 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
84 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | 84 if (channel == chrome::VersionInfo::CHANNEL_STABLE || |
85 channel == chrome::VersionInfo::CHANNEL_BETA) { | 85 channel == chrome::VersionInfo::CHANNEL_BETA) { |
86 return CommandLine::ForCurrentProcess()->HasSwitch( | 86 return CommandLine::ForCurrentProcess()->HasSwitch( |
87 switches::kEnablePanels) || | 87 switches::kEnablePanels) || |
88 extension_id == std::string("nckgahadagoaajjgafhacjanaoiihapd") || | 88 extension_id == std::string("nckgahadagoaajjgafhacjanaoiihapd") || |
89 extension_id == std::string("ljclpkphhpbpinifbeabbhlfddcpfdde") || | 89 extension_id == std::string("ljclpkphhpbpinifbeabbhlfddcpfdde") || |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 339 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
340 panel_mouse_watcher_.reset(watcher); | 340 panel_mouse_watcher_.reset(watcher); |
341 } | 341 } |
342 | 342 |
343 void PanelManager::OnPanelAnimationEnded(Panel* panel) { | 343 void PanelManager::OnPanelAnimationEnded(Panel* panel) { |
344 content::NotificationService::current()->Notify( | 344 content::NotificationService::current()->Notify( |
345 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 345 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
346 content::Source<Panel>(panel), | 346 content::Source<Panel>(panel), |
347 content::NotificationService::NoDetails()); | 347 content::NotificationService::NoDetails()); |
348 } | 348 } |
OLD | NEW |