Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(982)

Side by Side Diff: chrome/browser/extensions/extension_browser_event_router.h

Issue 7134035: Make an inserted selected tab selected before calling TabInsertedAt on observers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename foreground to active, and function style Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_browser_event_router.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <string> 10 #include <string>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #elif defined(TOOLKIT_GTK) 52 #elif defined(TOOLKIT_GTK)
53 virtual void ActiveWindowChanged(GdkWindow* active_window); 53 virtual void ActiveWindowChanged(GdkWindow* active_window);
54 #endif 54 #endif
55 55
56 // Called from Observe() on BROWSER_WINDOW_READY (not a part of 56 // Called from Observe() on BROWSER_WINDOW_READY (not a part of
57 // BrowserList::Observer). 57 // BrowserList::Observer).
58 void OnBrowserWindowReady(const Browser* browser); 58 void OnBrowserWindowReady(const Browser* browser);
59 59
60 // TabStripModelObserver 60 // TabStripModelObserver
61 virtual void TabInsertedAt(TabContentsWrapper* contents, int index, 61 virtual void TabInsertedAt(TabContentsWrapper* contents, int index,
62 bool foreground); 62 bool active);
63 virtual void TabClosingAt(TabStripModel* tab_strip_model, 63 virtual void TabClosingAt(TabStripModel* tab_strip_model,
64 TabContentsWrapper* contents, 64 TabContentsWrapper* contents,
65 int index); 65 int index);
66 virtual void TabDetachedAt(TabContentsWrapper* contents, int index); 66 virtual void TabDetachedAt(TabContentsWrapper* contents, int index);
67 virtual void ActiveTabChanged(TabContentsWrapper* old_contents, 67 virtual void ActiveTabChanged(TabContentsWrapper* old_contents,
68 TabContentsWrapper* new_contents, 68 TabContentsWrapper* new_contents,
69 int index, 69 int index,
70 bool user_gesture); 70 bool user_gesture);
71 virtual void TabMoved(TabContentsWrapper* contents, int from_index, 71 virtual void TabMoved(TabContentsWrapper* contents, int from_index,
72 int to_index); 72 int to_index);
(...skipping 17 matching lines...) Expand all
90 void BrowserActionExecuted(Profile* profile, 90 void BrowserActionExecuted(Profile* profile,
91 const std::string& extension_id, 91 const std::string& extension_id,
92 Browser* browser); 92 Browser* browser);
93 93
94 // NotificationObserver. 94 // NotificationObserver.
95 virtual void Observe(NotificationType type, 95 virtual void Observe(NotificationType type,
96 const NotificationSource& source, 96 const NotificationSource& source,
97 const NotificationDetails& details); 97 const NotificationDetails& details);
98 private: 98 private:
99 // "Synthetic" event. Called from TabInsertedAt if new tab is detected. 99 // "Synthetic" event. Called from TabInsertedAt if new tab is detected.
100 void TabCreatedAt(TabContents* contents, int index, bool foreground); 100 void TabCreatedAt(TabContents* contents, int index, bool active);
101 101
102 // Internal processing of tab updated events. Is called by both TabChangedAt 102 // Internal processing of tab updated events. Is called by both TabChangedAt
103 // and Observe/NAV_ENTRY_COMMITTED. 103 // and Observe/NAV_ENTRY_COMMITTED.
104 void TabUpdated(TabContents* contents, bool did_navigate); 104 void TabUpdated(TabContents* contents, bool did_navigate);
105 105
106 // The DispatchEvent methods forward events to the |profile|'s event router. 106 // The DispatchEvent methods forward events to the |profile|'s event router.
107 // The ExtensionBrowserEventRouter listens to events for all profiles, 107 // The ExtensionBrowserEventRouter listens to events for all profiles,
108 // so we avoid duplication by dropping events destined for other profiles. 108 // so we avoid duplication by dropping events destined for other profiles.
109 void DispatchEvent(Profile* profile, 109 void DispatchEvent(Profile* profile,
110 const char* event_name, 110 const char* event_name,
111 const std::string& json_args); 111 const std::string& json_args);
112 112
113 void DispatchEventToExtension(Profile* profile, 113 void DispatchEventToExtension(Profile* profile,
114 const std::string& extension_id, 114 const std::string& extension_id,
115 const char* event_name, 115 const char* event_name,
116 const std::string& json_args); 116 const std::string& json_args);
117 117
118 void DispatchEventWithTab(Profile* profile, 118 void DispatchEventWithTab(Profile* profile,
119 const std::string& extension_id, 119 const std::string& extension_id,
120 const char* event_name, 120 const char* event_name,
121 const TabContents* tab_contents); 121 const TabContents* tab_contents,
122 bool active);
122 123
123 void DispatchSimpleBrowserEvent(Profile* profile, 124 void DispatchSimpleBrowserEvent(Profile* profile,
124 const int window_id, 125 const int window_id,
125 const char* event_name); 126 const char* event_name);
126 127
127 // Packages |changed_properties| as a tab updated event for the tab |contents| 128 // Packages |changed_properties| as a tab updated event for the tab |contents|
128 // and dispatches the event to the extension. 129 // and dispatches the event to the extension.
129 void DispatchTabUpdatedEvent(TabContents* contents, 130 void DispatchTabUpdatedEvent(TabContents* contents,
130 DictionaryValue* changed_properties); 131 DictionaryValue* changed_properties);
131 132
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 int focused_window_id_; 201 int focused_window_id_;
201 202
202 // The main profile (non-OTR) profile which will be used to send events not 203 // The main profile (non-OTR) profile which will be used to send events not
203 // associated with any browser. 204 // associated with any browser.
204 Profile* profile_; 205 Profile* profile_;
205 206
206 DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserEventRouter); 207 DISALLOW_COPY_AND_ASSIGN(ExtensionBrowserEventRouter);
207 }; 208 };
208 209
209 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_ 210 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_BROWSER_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_browser_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698