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/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
12 #include "chrome/browser/chrome_notification_types.h" | 12 #include "chrome/browser/chrome_notification_types.h" |
13 #include "chrome/browser/ui/panels/detached_panel_collection.h" | 13 #include "chrome/browser/ui/panels/detached_panel_collection.h" |
14 #include "chrome/browser/ui/panels/docked_panel_collection.h" | 14 #include "chrome/browser/ui/panels/docked_panel_collection.h" |
15 #include "chrome/browser/ui/panels/panel_drag_controller.h" | 15 #include "chrome/browser/ui/panels/panel_drag_controller.h" |
16 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" | 16 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" |
17 #include "chrome/browser/ui/panels/panel_resize_controller.h" | 17 #include "chrome/browser/ui/panels/panel_resize_controller.h" |
18 #include "chrome/browser/ui/panels/stacked_panel_collection.h" | 18 #include "chrome/browser/ui/panels/stacked_panel_collection.h" |
19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
21 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "content/public/browser/notification_source.h" | 22 #include "content/public/browser/notification_source.h" |
23 | 23 |
24 #if defined(USE_X11) && !defined(OS_CHROMEOS) | 24 #if defined(USE_X11) && !defined(OS_CHROMEOS) |
25 #include "base/environment.h" | 25 #include "base/environment.h" |
26 #include "base/nix/xdg_util.h" | 26 #include "base/nix/xdg_util.h" |
27 #include "ui/base/x/x11_util.h" | 27 #include "ui/base/x/x11_util.h" |
28 #endif | 28 #endif |
29 | 29 |
30 #if defined(OS_WIN) | |
31 #include "win8/util/win8_util.h" | |
32 #endif | |
33 | |
34 namespace { | 30 namespace { |
35 // Maxmium width of a panel is based on a factor of the working area. | 31 // Maxmium width of a panel is based on a factor of the working area. |
36 #if defined(OS_CHROMEOS) | 32 #if defined(OS_CHROMEOS) |
37 // ChromeOS device screens are relatively small and limiting the width | 33 // ChromeOS device screens are relatively small and limiting the width |
38 // interferes with some apps (e.g. http://crbug.com/111121). | 34 // interferes with some apps (e.g. http://crbug.com/111121). |
39 const double kPanelMaxWidthFactor = 0.80; | 35 const double kPanelMaxWidthFactor = 0.80; |
40 #else | 36 #else |
41 const double kPanelMaxWidthFactor = 0.35; | 37 const double kPanelMaxWidthFactor = 0.35; |
42 #endif | 38 #endif |
43 | 39 |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 wm_type != ui::WM_ICE_WM && | 113 wm_type != ui::WM_ICE_WM && |
118 wm_type != ui::WM_KWIN && | 114 wm_type != ui::WM_KWIN && |
119 wm_type != ui::WM_METACITY && | 115 wm_type != ui::WM_METACITY && |
120 wm_type != ui::WM_MUFFIN && | 116 wm_type != ui::WM_MUFFIN && |
121 wm_type != ui::WM_MUTTER && | 117 wm_type != ui::WM_MUTTER && |
122 wm_type != ui::WM_XFWM4) { | 118 wm_type != ui::WM_XFWM4) { |
123 return false; | 119 return false; |
124 } | 120 } |
125 #endif // USE_X11 && !OS_CHROMEOS | 121 #endif // USE_X11 && !OS_CHROMEOS |
126 | 122 |
127 #if defined(OS_WIN) | |
128 // No panels in Metro mode. | |
129 if (win8::IsSingleWindowMetroMode()) | |
130 return false; | |
131 #endif // OS_WIN | |
132 | |
133 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | 123 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); |
134 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | 124 if (channel == chrome::VersionInfo::CHANNEL_STABLE || |
135 channel == chrome::VersionInfo::CHANNEL_BETA) { | 125 channel == chrome::VersionInfo::CHANNEL_BETA) { |
136 return CommandLine::ForCurrentProcess()->HasSwitch( | 126 return CommandLine::ForCurrentProcess()->HasSwitch( |
137 switches::kEnablePanels) || | 127 switches::kEnablePanels) || |
138 extension_id == std::string("nckgahadagoaajjgafhacjanaoiihapd") || | 128 extension_id == std::string("nckgahadagoaajjgafhacjanaoiihapd") || |
139 extension_id == std::string("ljclpkphhpbpinifbeabbhlfddcpfdde") || | 129 extension_id == std::string("ljclpkphhpbpinifbeabbhlfddcpfdde") || |
140 extension_id == std::string("ppleadejekpmccmnpjdimmlfljlkdfej") || | 130 extension_id == std::string("ppleadejekpmccmnpjdimmlfljlkdfej") || |
141 extension_id == std::string("eggnbpckecmjlblplehfpjjdhhidfdoj"); | 131 extension_id == std::string("eggnbpckecmjlblplehfpjjdhhidfdoj"); |
142 } | 132 } |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { | 560 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { |
571 panel_mouse_watcher_.reset(watcher); | 561 panel_mouse_watcher_.reset(watcher); |
572 } | 562 } |
573 | 563 |
574 void PanelManager::OnPanelAnimationEnded(Panel* panel) { | 564 void PanelManager::OnPanelAnimationEnded(Panel* panel) { |
575 content::NotificationService::current()->Notify( | 565 content::NotificationService::current()->Notify( |
576 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, | 566 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, |
577 content::Source<Panel>(panel), | 567 content::Source<Panel>(panel), |
578 content::NotificationService::NoDetails()); | 568 content::NotificationService::NoDetails()); |
579 } | 569 } |
OLD | NEW |