Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/tabs/tabs_event_router.h" | 5 #include "chrome/browser/extensions/api/tabs/tabs_event_router.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 | 122 |
| 123 BrowserList::AddObserver(this); | 123 BrowserList::AddObserver(this); |
| 124 | 124 |
| 125 // Init() can happen after the browser is running, so catch up with any | 125 // Init() can happen after the browser is running, so catch up with any |
| 126 // windows that already exist. | 126 // windows that already exist. |
| 127 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 127 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
| 128 RegisterForBrowserNotifications(*it); | 128 RegisterForBrowserNotifications(*it); |
| 129 | 129 |
| 130 // Also catch up our internal bookkeeping of tab entries. | 130 // Also catch up our internal bookkeeping of tab entries. |
| 131 Browser* browser = *it; | 131 Browser* browser = *it; |
| 132 if (browser->tab_strip_model()) { | 132 if (!browser->is_devtools() && browser->tab_strip_model()) { |
|
not at google - send to devlin
2015/07/16 17:09:23
For whatever reason, this condition would make mor
llandwerlin-old
2015/07/17 11:32:04
Done.
| |
| 133 for (int i = 0; i < browser->tab_strip_model()->count(); ++i) { | 133 for (int i = 0; i < browser->tab_strip_model()->count(); ++i) { |
| 134 WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(i); | 134 WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(i); |
| 135 int tab_id = ExtensionTabUtil::GetTabId(contents); | 135 int tab_id = ExtensionTabUtil::GetTabId(contents); |
| 136 tab_entries_[tab_id] = make_linked_ptr(new TabEntry(contents)); | 136 tab_entries_[tab_id] = make_linked_ptr(new TabEntry(contents)); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 TabsEventRouter::~TabsEventRouter() { | 142 TabsEventRouter::~TabsEventRouter() { |
| 143 BrowserList::RemoveObserver(this); | 143 BrowserList::RemoveObserver(this); |
| 144 } | 144 } |
| 145 | 145 |
| 146 void TabsEventRouter::OnBrowserAdded(Browser* browser) { | 146 void TabsEventRouter::OnBrowserAdded(Browser* browser) { |
| 147 RegisterForBrowserNotifications(browser); | 147 RegisterForBrowserNotifications(browser); |
| 148 } | 148 } |
| 149 | 149 |
| 150 void TabsEventRouter::RegisterForBrowserNotifications(Browser* browser) { | 150 void TabsEventRouter::RegisterForBrowserNotifications(Browser* browser) { |
| 151 if (!profile_->IsSameProfile(browser->profile())) | 151 if (!profile_->IsSameProfile(browser->profile()) || browser->is_devtools()) |
| 152 return; | 152 return; |
| 153 // Start listening to TabStripModel events for this browser. | 153 // Start listening to TabStripModel events for this browser. |
| 154 TabStripModel* tab_strip = browser->tab_strip_model(); | 154 TabStripModel* tab_strip = browser->tab_strip_model(); |
| 155 tab_strip->AddObserver(this); | 155 tab_strip->AddObserver(this); |
| 156 | 156 |
| 157 for (int i = 0; i < tab_strip->count(); ++i) { | 157 for (int i = 0; i < tab_strip->count(); ++i) { |
| 158 RegisterForTabNotifications(tab_strip->GetWebContentsAt(i)); | 158 RegisterForTabNotifications(tab_strip->GetWebContentsAt(i)); |
| 159 } | 159 } |
| 160 } | 160 } |
| 161 | 161 |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 void TabsEventRouter::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, | 629 void TabsEventRouter::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, |
| 630 bool icon_url_changed) { | 630 bool icon_url_changed) { |
| 631 if (icon_url_changed) { | 631 if (icon_url_changed) { |
| 632 favicon::ContentFaviconDriver* content_favicon_driver = | 632 favicon::ContentFaviconDriver* content_favicon_driver = |
| 633 static_cast<favicon::ContentFaviconDriver*>(favicon_driver); | 633 static_cast<favicon::ContentFaviconDriver*>(favicon_driver); |
| 634 FaviconUrlUpdated(content_favicon_driver->web_contents()); | 634 FaviconUrlUpdated(content_favicon_driver->web_contents()); |
| 635 } | 635 } |
| 636 } | 636 } |
| 637 | 637 |
| 638 } // namespace extensions | 638 } // namespace extensions |
| OLD | NEW |