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

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

Issue 10965023: [Panels] Provide a tab id for web contents in Panels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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/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"
11 #include "chrome/browser/extensions/window_controller.h" 11 #include "chrome/browser/extensions/window_controller.h"
12 #include "chrome/browser/favicon/favicon_tab_helper.h" 12 #include "chrome/browser/favicon/favicon_tab_helper.h"
13 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/sessions/session_tab_helper.h"
14 #include "chrome/browser/ui/browser_navigator.h" 15 #include "chrome/browser/ui/browser_navigator.h"
15 #include "chrome/browser/ui/panels/panel.h" 16 #include "chrome/browser/ui/panels/panel.h"
16 #include "chrome/browser/ui/prefs/prefs_tab_helper.h" 17 #include "chrome/browser/ui/prefs/prefs_tab_helper.h"
17 #include "chrome/browser/ui/tab_contents/tab_contents.h" 18 #include "chrome/browser/ui/tab_contents/tab_contents.h"
18 #include "chrome/browser/view_type_utils.h" 19 #include "chrome/browser/view_type_utils.h"
19 #include "chrome/common/chrome_notification_types.h" 20 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/extensions/extension_messages.h" 21 #include "chrome/common/extensions/extension_messages.h"
21 #include "content/public/browser/invalidate_type.h" 22 #include "content/public/browser/invalidate_type.h"
22 #include "content/public/browser/navigation_controller.h" 23 #include "content/public/browser/navigation_controller.h"
23 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
(...skipping 25 matching lines...) Expand all
49 if (url.is_empty()) 50 if (url.is_empty())
50 return; 51 return;
51 52
52 web_contents_.reset(content::WebContents::Create( 53 web_contents_.reset(content::WebContents::Create(
53 profile_, content::SiteInstance::CreateForURL(profile_, url), 54 profile_, content::SiteInstance::CreateForURL(profile_, url),
54 MSG_ROUTING_NONE, NULL)); 55 MSG_ROUTING_NONE, NULL));
55 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_PANEL); 56 chrome::SetViewType(web_contents_.get(), chrome::VIEW_TYPE_PANEL);
56 web_contents_->SetDelegate(this); 57 web_contents_->SetDelegate(this);
57 content::WebContentsObserver::Observe(web_contents_.get()); 58 content::WebContentsObserver::Observe(web_contents_.get());
58 59
60 // Needed to give the web contents a Tab ID.
Dmitry Titov 2012/09/21 01:29:42 Could you add a motivation to this comment, so it
jennb 2012/09/21 17:28:35 Done. http://crbug.com/151474 created to track the
61 SessionTabHelper::CreateForWebContents(web_contents_.get());
62 SessionTabHelper::FromWebContents(web_contents_.get())->SetWindowID(
63 panel_->session_id());
64
59 favicon_tab_helper_.reset(new FaviconTabHelper(web_contents_.get())); 65 favicon_tab_helper_.reset(new FaviconTabHelper(web_contents_.get()));
60 prefs_tab_helper_.reset(new PrefsTabHelper(web_contents_.get())); 66 prefs_tab_helper_.reset(new PrefsTabHelper(web_contents_.get()));
61 67
62 web_contents_->GetController().LoadURL( 68 web_contents_->GetController().LoadURL(
63 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string()); 69 url, content::Referrer(), content::PAGE_TRANSITION_LINK, std::string());
64 } 70 }
65 71
66 void PanelHost::DestroyWebContents() { 72 void PanelHost::DestroyWebContents() {
67 favicon_tab_helper_.reset(); 73 favicon_tab_helper_.reset();
68 prefs_tab_helper_.reset(); 74 prefs_tab_helper_.reset();
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 } 252 }
247 253
248 void PanelHost::StopLoading() { 254 void PanelHost::StopLoading() {
249 content::RecordAction(UserMetricsAction("Stop")); 255 content::RecordAction(UserMetricsAction("Stop"));
250 web_contents_->Stop(); 256 web_contents_->Stop();
251 } 257 }
252 258
253 void PanelHost::Zoom(content::PageZoom zoom) { 259 void PanelHost::Zoom(content::PageZoom zoom) {
254 chrome_page_zoom::Zoom(web_contents_.get(), zoom); 260 chrome_page_zoom::Zoom(web_contents_.get(), zoom);
255 } 261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698