OLD | NEW |
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" |
11 #include "chrome/browser/history/history.h" | 11 #include "chrome/browser/history/history.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_list.h" | 14 #include "chrome/browser/ui/browser_list.h" |
15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "content/browser/tab_contents/navigation_details.h" | 17 #include "content/browser/tab_contents/navigation_details.h" |
18 #include "content/browser/tab_contents/navigation_entry.h" | 18 #include "content/browser/tab_contents/navigation_entry.h" |
19 #include "content/browser/tab_contents/tab_contents.h" | 19 #include "content/browser/tab_contents/tab_contents.h" |
20 #include "content/browser/tab_contents/tab_contents_observer.h" | 20 #include "content/browser/tab_contents/tab_contents_observer.h" |
21 #include "content/common/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
22 #include "content/common/view_messages.h" | 22 #include "content/common/view_messages.h" |
23 #include "content/public/browser/notification_source.h" | 23 #include "content/public/browser/notification_source.h" |
24 #include "content/public/browser/notification_types.h" | 24 #include "content/public/browser/notification_types.h" |
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 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 const content::NotificationDetails& details) { | 116 const content::NotificationDetails& details) { |
117 DCHECK_EQ(type, content::NOTIFICATION_TAB_PARENTED); | 117 DCHECK_EQ(type, content::NOTIFICATION_TAB_PARENTED); |
118 | 118 |
119 // The tab was added to a browser. Query for its state now. | 119 // The tab was added to a browser. Query for its state now. |
120 TabContentsWrapper* tab = content::Source<TabContentsWrapper>(source).ptr(); | 120 TabContentsWrapper* tab = content::Source<TabContentsWrapper>(source).ptr(); |
121 TrackTab(tab->tab_contents()); | 121 TrackTab(tab->tab_contents()); |
122 } | 122 } |
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 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::DidNavigateAnyFramePostCommit( |
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) { |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |