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

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

Issue 10831226: Panels refactor: Support browserless panels on Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: feedback changes 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_host.h" 5 #include "chrome/browser/ui/panels/panel_host.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 "chrome/browser/chrome_page_zoom.h" 9 #include "chrome/browser/chrome_page_zoom.h"
10 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/ui/panels/panel.h" 12 #include "chrome/browser/ui/panels/panel.h"
13 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
13 #include "chrome/browser/view_type_utils.h" 14 #include "chrome/browser/view_type_utils.h"
14 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
15 #include "chrome/common/extensions/extension_messages.h" 16 #include "chrome/common/extensions/extension_messages.h"
16 #include "content/public/browser/invalidate_type.h" 17 #include "content/public/browser/invalidate_type.h"
17 #include "content/public/browser/navigation_controller.h" 18 #include "content/public/browser/navigation_controller.h"
18 #include "content/public/browser/notification_service.h" 19 #include "content/public/browser/notification_service.h"
19 #include "content/public/browser/notification_source.h" 20 #include "content/public/browser/notification_source.h"
20 #include "content/public/browser/notification_types.h" 21 #include "content/public/browser/notification_types.h"
21 #include "content/public/browser/render_view_host.h" 22 #include "content/public/browser/render_view_host.h"
22 #include "content/public/browser/site_instance.h" 23 #include "content/public/browser/site_instance.h"
(...skipping 21 matching lines...) Expand all
44 return; 45 return;
45 46
46 web_contents_.reset(content::WebContents::Create( 47 web_contents_.reset(content::WebContents::Create(
47 profile_, content::SiteInstance::CreateForURL(profile_, url), 48 profile_, content::SiteInstance::CreateForURL(profile_, url),
48 MSG_ROUTING_NONE, NULL, NULL)); 49 MSG_ROUTING_NONE, NULL, NULL));
49 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_PANEL); 50 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_PANEL);
50 web_contents_->SetDelegate(this); 51 web_contents_->SetDelegate(this);
51 content::WebContentsObserver::Observe(web_contents_.get()); 52 content::WebContentsObserver::Observe(web_contents_.get());
52 53
53 favicon_tab_helper_.reset(new FaviconTabHelper(web_contents_.get())); 54 favicon_tab_helper_.reset(new FaviconTabHelper(web_contents_.get()));
55 prefs_tab_helper_.reset(new PrefsTabHelper(web_contents_.get()));
54 56
55 web_contents_->GetController().LoadURL( 57 web_contents_->GetController().LoadURL(
56 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 58 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
57 } 59 }
58 60
59 void PanelHost::DestroyWebContents() { 61 void PanelHost::DestroyWebContents() {
62 favicon_tab_helper_.reset();
63 prefs_tab_helper_.reset();
60 web_contents_.reset(); 64 web_contents_.reset();
61 favicon_tab_helper_.reset();
62 } 65 }
63 66
64 SkBitmap PanelHost::GetPageIcon() const { 67 SkBitmap PanelHost::GetPageIcon() const {
65 return favicon_tab_helper_.get() ? 68 return favicon_tab_helper_.get() ?
66 favicon_tab_helper_->GetFavicon() : SkBitmap(); 69 favicon_tab_helper_->GetFavicon() : SkBitmap();
67 } 70 }
68 71
69 void PanelHost::NavigationStateChanged(const content::WebContents* source, 72 void PanelHost::NavigationStateChanged(const content::WebContents* source,
70 unsigned changed_flags) { 73 unsigned changed_flags) {
71 // Only need to update the title if the title changed while not loading, 74 // Only need to update the title if the title changed while not loading,
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 184 }
182 185
183 void PanelHost::StopLoading() { 186 void PanelHost::StopLoading() {
184 content::RecordAction(UserMetricsAction("Stop")); 187 content::RecordAction(UserMetricsAction("Stop"));
185 web_contents_->Stop(); 188 web_contents_->Stop();
186 } 189 }
187 190
188 void PanelHost::Zoom(content::PageZoom zoom) { 191 void PanelHost::Zoom(content::PageZoom zoom) {
189 chrome_page_zoom::Zoom(web_contents_.get(), zoom); 192 chrome_page_zoom::Zoom(web_contents_.get(), zoom);
190 } 193 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698