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

Side by Side Diff: chrome/browser/automation/automation_provider_observers.h

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
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_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 5 #ifndef CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 6 #define CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <map> 10 #include <map>
(...skipping 19 matching lines...) Expand all
30 #include "chrome/browser/history/history_types.h" 30 #include "chrome/browser/history/history_types.h"
31 #include "chrome/browser/importer/importer_data_types.h" 31 #include "chrome/browser/importer/importer_data_types.h"
32 #include "chrome/browser/importer/importer_progress_observer.h" 32 #include "chrome/browser/importer/importer_progress_observer.h"
33 #include "chrome/browser/password_manager/password_store_change.h" 33 #include "chrome/browser/password_manager/password_store_change.h"
34 #include "chrome/browser/password_manager/password_store_consumer.h" 34 #include "chrome/browser/password_manager/password_store_consumer.h"
35 #include "chrome/browser/search_engines/template_url_service_observer.h" 35 #include "chrome/browser/search_engines/template_url_service_observer.h"
36 #include "chrome/browser/tabs/tab_strip_model.h" 36 #include "chrome/browser/tabs/tab_strip_model.h"
37 #include "chrome/common/automation_constants.h" 37 #include "chrome/common/automation_constants.h"
38 #include "chrome/common/extensions/extension_constants.h" 38 #include "chrome/common/extensions/extension_constants.h"
39 #include "content/browser/cancelable_request.h" 39 #include "content/browser/cancelable_request.h"
40 #include "content/common/content_notification_types.h"
40 #include "content/common/notification_observer.h" 41 #include "content/common/notification_observer.h"
41 #include "content/common/notification_registrar.h" 42 #include "content/common/notification_registrar.h"
42 #include "content/common/notification_type.h"
43 #include "ui/gfx/size.h" 43 #include "ui/gfx/size.h"
44 44
45 class AutocompleteEditModel; 45 class AutocompleteEditModel;
46 class AutomationProvider; 46 class AutomationProvider;
47 class BalloonCollection; 47 class BalloonCollection;
48 class Browser; 48 class Browser;
49 class Extension; 49 class Extension;
50 class ExtensionProcessManager; 50 class ExtensionProcessManager;
51 class NavigationController; 51 class NavigationController;
52 class RenderViewHost; 52 class RenderViewHost;
(...skipping 13 matching lines...) Expand all
66 66
67 namespace IPC { 67 namespace IPC {
68 class Message; 68 class Message;
69 } 69 }
70 70
71 class InitialLoadObserver : public NotificationObserver { 71 class InitialLoadObserver : public NotificationObserver {
72 public: 72 public:
73 InitialLoadObserver(size_t tab_count, AutomationProvider* automation); 73 InitialLoadObserver(size_t tab_count, AutomationProvider* automation);
74 virtual ~InitialLoadObserver(); 74 virtual ~InitialLoadObserver();
75 75
76 virtual void Observe(NotificationType type, 76 virtual void Observe(int type,
77 const NotificationSource& source, 77 const NotificationSource& source,
78 const NotificationDetails& details); 78 const NotificationDetails& details);
79 79
80 // Caller owns the return value and is responsible for deleting it. 80 // Caller owns the return value and is responsible for deleting it.
81 // Example return value: 81 // Example return value:
82 // {'tabs': [{'start_time_ms': 1, 'stop_time_ms': 2.5}, 82 // {'tabs': [{'start_time_ms': 1, 'stop_time_ms': 2.5},
83 // {'start_time_ms': 0.5, 'stop_time_ms': 3}]} 83 // {'start_time_ms': 0.5, 'stop_time_ms': 3}]}
84 // stop_time_ms values may be null if WaitForInitialLoads has not finished. 84 // stop_time_ms values may be null if WaitForInitialLoads has not finished.
85 // Only includes entries for the |tab_count| tabs we are monitoring. 85 // Only includes entries for the |tab_count| tabs we are monitoring.
86 // There is no defined ordering of the return value. 86 // There is no defined ordering of the return value.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 DISALLOW_COPY_AND_ASSIGN(NetworkManagerInitObserver); 121 DISALLOW_COPY_AND_ASSIGN(NetworkManagerInitObserver);
122 }; 122 };
123 #endif // defined(OS_CHROMEOS) 123 #endif // defined(OS_CHROMEOS)
124 124
125 // Watches for NewTabUI page loads for performance timing purposes. 125 // Watches for NewTabUI page loads for performance timing purposes.
126 class NewTabUILoadObserver : public NotificationObserver { 126 class NewTabUILoadObserver : public NotificationObserver {
127 public: 127 public:
128 explicit NewTabUILoadObserver(AutomationProvider* automation); 128 explicit NewTabUILoadObserver(AutomationProvider* automation);
129 virtual ~NewTabUILoadObserver(); 129 virtual ~NewTabUILoadObserver();
130 130
131 virtual void Observe(NotificationType type, 131 virtual void Observe(int type,
132 const NotificationSource& source, 132 const NotificationSource& source,
133 const NotificationDetails& details); 133 const NotificationDetails& details);
134 134
135 private: 135 private:
136 NotificationRegistrar registrar_; 136 NotificationRegistrar registrar_;
137 base::WeakPtr<AutomationProvider> automation_; 137 base::WeakPtr<AutomationProvider> automation_;
138 138
139 DISALLOW_COPY_AND_ASSIGN(NewTabUILoadObserver); 139 DISALLOW_COPY_AND_ASSIGN(NewTabUILoadObserver);
140 }; 140 };
141 141
142 class NavigationControllerRestoredObserver : public NotificationObserver { 142 class NavigationControllerRestoredObserver : public NotificationObserver {
143 public: 143 public:
144 NavigationControllerRestoredObserver(AutomationProvider* automation, 144 NavigationControllerRestoredObserver(AutomationProvider* automation,
145 NavigationController* controller, 145 NavigationController* controller,
146 IPC::Message* reply_message); 146 IPC::Message* reply_message);
147 virtual ~NavigationControllerRestoredObserver(); 147 virtual ~NavigationControllerRestoredObserver();
148 148
149 virtual void Observe(NotificationType type, 149 virtual void Observe(int type,
150 const NotificationSource& source, 150 const NotificationSource& source,
151 const NotificationDetails& details); 151 const NotificationDetails& details);
152 152
153 private: 153 private:
154 bool FinishedRestoring(); 154 bool FinishedRestoring();
155 void SendDone(); 155 void SendDone();
156 156
157 NotificationRegistrar registrar_; 157 NotificationRegistrar registrar_;
158 base::WeakPtr<AutomationProvider> automation_; 158 base::WeakPtr<AutomationProvider> automation_;
159 NavigationController* controller_; 159 NavigationController* controller_;
160 scoped_ptr<IPC::Message> reply_message_; 160 scoped_ptr<IPC::Message> reply_message_;
161 161
162 DISALLOW_COPY_AND_ASSIGN(NavigationControllerRestoredObserver); 162 DISALLOW_COPY_AND_ASSIGN(NavigationControllerRestoredObserver);
163 }; 163 };
164 164
165 class NavigationNotificationObserver : public NotificationObserver { 165 class NavigationNotificationObserver : public NotificationObserver {
166 public: 166 public:
167 NavigationNotificationObserver(NavigationController* controller, 167 NavigationNotificationObserver(NavigationController* controller,
168 AutomationProvider* automation, 168 AutomationProvider* automation,
169 IPC::Message* reply_message, 169 IPC::Message* reply_message,
170 int number_of_navigations, 170 int number_of_navigations,
171 bool include_current_navigation, 171 bool include_current_navigation,
172 bool use_json_interface); 172 bool use_json_interface);
173 virtual ~NavigationNotificationObserver(); 173 virtual ~NavigationNotificationObserver();
174 174
175 virtual void Observe(NotificationType type, 175 virtual void Observe(int type,
176 const NotificationSource& source, 176 const NotificationSource& source,
177 const NotificationDetails& details); 177 const NotificationDetails& details);
178 178
179 private: 179 private:
180 void ConditionMet(AutomationMsg_NavigationResponseValues navigation_result); 180 void ConditionMet(AutomationMsg_NavigationResponseValues navigation_result);
181 181
182 NotificationRegistrar registrar_; 182 NotificationRegistrar registrar_;
183 base::WeakPtr<AutomationProvider> automation_; 183 base::WeakPtr<AutomationProvider> automation_;
184 scoped_ptr<IPC::Message> reply_message_; 184 scoped_ptr<IPC::Message> reply_message_;
185 NavigationController* controller_; 185 NavigationController* controller_;
186 int navigations_remaining_; 186 int navigations_remaining_;
187 bool navigation_started_; 187 bool navigation_started_;
188 bool use_json_interface_; 188 bool use_json_interface_;
189 189
190 DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver); 190 DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver);
191 }; 191 };
192 192
193 class TabStripNotificationObserver : public NotificationObserver { 193 class TabStripNotificationObserver : public NotificationObserver {
194 public: 194 public:
195 TabStripNotificationObserver(NotificationType notification, 195 TabStripNotificationObserver(int notification,
196 AutomationProvider* automation); 196 AutomationProvider* automation);
197 virtual ~TabStripNotificationObserver(); 197 virtual ~TabStripNotificationObserver();
198 198
199 virtual void Observe(NotificationType type, 199 virtual void Observe(int type,
200 const NotificationSource& source, 200 const NotificationSource& source,
201 const NotificationDetails& details); 201 const NotificationDetails& details);
202 202
203 virtual void ObserveTab(NavigationController* controller) = 0; 203 virtual void ObserveTab(NavigationController* controller) = 0;
204 204
205 protected: 205 protected:
206 NotificationRegistrar registrar_; 206 NotificationRegistrar registrar_;
207 base::WeakPtr<AutomationProvider> automation_; 207 base::WeakPtr<AutomationProvider> automation_;
208 NotificationType notification_; 208 int notification_;
209 }; 209 };
210 210
211 class TabAppendedNotificationObserver : public TabStripNotificationObserver { 211 class TabAppendedNotificationObserver : public TabStripNotificationObserver {
212 public: 212 public:
213 TabAppendedNotificationObserver(Browser* parent, 213 TabAppendedNotificationObserver(Browser* parent,
214 AutomationProvider* automation, 214 AutomationProvider* automation,
215 IPC::Message* reply_message); 215 IPC::Message* reply_message);
216 virtual ~TabAppendedNotificationObserver(); 216 virtual ~TabAppendedNotificationObserver();
217 217
218 virtual void ObserveTab(NavigationController* controller); 218 virtual void ObserveTab(NavigationController* controller);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 // Observes when an extension has finished installing or possible install 278 // Observes when an extension has finished installing or possible install
279 // errors. This does not guarantee that the extension is ready for use. 279 // errors. This does not guarantee that the extension is ready for use.
280 class ExtensionInstallNotificationObserver : public NotificationObserver { 280 class ExtensionInstallNotificationObserver : public NotificationObserver {
281 public: 281 public:
282 ExtensionInstallNotificationObserver(AutomationProvider* automation, 282 ExtensionInstallNotificationObserver(AutomationProvider* automation,
283 int id, 283 int id,
284 IPC::Message* reply_message); 284 IPC::Message* reply_message);
285 virtual ~ExtensionInstallNotificationObserver(); 285 virtual ~ExtensionInstallNotificationObserver();
286 286
287 // Implementation of NotificationObserver. 287 // Implementation of NotificationObserver.
288 virtual void Observe(NotificationType type, 288 virtual void Observe(int type,
289 const NotificationSource& source, 289 const NotificationSource& source,
290 const NotificationDetails& details); 290 const NotificationDetails& details);
291 291
292 private: 292 private:
293 // Send |response| back to the provider's client. 293 // Send |response| back to the provider's client.
294 void SendResponse(AutomationMsg_ExtensionResponseValues response); 294 void SendResponse(AutomationMsg_ExtensionResponseValues response);
295 295
296 NotificationRegistrar registrar_; 296 NotificationRegistrar registrar_;
297 base::WeakPtr<AutomationProvider> automation_; 297 base::WeakPtr<AutomationProvider> automation_;
298 int id_; 298 int id_;
299 scoped_ptr<IPC::Message> reply_message_; 299 scoped_ptr<IPC::Message> reply_message_;
300 300
301 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallNotificationObserver); 301 DISALLOW_COPY_AND_ASSIGN(ExtensionInstallNotificationObserver);
302 }; 302 };
303 303
304 // Observes when an extension has been uninstalled. 304 // Observes when an extension has been uninstalled.
305 class ExtensionUninstallObserver : public NotificationObserver { 305 class ExtensionUninstallObserver : public NotificationObserver {
306 public: 306 public:
307 ExtensionUninstallObserver(AutomationProvider* automation, 307 ExtensionUninstallObserver(AutomationProvider* automation,
308 IPC::Message* reply_message, 308 IPC::Message* reply_message,
309 const std::string& id); 309 const std::string& id);
310 virtual ~ExtensionUninstallObserver(); 310 virtual ~ExtensionUninstallObserver();
311 311
312 // Implementation of NotificationObserver. 312 // Implementation of NotificationObserver.
313 virtual void Observe(NotificationType type, 313 virtual void Observe(int type,
314 const NotificationSource& source, 314 const NotificationSource& source,
315 const NotificationDetails& details); 315 const NotificationDetails& details);
316 316
317 private: 317 private:
318 NotificationRegistrar registrar_; 318 NotificationRegistrar registrar_;
319 base::WeakPtr<AutomationProvider> automation_; 319 base::WeakPtr<AutomationProvider> automation_;
320 scoped_ptr<IPC::Message> reply_message_; 320 scoped_ptr<IPC::Message> reply_message_;
321 std::string id_; 321 std::string id_;
322 322
323 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallObserver); 323 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallObserver);
324 }; 324 };
325 325
326 // Observes when an extension has finished loading and is ready for use. Also 326 // Observes when an extension has finished loading and is ready for use. Also
327 // checks for possible install errors. 327 // checks for possible install errors.
328 class ExtensionReadyNotificationObserver : public NotificationObserver { 328 class ExtensionReadyNotificationObserver : public NotificationObserver {
329 public: 329 public:
330 ExtensionReadyNotificationObserver(ExtensionProcessManager* manager, 330 ExtensionReadyNotificationObserver(ExtensionProcessManager* manager,
331 AutomationProvider* automation, 331 AutomationProvider* automation,
332 int id, 332 int id,
333 IPC::Message* reply_message); 333 IPC::Message* reply_message);
334 virtual ~ExtensionReadyNotificationObserver(); 334 virtual ~ExtensionReadyNotificationObserver();
335 335
336 // Implementation of NotificationObserver. 336 // Implementation of NotificationObserver.
337 virtual void Observe(NotificationType type, 337 virtual void Observe(int type,
338 const NotificationSource& source, 338 const NotificationSource& source,
339 const NotificationDetails& details); 339 const NotificationDetails& details);
340 340
341 private: 341 private:
342 NotificationRegistrar registrar_; 342 NotificationRegistrar registrar_;
343 ExtensionProcessManager* manager_; 343 ExtensionProcessManager* manager_;
344 base::WeakPtr<AutomationProvider> automation_; 344 base::WeakPtr<AutomationProvider> automation_;
345 int id_; 345 int id_;
346 scoped_ptr<IPC::Message> reply_message_; 346 scoped_ptr<IPC::Message> reply_message_;
347 const Extension* extension_; 347 const Extension* extension_;
348 348
349 DISALLOW_COPY_AND_ASSIGN(ExtensionReadyNotificationObserver); 349 DISALLOW_COPY_AND_ASSIGN(ExtensionReadyNotificationObserver);
350 }; 350 };
351 351
352 class ExtensionUnloadNotificationObserver : public NotificationObserver { 352 class ExtensionUnloadNotificationObserver : public NotificationObserver {
353 public: 353 public:
354 ExtensionUnloadNotificationObserver(); 354 ExtensionUnloadNotificationObserver();
355 virtual ~ExtensionUnloadNotificationObserver(); 355 virtual ~ExtensionUnloadNotificationObserver();
356 356
357 // Implementation of NotificationObserver. 357 // Implementation of NotificationObserver.
358 virtual void Observe(NotificationType type, 358 virtual void Observe(int type,
359 const NotificationSource& source, 359 const NotificationSource& source,
360 const NotificationDetails& details); 360 const NotificationDetails& details);
361 361
362 bool did_receive_unload_notification() { 362 bool did_receive_unload_notification() {
363 return did_receive_unload_notification_; 363 return did_receive_unload_notification_;
364 } 364 }
365 365
366 private: 366 private:
367 NotificationRegistrar registrar_; 367 NotificationRegistrar registrar_;
368 bool did_receive_unload_notification_; 368 bool did_receive_unload_notification_;
369 369
370 DISALLOW_COPY_AND_ASSIGN(ExtensionUnloadNotificationObserver); 370 DISALLOW_COPY_AND_ASSIGN(ExtensionUnloadNotificationObserver);
371 }; 371 };
372 372
373 // Observes when the extensions have been fully updated. The ExtensionUpdater 373 // Observes when the extensions have been fully updated. The ExtensionUpdater
374 // service provides notifications for each extension that gets updated, but 374 // service provides notifications for each extension that gets updated, but
375 // it does not wait for the updated extensions to be installed or loaded. This 375 // it does not wait for the updated extensions to be installed or loaded. This
376 // observer waits until all updated extensions have actually been loaded. 376 // observer waits until all updated extensions have actually been loaded.
377 class ExtensionsUpdatedObserver : public NotificationObserver { 377 class ExtensionsUpdatedObserver : public NotificationObserver {
378 public: 378 public:
379 ExtensionsUpdatedObserver(ExtensionProcessManager* manager, 379 ExtensionsUpdatedObserver(ExtensionProcessManager* manager,
380 AutomationProvider* automation, 380 AutomationProvider* automation,
381 IPC::Message* reply_message); 381 IPC::Message* reply_message);
382 virtual ~ExtensionsUpdatedObserver(); 382 virtual ~ExtensionsUpdatedObserver();
383 383
384 // Implementation of NotificationObserver. 384 // Implementation of NotificationObserver.
385 virtual void Observe(NotificationType type, 385 virtual void Observe(int type,
386 const NotificationSource& source, 386 const NotificationSource& source,
387 const NotificationDetails& details); 387 const NotificationDetails& details);
388 388
389 private: 389 private:
390 NotificationRegistrar registrar_; 390 NotificationRegistrar registrar_;
391 ExtensionProcessManager* manager_; 391 ExtensionProcessManager* manager_;
392 base::WeakPtr<AutomationProvider> automation_; 392 base::WeakPtr<AutomationProvider> automation_;
393 scoped_ptr<IPC::Message> reply_message_; 393 scoped_ptr<IPC::Message> reply_message_;
394 std::set<std::string> in_progress_updates_; 394 std::set<std::string> in_progress_updates_;
395 bool updater_finished_; 395 bool updater_finished_;
396 396
397 DISALLOW_COPY_AND_ASSIGN(ExtensionsUpdatedObserver); 397 DISALLOW_COPY_AND_ASSIGN(ExtensionsUpdatedObserver);
398 }; 398 };
399 399
400 class ExtensionTestResultNotificationObserver : public NotificationObserver { 400 class ExtensionTestResultNotificationObserver : public NotificationObserver {
401 public: 401 public:
402 explicit ExtensionTestResultNotificationObserver( 402 explicit ExtensionTestResultNotificationObserver(
403 AutomationProvider* automation); 403 AutomationProvider* automation);
404 virtual ~ExtensionTestResultNotificationObserver(); 404 virtual ~ExtensionTestResultNotificationObserver();
405 405
406 // Implementation of NotificationObserver. 406 // Implementation of NotificationObserver.
407 virtual void Observe(NotificationType type, 407 virtual void Observe(int type,
408 const NotificationSource& source, 408 const NotificationSource& source,
409 const NotificationDetails& details); 409 const NotificationDetails& details);
410 410
411 // Sends a test result back to the provider's client, if there is a pending 411 // Sends a test result back to the provider's client, if there is a pending
412 // provider message and there is a result in the queue. 412 // provider message and there is a result in the queue.
413 void MaybeSendResult(); 413 void MaybeSendResult();
414 414
415 private: 415 private:
416 NotificationRegistrar registrar_; 416 NotificationRegistrar registrar_;
417 base::WeakPtr<AutomationProvider> automation_; 417 base::WeakPtr<AutomationProvider> automation_;
(...skipping 11 matching lines...) Expand all
429 }; 429 };
430 430
431 // Observes when a new browser has been opened and a tab within it has stopped 431 // Observes when a new browser has been opened and a tab within it has stopped
432 // loading. 432 // loading.
433 class BrowserOpenedNotificationObserver : public NotificationObserver { 433 class BrowserOpenedNotificationObserver : public NotificationObserver {
434 public: 434 public:
435 BrowserOpenedNotificationObserver(AutomationProvider* automation, 435 BrowserOpenedNotificationObserver(AutomationProvider* automation,
436 IPC::Message* reply_message); 436 IPC::Message* reply_message);
437 virtual ~BrowserOpenedNotificationObserver(); 437 virtual ~BrowserOpenedNotificationObserver();
438 438
439 virtual void Observe(NotificationType type, 439 virtual void Observe(int type,
440 const NotificationSource& source, 440 const NotificationSource& source,
441 const NotificationDetails& details); 441 const NotificationDetails& details);
442 442
443 void set_for_browser_command(bool for_browser_command); 443 void set_for_browser_command(bool for_browser_command);
444 444
445 private: 445 private:
446 NotificationRegistrar registrar_; 446 NotificationRegistrar registrar_;
447 base::WeakPtr<AutomationProvider> automation_; 447 base::WeakPtr<AutomationProvider> automation_;
448 scoped_ptr<IPC::Message> reply_message_; 448 scoped_ptr<IPC::Message> reply_message_;
449 int new_window_id_; 449 int new_window_id_;
450 bool for_browser_command_; 450 bool for_browser_command_;
451 451
452 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedNotificationObserver); 452 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedNotificationObserver);
453 }; 453 };
454 454
455 class BrowserClosedNotificationObserver : public NotificationObserver { 455 class BrowserClosedNotificationObserver : public NotificationObserver {
456 public: 456 public:
457 BrowserClosedNotificationObserver(Browser* browser, 457 BrowserClosedNotificationObserver(Browser* browser,
458 AutomationProvider* automation, 458 AutomationProvider* automation,
459 IPC::Message* reply_message); 459 IPC::Message* reply_message);
460 virtual ~BrowserClosedNotificationObserver(); 460 virtual ~BrowserClosedNotificationObserver();
461 461
462 virtual void Observe(NotificationType type, 462 virtual void Observe(int type,
463 const NotificationSource& source, 463 const NotificationSource& source,
464 const NotificationDetails& details); 464 const NotificationDetails& details);
465 465
466 void set_for_browser_command(bool for_browser_command); 466 void set_for_browser_command(bool for_browser_command);
467 467
468 private: 468 private:
469 NotificationRegistrar registrar_; 469 NotificationRegistrar registrar_;
470 base::WeakPtr<AutomationProvider> automation_; 470 base::WeakPtr<AutomationProvider> automation_;
471 scoped_ptr<IPC::Message> reply_message_; 471 scoped_ptr<IPC::Message> reply_message_;
472 bool for_browser_command_; 472 bool for_browser_command_;
473 473
474 DISALLOW_COPY_AND_ASSIGN(BrowserClosedNotificationObserver); 474 DISALLOW_COPY_AND_ASSIGN(BrowserClosedNotificationObserver);
475 }; 475 };
476 476
477 class BrowserCountChangeNotificationObserver : public NotificationObserver { 477 class BrowserCountChangeNotificationObserver : public NotificationObserver {
478 public: 478 public:
479 BrowserCountChangeNotificationObserver(int target_count, 479 BrowserCountChangeNotificationObserver(int target_count,
480 AutomationProvider* automation, 480 AutomationProvider* automation,
481 IPC::Message* reply_message); 481 IPC::Message* reply_message);
482 virtual ~BrowserCountChangeNotificationObserver(); 482 virtual ~BrowserCountChangeNotificationObserver();
483 483
484 virtual void Observe(NotificationType type, 484 virtual void Observe(int type,
485 const NotificationSource& source, 485 const NotificationSource& source,
486 const NotificationDetails& details); 486 const NotificationDetails& details);
487 487
488 private: 488 private:
489 int target_count_; 489 int target_count_;
490 NotificationRegistrar registrar_; 490 NotificationRegistrar registrar_;
491 base::WeakPtr<AutomationProvider> automation_; 491 base::WeakPtr<AutomationProvider> automation_;
492 scoped_ptr<IPC::Message> reply_message_; 492 scoped_ptr<IPC::Message> reply_message_;
493 493
494 DISALLOW_COPY_AND_ASSIGN(BrowserCountChangeNotificationObserver); 494 DISALLOW_COPY_AND_ASSIGN(BrowserCountChangeNotificationObserver);
495 }; 495 };
496 496
497 class AppModalDialogShownObserver : public NotificationObserver { 497 class AppModalDialogShownObserver : public NotificationObserver {
498 public: 498 public:
499 AppModalDialogShownObserver(AutomationProvider* automation, 499 AppModalDialogShownObserver(AutomationProvider* automation,
500 IPC::Message* reply_message); 500 IPC::Message* reply_message);
501 virtual ~AppModalDialogShownObserver(); 501 virtual ~AppModalDialogShownObserver();
502 502
503 virtual void Observe(NotificationType type, 503 virtual void Observe(int type,
504 const NotificationSource& source, 504 const NotificationSource& source,
505 const NotificationDetails& details); 505 const NotificationDetails& details);
506 506
507 private: 507 private:
508 NotificationRegistrar registrar_; 508 NotificationRegistrar registrar_;
509 base::WeakPtr<AutomationProvider> automation_; 509 base::WeakPtr<AutomationProvider> automation_;
510 scoped_ptr<IPC::Message> reply_message_; 510 scoped_ptr<IPC::Message> reply_message_;
511 511
512 DISALLOW_COPY_AND_ASSIGN(AppModalDialogShownObserver); 512 DISALLOW_COPY_AND_ASSIGN(AppModalDialogShownObserver);
513 }; 513 };
514 514
515 class ExecuteBrowserCommandObserver : public NotificationObserver { 515 class ExecuteBrowserCommandObserver : public NotificationObserver {
516 public: 516 public:
517 virtual ~ExecuteBrowserCommandObserver(); 517 virtual ~ExecuteBrowserCommandObserver();
518 518
519 static bool CreateAndRegisterObserver(AutomationProvider* automation, 519 static bool CreateAndRegisterObserver(AutomationProvider* automation,
520 Browser* browser, 520 Browser* browser,
521 int command, 521 int command,
522 IPC::Message* reply_message); 522 IPC::Message* reply_message);
523 523
524 virtual void Observe(NotificationType type, 524 virtual void Observe(int type,
525 const NotificationSource& source, 525 const NotificationSource& source,
526 const NotificationDetails& details); 526 const NotificationDetails& details);
527 527
528 private: 528 private:
529 ExecuteBrowserCommandObserver(AutomationProvider* automation, 529 ExecuteBrowserCommandObserver(AutomationProvider* automation,
530 IPC::Message* reply_message); 530 IPC::Message* reply_message);
531 531
532 bool Register(int command); 532 bool Register(int command);
533 533
534 bool GetNotificationType(int command, NotificationType::Type* type); 534 bool Getint(int command, int* type);
535 535
536 NotificationRegistrar registrar_; 536 NotificationRegistrar registrar_;
537 base::WeakPtr<AutomationProvider> automation_; 537 base::WeakPtr<AutomationProvider> automation_;
538 NotificationType::Type notification_type_; 538 int notification_type_;
539 scoped_ptr<IPC::Message> reply_message_; 539 scoped_ptr<IPC::Message> reply_message_;
540 540
541 DISALLOW_COPY_AND_ASSIGN(ExecuteBrowserCommandObserver); 541 DISALLOW_COPY_AND_ASSIGN(ExecuteBrowserCommandObserver);
542 }; 542 };
543 543
544 class FindInPageNotificationObserver : public NotificationObserver { 544 class FindInPageNotificationObserver : public NotificationObserver {
545 public: 545 public:
546 FindInPageNotificationObserver(AutomationProvider* automation, 546 FindInPageNotificationObserver(AutomationProvider* automation,
547 TabContents* parent_tab, 547 TabContents* parent_tab,
548 bool reply_with_json, 548 bool reply_with_json,
549 IPC::Message* reply_message); 549 IPC::Message* reply_message);
550 virtual ~FindInPageNotificationObserver(); 550 virtual ~FindInPageNotificationObserver();
551 551
552 virtual void Observe(NotificationType type, 552 virtual void Observe(int type,
553 const NotificationSource& source, 553 const NotificationSource& source,
554 const NotificationDetails& details); 554 const NotificationDetails& details);
555 555
556 // The Find mechanism is over asynchronous IPC, so a search is kicked off and 556 // The Find mechanism is over asynchronous IPC, so a search is kicked off and
557 // we wait for notification to find out what the results are. As the user is 557 // we wait for notification to find out what the results are. As the user is
558 // typing, new search requests can be issued and the Request ID helps us make 558 // typing, new search requests can be issued and the Request ID helps us make
559 // sense of whether this is the current request or an old one. The unit tests, 559 // sense of whether this is the current request or an old one. The unit tests,
560 // however, which uses this constant issues only one search at a time, so we 560 // however, which uses this constant issues only one search at a time, so we
561 // don't need a rolling id to identify each search. But, we still need to 561 // don't need a rolling id to identify each search. But, we still need to
562 // specify one, so we just use a fixed one - its value does not matter. 562 // specify one, so we just use a fixed one - its value does not matter.
(...skipping 10 matching lines...) Expand all
573 scoped_ptr<IPC::Message> reply_message_; 573 scoped_ptr<IPC::Message> reply_message_;
574 574
575 DISALLOW_COPY_AND_ASSIGN(FindInPageNotificationObserver); 575 DISALLOW_COPY_AND_ASSIGN(FindInPageNotificationObserver);
576 }; 576 };
577 577
578 class DomOperationObserver : public NotificationObserver { 578 class DomOperationObserver : public NotificationObserver {
579 public: 579 public:
580 DomOperationObserver(); 580 DomOperationObserver();
581 virtual ~DomOperationObserver(); 581 virtual ~DomOperationObserver();
582 582
583 virtual void Observe(NotificationType type, 583 virtual void Observe(int type,
584 const NotificationSource& source, 584 const NotificationSource& source,
585 const NotificationDetails& details); 585 const NotificationDetails& details);
586 586
587 virtual void OnDomOperationCompleted(const std::string& json) = 0; 587 virtual void OnDomOperationCompleted(const std::string& json) = 0;
588 588
589 private: 589 private:
590 NotificationRegistrar registrar_; 590 NotificationRegistrar registrar_;
591 591
592 DISALLOW_COPY_AND_ASSIGN(DomOperationObserver); 592 DISALLOW_COPY_AND_ASSIGN(DomOperationObserver);
593 }; 593 };
(...skipping 16 matching lines...) Expand all
610 610
611 DISALLOW_COPY_AND_ASSIGN(DomOperationMessageSender); 611 DISALLOW_COPY_AND_ASSIGN(DomOperationMessageSender);
612 }; 612 };
613 613
614 class DocumentPrintedNotificationObserver : public NotificationObserver { 614 class DocumentPrintedNotificationObserver : public NotificationObserver {
615 public: 615 public:
616 DocumentPrintedNotificationObserver(AutomationProvider* automation, 616 DocumentPrintedNotificationObserver(AutomationProvider* automation,
617 IPC::Message* reply_message); 617 IPC::Message* reply_message);
618 virtual ~DocumentPrintedNotificationObserver(); 618 virtual ~DocumentPrintedNotificationObserver();
619 619
620 virtual void Observe(NotificationType type, const NotificationSource& source, 620 virtual void Observe(int type, const NotificationSource& source,
621 const NotificationDetails& details); 621 const NotificationDetails& details);
622 622
623 private: 623 private:
624 NotificationRegistrar registrar_; 624 NotificationRegistrar registrar_;
625 base::WeakPtr<AutomationProvider> automation_; 625 base::WeakPtr<AutomationProvider> automation_;
626 bool success_; 626 bool success_;
627 scoped_ptr<IPC::Message> reply_message_; 627 scoped_ptr<IPC::Message> reply_message_;
628 628
629 DISALLOW_COPY_AND_ASSIGN(DocumentPrintedNotificationObserver); 629 DISALLOW_COPY_AND_ASSIGN(DocumentPrintedNotificationObserver);
630 }; 630 };
631 631
632 // Collects METRIC_EVENT_DURATION notifications and keep track of the times. 632 // Collects METRIC_EVENT_DURATION notifications and keep track of the times.
633 class MetricEventDurationObserver : public NotificationObserver { 633 class MetricEventDurationObserver : public NotificationObserver {
634 public: 634 public:
635 MetricEventDurationObserver(); 635 MetricEventDurationObserver();
636 virtual ~MetricEventDurationObserver(); 636 virtual ~MetricEventDurationObserver();
637 637
638 // Get the duration of an event. Returns -1 if we haven't seen the event. 638 // Get the duration of an event. Returns -1 if we haven't seen the event.
639 int GetEventDurationMs(const std::string& event_name); 639 int GetEventDurationMs(const std::string& event_name);
640 640
641 // NotificationObserver interface. 641 // NotificationObserver interface.
642 virtual void Observe(NotificationType type, const NotificationSource& source, 642 virtual void Observe(int type, const NotificationSource& source,
643 const NotificationDetails& details); 643 const NotificationDetails& details);
644 644
645 private: 645 private:
646 NotificationRegistrar registrar_; 646 NotificationRegistrar registrar_;
647 647
648 typedef std::map<std::string, int> EventDurationMap; 648 typedef std::map<std::string, int> EventDurationMap;
649 EventDurationMap durations_; 649 EventDurationMap durations_;
650 650
651 DISALLOW_COPY_AND_ASSIGN(MetricEventDurationObserver); 651 DISALLOW_COPY_AND_ASSIGN(MetricEventDurationObserver);
652 }; 652 };
653 653
654 class PageTranslatedObserver : public NotificationObserver { 654 class PageTranslatedObserver : public NotificationObserver {
655 public: 655 public:
656 PageTranslatedObserver(AutomationProvider* automation, 656 PageTranslatedObserver(AutomationProvider* automation,
657 IPC::Message* reply_message, 657 IPC::Message* reply_message,
658 TabContents* tab_contents); 658 TabContents* tab_contents);
659 virtual ~PageTranslatedObserver(); 659 virtual ~PageTranslatedObserver();
660 660
661 // NotificationObserver interface. 661 // NotificationObserver interface.
662 virtual void Observe(NotificationType type, 662 virtual void Observe(int type,
663 const NotificationSource& source, 663 const NotificationSource& source,
664 const NotificationDetails& details); 664 const NotificationDetails& details);
665 665
666 private: 666 private:
667 NotificationRegistrar registrar_; 667 NotificationRegistrar registrar_;
668 base::WeakPtr<AutomationProvider> automation_; 668 base::WeakPtr<AutomationProvider> automation_;
669 scoped_ptr<IPC::Message> reply_message_; 669 scoped_ptr<IPC::Message> reply_message_;
670 670
671 DISALLOW_COPY_AND_ASSIGN(PageTranslatedObserver); 671 DISALLOW_COPY_AND_ASSIGN(PageTranslatedObserver);
672 }; 672 };
673 673
674 class TabLanguageDeterminedObserver : public NotificationObserver { 674 class TabLanguageDeterminedObserver : public NotificationObserver {
675 public: 675 public:
676 TabLanguageDeterminedObserver(AutomationProvider* automation, 676 TabLanguageDeterminedObserver(AutomationProvider* automation,
677 IPC::Message* reply_message, 677 IPC::Message* reply_message,
678 TabContents* tab_contents, 678 TabContents* tab_contents,
679 TranslateInfoBarDelegate* translate_bar); 679 TranslateInfoBarDelegate* translate_bar);
680 virtual ~TabLanguageDeterminedObserver(); 680 virtual ~TabLanguageDeterminedObserver();
681 681
682 // NotificationObserver interface. 682 // NotificationObserver interface.
683 virtual void Observe(NotificationType type, 683 virtual void Observe(int type,
684 const NotificationSource& source, 684 const NotificationSource& source,
685 const NotificationDetails& details); 685 const NotificationDetails& details);
686 686
687 private: 687 private:
688 NotificationRegistrar registrar_; 688 NotificationRegistrar registrar_;
689 base::WeakPtr<AutomationProvider> automation_; 689 base::WeakPtr<AutomationProvider> automation_;
690 scoped_ptr<IPC::Message> reply_message_; 690 scoped_ptr<IPC::Message> reply_message_;
691 TabContents* tab_contents_; 691 TabContents* tab_contents_;
692 TranslateInfoBarDelegate* translate_bar_; 692 TranslateInfoBarDelegate* translate_bar_;
693 693
694 DISALLOW_COPY_AND_ASSIGN(TabLanguageDeterminedObserver); 694 DISALLOW_COPY_AND_ASSIGN(TabLanguageDeterminedObserver);
695 }; 695 };
696 696
697 class InfoBarCountObserver : public NotificationObserver { 697 class InfoBarCountObserver : public NotificationObserver {
698 public: 698 public:
699 InfoBarCountObserver(AutomationProvider* automation, 699 InfoBarCountObserver(AutomationProvider* automation,
700 IPC::Message* reply_message, 700 IPC::Message* reply_message,
701 TabContentsWrapper* tab_contents, 701 TabContentsWrapper* tab_contents,
702 size_t target_count); 702 size_t target_count);
703 virtual ~InfoBarCountObserver(); 703 virtual ~InfoBarCountObserver();
704 704
705 // NotificationObserver interface. 705 // NotificationObserver interface.
706 virtual void Observe(NotificationType type, 706 virtual void Observe(int type,
707 const NotificationSource& source, 707 const NotificationSource& source,
708 const NotificationDetails& details); 708 const NotificationDetails& details);
709 709
710 private: 710 private:
711 // Checks whether the infobar count matches our target, and if so 711 // Checks whether the infobar count matches our target, and if so
712 // sends the reply message and deletes itself. 712 // sends the reply message and deletes itself.
713 void CheckCount(); 713 void CheckCount();
714 714
715 NotificationRegistrar registrar_; 715 NotificationRegistrar registrar_;
716 base::WeakPtr<AutomationProvider> automation_; 716 base::WeakPtr<AutomationProvider> automation_;
(...skipping 16 matching lines...) Expand all
733 virtual ~LoginObserver(); 733 virtual ~LoginObserver();
734 734
735 virtual void OnLoginFailure(const chromeos::LoginFailure& error); 735 virtual void OnLoginFailure(const chromeos::LoginFailure& error);
736 736
737 virtual void OnLoginSuccess( 737 virtual void OnLoginSuccess(
738 const std::string& username, 738 const std::string& username,
739 const std::string& password, 739 const std::string& password,
740 const GaiaAuthConsumer::ClientLoginResult& credentials, 740 const GaiaAuthConsumer::ClientLoginResult& credentials,
741 bool pending_requests); 741 bool pending_requests);
742 742
743 virtual void Observe(NotificationType type, 743 virtual void Observe(int type,
744 const NotificationSource& source, 744 const NotificationSource& source,
745 const NotificationDetails& details); 745 const NotificationDetails& details);
746 746
747 private: 747 private:
748 chromeos::ExistingUserController* controller_; 748 chromeos::ExistingUserController* controller_;
749 NotificationRegistrar registrar_; 749 NotificationRegistrar registrar_;
750 base::WeakPtr<AutomationProvider> automation_; 750 base::WeakPtr<AutomationProvider> automation_;
751 scoped_ptr<IPC::Message> reply_message_; 751 scoped_ptr<IPC::Message> reply_message_;
752 752
753 DISALLOW_COPY_AND_ASSIGN(LoginObserver); 753 DISALLOW_COPY_AND_ASSIGN(LoginObserver);
754 }; 754 };
755 755
756 // Collects SCREEN_LOCK_STATE_CHANGED notifications and returns 756 // Collects SCREEN_LOCK_STATE_CHANGED notifications and returns
757 // whether authentication succeeded to the automation provider. 757 // whether authentication succeeded to the automation provider.
758 class ScreenLockUnlockObserver : public NotificationObserver { 758 class ScreenLockUnlockObserver : public NotificationObserver {
759 public: 759 public:
760 // Set lock_screen to true to observe lock screen events, 760 // Set lock_screen to true to observe lock screen events,
761 // false for unlock screen events. 761 // false for unlock screen events.
762 ScreenLockUnlockObserver(AutomationProvider* automation, 762 ScreenLockUnlockObserver(AutomationProvider* automation,
763 IPC::Message* reply_message, 763 IPC::Message* reply_message,
764 bool lock_screen); 764 bool lock_screen);
765 virtual ~ScreenLockUnlockObserver(); 765 virtual ~ScreenLockUnlockObserver();
766 766
767 // NotificationObserver interface. 767 // NotificationObserver interface.
768 virtual void Observe(NotificationType type, const NotificationSource& source, 768 virtual void Observe(int type, const NotificationSource& source,
769 const NotificationDetails& details); 769 const NotificationDetails& details);
770 770
771 protected: 771 protected:
772 base::WeakPtr<AutomationProvider> automation_; 772 base::WeakPtr<AutomationProvider> automation_;
773 scoped_ptr<IPC::Message> reply_message_; 773 scoped_ptr<IPC::Message> reply_message_;
774 774
775 private: 775 private:
776 NotificationRegistrar registrar_; 776 NotificationRegistrar registrar_;
777 bool lock_screen_; 777 bool lock_screen_;
778 778
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
1098 PasswordStoreLoginsChangedObserver(AutomationProvider* automation, 1098 PasswordStoreLoginsChangedObserver(AutomationProvider* automation,
1099 IPC::Message* reply_message, 1099 IPC::Message* reply_message,
1100 PasswordStoreChange::Type expected_type, 1100 PasswordStoreChange::Type expected_type,
1101 const std::string& result_key); 1101 const std::string& result_key);
1102 virtual ~PasswordStoreLoginsChangedObserver(); 1102 virtual ~PasswordStoreLoginsChangedObserver();
1103 1103
1104 // Schedules a task on the DB thread to register the appropriate observers. 1104 // Schedules a task on the DB thread to register the appropriate observers.
1105 virtual void Init(); 1105 virtual void Init();
1106 1106
1107 // NotificationObserver interface. 1107 // NotificationObserver interface.
1108 virtual void Observe(NotificationType type, 1108 virtual void Observe(int type,
1109 const NotificationSource& source, 1109 const NotificationSource& source,
1110 const NotificationDetails& details); 1110 const NotificationDetails& details);
1111 1111
1112 private: 1112 private:
1113 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 1113 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
1114 friend class DeleteTask<PasswordStoreLoginsChangedObserver>; 1114 friend class DeleteTask<PasswordStoreLoginsChangedObserver>;
1115 1115
1116 // Registers the appropriate observers. Called on the DB thread. 1116 // Registers the appropriate observers. Called on the DB thread.
1117 void RegisterObserversTask(); 1117 void RegisterObserversTask();
1118 1118
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 1154
1155 // Allows automation provider to wait until page load after selecting an item 1155 // Allows automation provider to wait until page load after selecting an item
1156 // in the omnibox popup. 1156 // in the omnibox popup.
1157 class OmniboxAcceptNotificationObserver : public NotificationObserver { 1157 class OmniboxAcceptNotificationObserver : public NotificationObserver {
1158 public: 1158 public:
1159 OmniboxAcceptNotificationObserver(NavigationController* controller, 1159 OmniboxAcceptNotificationObserver(NavigationController* controller,
1160 AutomationProvider* automation, 1160 AutomationProvider* automation,
1161 IPC::Message* reply_message); 1161 IPC::Message* reply_message);
1162 virtual ~OmniboxAcceptNotificationObserver(); 1162 virtual ~OmniboxAcceptNotificationObserver();
1163 1163
1164 virtual void Observe(NotificationType type, 1164 virtual void Observe(int type,
1165 const NotificationSource& source, 1165 const NotificationSource& source,
1166 const NotificationDetails& details); 1166 const NotificationDetails& details);
1167 1167
1168 private: 1168 private:
1169 NotificationRegistrar registrar_; 1169 NotificationRegistrar registrar_;
1170 base::WeakPtr<AutomationProvider> automation_; 1170 base::WeakPtr<AutomationProvider> automation_;
1171 scoped_ptr<IPC::Message> reply_message_; 1171 scoped_ptr<IPC::Message> reply_message_;
1172 NavigationController* controller_; 1172 NavigationController* controller_;
1173 1173
1174 DISALLOW_COPY_AND_ASSIGN(OmniboxAcceptNotificationObserver); 1174 DISALLOW_COPY_AND_ASSIGN(OmniboxAcceptNotificationObserver);
1175 }; 1175 };
1176 1176
1177 // Allows the automation provider to wait for a save package notification. 1177 // Allows the automation provider to wait for a save package notification.
1178 class SavePackageNotificationObserver : public NotificationObserver { 1178 class SavePackageNotificationObserver : public NotificationObserver {
1179 public: 1179 public:
1180 SavePackageNotificationObserver(SavePackage* save_package, 1180 SavePackageNotificationObserver(SavePackage* save_package,
1181 AutomationProvider* automation, 1181 AutomationProvider* automation,
1182 IPC::Message* reply_message); 1182 IPC::Message* reply_message);
1183 virtual ~SavePackageNotificationObserver(); 1183 virtual ~SavePackageNotificationObserver();
1184 1184
1185 virtual void Observe(NotificationType type, 1185 virtual void Observe(int type,
1186 const NotificationSource& source, 1186 const NotificationSource& source,
1187 const NotificationDetails& details); 1187 const NotificationDetails& details);
1188 1188
1189 private: 1189 private:
1190 NotificationRegistrar registrar_; 1190 NotificationRegistrar registrar_;
1191 base::WeakPtr<AutomationProvider> automation_; 1191 base::WeakPtr<AutomationProvider> automation_;
1192 scoped_ptr<IPC::Message> reply_message_; 1192 scoped_ptr<IPC::Message> reply_message_;
1193 1193
1194 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); 1194 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver);
1195 }; 1195 };
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1231 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker); 1231 DISALLOW_COPY_AND_ASSIGN(PageSnapshotTaker);
1232 }; 1232 };
1233 1233
1234 class NTPInfoObserver : public NotificationObserver { 1234 class NTPInfoObserver : public NotificationObserver {
1235 public: 1235 public:
1236 NTPInfoObserver(AutomationProvider* automation, 1236 NTPInfoObserver(AutomationProvider* automation,
1237 IPC::Message* reply_message, 1237 IPC::Message* reply_message,
1238 CancelableRequestConsumer* consumer); 1238 CancelableRequestConsumer* consumer);
1239 virtual ~NTPInfoObserver(); 1239 virtual ~NTPInfoObserver();
1240 1240
1241 virtual void Observe(NotificationType type, 1241 virtual void Observe(int type,
1242 const NotificationSource& source, 1242 const NotificationSource& source,
1243 const NotificationDetails& details); 1243 const NotificationDetails& details);
1244 1244
1245 private: 1245 private:
1246 void OnTopSitesLoaded(); 1246 void OnTopSitesLoaded();
1247 void OnTopSitesReceived(const history::MostVisitedURLList& visited_list); 1247 void OnTopSitesReceived(const history::MostVisitedURLList& visited_list);
1248 1248
1249 base::WeakPtr<AutomationProvider> automation_; 1249 base::WeakPtr<AutomationProvider> automation_;
1250 scoped_ptr<IPC::Message> reply_message_; 1250 scoped_ptr<IPC::Message> reply_message_;
1251 CancelableRequestConsumer* consumer_; 1251 CancelableRequestConsumer* consumer_;
1252 CancelableRequestProvider::Handle request_; 1252 CancelableRequestProvider::Handle request_;
1253 scoped_ptr<DictionaryValue> ntp_info_; 1253 scoped_ptr<DictionaryValue> ntp_info_;
1254 history::TopSites* top_sites_; 1254 history::TopSites* top_sites_;
1255 NotificationRegistrar registrar_; 1255 NotificationRegistrar registrar_;
1256 1256
1257 DISALLOW_COPY_AND_ASSIGN(NTPInfoObserver); 1257 DISALLOW_COPY_AND_ASSIGN(NTPInfoObserver);
1258 }; 1258 };
1259 1259
1260 // Observes when an app has been launched, as indicated by a notification that 1260 // Observes when an app has been launched, as indicated by a notification that
1261 // a content load in some tab has stopped. 1261 // a content load in some tab has stopped.
1262 class AppLaunchObserver : public NotificationObserver { 1262 class AppLaunchObserver : public NotificationObserver {
1263 public: 1263 public:
1264 AppLaunchObserver(NavigationController* controller, 1264 AppLaunchObserver(NavigationController* controller,
1265 AutomationProvider* automation, 1265 AutomationProvider* automation,
1266 IPC::Message* reply_message, 1266 IPC::Message* reply_message,
1267 extension_misc::LaunchContainer launch_container); 1267 extension_misc::LaunchContainer launch_container);
1268 virtual ~AppLaunchObserver(); 1268 virtual ~AppLaunchObserver();
1269 1269
1270 virtual void Observe(NotificationType type, 1270 virtual void Observe(int type,
1271 const NotificationSource& source, 1271 const NotificationSource& source,
1272 const NotificationDetails& details); 1272 const NotificationDetails& details);
1273 1273
1274 private: 1274 private:
1275 NavigationController* controller_; 1275 NavigationController* controller_;
1276 base::WeakPtr<AutomationProvider> automation_; 1276 base::WeakPtr<AutomationProvider> automation_;
1277 scoped_ptr<IPC::Message> reply_message_; 1277 scoped_ptr<IPC::Message> reply_message_;
1278 NotificationRegistrar registrar_; 1278 NotificationRegistrar registrar_;
1279 extension_misc::LaunchContainer launch_container_; 1279 extension_misc::LaunchContainer launch_container_;
1280 int new_window_id_; 1280 int new_window_id_;
1281 1281
1282 DISALLOW_COPY_AND_ASSIGN(AppLaunchObserver); 1282 DISALLOW_COPY_AND_ASSIGN(AppLaunchObserver);
1283 }; 1283 };
1284 1284
1285 // Observes when Autofill information is displayed in the renderer. This can 1285 // Observes when Autofill information is displayed in the renderer. This can
1286 // happen in two different ways: (1) a popup containing Autofill suggestions 1286 // happen in two different ways: (1) a popup containing Autofill suggestions
1287 // has been shown in the renderer; (2) a webpage form is filled or previewed 1287 // has been shown in the renderer; (2) a webpage form is filled or previewed
1288 // with Autofill suggestions. A constructor argument specifies the appropriate 1288 // with Autofill suggestions. A constructor argument specifies the appropriate
1289 // notification to wait for. 1289 // notification to wait for.
1290 class AutofillDisplayedObserver : public NotificationObserver { 1290 class AutofillDisplayedObserver : public NotificationObserver {
1291 public: 1291 public:
1292 AutofillDisplayedObserver(NotificationType notification, 1292 AutofillDisplayedObserver(int notification,
1293 RenderViewHost* render_view_host, 1293 RenderViewHost* render_view_host,
1294 AutomationProvider* automation, 1294 AutomationProvider* automation,
1295 IPC::Message* reply_message); 1295 IPC::Message* reply_message);
1296 virtual ~AutofillDisplayedObserver(); 1296 virtual ~AutofillDisplayedObserver();
1297 1297
1298 // NotificationObserver interface. 1298 // NotificationObserver interface.
1299 virtual void Observe(NotificationType type, 1299 virtual void Observe(int type,
1300 const NotificationSource& source, 1300 const NotificationSource& source,
1301 const NotificationDetails& details); 1301 const NotificationDetails& details);
1302 1302
1303 private: 1303 private:
1304 NotificationType notification_; 1304 int notification_;
1305 RenderViewHost* render_view_host_; 1305 RenderViewHost* render_view_host_;
1306 base::WeakPtr<AutomationProvider> automation_; 1306 base::WeakPtr<AutomationProvider> automation_;
1307 scoped_ptr<IPC::Message> reply_message_; 1307 scoped_ptr<IPC::Message> reply_message_;
1308 NotificationRegistrar registrar_; 1308 NotificationRegistrar registrar_;
1309 1309
1310 DISALLOW_COPY_AND_ASSIGN(AutofillDisplayedObserver); 1310 DISALLOW_COPY_AND_ASSIGN(AutofillDisplayedObserver);
1311 }; 1311 };
1312 1312
1313 // Observes when a specified number of autofill profiles and credit cards have 1313 // Observes when a specified number of autofill profiles and credit cards have
1314 // been changed in the WebDataService. The notifications are sent on the DB 1314 // been changed in the WebDataService. The notifications are sent on the DB
1315 // thread, the thread that interacts with the database. 1315 // thread, the thread that interacts with the database.
1316 class AutofillChangedObserver 1316 class AutofillChangedObserver
1317 : public base::RefCountedThreadSafe< 1317 : public base::RefCountedThreadSafe<
1318 AutofillChangedObserver, 1318 AutofillChangedObserver,
1319 BrowserThread::DeleteOnUIThread>, 1319 BrowserThread::DeleteOnUIThread>,
1320 public NotificationObserver { 1320 public NotificationObserver {
1321 public: 1321 public:
1322 AutofillChangedObserver(AutomationProvider* automation, 1322 AutofillChangedObserver(AutomationProvider* automation,
1323 IPC::Message* reply_message, 1323 IPC::Message* reply_message,
1324 int num_profiles, 1324 int num_profiles,
1325 int num_credit_cards); 1325 int num_credit_cards);
1326 virtual ~AutofillChangedObserver(); 1326 virtual ~AutofillChangedObserver();
1327 1327
1328 // Schedules a task on the DB thread to register the appropriate observers. 1328 // Schedules a task on the DB thread to register the appropriate observers.
1329 virtual void Init(); 1329 virtual void Init();
1330 1330
1331 // NotificationObserver interface. 1331 // NotificationObserver interface.
1332 virtual void Observe(NotificationType type, 1332 virtual void Observe(int type,
1333 const NotificationSource& source, 1333 const NotificationSource& source,
1334 const NotificationDetails& details); 1334 const NotificationDetails& details);
1335 1335
1336 private: 1336 private:
1337 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; 1337 friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>;
1338 friend class DeleteTask<AutofillChangedObserver>; 1338 friend class DeleteTask<AutofillChangedObserver>;
1339 1339
1340 // Registers the appropriate observers. Called on the DB thread. 1340 // Registers the appropriate observers. Called on the DB thread.
1341 void RegisterObserversTask(); 1341 void RegisterObserversTask();
1342 1342
(...skipping 15 matching lines...) Expand all
1358 }; 1358 };
1359 1359
1360 // Allows the automation provider to wait until all the notification 1360 // Allows the automation provider to wait until all the notification
1361 // processes are ready. 1361 // processes are ready.
1362 class GetActiveNotificationsObserver : public NotificationObserver { 1362 class GetActiveNotificationsObserver : public NotificationObserver {
1363 public: 1363 public:
1364 GetActiveNotificationsObserver(AutomationProvider* automation, 1364 GetActiveNotificationsObserver(AutomationProvider* automation,
1365 IPC::Message* reply_message); 1365 IPC::Message* reply_message);
1366 virtual ~GetActiveNotificationsObserver(); 1366 virtual ~GetActiveNotificationsObserver();
1367 1367
1368 virtual void Observe(NotificationType type, 1368 virtual void Observe(int type,
1369 const NotificationSource& source, 1369 const NotificationSource& source,
1370 const NotificationDetails& details); 1370 const NotificationDetails& details);
1371 1371
1372 private: 1372 private:
1373 // Sends a message via the |AutomationProvider|. |automation_| must be valid. 1373 // Sends a message via the |AutomationProvider|. |automation_| must be valid.
1374 // Deletes itself after the message is sent. 1374 // Deletes itself after the message is sent.
1375 void SendMessage(); 1375 void SendMessage();
1376 1376
1377 NotificationRegistrar registrar_; 1377 NotificationRegistrar registrar_;
1378 base::WeakPtr<AutomationProvider> automation_; 1378 base::WeakPtr<AutomationProvider> automation_;
1379 scoped_ptr<IPC::Message> reply_message_; 1379 scoped_ptr<IPC::Message> reply_message_;
1380 1380
1381 DISALLOW_COPY_AND_ASSIGN(GetActiveNotificationsObserver); 1381 DISALLOW_COPY_AND_ASSIGN(GetActiveNotificationsObserver);
1382 }; 1382 };
1383 1383
1384 // Allows the automation provider to wait for a given number of 1384 // Allows the automation provider to wait for a given number of
1385 // notification balloons. 1385 // notification balloons.
1386 class OnNotificationBalloonCountObserver : public NotificationObserver { 1386 class OnNotificationBalloonCountObserver : public NotificationObserver {
1387 public: 1387 public:
1388 OnNotificationBalloonCountObserver(AutomationProvider* provider, 1388 OnNotificationBalloonCountObserver(AutomationProvider* provider,
1389 IPC::Message* reply_message, 1389 IPC::Message* reply_message,
1390 int count); 1390 int count);
1391 virtual ~OnNotificationBalloonCountObserver(); 1391 virtual ~OnNotificationBalloonCountObserver();
1392 1392
1393 // Sends an automation reply message if |automation_| is still valid and the 1393 // Sends an automation reply message if |automation_| is still valid and the
1394 // number of ready balloons matches the desired count. Deletes itself if the 1394 // number of ready balloons matches the desired count. Deletes itself if the
1395 // message is sent or if |automation_| is invalid. 1395 // message is sent or if |automation_| is invalid.
1396 void CheckBalloonCount(); 1396 void CheckBalloonCount();
1397 1397
1398 virtual void Observe(NotificationType type, 1398 virtual void Observe(int type,
1399 const NotificationSource& source, 1399 const NotificationSource& source,
1400 const NotificationDetails& details); 1400 const NotificationDetails& details);
1401 1401
1402 private: 1402 private:
1403 NotificationRegistrar registrar_; 1403 NotificationRegistrar registrar_;
1404 base::WeakPtr<AutomationProvider> automation_; 1404 base::WeakPtr<AutomationProvider> automation_;
1405 scoped_ptr<IPC::Message> reply_message_; 1405 scoped_ptr<IPC::Message> reply_message_;
1406 1406
1407 BalloonCollection* collection_; 1407 BalloonCollection* collection_;
1408 int count_; 1408 int count_;
1409 1409
1410 DISALLOW_COPY_AND_ASSIGN(OnNotificationBalloonCountObserver); 1410 DISALLOW_COPY_AND_ASSIGN(OnNotificationBalloonCountObserver);
1411 }; 1411 };
1412 1412
1413 // Allows the automation provider to wait for a RENDERER_PROCESS_CLOSED 1413 // Allows the automation provider to wait for a RENDERER_PROCESS_CLOSED
1414 // notification. 1414 // notification.
1415 class RendererProcessClosedObserver : public NotificationObserver { 1415 class RendererProcessClosedObserver : public NotificationObserver {
1416 public: 1416 public:
1417 RendererProcessClosedObserver(AutomationProvider* automation, 1417 RendererProcessClosedObserver(AutomationProvider* automation,
1418 IPC::Message* reply_message); 1418 IPC::Message* reply_message);
1419 virtual ~RendererProcessClosedObserver(); 1419 virtual ~RendererProcessClosedObserver();
1420 1420
1421 virtual void Observe(NotificationType type, 1421 virtual void Observe(int type,
1422 const NotificationSource& source, 1422 const NotificationSource& source,
1423 const NotificationDetails& details); 1423 const NotificationDetails& details);
1424 1424
1425 private: 1425 private:
1426 NotificationRegistrar registrar_; 1426 NotificationRegistrar registrar_;
1427 base::WeakPtr<AutomationProvider> automation_; 1427 base::WeakPtr<AutomationProvider> automation_;
1428 scoped_ptr<IPC::Message> reply_message_; 1428 scoped_ptr<IPC::Message> reply_message_;
1429 1429
1430 DISALLOW_COPY_AND_ASSIGN(RendererProcessClosedObserver); 1430 DISALLOW_COPY_AND_ASSIGN(RendererProcessClosedObserver);
1431 }; 1431 };
1432 1432
1433 // Allows the automation provider to wait for acknowledgement that a certain 1433 // Allows the automation provider to wait for acknowledgement that a certain
1434 // type and number of input events has been processed by the renderer. 1434 // type and number of input events has been processed by the renderer.
1435 class InputEventAckNotificationObserver : public NotificationObserver { 1435 class InputEventAckNotificationObserver : public NotificationObserver {
1436 public: 1436 public:
1437 InputEventAckNotificationObserver(AutomationProvider* automation, 1437 InputEventAckNotificationObserver(AutomationProvider* automation,
1438 IPC::Message* reply_message, 1438 IPC::Message* reply_message,
1439 int event_type, int count); 1439 int event_type, int count);
1440 virtual ~InputEventAckNotificationObserver(); 1440 virtual ~InputEventAckNotificationObserver();
1441 1441
1442 virtual void Observe(NotificationType type, 1442 virtual void Observe(int type,
1443 const NotificationSource& source, 1443 const NotificationSource& source,
1444 const NotificationDetails& details); 1444 const NotificationDetails& details);
1445 1445
1446 private: 1446 private:
1447 NotificationRegistrar registrar_; 1447 NotificationRegistrar registrar_;
1448 base::WeakPtr<AutomationProvider> automation_; 1448 base::WeakPtr<AutomationProvider> automation_;
1449 scoped_ptr<IPC::Message> reply_message_; 1449 scoped_ptr<IPC::Message> reply_message_;
1450 int event_type_; 1450 int event_type_;
1451 int count_; 1451 int count_;
1452 1452
(...skipping 27 matching lines...) Expand all
1480 scoped_ptr<IPC::Message> reply_message_; 1480 scoped_ptr<IPC::Message> reply_message_;
1481 1481
1482 DISALLOW_COPY_AND_ASSIGN(AllTabsStoppedLoadingObserver); 1482 DISALLOW_COPY_AND_ASSIGN(AllTabsStoppedLoadingObserver);
1483 }; 1483 };
1484 1484
1485 // Observer used to listen for new tab creation to complete. 1485 // Observer used to listen for new tab creation to complete.
1486 class NewTabObserver : public NotificationObserver { 1486 class NewTabObserver : public NotificationObserver {
1487 public: 1487 public:
1488 NewTabObserver(AutomationProvider* automation, IPC::Message* reply_message); 1488 NewTabObserver(AutomationProvider* automation, IPC::Message* reply_message);
1489 1489
1490 virtual void Observe(NotificationType type, 1490 virtual void Observe(int type,
1491 const NotificationSource& source, 1491 const NotificationSource& source,
1492 const NotificationDetails& details) OVERRIDE; 1492 const NotificationDetails& details) OVERRIDE;
1493 1493
1494 private: 1494 private:
1495 virtual ~NewTabObserver(); 1495 virtual ~NewTabObserver();
1496 1496
1497 NotificationRegistrar registrar_; 1497 NotificationRegistrar registrar_;
1498 base::WeakPtr<AutomationProvider> automation_; 1498 base::WeakPtr<AutomationProvider> automation_;
1499 scoped_ptr<IPC::Message> reply_message_; 1499 scoped_ptr<IPC::Message> reply_message_;
1500 1500
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1537 }; 1537 };
1538 1538
1539 // Allows the automation provider to wait for acknowledgement that a drop 1539 // Allows the automation provider to wait for acknowledgement that a drop
1540 // operation has been processed by the renderer. 1540 // operation has been processed by the renderer.
1541 class DragTargetDropAckNotificationObserver : public NotificationObserver { 1541 class DragTargetDropAckNotificationObserver : public NotificationObserver {
1542 public: 1542 public:
1543 DragTargetDropAckNotificationObserver(AutomationProvider* automation, 1543 DragTargetDropAckNotificationObserver(AutomationProvider* automation,
1544 IPC::Message* reply_message); 1544 IPC::Message* reply_message);
1545 virtual ~DragTargetDropAckNotificationObserver(); 1545 virtual ~DragTargetDropAckNotificationObserver();
1546 1546
1547 virtual void Observe(NotificationType type, 1547 virtual void Observe(int type,
1548 const NotificationSource& source, 1548 const NotificationSource& source,
1549 const NotificationDetails& details); 1549 const NotificationDetails& details);
1550 1550
1551 private: 1551 private:
1552 NotificationRegistrar registrar_; 1552 NotificationRegistrar registrar_;
1553 base::WeakPtr<AutomationProvider> automation_; 1553 base::WeakPtr<AutomationProvider> automation_;
1554 scoped_ptr<IPC::Message> reply_message_; 1554 scoped_ptr<IPC::Message> reply_message_;
1555 1555
1556 DISALLOW_COPY_AND_ASSIGN(DragTargetDropAckNotificationObserver); 1556 DISALLOW_COPY_AND_ASSIGN(DragTargetDropAckNotificationObserver);
1557 }; 1557 };
1558 1558
1559 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 1559 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_extension_tracker.cc ('k') | chrome/browser/automation/automation_provider_observers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698