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 #include "chrome/browser/extensions/extension_browser_event_router.h" | 5 #include "chrome/browser/extensions/extension_browser_event_router.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api_constants.h" | 9 #include "chrome/browser/extensions/api/extension_action/extension_page_actions_
api_constants.h" |
10 #include "chrome/browser/extensions/extension_event_names.h" | 10 #include "chrome/browser/extensions/extension_event_names.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 tab_keys::kStatusValueLoading); | 65 tab_keys::kStatusValueLoading); |
66 | 66 |
67 if (contents->GetURL() != url_) { | 67 if (contents->GetURL() != url_) { |
68 url_ = contents->GetURL(); | 68 url_ = contents->GetURL(); |
69 changed_properties->SetString(tab_keys::kUrlKey, url_.spec()); | 69 changed_properties->SetString(tab_keys::kUrlKey, url_.spec()); |
70 } | 70 } |
71 | 71 |
72 return changed_properties; | 72 return changed_properties; |
73 } | 73 } |
74 | 74 |
75 void ExtensionBrowserEventRouter::Init(ExtensionToolbarModel* model) { | 75 void ExtensionBrowserEventRouter::Init() { |
76 if (initialized_) | 76 if (initialized_) |
77 return; | 77 return; |
78 model->AddObserver(this); | |
79 BrowserList::AddObserver(this); | 78 BrowserList::AddObserver(this); |
80 #if defined(TOOLKIT_VIEWS) | 79 #if defined(TOOLKIT_VIEWS) |
81 views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this); | 80 views::WidgetFocusManager::GetInstance()->AddFocusChangeListener(this); |
82 #elif defined(TOOLKIT_GTK) | 81 #elif defined(TOOLKIT_GTK) |
83 ui::ActiveWindowWatcherX::AddObserver(this); | 82 ui::ActiveWindowWatcherX::AddObserver(this); |
84 #elif defined(OS_MACOSX) | 83 #elif defined(OS_MACOSX) |
85 // Needed for when no suitable window can be passed to an extension as the | 84 // Needed for when no suitable window can be passed to an extension as the |
86 // currently focused window. | 85 // currently focused window. |
87 registrar_.Add(this, content::NOTIFICATION_NO_KEY_WINDOW, | 86 registrar_.Add(this, content::NOTIFICATION_NO_KEY_WINDOW, |
88 content::NotificationService::AllSources()); | 87 content::NotificationService::AllSources()); |
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 } | 693 } |
695 | 694 |
696 if (event_name) { | 695 if (event_name) { |
697 DispatchEventWithTab(profile, | 696 DispatchEventWithTab(profile, |
698 extension_id, | 697 extension_id, |
699 event_name, | 698 event_name, |
700 tab_contents->web_contents(), | 699 tab_contents->web_contents(), |
701 true); | 700 true); |
702 } | 701 } |
703 } | 702 } |
OLD | NEW |