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

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

Issue 9403035: Refactor intra-strip panel drags by introducing PanelDragController. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix per feedback Created 8 years, 10 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 web_app::GetExtensionIdFromApplicationName(browser->app_name()), false); 42 web_app::GetExtensionIdFromApplicationName(browser->app_name()), false);
43 } 43 }
44 44
45 Panel::Panel(Browser* browser, const gfx::Size& requested_size) 45 Panel::Panel(Browser* browser, const gfx::Size& requested_size)
46 : browser_(browser), 46 : browser_(browser),
47 panel_strip_(NULL), 47 panel_strip_(NULL),
48 initialized_(false), 48 initialized_(false),
49 has_temporary_layout_(false), 49 has_temporary_layout_(false),
50 restored_size_(requested_size), 50 restored_size_(requested_size),
51 auto_resizable_(false), 51 auto_resizable_(false),
52 draggable_(true),
53 expansion_state_(EXPANDED), 52 expansion_state_(EXPANDED),
54 old_expansion_state_(EXPANDED), 53 old_expansion_state_(EXPANDED),
55 app_icon_visible_(true) { 54 app_icon_visible_(true) {
56 } 55 }
57 56
58 Panel::~Panel() { 57 Panel::~Panel() {
59 // Invoked by native panel destructor. Do not access native_panel_ here. 58 // Invoked by native panel destructor. Do not access native_panel_ here.
60 } 59 }
61 60
62 void Panel::Initialize(const gfx::Rect& bounds) { 61 void Panel::Initialize(const gfx::Rect& bounds) {
63 DCHECK(!initialized_); 62 DCHECK(!initialized_);
64 DCHECK(!bounds.IsEmpty()); 63 DCHECK(!bounds.IsEmpty());
65 initialized_ = true; 64 initialized_ = true;
66 native_panel_ = CreateNativePanel(browser_, this, bounds); 65 native_panel_ = CreateNativePanel(browser_, this, bounds);
67 } 66 }
68 67
69 void Panel::OnNativePanelClosed() { 68 void Panel::OnNativePanelClosed() {
70 if (auto_resizable_) 69 if (auto_resizable_)
71 native_panel_->GetPanelBrowser()->tabstrip_model()->RemoveObserver(this); 70 native_panel_->GetPanelBrowser()->tabstrip_model()->RemoveObserver(this);
72 panel_strip_->RemovePanel(this); 71 panel_strip_->RemovePanel(this);
73 } 72 }
74 73
75 PanelManager* Panel::manager() const { 74 PanelManager* Panel::manager() const {
76 return PanelManager::GetInstance(); 75 return PanelManager::GetInstance();
77 } 76 }
78 77
78 bool Panel::draggable() const {
79 return panel_strip()->CanDragPanel(this);
80 }
81
79 const Extension* Panel::GetExtension() const { 82 const Extension* Panel::GetExtension() const {
80 return GetExtensionFromBrowser(browser()); 83 return GetExtensionFromBrowser(browser());
81 } 84 }
82 85
83 // TODO(jennb): do not update restored_size here as there's no knowledge 86 // TODO(jennb): do not update restored_size here as there's no knowledge
84 // at this point whether the bounds change is due to the content window 87 // at this point whether the bounds change is due to the content window
85 // being resized vs a change in current display bounds, e.g. from overflow 88 // being resized vs a change in current display bounds, e.g. from overflow
86 // size change. Change this when refactoring panel resize logic. 89 // size change. Change this when refactoring panel resize logic.
87 void Panel::SetPanelBounds(const gfx::Rect& bounds) { 90 void Panel::SetPanelBounds(const gfx::Rect& bounds) {
88 if (panel_strip_->type() == PanelStrip::DOCKED && 91 if (panel_strip_->type() == PanelStrip::DOCKED &&
(...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 native_panel_->ContentSizeFromWindowSize(max_size_)); 680 native_panel_->ContentSizeFromWindowSize(max_size_));
678 } 681 }
679 682
680 void Panel::OnWindowSizeAvailable() { 683 void Panel::OnWindowSizeAvailable() {
681 ConfigureAutoResize(browser()->GetSelectedWebContents()); 684 ConfigureAutoResize(browser()->GetSelectedWebContents());
682 } 685 }
683 686
684 void Panel::DestroyBrowser() { 687 void Panel::DestroyBrowser() {
685 native_panel_->DestroyPanelBrowser(); 688 native_panel_->DestroyPanelBrowser();
686 } 689 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698