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/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
8 #include "base/values.h" | 9 #include "base/values.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 10 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" | 11 #include "chrome/browser/extensions/api/tabs/tabs_constants.h" |
11 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" | 12 #include "chrome/browser/extensions/api/tabs/tabs_windows_api.h" |
12 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" | 13 #include "chrome/browser/extensions/api/tabs/windows_event_router.h" |
13 #include "chrome/browser/extensions/extension_tab_util.h" | 14 #include "chrome/browser/extensions/extension_tab_util.h" |
14 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
15 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
16 #include "chrome/browser/ui/browser_iterator.h" | 17 #include "chrome/browser/ui/browser_iterator.h" |
17 #include "chrome/browser/ui/browser_list.h" | 18 #include "chrome/browser/ui/browser_list.h" |
18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/browser/ui/tabs/tab_utils.h" |
| 21 #include "chrome/common/chrome_switches.h" |
19 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
20 #include "components/favicon/content/content_favicon_driver.h" | 23 #include "components/favicon/content/content_favicon_driver.h" |
21 #include "content/public/browser/favicon_status.h" | 24 #include "content/public/browser/favicon_status.h" |
22 #include "content/public/browser/navigation_controller.h" | 25 #include "content/public/browser/navigation_controller.h" |
23 #include "content/public/browser/navigation_entry.h" | 26 #include "content/public/browser/navigation_entry.h" |
24 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
25 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
26 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
27 | 30 |
28 using base::DictionaryValue; | 31 using base::DictionaryValue; |
(...skipping 23 matching lines...) Expand all Loading... |
52 properties_value); | 55 properties_value); |
53 event_args->Set(1, properties_value); | 56 event_args->Set(1, properties_value); |
54 | 57 |
55 // Overwrite the third arg with our tab value as seen by this extension. | 58 // Overwrite the third arg with our tab value as seen by this extension. |
56 event_args->Set(2, ExtensionTabUtil::CreateTabValue(contents, extension)); | 59 event_args->Set(2, ExtensionTabUtil::CreateTabValue(contents, extension)); |
57 return true; | 60 return true; |
58 } | 61 } |
59 | 62 |
60 } // namespace | 63 } // namespace |
61 | 64 |
62 TabsEventRouter::TabEntry::TabEntry() : complete_waiting_on_load_(false), | 65 TabsEventRouter::TabEntry::TabEntry(content::WebContents* contents) |
63 url_() { | 66 : contents_(contents), |
| 67 complete_waiting_on_load_(false), |
| 68 was_audible_(contents->WasRecentlyAudible()), |
| 69 was_muted_(contents->IsAudioMuted()) { |
64 } | 70 } |
65 | 71 |
66 base::DictionaryValue* TabsEventRouter::TabEntry::UpdateLoadState( | 72 scoped_ptr<base::DictionaryValue> TabsEventRouter::TabEntry::UpdateLoadState() { |
67 const WebContents* contents) { | |
68 // The tab may go in & out of loading (for instance if iframes navigate). | 73 // The tab may go in & out of loading (for instance if iframes navigate). |
69 // We only want to respond to the first change from loading to !loading after | 74 // We only want to respond to the first change from loading to !loading after |
70 // the NAV_ENTRY_COMMITTED was fired. | 75 // the NAV_ENTRY_COMMITTED was fired. |
71 if (!complete_waiting_on_load_ || contents->IsLoading()) | 76 scoped_ptr<base::DictionaryValue> changed_properties( |
72 return NULL; | 77 new base::DictionaryValue()); |
| 78 if (!complete_waiting_on_load_ || contents_->IsLoading()) { |
| 79 return changed_properties.Pass(); |
| 80 } |
73 | 81 |
74 // Send "complete" state change. | 82 // Send "complete" state change. |
75 complete_waiting_on_load_ = false; | 83 complete_waiting_on_load_ = false; |
76 base::DictionaryValue* changed_properties = new base::DictionaryValue(); | |
77 changed_properties->SetString(tabs_constants::kStatusKey, | 84 changed_properties->SetString(tabs_constants::kStatusKey, |
78 tabs_constants::kStatusValueComplete); | 85 tabs_constants::kStatusValueComplete); |
79 return changed_properties; | 86 return changed_properties.Pass(); |
80 } | 87 } |
81 | 88 |
82 base::DictionaryValue* TabsEventRouter::TabEntry::DidNavigate( | 89 scoped_ptr<base::DictionaryValue> TabsEventRouter::TabEntry::DidNavigate() { |
83 const WebContents* contents) { | |
84 // Send "loading" state change. | 90 // Send "loading" state change. |
85 complete_waiting_on_load_ = true; | 91 complete_waiting_on_load_ = true; |
86 base::DictionaryValue* changed_properties = new base::DictionaryValue(); | 92 scoped_ptr<base::DictionaryValue> changed_properties( |
| 93 new base::DictionaryValue()); |
87 changed_properties->SetString(tabs_constants::kStatusKey, | 94 changed_properties->SetString(tabs_constants::kStatusKey, |
88 tabs_constants::kStatusValueLoading); | 95 tabs_constants::kStatusValueLoading); |
89 | 96 |
90 if (contents->GetURL() != url_) { | 97 if (contents_->GetURL() != url_) { |
91 url_ = contents->GetURL(); | 98 url_ = contents_->GetURL(); |
92 changed_properties->SetString(tabs_constants::kUrlKey, url_.spec()); | 99 changed_properties->SetString(tabs_constants::kUrlKey, url_.spec()); |
93 } | 100 } |
94 | 101 |
95 return changed_properties; | 102 return changed_properties.Pass(); |
| 103 } |
| 104 |
| 105 bool TabsEventRouter::TabEntry::SetAudible(bool new_val) { |
| 106 if (was_audible_ == new_val) |
| 107 return false; |
| 108 was_audible_ = new_val; |
| 109 return true; |
| 110 } |
| 111 |
| 112 bool TabsEventRouter::TabEntry::SetMuted(bool new_val) { |
| 113 if (was_muted_ == new_val) |
| 114 return false; |
| 115 was_muted_ = new_val; |
| 116 return true; |
96 } | 117 } |
97 | 118 |
98 TabsEventRouter::TabsEventRouter(Profile* profile) | 119 TabsEventRouter::TabsEventRouter(Profile* profile) |
99 : profile_(profile), favicon_scoped_observer_(this) { | 120 : profile_(profile), favicon_scoped_observer_(this) { |
100 DCHECK(!profile->IsOffTheRecord()); | 121 DCHECK(!profile->IsOffTheRecord()); |
101 | 122 |
102 BrowserList::AddObserver(this); | 123 BrowserList::AddObserver(this); |
103 | 124 |
104 // 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 |
105 // windows that already exist. | 126 // windows that already exist. |
106 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | 127 for (chrome::BrowserIterator it; !it.done(); it.Next()) { |
107 RegisterForBrowserNotifications(*it); | 128 RegisterForBrowserNotifications(*it); |
108 | 129 |
109 // Also catch up our internal bookkeeping of tab entries. | 130 // Also catch up our internal bookkeeping of tab entries. |
110 Browser* browser = *it; | 131 Browser* browser = *it; |
111 if (browser->tab_strip_model()) { | 132 if (browser->tab_strip_model()) { |
112 for (int i = 0; i < browser->tab_strip_model()->count(); ++i) { | 133 for (int i = 0; i < browser->tab_strip_model()->count(); ++i) { |
113 WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(i); | 134 WebContents* contents = browser->tab_strip_model()->GetWebContentsAt(i); |
114 int tab_id = ExtensionTabUtil::GetTabId(contents); | 135 int tab_id = ExtensionTabUtil::GetTabId(contents); |
115 tab_entries_[tab_id] = TabEntry(); | 136 tab_entries_[tab_id] = make_linked_ptr(new TabEntry(contents)); |
116 } | 137 } |
117 } | 138 } |
118 } | 139 } |
119 } | 140 } |
120 | 141 |
121 TabsEventRouter::~TabsEventRouter() { | 142 TabsEventRouter::~TabsEventRouter() { |
122 BrowserList::RemoveObserver(this); | 143 BrowserList::RemoveObserver(this); |
123 } | 144 } |
124 | 145 |
125 void TabsEventRouter::OnBrowserAdded(Browser* browser) { | 146 void TabsEventRouter::OnBrowserAdded(Browser* browser) { |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 EventRouter::Get(profile)->BroadcastEvent(event.Pass()); | 231 EventRouter::Get(profile)->BroadcastEvent(event.Pass()); |
211 | 232 |
212 RegisterForTabNotifications(contents); | 233 RegisterForTabNotifications(contents); |
213 } | 234 } |
214 | 235 |
215 void TabsEventRouter::TabInsertedAt(WebContents* contents, | 236 void TabsEventRouter::TabInsertedAt(WebContents* contents, |
216 int index, | 237 int index, |
217 bool active) { | 238 bool active) { |
218 // If tab is new, send created event. | 239 // If tab is new, send created event. |
219 int tab_id = ExtensionTabUtil::GetTabId(contents); | 240 int tab_id = ExtensionTabUtil::GetTabId(contents); |
220 if (!GetTabEntry(contents)) { | 241 if (GetTabEntry(contents).get() == NULL) { |
221 tab_entries_[tab_id] = TabEntry(); | 242 tab_entries_[tab_id] = make_linked_ptr(new TabEntry(contents)); |
222 | 243 |
223 TabCreatedAt(contents, index, active); | 244 TabCreatedAt(contents, index, active); |
224 return; | 245 return; |
225 } | 246 } |
226 | 247 |
227 scoped_ptr<base::ListValue> args(new base::ListValue); | 248 scoped_ptr<base::ListValue> args(new base::ListValue); |
228 args->Append(new FundamentalValue(tab_id)); | 249 args->Append(new FundamentalValue(tab_id)); |
229 | 250 |
230 base::DictionaryValue* object_args = new base::DictionaryValue(); | 251 base::DictionaryValue* object_args = new base::DictionaryValue(); |
231 object_args->Set(tabs_constants::kNewWindowIdKey, | 252 object_args->Set(tabs_constants::kNewWindowIdKey, |
232 new FundamentalValue( | 253 new FundamentalValue( |
233 ExtensionTabUtil::GetWindowIdOfTab(contents))); | 254 ExtensionTabUtil::GetWindowIdOfTab(contents))); |
234 object_args->Set(tabs_constants::kNewPositionKey, | 255 object_args->Set(tabs_constants::kNewPositionKey, |
235 new FundamentalValue(index)); | 256 new FundamentalValue(index)); |
236 args->Append(object_args); | 257 args->Append(object_args); |
237 | 258 |
238 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 259 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
239 DispatchEvent(profile, tabs::OnAttached::kEventName, args.Pass(), | 260 DispatchEvent(profile, tabs::OnAttached::kEventName, args.Pass(), |
240 EventRouter::USER_GESTURE_UNKNOWN); | 261 EventRouter::USER_GESTURE_UNKNOWN); |
241 } | 262 } |
242 | 263 |
243 void TabsEventRouter::TabDetachedAt(WebContents* contents, int index) { | 264 void TabsEventRouter::TabDetachedAt(WebContents* contents, int index) { |
244 if (!GetTabEntry(contents)) { | 265 if (GetTabEntry(contents).get() == NULL) { |
245 // The tab was removed. Don't send detach event. | 266 // The tab was removed. Don't send detach event. |
246 return; | 267 return; |
247 } | 268 } |
248 | 269 |
249 scoped_ptr<base::ListValue> args(new base::ListValue); | 270 scoped_ptr<base::ListValue> args(new base::ListValue); |
250 args->Append( | 271 args->Append( |
251 new FundamentalValue(ExtensionTabUtil::GetTabId(contents))); | 272 new FundamentalValue(ExtensionTabUtil::GetTabId(contents))); |
252 | 273 |
253 base::DictionaryValue* object_args = new base::DictionaryValue(); | 274 base::DictionaryValue* object_args = new base::DictionaryValue(); |
254 object_args->Set(tabs_constants::kOldWindowIdKey, | 275 object_args->Set(tabs_constants::kOldWindowIdKey, |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 new FundamentalValue(to_index)); | 407 new FundamentalValue(to_index)); |
387 args->Append(object_args); | 408 args->Append(object_args); |
388 | 409 |
389 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); | 410 Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); |
390 DispatchEvent(profile, | 411 DispatchEvent(profile, |
391 tabs::OnMoved::kEventName, | 412 tabs::OnMoved::kEventName, |
392 args.Pass(), | 413 args.Pass(), |
393 EventRouter::USER_GESTURE_UNKNOWN); | 414 EventRouter::USER_GESTURE_UNKNOWN); |
394 } | 415 } |
395 | 416 |
396 void TabsEventRouter::TabUpdated(WebContents* contents, bool did_navigate) { | 417 void TabsEventRouter::TabUpdated( |
397 TabEntry* entry = GetTabEntry(contents); | 418 linked_ptr<TabEntry> entry, |
398 scoped_ptr<base::DictionaryValue> changed_properties; | 419 scoped_ptr<base::DictionaryValue> changed_properties) { |
| 420 CHECK(entry->web_contents()); |
399 | 421 |
400 if (!entry) | 422 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
401 return; | 423 switches::kEnableTabAudioMuting)) { |
| 424 bool audible = entry->web_contents()->WasRecentlyAudible(); |
| 425 if (entry->SetAudible(audible)) { |
| 426 changed_properties->SetBoolean(tabs_constants::kAudibleKey, audible); |
| 427 } |
402 | 428 |
403 if (did_navigate) | 429 bool muted = entry->web_contents()->IsAudioMuted(); |
404 changed_properties.reset(entry->DidNavigate(contents)); | 430 if (entry->SetMuted(muted)) { |
405 else | 431 changed_properties->SetBoolean(tabs_constants::kMutedKey, muted); |
406 changed_properties.reset(entry->UpdateLoadState(contents)); | 432 changed_properties->SetString( |
| 433 tabs_constants::kMutedCauseKey, |
| 434 chrome::GetTabAudioMutedCause(entry->web_contents())); |
| 435 } |
| 436 } |
407 | 437 |
408 if (changed_properties) | 438 if (!changed_properties->empty()) { |
409 DispatchTabUpdatedEvent(contents, changed_properties.Pass()); | 439 DispatchTabUpdatedEvent(entry->web_contents(), changed_properties.Pass()); |
| 440 } |
410 } | 441 } |
411 | 442 |
412 void TabsEventRouter::FaviconUrlUpdated(WebContents* contents) { | 443 void TabsEventRouter::FaviconUrlUpdated(WebContents* contents) { |
413 content::NavigationEntry* entry = | 444 content::NavigationEntry* entry = |
414 contents->GetController().GetVisibleEntry(); | 445 contents->GetController().GetVisibleEntry(); |
415 if (!entry || !entry->GetFavicon().valid) | 446 if (!entry || !entry->GetFavicon().valid) |
416 return; | 447 return; |
417 scoped_ptr<base::DictionaryValue> changed_properties( | 448 scoped_ptr<base::DictionaryValue> changed_properties( |
418 new base::DictionaryValue); | 449 new base::DictionaryValue); |
419 changed_properties->SetString( | 450 changed_properties->SetString( |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 events::UNKNOWN, tabs::OnUpdated::kEventName, args_base.Pass())); | 507 events::UNKNOWN, tabs::OnUpdated::kEventName, args_base.Pass())); |
477 event->restrict_to_browser_context = profile; | 508 event->restrict_to_browser_context = profile; |
478 event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED; | 509 event->user_gesture = EventRouter::USER_GESTURE_NOT_ENABLED; |
479 event->will_dispatch_callback = | 510 event->will_dispatch_callback = |
480 base::Bind(&WillDispatchTabUpdatedEvent, | 511 base::Bind(&WillDispatchTabUpdatedEvent, |
481 contents, | 512 contents, |
482 changed_properties.get()); | 513 changed_properties.get()); |
483 EventRouter::Get(profile)->BroadcastEvent(event.Pass()); | 514 EventRouter::Get(profile)->BroadcastEvent(event.Pass()); |
484 } | 515 } |
485 | 516 |
486 TabsEventRouter::TabEntry* TabsEventRouter::GetTabEntry(WebContents* contents) { | 517 linked_ptr<TabsEventRouter::TabEntry> TabsEventRouter::GetTabEntry( |
| 518 WebContents* contents) { |
487 int tab_id = ExtensionTabUtil::GetTabId(contents); | 519 int tab_id = ExtensionTabUtil::GetTabId(contents); |
488 std::map<int, TabEntry>::iterator i = tab_entries_.find(tab_id); | 520 |
| 521 TabEntryMap::iterator i = tab_entries_.find(tab_id); |
489 if (tab_entries_.end() == i) | 522 if (tab_entries_.end() == i) |
490 return NULL; | 523 return linked_ptr<TabEntry>(NULL); |
491 return &i->second; | 524 return i->second; |
492 } | 525 } |
493 | 526 |
494 void TabsEventRouter::Observe(int type, | 527 void TabsEventRouter::Observe(int type, |
495 const content::NotificationSource& source, | 528 const content::NotificationSource& source, |
496 const content::NotificationDetails& details) { | 529 const content::NotificationDetails& details) { |
497 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { | 530 if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { |
498 NavigationController* source_controller = | 531 NavigationController* source_controller = |
499 content::Source<NavigationController>(source).ptr(); | 532 content::Source<NavigationController>(source).ptr(); |
500 TabUpdated(source_controller->GetWebContents(), true); | 533 linked_ptr<TabEntry> entry = |
| 534 GetTabEntry(source_controller->GetWebContents()); |
| 535 CHECK(entry.get()); |
| 536 TabUpdated(entry, (entry.get())->DidNavigate()); |
501 } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { | 537 } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { |
502 // Tab was destroyed after being detached (without being re-attached). | 538 // Tab was destroyed after being detached (without being re-attached). |
503 WebContents* contents = content::Source<WebContents>(source).ptr(); | 539 WebContents* contents = content::Source<WebContents>(source).ptr(); |
504 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 540 registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
505 content::Source<NavigationController>(&contents->GetController())); | 541 content::Source<NavigationController>(&contents->GetController())); |
506 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 542 registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
507 content::Source<WebContents>(contents)); | 543 content::Source<WebContents>(contents)); |
508 favicon_scoped_observer_.Remove( | 544 favicon_scoped_observer_.Remove( |
509 favicon::ContentFaviconDriver::FromWebContents(contents)); | 545 favicon::ContentFaviconDriver::FromWebContents(contents)); |
510 } else { | 546 } else { |
511 NOTREACHED(); | 547 NOTREACHED(); |
512 } | 548 } |
513 } | 549 } |
514 | 550 |
515 void TabsEventRouter::TabChangedAt(WebContents* contents, | 551 void TabsEventRouter::TabChangedAt(WebContents* contents, |
516 int index, | 552 int index, |
517 TabChangeType change_type) { | 553 TabChangeType change_type) { |
518 TabUpdated(contents, false); | 554 linked_ptr<TabEntry> entry = GetTabEntry(contents); |
| 555 CHECK(entry.get()); |
| 556 TabUpdated(entry, (entry.get())->UpdateLoadState()); |
519 } | 557 } |
520 | 558 |
521 void TabsEventRouter::TabReplacedAt(TabStripModel* tab_strip_model, | 559 void TabsEventRouter::TabReplacedAt(TabStripModel* tab_strip_model, |
522 WebContents* old_contents, | 560 WebContents* old_contents, |
523 WebContents* new_contents, | 561 WebContents* new_contents, |
524 int index) { | 562 int index) { |
525 // Notify listeners that the next tabs closing or being added are due to | 563 // Notify listeners that the next tabs closing or being added are due to |
526 // WebContents being swapped. | 564 // WebContents being swapped. |
527 const int new_tab_id = ExtensionTabUtil::GetTabId(new_contents); | 565 const int new_tab_id = ExtensionTabUtil::GetTabId(new_contents); |
528 const int old_tab_id = ExtensionTabUtil::GetTabId(old_contents); | 566 const int old_tab_id = ExtensionTabUtil::GetTabId(old_contents); |
529 scoped_ptr<base::ListValue> args(new base::ListValue); | 567 scoped_ptr<base::ListValue> args(new base::ListValue); |
530 args->Append(new FundamentalValue(new_tab_id)); | 568 args->Append(new FundamentalValue(new_tab_id)); |
531 args->Append(new FundamentalValue(old_tab_id)); | 569 args->Append(new FundamentalValue(old_tab_id)); |
532 | 570 |
533 DispatchEvent(Profile::FromBrowserContext(new_contents->GetBrowserContext()), | 571 DispatchEvent(Profile::FromBrowserContext(new_contents->GetBrowserContext()), |
534 tabs::OnReplaced::kEventName, | 572 tabs::OnReplaced::kEventName, |
535 args.Pass(), | 573 args.Pass(), |
536 EventRouter::USER_GESTURE_UNKNOWN); | 574 EventRouter::USER_GESTURE_UNKNOWN); |
537 | 575 |
538 // Update tab_entries_. | 576 // Update tab_entries_. |
539 const int removed_count = tab_entries_.erase(old_tab_id); | 577 const int removed_count = tab_entries_.erase(old_tab_id); |
540 DCHECK_GT(removed_count, 0); | 578 DCHECK_GT(removed_count, 0); |
541 UnregisterForTabNotifications(old_contents); | 579 UnregisterForTabNotifications(old_contents); |
542 | 580 |
543 if (!GetTabEntry(new_contents)) { | 581 if (GetTabEntry(new_contents).get() == NULL) { |
544 tab_entries_[new_tab_id] = TabEntry(); | 582 tab_entries_[new_tab_id] = make_linked_ptr(new TabEntry(new_contents)); |
545 RegisterForTabNotifications(new_contents); | 583 RegisterForTabNotifications(new_contents); |
546 } | 584 } |
547 } | 585 } |
548 | 586 |
549 void TabsEventRouter::TabPinnedStateChanged(WebContents* contents, int index) { | 587 void TabsEventRouter::TabPinnedStateChanged(WebContents* contents, int index) { |
550 TabStripModel* tab_strip = NULL; | 588 TabStripModel* tab_strip = NULL; |
551 int tab_index; | 589 int tab_index; |
552 | 590 |
553 if (ExtensionTabUtil::GetTabStripModel(contents, &tab_strip, &tab_index)) { | 591 if (ExtensionTabUtil::GetTabStripModel(contents, &tab_strip, &tab_index)) { |
554 scoped_ptr<base::DictionaryValue> changed_properties( | 592 scoped_ptr<base::DictionaryValue> changed_properties( |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 void TabsEventRouter::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, | 629 void TabsEventRouter::OnFaviconUpdated(favicon::FaviconDriver* favicon_driver, |
592 bool icon_url_changed) { | 630 bool icon_url_changed) { |
593 if (icon_url_changed) { | 631 if (icon_url_changed) { |
594 favicon::ContentFaviconDriver* content_favicon_driver = | 632 favicon::ContentFaviconDriver* content_favicon_driver = |
595 static_cast<favicon::ContentFaviconDriver*>(favicon_driver); | 633 static_cast<favicon::ContentFaviconDriver*>(favicon_driver); |
596 FaviconUrlUpdated(content_favicon_driver->web_contents()); | 634 FaviconUrlUpdated(content_favicon_driver->web_contents()); |
597 } | 635 } |
598 } | 636 } |
599 | 637 |
600 } // namespace extensions | 638 } // namespace extensions |
OLD | NEW |