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

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

Issue 11011002: Switch FaviconTabHelper to use WebContentsUserData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 8 years, 2 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
« no previous file with comments | « chrome/browser/ui/panels/panel_host.h ('k') | chrome/browser/ui/tab_contents/tab_contents.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) 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/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/chrome_page_zoom.h" 10 #include "chrome/browser/chrome_page_zoom.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_PANEL); 56 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_PANEL);
57 web_contents_->SetDelegate(this); 57 web_contents_->SetDelegate(this);
58 content::WebContentsObserver::Observe(web_contents_.get()); 58 content::WebContentsObserver::Observe(web_contents_.get());
59 59
60 // Needed to give the web contents a Tab ID. Extension APIs 60 // Needed to give the web contents a Tab ID. Extension APIs
61 // expect web contents to have a Tab ID. 61 // expect web contents to have a Tab ID.
62 SessionTabHelper::CreateForWebContents(web_contents_.get()); 62 SessionTabHelper::CreateForWebContents(web_contents_.get());
63 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID( 63 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID(
64 panel_->session_id()); 64 panel_->session_id());
65 65
66 favicon_tab_helper_.reset(new FaviconTabHelper(web_contents_.get())); 66 FaviconTabHelper::CreateForWebContents(web_contents_.get());
67 prefs_tab_helper_.reset(new PrefsTabHelper(web_contents_.get())); 67 prefs_tab_helper_.reset(new PrefsTabHelper(web_contents_.get()));
68 68
69 web_contents_->GetController().LoadURL( 69 web_contents_->GetController().LoadURL(
70 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 70 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
71 } 71 }
72 72
73 void PanelHost::DestroyWebContents() { 73 void PanelHost::DestroyWebContents() {
74 favicon_tab_helper_.reset();
75 prefs_tab_helper_.reset(); 74 prefs_tab_helper_.reset();
76 web_contents_.reset(); 75 web_contents_.reset();
77 } 76 }
78 77
79 gfx::Image PanelHost::GetPageIcon() const { 78 gfx::Image PanelHost::GetPageIcon() const {
80 return favicon_tab_helper_.get() ? 79 if (!web_contents_.get())
81 favicon_tab_helper_->GetFavicon() : gfx::Image(); 80 return gfx::Image();
81
82 FaviconTabHelper* favicon_tab_helper =
83 FaviconTabHelper::FromWebContents(web_contents_.get());
84 return favicon_tab_helper->GetFavicon();
82 } 85 }
83 86
84 content::WebContents* PanelHost::OpenURLFromTab( 87 content::WebContents* PanelHost::OpenURLFromTab(
85 content::WebContents* source, 88 content::WebContents* source,
86 const content::OpenURLParams& params) { 89 const content::OpenURLParams& params) {
87 // These dispositions aren't really navigations. 90 // These dispositions aren't really navigations.
88 if (params.disposition == SUPPRESS_OPEN || 91 if (params.disposition == SUPPRESS_OPEN ||
89 params.disposition == SAVE_TO_DISK || 92 params.disposition == SAVE_TO_DISK ||
90 params.disposition == IGNORE_ACTION) 93 params.disposition == IGNORE_ACTION)
91 return NULL; 94 return NULL;
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 } 252 }
250 253
251 void PanelHost::StopLoading() { 254 void PanelHost::StopLoading() {
252 content::RecordAction(UserMetricsAction("Stop")); 255 content::RecordAction(UserMetricsAction("Stop"));
253 web_contents_->Stop(); 256 web_contents_->Stop();
254 } 257 }
255 258
256 void PanelHost::Zoom(content::PageZoom zoom) { 259 void PanelHost::Zoom(content::PageZoom zoom) {
257 chrome_page_zoom::Zoom(web_contents_.get(), zoom); 260 chrome_page_zoom::Zoom(web_contents_.get(), zoom);
258 } 261 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_host.h ('k') | chrome/browser/ui/tab_contents/tab_contents.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698