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 #ifndef CHROME_BROWSER_TABS_TAB_FINDER_H_ | 5 #ifndef CHROME_BROWSER_TABS_TAB_FINDER_H_ |
6 #define CHROME_BROWSER_TABS_TAB_FINDER_H_ | 6 #define CHROME_BROWSER_TABS_TAB_FINDER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "chrome/browser/history/history_types.h" | 14 #include "chrome/browser/history/history_types.h" |
15 #include "content/browser/cancelable_request.h" | 15 #include "content/browser/cancelable_request.h" |
16 #include "content/public/browser/notification_observer.h" | 16 #include "content/public/browser/notification_observer.h" |
17 #include "content/public/browser/notification_registrar.h" | 17 #include "content/public/browser/notification_registrar.h" |
18 | 18 |
19 class Browser; | 19 class Browser; |
20 class GURL; | 20 class GURL; |
21 class TabContents; | 21 class TabContents; |
22 struct ViewHostMsg_FrameNavigate_Params; | |
23 | 22 |
24 namespace content { | 23 namespace content { |
| 24 struct FrameNavigateParams; |
25 struct LoadCommittedDetails; | 25 struct LoadCommittedDetails; |
26 } | 26 } |
27 | 27 |
28 // TabFinder is used to locate a tab by URL. TabFinder matches tabs based | 28 // TabFinder is used to locate a tab by URL. TabFinder matches tabs based |
29 // on the tabs current url, or the start of the redirect chain. | 29 // on the tabs current url, or the start of the redirect chain. |
30 // | 30 // |
31 // TODO: if we end up keeping this (moving it out of about:flags) then we | 31 // TODO: if we end up keeping this (moving it out of about:flags) then we |
32 // should persist the start of the redirect chain in the navigation entry. | 32 // should persist the start of the redirect chain in the navigation entry. |
33 class TabFinder : public content::NotificationObserver { | 33 class TabFinder : public content::NotificationObserver { |
34 public: | 34 public: |
(...skipping 23 matching lines...) Expand all Loading... |
58 typedef std::map<TabContents*, GURL> TabContentsToURLMap; | 58 typedef std::map<TabContents*, GURL> TabContentsToURLMap; |
59 typedef std::set<TabContentsObserverImpl*> TabContentsObservers; | 59 typedef std::set<TabContentsObserverImpl*> TabContentsObservers; |
60 | 60 |
61 TabFinder(); | 61 TabFinder(); |
62 virtual ~TabFinder(); | 62 virtual ~TabFinder(); |
63 | 63 |
64 // Forwarded from TabContentsObserverImpl. | 64 // Forwarded from TabContentsObserverImpl. |
65 void DidNavigateAnyFrame( | 65 void DidNavigateAnyFrame( |
66 TabContents* source, | 66 TabContents* source, |
67 const content::LoadCommittedDetails& details, | 67 const content::LoadCommittedDetails& details, |
68 const ViewHostMsg_FrameNavigate_Params& params); | 68 const content::FrameNavigateParams& params); |
69 | 69 |
70 // Returns true if the tab's current url is |url|, or the start of the | 70 // Returns true if the tab's current url is |url|, or the start of the |
71 // redirect chain for the tab is |url|. | 71 // redirect chain for the tab is |url|. |
72 bool TabMatchesURL(TabContents* tab_contents, const GURL& url); | 72 bool TabMatchesURL(TabContents* tab_contents, const GURL& url); |
73 | 73 |
74 // Returns the first tab in the specified browser that matches the specified | 74 // Returns the first tab in the specified browser that matches the specified |
75 // url. Returns NULL if there are no tabs matching the specified url. | 75 // url. Returns NULL if there are no tabs matching the specified url. |
76 TabContents* FindTabInBrowser(Browser* browser, const GURL& url); | 76 TabContents* FindTabInBrowser(Browser* browser, const GURL& url); |
77 | 77 |
78 // If we're not currently tracking |tab| this creates a | 78 // If we're not currently tracking |tab| this creates a |
(...skipping 22 matching lines...) Expand all Loading... |
101 CancelableRequestConsumerTSimple<TabContents*> callback_consumer_; | 101 CancelableRequestConsumerTSimple<TabContents*> callback_consumer_; |
102 | 102 |
103 content::NotificationRegistrar registrar_; | 103 content::NotificationRegistrar registrar_; |
104 | 104 |
105 TabContentsObservers tab_contents_observers_; | 105 TabContentsObservers tab_contents_observers_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(TabFinder); | 107 DISALLOW_COPY_AND_ASSIGN(TabFinder); |
108 }; | 108 }; |
109 | 109 |
110 #endif // CHROME_BROWSER_TABS_TAB_FINDER_H_ | 110 #endif // CHROME_BROWSER_TABS_TAB_FINDER_H_ |
OLD | NEW |