| OLD | NEW |
| 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 // Implements the Chrome Extensions WebNavigation API. | 5 // Implements the Chrome Extensions WebNavigation API. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" | 7 #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 WebNavigationEventRouter::WebNavigationEventRouter(Profile* profile) | 74 WebNavigationEventRouter::WebNavigationEventRouter(Profile* profile) |
| 75 : profile_(profile), browser_tab_strip_tracker_(this, this, nullptr) { | 75 : profile_(profile), browser_tab_strip_tracker_(this, this, nullptr) { |
| 76 CHECK(registrar_.IsEmpty()); | 76 CHECK(registrar_.IsEmpty()); |
| 77 registrar_.Add(this, | 77 registrar_.Add(this, |
| 78 chrome::NOTIFICATION_TAB_ADDED, | 78 chrome::NOTIFICATION_TAB_ADDED, |
| 79 content::NotificationService::AllSources()); | 79 content::NotificationService::AllSources()); |
| 80 registrar_.Add(this, | 80 registrar_.Add(this, |
| 81 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 81 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 82 content::NotificationService::AllSources()); | 82 content::NotificationService::AllSources()); |
| 83 | 83 |
| 84 browser_tab_strip_tracker_.Init( | 84 browser_tab_strip_tracker_.Init(); |
| 85 BrowserTabStripTracker::InitWith::ALL_BROWERS); | |
| 86 } | 85 } |
| 87 | 86 |
| 88 WebNavigationEventRouter::~WebNavigationEventRouter() { | 87 WebNavigationEventRouter::~WebNavigationEventRouter() { |
| 89 } | 88 } |
| 90 | 89 |
| 91 bool WebNavigationEventRouter::ShouldTrackBrowser(Browser* browser) { | 90 bool WebNavigationEventRouter::ShouldTrackBrowser(Browser* browser) { |
| 92 return profile_->IsSameProfile(browser->profile()); | 91 return profile_->IsSameProfile(browser->profile()); |
| 93 } | 92 } |
| 94 | 93 |
| 95 void WebNavigationEventRouter::TabReplacedAt( | 94 void WebNavigationEventRouter::TabReplacedAt( |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 return g_factory.Pointer(); | 581 return g_factory.Pointer(); |
| 583 } | 582 } |
| 584 | 583 |
| 585 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { | 584 void WebNavigationAPI::OnListenerAdded(const EventListenerInfo& details) { |
| 586 web_navigation_event_router_.reset(new WebNavigationEventRouter( | 585 web_navigation_event_router_.reset(new WebNavigationEventRouter( |
| 587 Profile::FromBrowserContext(browser_context_))); | 586 Profile::FromBrowserContext(browser_context_))); |
| 588 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 587 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
| 589 } | 588 } |
| 590 | 589 |
| 591 } // namespace extensions | 590 } // namespace extensions |
| OLD | NEW |