Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(207)

Side by Side Diff: chrome/browser/ui/panels/panel_manager.cc

Issue 8863011: Panels back behind a flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Synced Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/panels/panel_manager.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h"
7 #include "base/logging.h" 8 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
9 #include "chrome/browser/fullscreen.h" 10 #include "chrome/browser/fullscreen.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/browser_list.h" 12 #include "chrome/browser/ui/browser_list.h"
12 #include "chrome/browser/ui/panels/panel_mouse_watcher.h" 13 #include "chrome/browser/ui/panels/panel_mouse_watcher.h"
13 #include "chrome/browser/ui/panels/panel_overflow_strip.h" 14 #include "chrome/browser/ui/panels/panel_overflow_strip.h"
14 #include "chrome/browser/ui/panels/panel_strip.h" 15 #include "chrome/browser/ui/panels/panel_strip.h"
15 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
17 #include "chrome/common/chrome_switches.h"
18 #include "chrome/common/chrome_version_info.h"
16 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
17 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
18 #include "ui/gfx/screen.h" 21 #include "ui/gfx/screen.h"
19 22
20 namespace { 23 namespace {
21 const int kOverflowStripThickness = 26; 24 const int kOverflowStripThickness = 26;
22 25
23 // Width of spacing around panel strip and the left/right edges of the screen. 26 // Width of spacing around panel strip and the left/right edges of the screen.
24 const int kPanelStripLeftMargin = kOverflowStripThickness + 6; 27 const int kPanelStripLeftMargin = kOverflowStripThickness + 6;
25 const int kPanelStripRightMargin = 24; 28 const int kPanelStripRightMargin = 24;
26 29
27 // Height of panel strip is based on the factor of the working area. 30 // Height of panel strip is based on the factor of the working area.
28 const double kPanelStripHeightFactor = 0.5; 31 const double kPanelStripHeightFactor = 0.5;
29 32
30 static const int kFullScreenModeCheckIntervalMs = 1000; 33 static const int kFullScreenModeCheckIntervalMs = 1000;
31 34
32 } // namespace 35 } // namespace
33 36
34 // static 37 // static
35 PanelManager* PanelManager::GetInstance() { 38 PanelManager* PanelManager::GetInstance() {
36 static base::LazyInstance<PanelManager> instance = LAZY_INSTANCE_INITIALIZER; 39 static base::LazyInstance<PanelManager> instance = LAZY_INSTANCE_INITIALIZER;
37 return instance.Pointer(); 40 return instance.Pointer();
38 } 41 }
39 42
43 // static
44 bool PanelManager::ShouldUsePanels(const std::string& extension_id) {
45 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel();
46 if (channel == chrome::VersionInfo::CHANNEL_STABLE ||
47 channel == chrome::VersionInfo::CHANNEL_BETA) {
48 return CommandLine::ForCurrentProcess()->HasSwitch(
49 switches::kEnablePanels) ||
50 extension_id == std::string("nckgahadagoaajjgafhacjanaoiihapd") ||
51 extension_id == std::string("ljclpkphhpbpinifbeabbhlfddcpfdde") ||
52 extension_id == std::string("ppleadejekpmccmnpjdimmlfljlkdfej") ||
53 extension_id == std::string("eggnbpckecmjlblplehfpjjdhhidfdoj");
54 }
55
56 return true;
57 }
58
40 PanelManager::PanelManager() 59 PanelManager::PanelManager()
41 : panel_mouse_watcher_(PanelMouseWatcher::Create()), 60 : panel_mouse_watcher_(PanelMouseWatcher::Create()),
42 auto_sizing_enabled_(true), 61 auto_sizing_enabled_(true),
43 is_full_screen_(false) { 62 is_full_screen_(false) {
44 panel_strip_.reset(new PanelStrip(this)); 63 panel_strip_.reset(new PanelStrip(this));
45 panel_overflow_strip_.reset(new PanelOverflowStrip(this)); 64 panel_overflow_strip_.reset(new PanelOverflowStrip(this));
46 auto_hiding_desktop_bar_ = AutoHidingDesktopBar::Create(this); 65 auto_hiding_desktop_bar_ = AutoHidingDesktopBar::Create(this);
47 OnDisplayChanged(); 66 OnDisplayChanged();
48 } 67 }
49 68
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 return panel_strip_->num_panels() + panel_overflow_strip_->num_panels(); 249 return panel_strip_->num_panels() + panel_overflow_strip_->num_panels();
231 } 250 }
232 251
233 const PanelManager::Panels& PanelManager::panels() const { 252 const PanelManager::Panels& PanelManager::panels() const {
234 return panel_strip_->panels(); 253 return panel_strip_->panels();
235 } 254 }
236 255
237 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) { 256 void PanelManager::SetMouseWatcher(PanelMouseWatcher* watcher) {
238 panel_mouse_watcher_.reset(watcher); 257 panel_mouse_watcher_.reset(watcher);
239 } 258 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_manager.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698