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

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

Issue 9546001: Support detaching/attaching panels via inter-strip drags. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fix per feedback Created 8 years, 9 months 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
OLDNEW
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.h" 5 #include "chrome/browser/ui/panels/panel.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/extensions/extension_prefs.h" 8 #include "chrome/browser/extensions/extension_prefs.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 web_app::GetExtensionIdFromApplicationName(browser->app_name()), false); 43 web_app::GetExtensionIdFromApplicationName(browser->app_name()), false);
44 } 44 }
45 45
46 Panel::Panel(Browser* browser, const gfx::Size& requested_size) 46 Panel::Panel(Browser* browser, const gfx::Size& requested_size)
47 : browser_(browser), 47 : browser_(browser),
48 panel_strip_(NULL), 48 panel_strip_(NULL),
49 initialized_(false), 49 initialized_(false),
50 has_temporary_layout_(false), 50 has_temporary_layout_(false),
51 restored_size_(requested_size), 51 restored_size_(requested_size),
52 auto_resizable_(false), 52 auto_resizable_(false),
53 always_on_top_(false),
54 in_preview_mode_(false),
53 expansion_state_(EXPANDED), 55 expansion_state_(EXPANDED),
54 old_expansion_state_(EXPANDED), 56 old_expansion_state_(EXPANDED) {
55 app_icon_visible_(true) {
56 } 57 }
57 58
58 Panel::~Panel() { 59 Panel::~Panel() {
59 // Invoked by native panel destructor. Do not access native_panel_ here. 60 // Invoked by native panel destructor. Do not access native_panel_ here.
60 } 61 }
61 62
62 void Panel::Initialize(const gfx::Rect& bounds) { 63 void Panel::Initialize(const gfx::Rect& bounds) {
63 DCHECK(!initialized_); 64 DCHECK(!initialized_);
64 DCHECK(!bounds.IsEmpty()); 65 DCHECK(!bounds.IsEmpty());
65 initialized_ = true; 66 initialized_ = true;
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 145
145 DCHECK(min_size.width() <= max_size.width()); 146 DCHECK(min_size.width() <= max_size.width());
146 DCHECK(min_size.height() <= max_size.height()); 147 DCHECK(min_size.height() <= max_size.height());
147 min_size_ = min_size; 148 min_size_ = min_size;
148 max_size_ = max_size; 149 max_size_ = max_size;
149 150
150 ConfigureAutoResize(browser()->GetSelectedWebContents()); 151 ConfigureAutoResize(browser()->GetSelectedWebContents());
151 } 152 }
152 153
153 void Panel::SetAppIconVisibility(bool visible) { 154 void Panel::SetAppIconVisibility(bool visible) {
154 if (app_icon_visible_ == visible) 155 native_panel_->SetPanelAppIconVisibility(visible);
156 }
157
158 void Panel::SetAlwaysOnTop(bool on_top) {
159 if (always_on_top_ == on_top)
155 return; 160 return;
156 app_icon_visible_ = visible; 161 always_on_top_ = on_top;
157 native_panel_->SetPanelAppIconVisibility(visible); 162 native_panel_->SetPanelAlwaysOnTop(on_top);
Andrei 2012/03/07 22:55:13 Actually the native panel needs to be on top iff a
jianli 2012/03/08 01:18:26 Per suggestion from Jenn, we're not going to make
163 }
164
165 void Panel::SetPreviewMode(bool in_preview) {
166 DCHECK_NE(in_preview_mode_, in_preview);
167 in_preview_mode_ = in_preview;
158 } 168 }
159 169
160 void Panel::SetExpansionState(ExpansionState new_state) { 170 void Panel::SetExpansionState(ExpansionState new_state) {
161 if (expansion_state_ == new_state) 171 if (expansion_state_ == new_state)
162 return; 172 return;
163 old_expansion_state_ = expansion_state_; 173 old_expansion_state_ = expansion_state_;
164 expansion_state_ = new_state; 174 expansion_state_ = new_state;
165 175
166 manager()->OnPanelExpansionStateChanged(this); 176 manager()->OnPanelExpansionStateChanged(this);
167 177
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 native_panel_->ContentSizeFromWindowSize(max_size_)); 688 native_panel_->ContentSizeFromWindowSize(max_size_));
679 } 689 }
680 690
681 void Panel::OnWindowSizeAvailable() { 691 void Panel::OnWindowSizeAvailable() {
682 ConfigureAutoResize(browser()->GetSelectedWebContents()); 692 ConfigureAutoResize(browser()->GetSelectedWebContents());
683 } 693 }
684 694
685 void Panel::DestroyBrowser() { 695 void Panel::DestroyBrowser() {
686 native_panel_->DestroyPanelBrowser(); 696 native_panel_->DestroyPanelBrowser();
687 } 697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698