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

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

Issue 10828289: Revert 151353 - Panels refactor: Support browserless panels on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/app/chrome_command_ids.h" 10 #include "chrome/app/chrome_command_ids.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 bool PanelExtensionWindowController::IsVisibleToExtension( 95 bool PanelExtensionWindowController::IsVisibleToExtension(
96 const extensions::Extension* extension) const { 96 const extensions::Extension* extension) const {
97 return extension->id() == panel_->extension_id(); 97 return extension->id() == panel_->extension_id();
98 } 98 }
99 99
100 } // namespace internal 100 } // namespace internal
101 101
102 Panel::Panel(const std::string& app_name, 102 Panel::Panel(const std::string& app_name,
103 const gfx::Size& min_size, const gfx::Size& max_size) 103 const gfx::Size& min_size, const gfx::Size& max_size)
104 : app_name_(app_name), 104 : app_name_(app_name),
105 profile_(NULL),
106 panel_strip_(NULL), 105 panel_strip_(NULL),
107 initialized_(false), 106 initialized_(false),
108 min_size_(min_size), 107 min_size_(min_size),
109 max_size_(max_size), 108 max_size_(max_size),
110 max_size_policy_(DEFAULT_MAX_SIZE), 109 max_size_policy_(DEFAULT_MAX_SIZE),
111 auto_resizable_(false), 110 auto_resizable_(false),
112 always_on_top_(false), 111 always_on_top_(false),
113 in_preview_mode_(false), 112 in_preview_mode_(false),
114 native_panel_(NULL), 113 native_panel_(NULL),
115 attention_mode_(USE_PANEL_ATTENTION), 114 attention_mode_(USE_PANEL_ATTENTION),
(...skipping 20 matching lines...) Expand all
136 native_panel_ = CreateNativePanel(browser, this, bounds); 135 native_panel_ = CreateNativePanel(browser, this, bounds);
137 } 136 }
138 137
139 void Panel::Initialize(Profile* profile, const GURL& url, 138 void Panel::Initialize(Profile* profile, const GURL& url,
140 const gfx::Rect& bounds) { 139 const gfx::Rect& bounds) {
141 DCHECK(!initialized_); 140 DCHECK(!initialized_);
142 DCHECK(!panel_strip_); // Cannot be added to a strip until fully created. 141 DCHECK(!panel_strip_); // Cannot be added to a strip until fully created.
143 DCHECK_EQ(EXPANDED, expansion_state_); 142 DCHECK_EQ(EXPANDED, expansion_state_);
144 DCHECK(!bounds.IsEmpty()); 143 DCHECK(!bounds.IsEmpty());
145 initialized_ = true; 144 initialized_ = true;
146 profile_ = profile;
147 full_size_ = bounds.size(); 145 full_size_ = bounds.size();
148 native_panel_ = CreateNativePanel(this, bounds); 146 native_panel_ = CreateNativePanel(this, bounds);
149 147
150 extension_window_controller_.reset( 148 extension_window_controller_.reset(
151 new panel_internal::PanelExtensionWindowController(this, profile)); 149 new panel_internal::PanelExtensionWindowController(this, profile));
152 150
153 InitCommandState(); 151 InitCommandState();
154 152
155 // Set up hosting for web contents. 153 // Set up hosting for web contents.
156 panel_host_.reset(new PanelHost(this, profile)); 154 panel_host_.reset(new PanelHost(this, profile));
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 208
211 BrowserWindow* Panel::browser_window() const { 209 BrowserWindow* Panel::browser_window() const {
212 return NULL; 210 return NULL;
213 } 211 }
214 212
215 CommandUpdater* Panel::command_updater() { 213 CommandUpdater* Panel::command_updater() {
216 return &command_updater_; 214 return &command_updater_;
217 } 215 }
218 216
219 Profile* Panel::profile() const { 217 Profile* Panel::profile() const {
220 return profile_; 218 return extension_window_controller_->profile();
221 } 219 }
222 220
223 const std::string Panel::extension_id() const { 221 const std::string Panel::extension_id() const {
224 return web_app::GetExtensionIdFromApplicationName(app_name_); 222 return web_app::GetExtensionIdFromApplicationName(app_name_);
225 } 223 }
226 224
227 content::WebContents* Panel::GetWebContents() const { 225 content::WebContents* Panel::GetWebContents() const {
228 return panel_host_.get() ? panel_host_->web_contents() : NULL; 226 return panel_host_.get() ? panel_host_->web_contents() : NULL;
229 } 227 }
230 228
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 758
761 void Panel::LoadingStateChanged(bool is_loading) { 759 void Panel::LoadingStateChanged(bool is_loading) {
762 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading); 760 command_updater_.UpdateCommandEnabled(IDC_STOP, is_loading);
763 native_panel_->UpdatePanelLoadingAnimations(is_loading); 761 native_panel_->UpdatePanelLoadingAnimations(is_loading);
764 UpdateTitleBar(); 762 UpdateTitleBar();
765 } 763 }
766 764
767 void Panel::WebContentsFocused(content::WebContents* contents) { 765 void Panel::WebContentsFocused(content::WebContents* contents) {
768 native_panel_->PanelWebContentsFocused(contents); 766 native_panel_->PanelWebContentsFocused(contents);
769 } 767 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel.h ('k') | chrome/browser/ui/panels/panel_and_desktop_notification_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698