| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_H_ | 6 #define CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/browser_list_observer.h" | 9 #include "chrome/browser/ui/browser_list_observer.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 void OnBrowserSetLastActive(Browser* browser) override; | 32 void OnBrowserSetLastActive(Browser* browser) override; |
| 33 void OnBrowserRemoved(Browser* browser) override; | 33 void OnBrowserRemoved(Browser* browser) override; |
| 34 | 34 |
| 35 // TabStripModelObserver | 35 // TabStripModelObserver |
| 36 void ActiveTabChanged(content::WebContents* old_contents, | 36 void ActiveTabChanged(content::WebContents* old_contents, |
| 37 content::WebContents* new_contents, | 37 content::WebContents* new_contents, |
| 38 int index, | 38 int index, |
| 39 int reason) override; | 39 int reason) override; |
| 40 | 40 |
| 41 // content::WebContentsObserver | 41 // content::WebContentsObserver |
| 42 void DidNavigateMainFrame( | 42 void DidFinishNavigation( |
| 43 const content::LoadCommittedDetails& details, | 43 content::NavigationHandle* navigation_handle) override; |
| 44 const content::FrameNavigateParams& params) override; | |
| 45 | 44 |
| 46 // Updates the active browser. | 45 // Updates the active browser. |
| 47 void SetActiveBrowser(Browser* active_browser); | 46 void SetActiveBrowser(Browser* active_browser); |
| 48 | 47 |
| 49 // Makes this object start observing the WebContents, if it is not already | 48 // Makes this object start observing the WebContents, if it is not already |
| 50 // doing so. This method is idempotent. | 49 // doing so. This method is idempotent. |
| 51 void StartObservingWebContents(content::WebContents* web_contents); | 50 void StartObservingWebContents(content::WebContents* web_contents); |
| 52 | 51 |
| 53 // Makes this object stop observing the WebContents. | 52 // Makes this object stop observing the WebContents. |
| 54 void StopObservingWebContents(); | 53 void StopObservingWebContents(); |
| 55 | 54 |
| 56 // Returns the active WebContents. May return nullptr. | 55 // Returns the active WebContents. May return nullptr. |
| 57 content::WebContents* GetActiveWebContents(); | 56 content::WebContents* GetActiveWebContents(); |
| 58 | 57 |
| 59 // Instances of this class should be owned by their |delegate_|. | 58 // Instances of this class should be owned by their |delegate_|. |
| 60 HandoffActiveURLObserverDelegate* delegate_; | 59 HandoffActiveURLObserverDelegate* delegate_; |
| 61 | 60 |
| 62 // This pointer is always up to date, and points to the most recently | 61 // This pointer is always up to date, and points to the most recently |
| 63 // activated browser, or nullptr if no browsers exist. | 62 // activated browser, or nullptr if no browsers exist. |
| 64 Browser* active_browser_; | 63 Browser* active_browser_; |
| 65 | 64 |
| 66 DISALLOW_COPY_AND_ASSIGN(HandoffActiveURLObserver); | 65 DISALLOW_COPY_AND_ASSIGN(HandoffActiveURLObserver); |
| 67 }; | 66 }; |
| 68 | 67 |
| 69 #endif // CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_H_ | 68 #endif // CHROME_BROWSER_UI_COCOA_HANDOFF_ACTIVE_URL_OBSERVER_H_ |
| OLD | NEW |