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

Side by Side Diff: chrome/browser/tabs/tab_finder.cc

Issue 8469015: Switch BackgroundContents to use TabContents instead of RenderViewHost. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix unittest Created 9 years, 1 month 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/tabs/tab_finder.h" 5 #include "chrome/browser/tabs/tab_finder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 14 matching lines...) Expand all
25 #include "content/public/common/page_transition_types.h" 25 #include "content/public/common/page_transition_types.h"
26 26
27 class TabFinder::TabContentsObserverImpl : public TabContentsObserver { 27 class TabFinder::TabContentsObserverImpl : public TabContentsObserver {
28 public: 28 public:
29 TabContentsObserverImpl(TabContents* tab, TabFinder* finder); 29 TabContentsObserverImpl(TabContents* tab, TabFinder* finder);
30 virtual ~TabContentsObserverImpl(); 30 virtual ~TabContentsObserverImpl();
31 31
32 TabContents* tab_contents() { return TabContentsObserver::tab_contents(); } 32 TabContents* tab_contents() { return TabContentsObserver::tab_contents(); }
33 33
34 // TabContentsObserver overrides: 34 // TabContentsObserver overrides:
35 virtual void DidNavigateAnyFramePostCommit( 35 virtual void DidNavigateAnyFrame(
36 const content::LoadCommittedDetails& details, 36 const content::LoadCommittedDetails& details,
37 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE; 37 const ViewHostMsg_FrameNavigate_Params& params) OVERRIDE;
38 virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE; 38 virtual void TabContentsDestroyed(TabContents* tab) OVERRIDE;
39 39
40 private: 40 private:
41 TabFinder* finder_; 41 TabFinder* finder_;
42 42
43 DISALLOW_COPY_AND_ASSIGN(TabContentsObserverImpl); 43 DISALLOW_COPY_AND_ASSIGN(TabContentsObserverImpl);
44 }; 44 };
45 45
46 TabFinder::TabContentsObserverImpl::TabContentsObserverImpl( 46 TabFinder::TabContentsObserverImpl::TabContentsObserverImpl(
47 TabContents* tab, 47 TabContents* tab,
48 TabFinder* finder) 48 TabFinder* finder)
49 : TabContentsObserver(tab), 49 : TabContentsObserver(tab),
50 finder_(finder) { 50 finder_(finder) {
51 } 51 }
52 52
53 TabFinder::TabContentsObserverImpl::~TabContentsObserverImpl() { 53 TabFinder::TabContentsObserverImpl::~TabContentsObserverImpl() {
54 } 54 }
55 55
56 void TabFinder::TabContentsObserverImpl::DidNavigateAnyFramePostCommit( 56 void TabFinder::TabContentsObserverImpl::DidNavigateAnyFrame(
57 const content::LoadCommittedDetails& details, 57 const content::LoadCommittedDetails& details,
58 const ViewHostMsg_FrameNavigate_Params& params) { 58 const ViewHostMsg_FrameNavigate_Params& params) {
59 finder_->DidNavigateAnyFramePostCommit(tab_contents(), details, params); 59 finder_->DidNavigateAnyFrame(tab_contents(), details, params);
60 } 60 }
61 61
62 void TabFinder::TabContentsObserverImpl::TabContentsDestroyed( 62 void TabFinder::TabContentsObserverImpl::TabContentsDestroyed(
63 TabContents* tab) { 63 TabContents* tab) {
64 finder_->TabDestroyed(this); 64 finder_->TabDestroyed(this);
65 delete this; 65 delete this;
66 } 66 }
67 67
68 // static 68 // static
69 TabFinder* TabFinder::GetInstance() { 69 TabFinder* TabFinder::GetInstance() {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 TabFinder::TabFinder() { 124 TabFinder::TabFinder() {
125 registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, 125 registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED,
126 content::NotificationService::AllSources()); 126 content::NotificationService::AllSources());
127 } 127 }
128 128
129 TabFinder::~TabFinder() { 129 TabFinder::~TabFinder() {
130 STLDeleteElements(&tab_contents_observers_); 130 STLDeleteElements(&tab_contents_observers_);
131 } 131 }
132 132
133 void TabFinder::DidNavigateAnyFramePostCommit( 133 void TabFinder::DidNavigateAnyFrame(
134 TabContents* source, 134 TabContents* source,
135 const content::LoadCommittedDetails& details, 135 const content::LoadCommittedDetails& details,
136 const ViewHostMsg_FrameNavigate_Params& params) { 136 const ViewHostMsg_FrameNavigate_Params& params) {
137 CancelRequestsFor(source); 137 CancelRequestsFor(source);
138 138
139 if (content::PageTransitionIsRedirect(params.transition)) { 139 if (content::PageTransitionIsRedirect(params.transition)) {
140 // If this is a redirect, we need to go to the db to get the start. 140 // If this is a redirect, we need to go to the db to get the start.
141 FetchRedirectStart(source); 141 FetchRedirectStart(source);
142 } else if (params.redirects.size() > 1 || 142 } else if (params.redirects.size() > 1 ||
143 params.redirects[0] != details.entry->url()) { 143 params.redirects[0] != details.entry->url()) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 GURL url, 228 GURL url,
229 bool success, 229 bool success,
230 history::RedirectList* redirects) { 230 history::RedirectList* redirects) {
231 if (success && !redirects->empty()) { 231 if (success && !redirects->empty()) {
232 TabContents* tab_contents = 232 TabContents* tab_contents =
233 callback_consumer_.GetClientDataForCurrentRequest(); 233 callback_consumer_.GetClientDataForCurrentRequest();
234 DCHECK(tab_contents); 234 DCHECK(tab_contents);
235 tab_contents_to_url_[tab_contents] = redirects->back(); 235 tab_contents_to_url_[tab_contents] = redirects->back();
236 } 236 }
237 } 237 }
OLDNEW
« no previous file with comments | « chrome/browser/tabs/tab_finder.h ('k') | chrome/browser/task_manager/task_manager_resource_providers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698