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

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

Issue 10388251: Support maximize window command. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: "Use notification only when maximization happens asynchronously (OS Linux)." Created 8 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
OLDNEW
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 #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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 namespace policy { 98 namespace policy {
99 class BrowserPolicyConnector; 99 class BrowserPolicyConnector;
100 } 100 }
101 101
102 class InitialLoadObserver : public content::NotificationObserver { 102 class InitialLoadObserver : public content::NotificationObserver {
103 public: 103 public:
104 InitialLoadObserver(size_t tab_count, AutomationProvider* automation); 104 InitialLoadObserver(size_t tab_count, AutomationProvider* automation);
105 virtual ~InitialLoadObserver(); 105 virtual ~InitialLoadObserver();
106 106
107 // Overridden from content::NotificationObserver:
107 virtual void Observe(int type, 108 virtual void Observe(int type,
108 const content::NotificationSource& source, 109 const content::NotificationSource& source,
109 const content::NotificationDetails& details); 110 const content::NotificationDetails& details) OVERRIDE;
110 111
111 // Caller owns the return value and is responsible for deleting it. 112 // Caller owns the return value and is responsible for deleting it.
112 // Example return value: 113 // Example return value:
113 // {'tabs': [{'start_time_ms': 1, 'stop_time_ms': 2.5}, 114 // {'tabs': [{'start_time_ms': 1, 'stop_time_ms': 2.5},
114 // {'start_time_ms': 0.5, 'stop_time_ms': 3}]} 115 // {'start_time_ms': 0.5, 'stop_time_ms': 3}]}
115 // stop_time_ms values may be null if WaitForInitialLoads has not finished. 116 // stop_time_ms values may be null if WaitForInitialLoads has not finished.
116 // Only includes entries for the |tab_count| tabs we are monitoring. 117 // Only includes entries for the |tab_count| tabs we are monitoring.
117 // There is no defined ordering of the return value. 118 // There is no defined ordering of the return value.
118 base::DictionaryValue* GetTimingInformation() const; 119 base::DictionaryValue* GetTimingInformation() const;
119 120
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 153
153 DISALLOW_COPY_AND_ASSIGN(NetworkManagerInitObserver); 154 DISALLOW_COPY_AND_ASSIGN(NetworkManagerInitObserver);
154 }; 155 };
155 156
156 // Observes when the ChromeOS login WebUI becomes ready (by showing the login 157 // Observes when the ChromeOS login WebUI becomes ready (by showing the login
157 // form, account picker, a network error or the OOBE wizard, depending on Chrome 158 // form, account picker, a network error or the OOBE wizard, depending on Chrome
158 // flags and state). 159 // flags and state).
159 class LoginWebuiReadyObserver : public content::NotificationObserver { 160 class LoginWebuiReadyObserver : public content::NotificationObserver {
160 public: 161 public:
161 explicit LoginWebuiReadyObserver(AutomationProvider* automation); 162 explicit LoginWebuiReadyObserver(AutomationProvider* automation);
163 // Overridden from content::NotificationObserver:
162 virtual void Observe(int type, 164 virtual void Observe(int type,
163 const content::NotificationSource& source, 165 const content::NotificationSource& source,
164 const content::NotificationDetails& details); 166 const content::NotificationDetails& details) OVERRIDE;
165 167
166 private: 168 private:
167 content::NotificationRegistrar registrar_; 169 content::NotificationRegistrar registrar_;
168 base::WeakPtr<AutomationProvider> automation_; 170 base::WeakPtr<AutomationProvider> automation_;
169 171
170 DISALLOW_COPY_AND_ASSIGN(LoginWebuiReadyObserver); 172 DISALLOW_COPY_AND_ASSIGN(LoginWebuiReadyObserver);
171 }; 173 };
172 #endif // defined(OS_CHROMEOS) 174 #endif // defined(OS_CHROMEOS)
173 175
174 // Watches for NewTabUI page loads for performance timing purposes. 176 // Watches for NewTabUI page loads for performance timing purposes.
175 class NewTabUILoadObserver : public content::NotificationObserver { 177 class NewTabUILoadObserver : public content::NotificationObserver {
176 public: 178 public:
177 explicit NewTabUILoadObserver(AutomationProvider* automation, 179 explicit NewTabUILoadObserver(AutomationProvider* automation,
178 Profile* profile); 180 Profile* profile);
179 virtual ~NewTabUILoadObserver(); 181 virtual ~NewTabUILoadObserver();
180 182
183 // Overridden from content::NotificationObserver:
181 virtual void Observe(int type, 184 virtual void Observe(int type,
182 const content::NotificationSource& source, 185 const content::NotificationSource& source,
183 const content::NotificationDetails& details); 186 const content::NotificationDetails& details) OVERRIDE;
184 187
185 private: 188 private:
186 content::NotificationRegistrar registrar_; 189 content::NotificationRegistrar registrar_;
187 base::WeakPtr<AutomationProvider> automation_; 190 base::WeakPtr<AutomationProvider> automation_;
188 191
189 DISALLOW_COPY_AND_ASSIGN(NewTabUILoadObserver); 192 DISALLOW_COPY_AND_ASSIGN(NewTabUILoadObserver);
190 }; 193 };
191 194
192 class NavigationControllerRestoredObserver 195 class NavigationControllerRestoredObserver
193 : public content::NotificationObserver { 196 : public content::NotificationObserver {
194 public: 197 public:
195 NavigationControllerRestoredObserver( 198 NavigationControllerRestoredObserver(
196 AutomationProvider* automation, 199 AutomationProvider* automation,
197 content::NavigationController* controller, 200 content::NavigationController* controller,
198 IPC::Message* reply_message); 201 IPC::Message* reply_message);
199 virtual ~NavigationControllerRestoredObserver(); 202 virtual ~NavigationControllerRestoredObserver();
200 203
204 // Overridden from content::NotificationObserver:
201 virtual void Observe(int type, 205 virtual void Observe(int type,
202 const content::NotificationSource& source, 206 const content::NotificationSource& source,
203 const content::NotificationDetails& details); 207 const content::NotificationDetails& details) OVERRIDE;
204 208
205 private: 209 private:
206 bool FinishedRestoring(); 210 bool FinishedRestoring();
207 void SendDone(); 211 void SendDone();
208 212
209 content::NotificationRegistrar registrar_; 213 content::NotificationRegistrar registrar_;
210 base::WeakPtr<AutomationProvider> automation_; 214 base::WeakPtr<AutomationProvider> automation_;
211 content::NavigationController* controller_; 215 content::NavigationController* controller_;
212 scoped_ptr<IPC::Message> reply_message_; 216 scoped_ptr<IPC::Message> reply_message_;
213 217
214 DISALLOW_COPY_AND_ASSIGN(NavigationControllerRestoredObserver); 218 DISALLOW_COPY_AND_ASSIGN(NavigationControllerRestoredObserver);
215 }; 219 };
216 220
217 class NavigationNotificationObserver : public content::NotificationObserver { 221 class NavigationNotificationObserver : public content::NotificationObserver {
218 public: 222 public:
219 NavigationNotificationObserver(content::NavigationController* controller, 223 NavigationNotificationObserver(content::NavigationController* controller,
220 AutomationProvider* automation, 224 AutomationProvider* automation,
221 IPC::Message* reply_message, 225 IPC::Message* reply_message,
222 int number_of_navigations, 226 int number_of_navigations,
223 bool include_current_navigation, 227 bool include_current_navigation,
224 bool use_json_interface); 228 bool use_json_interface);
225 virtual ~NavigationNotificationObserver(); 229 virtual ~NavigationNotificationObserver();
226 230
231 // Overridden from content::NotificationObserver:
227 virtual void Observe(int type, 232 virtual void Observe(int type,
228 const content::NotificationSource& source, 233 const content::NotificationSource& source,
229 const content::NotificationDetails& details); 234 const content::NotificationDetails& details) OVERRIDE;
230 235
231 private: 236 private:
232 void ConditionMet(AutomationMsg_NavigationResponseValues navigation_result); 237 void ConditionMet(AutomationMsg_NavigationResponseValues navigation_result);
233 238
234 content::NotificationRegistrar registrar_; 239 content::NotificationRegistrar registrar_;
235 base::WeakPtr<AutomationProvider> automation_; 240 base::WeakPtr<AutomationProvider> automation_;
236 scoped_ptr<IPC::Message> reply_message_; 241 scoped_ptr<IPC::Message> reply_message_;
237 content::NavigationController* controller_; 242 content::NavigationController* controller_;
238 int navigations_remaining_; 243 int navigations_remaining_;
239 bool navigation_started_; 244 bool navigation_started_;
240 bool use_json_interface_; 245 bool use_json_interface_;
241 246
242 DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver); 247 DISALLOW_COPY_AND_ASSIGN(NavigationNotificationObserver);
243 }; 248 };
244 249
245 class TabStripNotificationObserver : public content::NotificationObserver { 250 class TabStripNotificationObserver : public content::NotificationObserver {
246 public: 251 public:
247 TabStripNotificationObserver(int notification, 252 TabStripNotificationObserver(int notification,
248 AutomationProvider* automation); 253 AutomationProvider* automation);
249 virtual ~TabStripNotificationObserver(); 254 virtual ~TabStripNotificationObserver();
250 255
256 // Overridden from content::NotificationObserver:
251 virtual void Observe(int type, 257 virtual void Observe(int type,
252 const content::NotificationSource& source, 258 const content::NotificationSource& source,
253 const content::NotificationDetails& details); 259 const content::NotificationDetails& details) OVERRIDE;
254 260
255 virtual void ObserveTab(content::NavigationController* controller) = 0; 261 virtual void ObserveTab(content::NavigationController* controller) = 0;
256 262
257 protected: 263 protected:
258 content::NotificationRegistrar registrar_; 264 content::NotificationRegistrar registrar_;
259 base::WeakPtr<AutomationProvider> automation_; 265 base::WeakPtr<AutomationProvider> automation_;
260 int notification_; 266 int notification_;
261 }; 267 };
262 268
263 class TabAppendedNotificationObserver : public TabStripNotificationObserver { 269 class TabAppendedNotificationObserver : public TabStripNotificationObserver {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 }; 334 };
329 335
330 // Observes when an extension has been uninstalled. 336 // Observes when an extension has been uninstalled.
331 class ExtensionUninstallObserver : public content::NotificationObserver { 337 class ExtensionUninstallObserver : public content::NotificationObserver {
332 public: 338 public:
333 ExtensionUninstallObserver(AutomationProvider* automation, 339 ExtensionUninstallObserver(AutomationProvider* automation,
334 IPC::Message* reply_message, 340 IPC::Message* reply_message,
335 const std::string& id); 341 const std::string& id);
336 virtual ~ExtensionUninstallObserver(); 342 virtual ~ExtensionUninstallObserver();
337 343
338 // Implementation of content::NotificationObserver. 344 // Overridden from content::NotificationObserver:
339 virtual void Observe(int type, 345 virtual void Observe(int type,
340 const content::NotificationSource& source, 346 const content::NotificationSource& source,
341 const content::NotificationDetails& details); 347 const content::NotificationDetails& details) OVERRIDE;
342 348
343 private: 349 private:
344 content::NotificationRegistrar registrar_; 350 content::NotificationRegistrar registrar_;
345 base::WeakPtr<AutomationProvider> automation_; 351 base::WeakPtr<AutomationProvider> automation_;
346 scoped_ptr<IPC::Message> reply_message_; 352 scoped_ptr<IPC::Message> reply_message_;
347 std::string id_; 353 std::string id_;
348 354
349 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallObserver); 355 DISALLOW_COPY_AND_ASSIGN(ExtensionUninstallObserver);
350 }; 356 };
351 357
352 // Observes when an extension has finished loading and is ready for use. Also 358 // Observes when an extension has finished loading and is ready for use. Also
353 // checks for possible install errors. 359 // checks for possible install errors.
354 class ExtensionReadyNotificationObserver 360 class ExtensionReadyNotificationObserver
355 : public content::NotificationObserver { 361 : public content::NotificationObserver {
356 public: 362 public:
357 // Creates an observer that replies using the JSON automation interface. 363 // Creates an observer that replies using the JSON automation interface.
358 ExtensionReadyNotificationObserver(ExtensionProcessManager* manager, 364 ExtensionReadyNotificationObserver(ExtensionProcessManager* manager,
359 ExtensionService* service, 365 ExtensionService* service,
360 AutomationProvider* automation, 366 AutomationProvider* automation,
361 IPC::Message* reply_message); 367 IPC::Message* reply_message);
362 virtual ~ExtensionReadyNotificationObserver(); 368 virtual ~ExtensionReadyNotificationObserver();
363 369
364 // Implementation of NotificationObserver. 370 // Overridden from content::NotificationObserver:
365 virtual void Observe(int type, 371 virtual void Observe(int type,
366 const content::NotificationSource& source, 372 const content::NotificationSource& source,
367 const content::NotificationDetails& details); 373 const content::NotificationDetails& details) OVERRIDE;
368 374
369 private: 375 private:
370 void Init(); 376 void Init();
371 377
372 content::NotificationRegistrar registrar_; 378 content::NotificationRegistrar registrar_;
373 ExtensionProcessManager* manager_; 379 ExtensionProcessManager* manager_;
374 ExtensionService* service_; 380 ExtensionService* service_;
375 base::WeakPtr<AutomationProvider> automation_; 381 base::WeakPtr<AutomationProvider> automation_;
376 scoped_ptr<IPC::Message> reply_message_; 382 scoped_ptr<IPC::Message> reply_message_;
377 const extensions::Extension* extension_; 383 const extensions::Extension* extension_;
378 384
379 DISALLOW_COPY_AND_ASSIGN(ExtensionReadyNotificationObserver); 385 DISALLOW_COPY_AND_ASSIGN(ExtensionReadyNotificationObserver);
380 }; 386 };
381 387
382 class ExtensionUnloadNotificationObserver 388 class ExtensionUnloadNotificationObserver
383 : public content::NotificationObserver { 389 : public content::NotificationObserver {
384 public: 390 public:
385 ExtensionUnloadNotificationObserver(); 391 ExtensionUnloadNotificationObserver();
386 virtual ~ExtensionUnloadNotificationObserver(); 392 virtual ~ExtensionUnloadNotificationObserver();
387 393
388 // Implementation of NotificationObserver. 394 // Overridden from content::NotificationObserver:
389 virtual void Observe(int type, 395 virtual void Observe(int type,
390 const content::NotificationSource& source, 396 const content::NotificationSource& source,
391 const content::NotificationDetails& details); 397 const content::NotificationDetails& details) OVERRIDE;
392 398
393 bool did_receive_unload_notification() { 399 bool did_receive_unload_notification() {
394 return did_receive_unload_notification_; 400 return did_receive_unload_notification_;
395 } 401 }
396 402
397 private: 403 private:
398 content::NotificationRegistrar registrar_; 404 content::NotificationRegistrar registrar_;
399 bool did_receive_unload_notification_; 405 bool did_receive_unload_notification_;
400 406
401 DISALLOW_COPY_AND_ASSIGN(ExtensionUnloadNotificationObserver); 407 DISALLOW_COPY_AND_ASSIGN(ExtensionUnloadNotificationObserver);
402 }; 408 };
403 409
404 // Observes when the extensions have been fully updated. The ExtensionUpdater 410 // Observes when the extensions have been fully updated. The ExtensionUpdater
405 // service provides notifications for each extension that gets updated, but 411 // service provides notifications for each extension that gets updated, but
406 // it does not wait for the updated extensions to be installed or loaded. This 412 // it does not wait for the updated extensions to be installed or loaded. This
407 // observer waits until all updated extensions have actually been loaded. 413 // observer waits until all updated extensions have actually been loaded.
408 class ExtensionsUpdatedObserver : public content::NotificationObserver { 414 class ExtensionsUpdatedObserver : public content::NotificationObserver {
409 public: 415 public:
410 ExtensionsUpdatedObserver(ExtensionProcessManager* manager, 416 ExtensionsUpdatedObserver(ExtensionProcessManager* manager,
411 AutomationProvider* automation, 417 AutomationProvider* automation,
412 IPC::Message* reply_message); 418 IPC::Message* reply_message);
413 virtual ~ExtensionsUpdatedObserver(); 419 virtual ~ExtensionsUpdatedObserver();
414 420
415 // Implementation of NotificationObserver. 421 // Overridden from content::NotificationObserver:
416 virtual void Observe(int type, 422 virtual void Observe(int type,
417 const content::NotificationSource& source, 423 const content::NotificationSource& source,
418 const content::NotificationDetails& details); 424 const content::NotificationDetails& details) OVERRIDE;
419 425
420 private: 426 private:
421 content::NotificationRegistrar registrar_; 427 content::NotificationRegistrar registrar_;
422 ExtensionProcessManager* manager_; 428 ExtensionProcessManager* manager_;
423 base::WeakPtr<AutomationProvider> automation_; 429 base::WeakPtr<AutomationProvider> automation_;
424 scoped_ptr<IPC::Message> reply_message_; 430 scoped_ptr<IPC::Message> reply_message_;
425 std::set<std::string> in_progress_updates_; 431 std::set<std::string> in_progress_updates_;
426 bool updater_finished_; 432 bool updater_finished_;
427 433
428 DISALLOW_COPY_AND_ASSIGN(ExtensionsUpdatedObserver); 434 DISALLOW_COPY_AND_ASSIGN(ExtensionsUpdatedObserver);
429 }; 435 };
430 436
431 // Observes when a new browser has been opened and a tab within it has stopped 437 // Observes when a new browser has been opened and a tab within it has stopped
432 // loading. 438 // loading.
433 class BrowserOpenedNotificationObserver : public content::NotificationObserver { 439 class BrowserOpenedNotificationObserver : public content::NotificationObserver {
434 public: 440 public:
435 BrowserOpenedNotificationObserver(AutomationProvider* automation, 441 BrowserOpenedNotificationObserver(AutomationProvider* automation,
436 IPC::Message* reply_message); 442 IPC::Message* reply_message);
437 virtual ~BrowserOpenedNotificationObserver(); 443 virtual ~BrowserOpenedNotificationObserver();
438 444
445 // Overridden from content::NotificationObserver:
439 virtual void Observe(int type, 446 virtual void Observe(int type,
440 const content::NotificationSource& source, 447 const content::NotificationSource& source,
441 const content::NotificationDetails& details); 448 const content::NotificationDetails& details) OVERRIDE;
442 449
443 void set_for_browser_command(bool for_browser_command); 450 void set_for_browser_command(bool for_browser_command);
444 451
445 private: 452 private:
446 content::NotificationRegistrar registrar_; 453 content::NotificationRegistrar registrar_;
447 base::WeakPtr<AutomationProvider> automation_; 454 base::WeakPtr<AutomationProvider> automation_;
448 scoped_ptr<IPC::Message> reply_message_; 455 scoped_ptr<IPC::Message> reply_message_;
449 int new_window_id_; 456 int new_window_id_;
450 bool for_browser_command_; 457 bool for_browser_command_;
451 458
452 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedNotificationObserver); 459 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedNotificationObserver);
453 }; 460 };
454 461
455 class BrowserClosedNotificationObserver : public content::NotificationObserver { 462 class BrowserClosedNotificationObserver : public content::NotificationObserver {
456 public: 463 public:
457 BrowserClosedNotificationObserver(Browser* browser, 464 BrowserClosedNotificationObserver(Browser* browser,
458 AutomationProvider* automation, 465 AutomationProvider* automation,
459 IPC::Message* reply_message); 466 IPC::Message* reply_message);
460 virtual ~BrowserClosedNotificationObserver(); 467 virtual ~BrowserClosedNotificationObserver();
461 468
469 // Overridden from content::NotificationObserver:
462 virtual void Observe(int type, 470 virtual void Observe(int type,
463 const content::NotificationSource& source, 471 const content::NotificationSource& source,
464 const content::NotificationDetails& details); 472 const content::NotificationDetails& details) OVERRIDE;
465 473
466 void set_for_browser_command(bool for_browser_command); 474 void set_for_browser_command(bool for_browser_command);
467 475
468 private: 476 private:
469 content::NotificationRegistrar registrar_; 477 content::NotificationRegistrar registrar_;
470 base::WeakPtr<AutomationProvider> automation_; 478 base::WeakPtr<AutomationProvider> automation_;
471 scoped_ptr<IPC::Message> reply_message_; 479 scoped_ptr<IPC::Message> reply_message_;
472 bool for_browser_command_; 480 bool for_browser_command_;
473 481
474 DISALLOW_COPY_AND_ASSIGN(BrowserClosedNotificationObserver); 482 DISALLOW_COPY_AND_ASSIGN(BrowserClosedNotificationObserver);
475 }; 483 };
476 484
477 class BrowserCountChangeNotificationObserver 485 class BrowserCountChangeNotificationObserver
478 : public content::NotificationObserver { 486 : public content::NotificationObserver {
479 public: 487 public:
480 BrowserCountChangeNotificationObserver(int target_count, 488 BrowserCountChangeNotificationObserver(int target_count,
481 AutomationProvider* automation, 489 AutomationProvider* automation,
482 IPC::Message* reply_message); 490 IPC::Message* reply_message);
483 virtual ~BrowserCountChangeNotificationObserver(); 491 virtual ~BrowserCountChangeNotificationObserver();
484 492
493 // Overridden from content::NotificationObserver:
485 virtual void Observe(int type, 494 virtual void Observe(int type,
486 const content::NotificationSource& source, 495 const content::NotificationSource& source,
487 const content::NotificationDetails& details); 496 const content::NotificationDetails& details) OVERRIDE;
488 497
489 private: 498 private:
490 int target_count_; 499 int target_count_;
491 content::NotificationRegistrar registrar_; 500 content::NotificationRegistrar registrar_;
492 base::WeakPtr<AutomationProvider> automation_; 501 base::WeakPtr<AutomationProvider> automation_;
493 scoped_ptr<IPC::Message> reply_message_; 502 scoped_ptr<IPC::Message> reply_message_;
494 503
495 DISALLOW_COPY_AND_ASSIGN(BrowserCountChangeNotificationObserver); 504 DISALLOW_COPY_AND_ASSIGN(BrowserCountChangeNotificationObserver);
496 }; 505 };
497 506
498 class ExecuteBrowserCommandObserver : public content::NotificationObserver { 507 class ExecuteBrowserCommandObserver : public content::NotificationObserver {
499 public: 508 public:
500 virtual ~ExecuteBrowserCommandObserver(); 509 virtual ~ExecuteBrowserCommandObserver();
501 510
502 static bool CreateAndRegisterObserver(AutomationProvider* automation, 511 static bool CreateAndRegisterObserver(AutomationProvider* automation,
503 Browser* browser, 512 Browser* browser,
504 int command, 513 int command,
505 IPC::Message* reply_message); 514 IPC::Message* reply_message);
506 515
516 // Overridden from content::NotificationObserver:
507 virtual void Observe(int type, 517 virtual void Observe(int type,
508 const content::NotificationSource& source, 518 const content::NotificationSource& source,
509 const content::NotificationDetails& details); 519 const content::NotificationDetails& details) OVERRIDE;
510 520
511 private: 521 private:
512 ExecuteBrowserCommandObserver(AutomationProvider* automation, 522 ExecuteBrowserCommandObserver(AutomationProvider* automation,
513 IPC::Message* reply_message); 523 IPC::Message* reply_message);
514 524
515 bool Register(int command); 525 bool Register(int command);
516 526
517 bool Getint(int command, int* type); 527 bool Getint(int command, int* type);
518 528
519 content::NotificationRegistrar registrar_; 529 content::NotificationRegistrar registrar_;
520 base::WeakPtr<AutomationProvider> automation_; 530 base::WeakPtr<AutomationProvider> automation_;
521 int notification_type_; 531 int notification_type_;
522 scoped_ptr<IPC::Message> reply_message_; 532 scoped_ptr<IPC::Message> reply_message_;
523 533
524 DISALLOW_COPY_AND_ASSIGN(ExecuteBrowserCommandObserver); 534 DISALLOW_COPY_AND_ASSIGN(ExecuteBrowserCommandObserver);
525 }; 535 };
526 536
527 class FindInPageNotificationObserver : public content::NotificationObserver { 537 class FindInPageNotificationObserver : public content::NotificationObserver {
528 public: 538 public:
529 FindInPageNotificationObserver(AutomationProvider* automation, 539 FindInPageNotificationObserver(AutomationProvider* automation,
530 content::WebContents* parent_tab, 540 content::WebContents* parent_tab,
531 bool reply_with_json, 541 bool reply_with_json,
532 IPC::Message* reply_message); 542 IPC::Message* reply_message);
533 virtual ~FindInPageNotificationObserver(); 543 virtual ~FindInPageNotificationObserver();
534 544
545 // Overridden from content::NotificationObserver:
535 virtual void Observe(int type, 546 virtual void Observe(int type,
536 const content::NotificationSource& source, 547 const content::NotificationSource& source,
537 const content::NotificationDetails& details); 548 const content::NotificationDetails& details) OVERRIDE;
538 549
539 // The Find mechanism is over asynchronous IPC, so a search is kicked off and 550 // The Find mechanism is over asynchronous IPC, so a search is kicked off and
540 // we wait for notification to find out what the results are. As the user is 551 // we wait for notification to find out what the results are. As the user is
541 // typing, new search requests can be issued and the Request ID helps us make 552 // typing, new search requests can be issued and the Request ID helps us make
542 // sense of whether this is the current request or an old one. The unit tests, 553 // sense of whether this is the current request or an old one. The unit tests,
543 // however, which uses this constant issues only one search at a time, so we 554 // however, which uses this constant issues only one search at a time, so we
544 // don't need a rolling id to identify each search. But, we still need to 555 // don't need a rolling id to identify each search. But, we still need to
545 // specify one, so we just use a fixed one - its value does not matter. 556 // specify one, so we just use a fixed one - its value does not matter.
546 static const int kFindInPageRequestId; 557 static const int kFindInPageRequestId;
547 558
548 private: 559 private:
549 content::NotificationRegistrar registrar_; 560 content::NotificationRegistrar registrar_;
550 base::WeakPtr<AutomationProvider> automation_; 561 base::WeakPtr<AutomationProvider> automation_;
551 // We will at some point (before final update) be notified of the ordinal and 562 // We will at some point (before final update) be notified of the ordinal and
552 // we need to preserve it so we can send it later. 563 // we need to preserve it so we can send it later.
553 int active_match_ordinal_; 564 int active_match_ordinal_;
554 // Send reply using json automation interface. 565 // Send reply using json automation interface.
555 bool reply_with_json_; 566 bool reply_with_json_;
556 scoped_ptr<IPC::Message> reply_message_; 567 scoped_ptr<IPC::Message> reply_message_;
557 568
558 DISALLOW_COPY_AND_ASSIGN(FindInPageNotificationObserver); 569 DISALLOW_COPY_AND_ASSIGN(FindInPageNotificationObserver);
559 }; 570 };
560 571
561 class DomOperationObserver : public content::NotificationObserver { 572 class DomOperationObserver : public content::NotificationObserver {
562 public: 573 public:
563 explicit DomOperationObserver(int automation_id); 574 explicit DomOperationObserver(int automation_id);
564 virtual ~DomOperationObserver(); 575 virtual ~DomOperationObserver();
565 576
577 // Overridden from content::NotificationObserver:
566 virtual void Observe(int type, 578 virtual void Observe(int type,
567 const content::NotificationSource& source, 579 const content::NotificationSource& source,
568 const content::NotificationDetails& details) OVERRIDE; 580 const content::NotificationDetails& details) OVERRIDE;
569 581
570 virtual void OnDomOperationCompleted(const std::string& json) = 0; 582 virtual void OnDomOperationCompleted(const std::string& json) = 0;
571 virtual void OnModalDialogShown() = 0; 583 virtual void OnModalDialogShown() = 0;
572 virtual void OnJavascriptBlocked() = 0; 584 virtual void OnJavascriptBlocked() = 0;
573 585
574 private: 586 private:
575 int automation_id_; 587 int automation_id_;
(...skipping 25 matching lines...) Expand all
601 613
602 // Collects METRIC_EVENT_DURATION notifications and keep track of the times. 614 // Collects METRIC_EVENT_DURATION notifications and keep track of the times.
603 class MetricEventDurationObserver : public content::NotificationObserver { 615 class MetricEventDurationObserver : public content::NotificationObserver {
604 public: 616 public:
605 MetricEventDurationObserver(); 617 MetricEventDurationObserver();
606 virtual ~MetricEventDurationObserver(); 618 virtual ~MetricEventDurationObserver();
607 619
608 // Get the duration of an event. Returns -1 if we haven't seen the event. 620 // Get the duration of an event. Returns -1 if we haven't seen the event.
609 int GetEventDurationMs(const std::string& event_name); 621 int GetEventDurationMs(const std::string& event_name);
610 622
611 // NotificationObserver interface. 623 // Overridden from content::NotificationObserver:
612 virtual void Observe(int type, const content::NotificationSource& source, 624 virtual void Observe(int type,
613 const content::NotificationDetails& details); 625 const content::NotificationSource& source,
626 const content::NotificationDetails& details) OVERRIDE;
614 627
615 private: 628 private:
616 content::NotificationRegistrar registrar_; 629 content::NotificationRegistrar registrar_;
617 630
618 typedef std::map<std::string, int> EventDurationMap; 631 typedef std::map<std::string, int> EventDurationMap;
619 EventDurationMap durations_; 632 EventDurationMap durations_;
620 633
621 DISALLOW_COPY_AND_ASSIGN(MetricEventDurationObserver); 634 DISALLOW_COPY_AND_ASSIGN(MetricEventDurationObserver);
622 }; 635 };
623 636
624 class PageTranslatedObserver : public content::NotificationObserver { 637 class PageTranslatedObserver : public content::NotificationObserver {
625 public: 638 public:
626 PageTranslatedObserver(AutomationProvider* automation, 639 PageTranslatedObserver(AutomationProvider* automation,
627 IPC::Message* reply_message, 640 IPC::Message* reply_message,
628 content::WebContents* web_contents); 641 content::WebContents* web_contents);
629 virtual ~PageTranslatedObserver(); 642 virtual ~PageTranslatedObserver();
630 643
631 // content::NotificationObserver interface. 644 // Overridden from content::NotificationObserver:
632 virtual void Observe(int type, 645 virtual void Observe(int type,
633 const content::NotificationSource& source, 646 const content::NotificationSource& source,
634 const content::NotificationDetails& details); 647 const content::NotificationDetails& details) OVERRIDE;
635 648
636 private: 649 private:
637 content::NotificationRegistrar registrar_; 650 content::NotificationRegistrar registrar_;
638 base::WeakPtr<AutomationProvider> automation_; 651 base::WeakPtr<AutomationProvider> automation_;
639 scoped_ptr<IPC::Message> reply_message_; 652 scoped_ptr<IPC::Message> reply_message_;
640 653
641 DISALLOW_COPY_AND_ASSIGN(PageTranslatedObserver); 654 DISALLOW_COPY_AND_ASSIGN(PageTranslatedObserver);
642 }; 655 };
643 656
644 class TabLanguageDeterminedObserver : public content::NotificationObserver { 657 class TabLanguageDeterminedObserver : public content::NotificationObserver {
645 public: 658 public:
646 TabLanguageDeterminedObserver(AutomationProvider* automation, 659 TabLanguageDeterminedObserver(AutomationProvider* automation,
647 IPC::Message* reply_message, 660 IPC::Message* reply_message,
648 content::WebContents* web_contents, 661 content::WebContents* web_contents,
649 TranslateInfoBarDelegate* translate_bar); 662 TranslateInfoBarDelegate* translate_bar);
650 virtual ~TabLanguageDeterminedObserver(); 663 virtual ~TabLanguageDeterminedObserver();
651 664
652 // content::NotificationObserver interface. 665 // Overridden from content::NotificationObserver:
653 virtual void Observe(int type, 666 virtual void Observe(int type,
654 const content::NotificationSource& source, 667 const content::NotificationSource& source,
655 const content::NotificationDetails& details); 668 const content::NotificationDetails& details) OVERRIDE;
656 669
657 private: 670 private:
658 content::NotificationRegistrar registrar_; 671 content::NotificationRegistrar registrar_;
659 base::WeakPtr<AutomationProvider> automation_; 672 base::WeakPtr<AutomationProvider> automation_;
660 scoped_ptr<IPC::Message> reply_message_; 673 scoped_ptr<IPC::Message> reply_message_;
661 content::WebContents* web_contents_; 674 content::WebContents* web_contents_;
662 TranslateInfoBarDelegate* translate_bar_; 675 TranslateInfoBarDelegate* translate_bar_;
663 676
664 DISALLOW_COPY_AND_ASSIGN(TabLanguageDeterminedObserver); 677 DISALLOW_COPY_AND_ASSIGN(TabLanguageDeterminedObserver);
665 }; 678 };
666 679
667 class InfoBarCountObserver : public content::NotificationObserver { 680 class InfoBarCountObserver : public content::NotificationObserver {
668 public: 681 public:
669 InfoBarCountObserver(AutomationProvider* automation, 682 InfoBarCountObserver(AutomationProvider* automation,
670 IPC::Message* reply_message, 683 IPC::Message* reply_message,
671 TabContentsWrapper* tab_contents, 684 TabContentsWrapper* tab_contents,
672 size_t target_count); 685 size_t target_count);
673 virtual ~InfoBarCountObserver(); 686 virtual ~InfoBarCountObserver();
674 687
675 // content::NotificationObserver interface. 688 // Overridden from content::NotificationObserver:
676 virtual void Observe(int type, 689 virtual void Observe(int type,
677 const content::NotificationSource& source, 690 const content::NotificationSource& source,
678 const content::NotificationDetails& details); 691 const content::NotificationDetails& details) OVERRIDE;
679 692
680 private: 693 private:
681 // Checks whether the infobar count matches our target, and if so 694 // Checks whether the infobar count matches our target, and if so
682 // sends the reply message and deletes itself. 695 // sends the reply message and deletes itself.
683 void CheckCount(); 696 void CheckCount();
684 697
685 content::NotificationRegistrar registrar_; 698 content::NotificationRegistrar registrar_;
686 base::WeakPtr<AutomationProvider> automation_; 699 base::WeakPtr<AutomationProvider> automation_;
687 scoped_ptr<IPC::Message> reply_message_; 700 scoped_ptr<IPC::Message> reply_message_;
688 TabContentsWrapper* tab_contents_; 701 TabContentsWrapper* tab_contents_;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
721 // whether authentication succeeded to the automation provider. 734 // whether authentication succeeded to the automation provider.
722 class ScreenLockUnlockObserver : public content::NotificationObserver { 735 class ScreenLockUnlockObserver : public content::NotificationObserver {
723 public: 736 public:
724 // Set lock_screen to true to observe lock screen events, 737 // Set lock_screen to true to observe lock screen events,
725 // false for unlock screen events. 738 // false for unlock screen events.
726 ScreenLockUnlockObserver(AutomationProvider* automation, 739 ScreenLockUnlockObserver(AutomationProvider* automation,
727 IPC::Message* reply_message, 740 IPC::Message* reply_message,
728 bool lock_screen); 741 bool lock_screen);
729 virtual ~ScreenLockUnlockObserver(); 742 virtual ~ScreenLockUnlockObserver();
730 743
731 // content::NotificationObserver interface. 744 // Overridden from content::NotificationObserver:
732 virtual void Observe(int type, const content::NotificationSource& source, 745 virtual void Observe(int type,
733 const content::NotificationDetails& details); 746 const content::NotificationSource& source,
747 const content::NotificationDetails& details) OVERRIDE;
734 748
735 protected: 749 protected:
736 base::WeakPtr<AutomationProvider> automation_; 750 base::WeakPtr<AutomationProvider> automation_;
737 scoped_ptr<IPC::Message> reply_message_; 751 scoped_ptr<IPC::Message> reply_message_;
738 752
739 private: 753 private:
740 content::NotificationRegistrar registrar_; 754 content::NotificationRegistrar registrar_;
741 bool lock_screen_; 755 bool lock_screen_;
742 756
743 DISALLOW_COPY_AND_ASSIGN(ScreenLockUnlockObserver); 757 DISALLOW_COPY_AND_ASSIGN(ScreenLockUnlockObserver);
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 public content::NotificationObserver { 1187 public content::NotificationObserver {
1174 public: 1188 public:
1175 PasswordStoreLoginsChangedObserver(AutomationProvider* automation, 1189 PasswordStoreLoginsChangedObserver(AutomationProvider* automation,
1176 IPC::Message* reply_message, 1190 IPC::Message* reply_message,
1177 PasswordStoreChange::Type expected_type, 1191 PasswordStoreChange::Type expected_type,
1178 const std::string& result_key); 1192 const std::string& result_key);
1179 1193
1180 // Schedules a task on the DB thread to register the appropriate observers. 1194 // Schedules a task on the DB thread to register the appropriate observers.
1181 virtual void Init(); 1195 virtual void Init();
1182 1196
1183 // content::NotificationObserver interface. 1197 // Overridden from content::NotificationObserver:
1184 virtual void Observe(int type, 1198 virtual void Observe(int type,
1185 const content::NotificationSource& source, 1199 const content::NotificationSource& source,
1186 const content::NotificationDetails& details); 1200 const content::NotificationDetails& details) OVERRIDE;
1187 1201
1188 private: 1202 private:
1189 friend struct content::BrowserThread::DeleteOnThread< 1203 friend struct content::BrowserThread::DeleteOnThread<
1190 content::BrowserThread::UI>; 1204 content::BrowserThread::UI>;
1191 ~PasswordStoreLoginsChangedObserver(); 1205 ~PasswordStoreLoginsChangedObserver();
1192 friend class base::DeleteHelper<PasswordStoreLoginsChangedObserver>; 1206 friend class base::DeleteHelper<PasswordStoreLoginsChangedObserver>;
1193 1207
1194 // Registers the appropriate observers. Called on the DB thread. 1208 // Registers the appropriate observers. Called on the DB thread.
1195 void RegisterObserversTask(); 1209 void RegisterObserversTask();
1196 1210
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 1246
1233 // Allows automation provider to wait until page load after selecting an item 1247 // Allows automation provider to wait until page load after selecting an item
1234 // in the omnibox popup. 1248 // in the omnibox popup.
1235 class OmniboxAcceptNotificationObserver : public content::NotificationObserver { 1249 class OmniboxAcceptNotificationObserver : public content::NotificationObserver {
1236 public: 1250 public:
1237 OmniboxAcceptNotificationObserver(content::NavigationController* controller, 1251 OmniboxAcceptNotificationObserver(content::NavigationController* controller,
1238 AutomationProvider* automation, 1252 AutomationProvider* automation,
1239 IPC::Message* reply_message); 1253 IPC::Message* reply_message);
1240 virtual ~OmniboxAcceptNotificationObserver(); 1254 virtual ~OmniboxAcceptNotificationObserver();
1241 1255
1256 // Overridden from content::NotificationObserver:
1242 virtual void Observe(int type, 1257 virtual void Observe(int type,
1243 const content::NotificationSource& source, 1258 const content::NotificationSource& source,
1244 const content::NotificationDetails& details); 1259 const content::NotificationDetails& details) OVERRIDE;
1245 1260
1246 private: 1261 private:
1247 content::NotificationRegistrar registrar_; 1262 content::NotificationRegistrar registrar_;
1248 base::WeakPtr<AutomationProvider> automation_; 1263 base::WeakPtr<AutomationProvider> automation_;
1249 scoped_ptr<IPC::Message> reply_message_; 1264 scoped_ptr<IPC::Message> reply_message_;
1250 content::NavigationController* controller_; 1265 content::NavigationController* controller_;
1251 1266
1252 DISALLOW_COPY_AND_ASSIGN(OmniboxAcceptNotificationObserver); 1267 DISALLOW_COPY_AND_ASSIGN(OmniboxAcceptNotificationObserver);
1253 }; 1268 };
1254 1269
1255 // Allows the automation provider to wait for a save package notification. 1270 // Allows the automation provider to wait for a save package notification.
1256 class SavePackageNotificationObserver : public content::NotificationObserver { 1271 class SavePackageNotificationObserver : public content::NotificationObserver {
1257 public: 1272 public:
1258 SavePackageNotificationObserver(content::DownloadManager* download_manager, 1273 SavePackageNotificationObserver(content::DownloadManager* download_manager,
1259 AutomationProvider* automation, 1274 AutomationProvider* automation,
1260 IPC::Message* reply_message); 1275 IPC::Message* reply_message);
1261 virtual ~SavePackageNotificationObserver(); 1276 virtual ~SavePackageNotificationObserver();
1262 1277
1278 // Overridden from content::NotificationObserver:
1263 virtual void Observe(int type, 1279 virtual void Observe(int type,
1264 const content::NotificationSource& source, 1280 const content::NotificationSource& source,
1265 const content::NotificationDetails& details); 1281 const content::NotificationDetails& details) OVERRIDE;
1266 1282
1267 private: 1283 private:
1268 content::NotificationRegistrar registrar_; 1284 content::NotificationRegistrar registrar_;
1269 base::WeakPtr<AutomationProvider> automation_; 1285 base::WeakPtr<AutomationProvider> automation_;
1270 scoped_ptr<IPC::Message> reply_message_; 1286 scoped_ptr<IPC::Message> reply_message_;
1271 1287
1272 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver); 1288 DISALLOW_COPY_AND_ASSIGN(SavePackageNotificationObserver);
1273 }; 1289 };
1274 1290
1275 // This class manages taking a snapshot of a page. 1291 // This class manages taking a snapshot of a page.
1276 class PageSnapshotTaker : public TabEventObserver, 1292 class PageSnapshotTaker : public TabEventObserver,
1277 public content::NotificationObserver { 1293 public content::NotificationObserver {
1278 public: 1294 public:
1279 PageSnapshotTaker(AutomationProvider* automation, 1295 PageSnapshotTaker(AutomationProvider* automation,
1280 IPC::Message* reply_message, 1296 IPC::Message* reply_message,
1281 TabContentsWrapper* tab_contents, 1297 TabContentsWrapper* tab_contents,
1282 const FilePath& path); 1298 const FilePath& path);
1283 virtual ~PageSnapshotTaker(); 1299 virtual ~PageSnapshotTaker();
1284 1300
1285 // Start the process of taking a snapshot of the entire page. 1301 // Start the process of taking a snapshot of the entire page.
1286 void Start(); 1302 void Start();
1287 1303
1288 private: 1304 private:
1289 // TabEventObserver overrides. 1305 // Overridden from TabEventObserver:
1290 virtual void OnSnapshotEntirePageACK( 1306 virtual void OnSnapshotEntirePageACK(
1291 bool success, 1307 bool success,
1292 const std::vector<unsigned char>& png_data, 1308 const std::vector<unsigned char>& png_data,
1293 const std::string& error_msg) OVERRIDE; 1309 const std::string& error_msg) OVERRIDE;
1294 // NotificationObserver overrides. 1310
1311 // Overridden from content::NotificationObserver:
1295 virtual void Observe(int type, 1312 virtual void Observe(int type,
1296 const content::NotificationSource& source, 1313 const content::NotificationSource& source,
1297 const content::NotificationDetails& details); 1314 const content::NotificationDetails& details) OVERRIDE;
1298 1315
1299 // Helper method to send a response back to the client. Deletes this. 1316 // Helper method to send a response back to the client. Deletes this.
1300 void SendMessage(bool success, const std::string& error_msg); 1317 void SendMessage(bool success, const std::string& error_msg);
1301 1318
1302 base::WeakPtr<AutomationProvider> automation_; 1319 base::WeakPtr<AutomationProvider> automation_;
1303 scoped_ptr<IPC::Message> reply_message_; 1320 scoped_ptr<IPC::Message> reply_message_;
1304 TabContentsWrapper* tab_contents_; 1321 TabContentsWrapper* tab_contents_;
1305 FilePath image_path_; 1322 FilePath image_path_;
1306 content::NotificationRegistrar registrar_; 1323 content::NotificationRegistrar registrar_;
1307 1324
(...skipping 19 matching lines...) Expand all
1327 const ErrorCallback& error_callback); 1344 const ErrorCallback& error_callback);
1328 virtual ~AutomationMouseEventProcessor(); 1345 virtual ~AutomationMouseEventProcessor();
1329 1346
1330 private: 1347 private:
1331 // IPC message handlers. 1348 // IPC message handlers.
1332 virtual void OnWillProcessMouseEventAt(const gfx::Point& point); 1349 virtual void OnWillProcessMouseEventAt(const gfx::Point& point);
1333 virtual void OnProcessMouseEventACK( 1350 virtual void OnProcessMouseEventACK(
1334 bool success, 1351 bool success,
1335 const std::string& error_msg); 1352 const std::string& error_msg);
1336 1353
1337 // RenderViewHostObserver overrides. 1354 // Overriden from RenderViewHostObserver.
1338 virtual void RenderViewHostDestroyed(content::RenderViewHost* host) OVERRIDE; 1355 virtual void RenderViewHostDestroyed(content::RenderViewHost* host) OVERRIDE;
1339 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 1356 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
1340 1357
1341 // NotificationObserver overrides. 1358 // Overridden from content::NotificationObserver:
1342 virtual void Observe(int type, 1359 virtual void Observe(int type,
1343 const content::NotificationSource& source, 1360 const content::NotificationSource& source,
1344 const content::NotificationDetails& details) OVERRIDE; 1361 const content::NotificationDetails& details) OVERRIDE;
1345 1362
1346 // Helper method to invoke the appropriate callback. Uses the given error 1363 // Helper method to invoke the appropriate callback. Uses the given error
1347 // only if the operation failed. Deletes this. 1364 // only if the operation failed. Deletes this.
1348 void InvokeCallback(const automation::Error& error); 1365 void InvokeCallback(const automation::Error& error);
1349 1366
1350 content::NotificationRegistrar registrar_; 1367 content::NotificationRegistrar registrar_;
1351 CompletionCallback completion_callback_; 1368 CompletionCallback completion_callback_;
1352 ErrorCallback error_callback_; 1369 ErrorCallback error_callback_;
1353 bool has_point_; 1370 bool has_point_;
1354 gfx::Point point_; 1371 gfx::Point point_;
1355 1372
1356 DISALLOW_COPY_AND_ASSIGN(AutomationMouseEventProcessor); 1373 DISALLOW_COPY_AND_ASSIGN(AutomationMouseEventProcessor);
1357 }; 1374 };
1358 1375
1359 class NTPInfoObserver : public content::NotificationObserver { 1376 class NTPInfoObserver : public content::NotificationObserver {
1360 public: 1377 public:
1361 NTPInfoObserver(AutomationProvider* automation, 1378 NTPInfoObserver(AutomationProvider* automation,
1362 IPC::Message* reply_message, 1379 IPC::Message* reply_message,
1363 CancelableRequestConsumer* consumer); 1380 CancelableRequestConsumer* consumer);
1364 virtual ~NTPInfoObserver(); 1381 virtual ~NTPInfoObserver();
1365 1382
1383 // Overridden from content::NotificationObserver:
1366 virtual void Observe(int type, 1384 virtual void Observe(int type,
1367 const content::NotificationSource& source, 1385 const content::NotificationSource& source,
1368 const content::NotificationDetails& details); 1386 const content::NotificationDetails& details) OVERRIDE;
1369 1387
1370 private: 1388 private:
1371 void OnTopSitesLoaded(); 1389 void OnTopSitesLoaded();
1372 void OnTopSitesReceived(const history::MostVisitedURLList& visited_list); 1390 void OnTopSitesReceived(const history::MostVisitedURLList& visited_list);
1373 1391
1374 base::WeakPtr<AutomationProvider> automation_; 1392 base::WeakPtr<AutomationProvider> automation_;
1375 scoped_ptr<IPC::Message> reply_message_; 1393 scoped_ptr<IPC::Message> reply_message_;
1376 CancelableRequestConsumer* consumer_; 1394 CancelableRequestConsumer* consumer_;
1377 CancelableRequestProvider::Handle request_; 1395 CancelableRequestProvider::Handle request_;
1378 scoped_ptr<base::DictionaryValue> ntp_info_; 1396 scoped_ptr<base::DictionaryValue> ntp_info_;
1379 history::TopSites* top_sites_; 1397 history::TopSites* top_sites_;
1380 content::NotificationRegistrar registrar_; 1398 content::NotificationRegistrar registrar_;
1381 1399
1382 DISALLOW_COPY_AND_ASSIGN(NTPInfoObserver); 1400 DISALLOW_COPY_AND_ASSIGN(NTPInfoObserver);
1383 }; 1401 };
1384 1402
1385 // Observes when an app has been launched, as indicated by a notification that 1403 // Observes when an app has been launched, as indicated by a notification that
1386 // a content load in some tab has stopped. 1404 // a content load in some tab has stopped.
1387 class AppLaunchObserver : public content::NotificationObserver { 1405 class AppLaunchObserver : public content::NotificationObserver {
1388 public: 1406 public:
1389 AppLaunchObserver(content::NavigationController* controller, 1407 AppLaunchObserver(content::NavigationController* controller,
1390 AutomationProvider* automation, 1408 AutomationProvider* automation,
1391 IPC::Message* reply_message, 1409 IPC::Message* reply_message,
1392 extension_misc::LaunchContainer launch_container); 1410 extension_misc::LaunchContainer launch_container);
1393 virtual ~AppLaunchObserver(); 1411 virtual ~AppLaunchObserver();
1394 1412
1413 // Overridden from content::NotificationObserver:
1395 virtual void Observe(int type, 1414 virtual void Observe(int type,
1396 const content::NotificationSource& source, 1415 const content::NotificationSource& source,
1397 const content::NotificationDetails& details); 1416 const content::NotificationDetails& details) OVERRIDE;
1398 1417
1399 private: 1418 private:
1400 content::NavigationController* controller_; 1419 content::NavigationController* controller_;
1401 base::WeakPtr<AutomationProvider> automation_; 1420 base::WeakPtr<AutomationProvider> automation_;
1402 scoped_ptr<IPC::Message> reply_message_; 1421 scoped_ptr<IPC::Message> reply_message_;
1403 content::NotificationRegistrar registrar_; 1422 content::NotificationRegistrar registrar_;
1404 extension_misc::LaunchContainer launch_container_; 1423 extension_misc::LaunchContainer launch_container_;
1405 int new_window_id_; 1424 int new_window_id_;
1406 1425
1407 DISALLOW_COPY_AND_ASSIGN(AppLaunchObserver); 1426 DISALLOW_COPY_AND_ASSIGN(AppLaunchObserver);
1408 }; 1427 };
1409 1428
1410 // Observes when Autofill information is displayed in the renderer. This can 1429 // Observes when Autofill information is displayed in the renderer. This can
1411 // happen in two different ways: (1) a popup containing Autofill suggestions 1430 // happen in two different ways: (1) a popup containing Autofill suggestions
1412 // has been shown in the renderer; (2) a webpage form is filled or previewed 1431 // has been shown in the renderer; (2) a webpage form is filled or previewed
1413 // with Autofill suggestions. A constructor argument specifies the appropriate 1432 // with Autofill suggestions. A constructor argument specifies the appropriate
1414 // notification to wait for. 1433 // notification to wait for.
1415 class AutofillDisplayedObserver : public content::NotificationObserver { 1434 class AutofillDisplayedObserver : public content::NotificationObserver {
1416 public: 1435 public:
1417 AutofillDisplayedObserver(int notification, 1436 AutofillDisplayedObserver(int notification,
1418 content::RenderViewHost* render_view_host, 1437 content::RenderViewHost* render_view_host,
1419 AutomationProvider* automation, 1438 AutomationProvider* automation,
1420 IPC::Message* reply_message); 1439 IPC::Message* reply_message);
1421 virtual ~AutofillDisplayedObserver(); 1440 virtual ~AutofillDisplayedObserver();
1422 1441
1423 // content::NotificationObserver interface. 1442 // Overridden from content::NotificationObserver:
1424 virtual void Observe(int type, 1443 virtual void Observe(int type,
1425 const content::NotificationSource& source, 1444 const content::NotificationSource& source,
1426 const content::NotificationDetails& details); 1445 const content::NotificationDetails& details) OVERRIDE;
1427 1446
1428 private: 1447 private:
1429 int notification_; 1448 int notification_;
1430 content::RenderViewHost* render_view_host_; 1449 content::RenderViewHost* render_view_host_;
1431 base::WeakPtr<AutomationProvider> automation_; 1450 base::WeakPtr<AutomationProvider> automation_;
1432 scoped_ptr<IPC::Message> reply_message_; 1451 scoped_ptr<IPC::Message> reply_message_;
1433 content::NotificationRegistrar registrar_; 1452 content::NotificationRegistrar registrar_;
1434 1453
1435 DISALLOW_COPY_AND_ASSIGN(AutofillDisplayedObserver); 1454 DISALLOW_COPY_AND_ASSIGN(AutofillDisplayedObserver);
1436 }; 1455 };
1437 1456
1438 // Observes when a specified number of autofill profiles and credit cards have 1457 // Observes when a specified number of autofill profiles and credit cards have
1439 // been changed in the WebDataService. The notifications are sent on the DB 1458 // been changed in the WebDataService. The notifications are sent on the DB
1440 // thread, the thread that interacts with the database. 1459 // thread, the thread that interacts with the database.
1441 class AutofillChangedObserver 1460 class AutofillChangedObserver
1442 : public base::RefCountedThreadSafe< 1461 : public base::RefCountedThreadSafe<
1443 AutofillChangedObserver, 1462 AutofillChangedObserver,
1444 content::BrowserThread::DeleteOnUIThread>, 1463 content::BrowserThread::DeleteOnUIThread>,
1445 public content::NotificationObserver { 1464 public content::NotificationObserver {
1446 public: 1465 public:
1447 AutofillChangedObserver(AutomationProvider* automation, 1466 AutofillChangedObserver(AutomationProvider* automation,
1448 IPC::Message* reply_message, 1467 IPC::Message* reply_message,
1449 int num_profiles, 1468 int num_profiles,
1450 int num_credit_cards); 1469 int num_credit_cards);
1451 1470
1452 // Schedules a task on the DB thread to register the appropriate observers. 1471 // Schedules a task on the DB thread to register the appropriate observers.
1453 virtual void Init(); 1472 virtual void Init();
1454 1473
1455 // content::NotificationObserver interface. 1474 // Overridden from content::NotificationObserver:
1456 virtual void Observe(int type, 1475 virtual void Observe(int type,
1457 const content::NotificationSource& source, 1476 const content::NotificationSource& source,
1458 const content::NotificationDetails& details); 1477 const content::NotificationDetails& details) OVERRIDE;
1459 1478
1460 private: 1479 private:
1461 friend struct content::BrowserThread::DeleteOnThread< 1480 friend struct content::BrowserThread::DeleteOnThread<
1462 content::BrowserThread::UI>; 1481 content::BrowserThread::UI>;
1463 ~AutofillChangedObserver(); 1482 ~AutofillChangedObserver();
1464 friend class base::DeleteHelper<AutofillChangedObserver>; 1483 friend class base::DeleteHelper<AutofillChangedObserver>;
1465 1484
1466 // Registers the appropriate observers. Called on the DB thread. 1485 // Registers the appropriate observers. Called on the DB thread.
1467 void RegisterObserversTask(); 1486 void RegisterObserversTask();
1468 1487
(...skipping 24 matching lines...) Expand all
1493 public: 1512 public:
1494 AutofillFormSubmittedObserver(AutomationProvider* automation, 1513 AutofillFormSubmittedObserver(AutomationProvider* automation,
1495 IPC::Message* reply_message, 1514 IPC::Message* reply_message,
1496 PersonalDataManager* pdm); 1515 PersonalDataManager* pdm);
1497 virtual ~AutofillFormSubmittedObserver(); 1516 virtual ~AutofillFormSubmittedObserver();
1498 1517
1499 // PersonalDataManagerObserver interface. 1518 // PersonalDataManagerObserver interface.
1500 virtual void OnPersonalDataChanged() OVERRIDE; 1519 virtual void OnPersonalDataChanged() OVERRIDE;
1501 virtual void OnInsufficientFormData() OVERRIDE; 1520 virtual void OnInsufficientFormData() OVERRIDE;
1502 1521
1503 // content::NotificationObserver interface. 1522 // Overridden from content::NotificationObserver:
1504 virtual void Observe(int type, 1523 virtual void Observe(int type,
1505 const content::NotificationSource& source, 1524 const content::NotificationSource& source,
1506 const content::NotificationDetails& details); 1525 const content::NotificationDetails& details) OVERRIDE;
1507 1526
1508 private: 1527 private:
1509 content::NotificationRegistrar registrar_; 1528 content::NotificationRegistrar registrar_;
1510 base::WeakPtr<AutomationProvider> automation_; 1529 base::WeakPtr<AutomationProvider> automation_;
1511 scoped_ptr<IPC::Message> reply_message_; 1530 scoped_ptr<IPC::Message> reply_message_;
1512 PersonalDataManager* pdm_; 1531 PersonalDataManager* pdm_;
1513 InfoBarTabHelper* infobar_helper_; 1532 InfoBarTabHelper* infobar_helper_;
1514 }; 1533 };
1515 1534
1516 // Allows the automation provider to wait until all the notification 1535 // Allows the automation provider to wait until all the notification
1517 // processes are ready. 1536 // processes are ready.
1518 class GetAllNotificationsObserver : public content::NotificationObserver { 1537 class GetAllNotificationsObserver : public content::NotificationObserver {
1519 public: 1538 public:
1520 GetAllNotificationsObserver(AutomationProvider* automation, 1539 GetAllNotificationsObserver(AutomationProvider* automation,
1521 IPC::Message* reply_message); 1540 IPC::Message* reply_message);
1522 virtual ~GetAllNotificationsObserver(); 1541 virtual ~GetAllNotificationsObserver();
1523 1542
1543 // Overridden from content::NotificationObserver:
1524 virtual void Observe(int type, 1544 virtual void Observe(int type,
1525 const content::NotificationSource& source, 1545 const content::NotificationSource& source,
1526 const content::NotificationDetails& details); 1546 const content::NotificationDetails& details) OVERRIDE;
1527 1547
1528 private: 1548 private:
1529 // Sends a message via the |AutomationProvider|. |automation_| must be valid. 1549 // Sends a message via the |AutomationProvider|. |automation_| must be valid.
1530 // Deletes itself after the message is sent. 1550 // Deletes itself after the message is sent.
1531 void SendMessage(); 1551 void SendMessage();
1532 // Returns a new dictionary describing the given notification. 1552 // Returns a new dictionary describing the given notification.
1533 base::DictionaryValue* NotificationToJson(const Notification* note); 1553 base::DictionaryValue* NotificationToJson(const Notification* note);
1534 1554
1535 content::NotificationRegistrar registrar_; 1555 content::NotificationRegistrar registrar_;
1536 base::WeakPtr<AutomationProvider> automation_; 1556 base::WeakPtr<AutomationProvider> automation_;
1537 scoped_ptr<IPC::Message> reply_message_; 1557 scoped_ptr<IPC::Message> reply_message_;
1538 1558
1539 DISALLOW_COPY_AND_ASSIGN(GetAllNotificationsObserver); 1559 DISALLOW_COPY_AND_ASSIGN(GetAllNotificationsObserver);
1540 }; 1560 };
1541 1561
1542 // Allows the automation provider to wait for a new notification balloon 1562 // Allows the automation provider to wait for a new notification balloon
1543 // to appear and be ready. 1563 // to appear and be ready.
1544 class NewNotificationBalloonObserver : public content::NotificationObserver { 1564 class NewNotificationBalloonObserver : public content::NotificationObserver {
1545 public: 1565 public:
1546 NewNotificationBalloonObserver(AutomationProvider* provider, 1566 NewNotificationBalloonObserver(AutomationProvider* provider,
1547 IPC::Message* reply_message); 1567 IPC::Message* reply_message);
1548 virtual ~NewNotificationBalloonObserver(); 1568 virtual ~NewNotificationBalloonObserver();
1569
1570 // Overridden from content::NotificationObserver:
1549 virtual void Observe(int type, 1571 virtual void Observe(int type,
1550 const content::NotificationSource& source, 1572 const content::NotificationSource& source,
1551 const content::NotificationDetails& details); 1573 const content::NotificationDetails& details) OVERRIDE;
1552 1574
1553 private: 1575 private:
1554 content::NotificationRegistrar registrar_; 1576 content::NotificationRegistrar registrar_;
1555 base::WeakPtr<AutomationProvider> automation_; 1577 base::WeakPtr<AutomationProvider> automation_;
1556 scoped_ptr<IPC::Message> reply_message_; 1578 scoped_ptr<IPC::Message> reply_message_;
1557 1579
1558 DISALLOW_COPY_AND_ASSIGN(NewNotificationBalloonObserver); 1580 DISALLOW_COPY_AND_ASSIGN(NewNotificationBalloonObserver);
1559 }; 1581 };
1560 1582
1561 // Allows the automation provider to wait for a given number of 1583 // Allows the automation provider to wait for a given number of
1562 // notification balloons. 1584 // notification balloons.
1563 class OnNotificationBalloonCountObserver 1585 class OnNotificationBalloonCountObserver
1564 : public content::NotificationObserver { 1586 : public content::NotificationObserver {
1565 public: 1587 public:
1566 OnNotificationBalloonCountObserver(AutomationProvider* provider, 1588 OnNotificationBalloonCountObserver(AutomationProvider* provider,
1567 IPC::Message* reply_message, 1589 IPC::Message* reply_message,
1568 int count); 1590 int count);
1569 virtual ~OnNotificationBalloonCountObserver(); 1591 virtual ~OnNotificationBalloonCountObserver();
1570 1592
1571 // Sends an automation reply message if |automation_| is still valid and the 1593 // Sends an automation reply message if |automation_| is still valid and the
1572 // number of ready balloons matches the desired count. Deletes itself if the 1594 // number of ready balloons matches the desired count. Deletes itself if the
1573 // message is sent or if |automation_| is invalid. 1595 // message is sent or if |automation_| is invalid.
1574 void CheckBalloonCount(); 1596 void CheckBalloonCount();
1575 1597
1598 // Overridden from content::NotificationObserver:
1576 virtual void Observe(int type, 1599 virtual void Observe(int type,
1577 const content::NotificationSource& source, 1600 const content::NotificationSource& source,
1578 const content::NotificationDetails& details); 1601 const content::NotificationDetails& details) OVERRIDE;
1579 1602
1580 private: 1603 private:
1581 content::NotificationRegistrar registrar_; 1604 content::NotificationRegistrar registrar_;
1582 base::WeakPtr<AutomationProvider> automation_; 1605 base::WeakPtr<AutomationProvider> automation_;
1583 scoped_ptr<IPC::Message> reply_message_; 1606 scoped_ptr<IPC::Message> reply_message_;
1584 1607
1585 BalloonCollection* collection_; 1608 BalloonCollection* collection_;
1586 int count_; 1609 int count_;
1587 1610
1588 DISALLOW_COPY_AND_ASSIGN(OnNotificationBalloonCountObserver); 1611 DISALLOW_COPY_AND_ASSIGN(OnNotificationBalloonCountObserver);
1589 }; 1612 };
1590 1613
1591 // Allows the automation provider to wait for a RENDERER_PROCESS_CLOSED 1614 // Allows the automation provider to wait for a RENDERER_PROCESS_CLOSED
1592 // notification. 1615 // notification.
1593 class RendererProcessClosedObserver : public content::NotificationObserver { 1616 class RendererProcessClosedObserver : public content::NotificationObserver {
1594 public: 1617 public:
1595 RendererProcessClosedObserver(AutomationProvider* automation, 1618 RendererProcessClosedObserver(AutomationProvider* automation,
1596 IPC::Message* reply_message); 1619 IPC::Message* reply_message);
1597 virtual ~RendererProcessClosedObserver(); 1620 virtual ~RendererProcessClosedObserver();
1598 1621
1622 // Overridden from content::NotificationObserver:
1599 virtual void Observe(int type, 1623 virtual void Observe(int type,
1600 const content::NotificationSource& source, 1624 const content::NotificationSource& source,
1601 const content::NotificationDetails& details); 1625 const content::NotificationDetails& details) OVERRIDE;
1602 1626
1603 private: 1627 private:
1604 content::NotificationRegistrar registrar_; 1628 content::NotificationRegistrar registrar_;
1605 base::WeakPtr<AutomationProvider> automation_; 1629 base::WeakPtr<AutomationProvider> automation_;
1606 scoped_ptr<IPC::Message> reply_message_; 1630 scoped_ptr<IPC::Message> reply_message_;
1607 1631
1608 DISALLOW_COPY_AND_ASSIGN(RendererProcessClosedObserver); 1632 DISALLOW_COPY_AND_ASSIGN(RendererProcessClosedObserver);
1609 }; 1633 };
1610 1634
1611 // Allows the automation provider to wait for acknowledgement that a certain 1635 // Allows the automation provider to wait for acknowledgement that a certain
1612 // type and number of input events has been processed by the renderer. 1636 // type and number of input events has been processed by the renderer.
1613 class InputEventAckNotificationObserver : public content::NotificationObserver { 1637 class InputEventAckNotificationObserver : public content::NotificationObserver {
1614 public: 1638 public:
1615 InputEventAckNotificationObserver(AutomationProvider* automation, 1639 InputEventAckNotificationObserver(AutomationProvider* automation,
1616 IPC::Message* reply_message, 1640 IPC::Message* reply_message,
1617 int event_type, int count); 1641 int event_type, int count);
1618 virtual ~InputEventAckNotificationObserver(); 1642 virtual ~InputEventAckNotificationObserver();
1619 1643
1644 // Overridden from content::NotificationObserver:
1620 virtual void Observe(int type, 1645 virtual void Observe(int type,
1621 const content::NotificationSource& source, 1646 const content::NotificationSource& source,
1622 const content::NotificationDetails& details); 1647 const content::NotificationDetails& details) OVERRIDE;
1623 1648
1624 private: 1649 private:
1625 content::NotificationRegistrar registrar_; 1650 content::NotificationRegistrar registrar_;
1626 base::WeakPtr<AutomationProvider> automation_; 1651 base::WeakPtr<AutomationProvider> automation_;
1627 scoped_ptr<IPC::Message> reply_message_; 1652 scoped_ptr<IPC::Message> reply_message_;
1628 int event_type_; 1653 int event_type_;
1629 int count_; 1654 int count_;
1630 1655
1631 DISALLOW_COPY_AND_ASSIGN(InputEventAckNotificationObserver); 1656 DISALLOW_COPY_AND_ASSIGN(InputEventAckNotificationObserver);
1632 }; 1657 };
1633 1658
1634 // Allows the automation provider to wait for all render views to finish any 1659 // Allows the automation provider to wait for all render views to finish any
1635 // pending loads. This wait is only guaranteed for views that exist at the 1660 // pending loads. This wait is only guaranteed for views that exist at the
1636 // observer's creation. Will send a message on construction if no views are 1661 // observer's creation. Will send a message on construction if no views are
1637 // currently loading. 1662 // currently loading.
1638 class AllViewsStoppedLoadingObserver : public TabEventObserver, 1663 class AllViewsStoppedLoadingObserver : public TabEventObserver,
1639 public content::NotificationObserver { 1664 public content::NotificationObserver {
1640 public: 1665 public:
1641 AllViewsStoppedLoadingObserver( 1666 AllViewsStoppedLoadingObserver(
1642 AutomationProvider* automation, 1667 AutomationProvider* automation,
1643 IPC::Message* reply_message, 1668 IPC::Message* reply_message,
1644 ExtensionProcessManager* extension_process_manager); 1669 ExtensionProcessManager* extension_process_manager);
1645 virtual ~AllViewsStoppedLoadingObserver(); 1670 virtual ~AllViewsStoppedLoadingObserver();
1646 1671
1647 // TabEventObserver implementation. 1672 // TabEventObserver implementation.
1648 virtual void OnFirstPendingLoad(content::WebContents* web_contents) OVERRIDE; 1673 virtual void OnFirstPendingLoad(content::WebContents* web_contents) OVERRIDE;
1649 virtual void OnNoMorePendingLoads( 1674 virtual void OnNoMorePendingLoads(
1650 content::WebContents* web_contents) OVERRIDE; 1675 content::WebContents* web_contents) OVERRIDE;
1651 1676
1652 // content::NotificationObserver implementation. 1677 // Overridden from content::NotificationObserver:
1653 virtual void Observe(int type, 1678 virtual void Observe(int type,
1654 const content::NotificationSource& source, 1679 const content::NotificationSource& source,
1655 const content::NotificationDetails& details) OVERRIDE; 1680 const content::NotificationDetails& details) OVERRIDE;
1656 1681
1657 private: 1682 private:
1658 typedef std::set<content::WebContents*> TabSet; 1683 typedef std::set<content::WebContents*> TabSet;
1659 1684
1660 // Checks if there are no pending loads. If none, it will send an automation 1685 // Checks if there are no pending loads. If none, it will send an automation
1661 // relpy and delete itself. 1686 // relpy and delete itself.
1662 void CheckIfNoMorePendingLoads(); 1687 void CheckIfNoMorePendingLoads();
1663 1688
1664 base::WeakPtr<AutomationProvider> automation_; 1689 base::WeakPtr<AutomationProvider> automation_;
1665 scoped_ptr<IPC::Message> reply_message_; 1690 scoped_ptr<IPC::Message> reply_message_;
1666 ExtensionProcessManager* extension_process_manager_; 1691 ExtensionProcessManager* extension_process_manager_;
1667 content::NotificationRegistrar registrar_; 1692 content::NotificationRegistrar registrar_;
1668 TabSet pending_tabs_; 1693 TabSet pending_tabs_;
1669 1694
1670 DISALLOW_COPY_AND_ASSIGN(AllViewsStoppedLoadingObserver); 1695 DISALLOW_COPY_AND_ASSIGN(AllViewsStoppedLoadingObserver);
1671 }; 1696 };
1672 1697
1673 // Observer used to listen for new tab creation to complete. 1698 // Observer used to listen for new tab creation to complete.
1674 class NewTabObserver : public content::NotificationObserver { 1699 class NewTabObserver : public content::NotificationObserver {
1675 public: 1700 public:
1676 NewTabObserver(AutomationProvider* automation, IPC::Message* reply_message); 1701 NewTabObserver(AutomationProvider* automation, IPC::Message* reply_message);
1677 1702
1703 // Overridden from content::NotificationObserver:
1678 virtual void Observe(int type, 1704 virtual void Observe(int type,
1679 const content::NotificationSource& source, 1705 const content::NotificationSource& source,
1680 const content::NotificationDetails& details) OVERRIDE; 1706 const content::NotificationDetails& details) OVERRIDE;
1681 1707
1682 private: 1708 private:
1683 virtual ~NewTabObserver(); 1709 virtual ~NewTabObserver();
1684 1710
1685 content::NotificationRegistrar registrar_; 1711 content::NotificationRegistrar registrar_;
1686 base::WeakPtr<AutomationProvider> automation_; 1712 base::WeakPtr<AutomationProvider> automation_;
1687 scoped_ptr<IPC::Message> reply_message_; 1713 scoped_ptr<IPC::Message> reply_message_;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1727 1753
1728 // Allows the automation provider to wait for acknowledgement that a drop 1754 // Allows the automation provider to wait for acknowledgement that a drop
1729 // operation has been processed by the renderer. 1755 // operation has been processed by the renderer.
1730 class DragTargetDropAckNotificationObserver 1756 class DragTargetDropAckNotificationObserver
1731 : public content::NotificationObserver { 1757 : public content::NotificationObserver {
1732 public: 1758 public:
1733 DragTargetDropAckNotificationObserver(AutomationProvider* automation, 1759 DragTargetDropAckNotificationObserver(AutomationProvider* automation,
1734 IPC::Message* reply_message); 1760 IPC::Message* reply_message);
1735 virtual ~DragTargetDropAckNotificationObserver(); 1761 virtual ~DragTargetDropAckNotificationObserver();
1736 1762
1763 // Overridden from content::NotificationObserver:
1737 virtual void Observe(int type, 1764 virtual void Observe(int type,
1738 const content::NotificationSource& source, 1765 const content::NotificationSource& source,
1739 const content::NotificationDetails& details); 1766 const content::NotificationDetails& details) OVERRIDE;
1740 1767
1741 private: 1768 private:
1742 content::NotificationRegistrar registrar_; 1769 content::NotificationRegistrar registrar_;
1743 base::WeakPtr<AutomationProvider> automation_; 1770 base::WeakPtr<AutomationProvider> automation_;
1744 scoped_ptr<IPC::Message> reply_message_; 1771 scoped_ptr<IPC::Message> reply_message_;
1745 1772
1746 DISALLOW_COPY_AND_ASSIGN(DragTargetDropAckNotificationObserver); 1773 DISALLOW_COPY_AND_ASSIGN(DragTargetDropAckNotificationObserver);
1747 }; 1774 };
1748 1775
1749 // Allows the automation provider to wait for process memory details to be 1776 // Allows the automation provider to wait for process memory details to be
(...skipping 14 matching lines...) Expand all
1764 }; 1791 };
1765 1792
1766 // Observes when new v8 heap statistics are computed for a renderer process. 1793 // Observes when new v8 heap statistics are computed for a renderer process.
1767 class V8HeapStatsObserver : public content::NotificationObserver { 1794 class V8HeapStatsObserver : public content::NotificationObserver {
1768 public: 1795 public:
1769 V8HeapStatsObserver(AutomationProvider* automation, 1796 V8HeapStatsObserver(AutomationProvider* automation,
1770 IPC::Message* reply_message, 1797 IPC::Message* reply_message,
1771 base::ProcessId renderer_id); 1798 base::ProcessId renderer_id);
1772 virtual ~V8HeapStatsObserver(); 1799 virtual ~V8HeapStatsObserver();
1773 1800
1801 // Overridden from content::NotificationObserver:
1774 virtual void Observe(int type, 1802 virtual void Observe(int type,
1775 const content::NotificationSource& source, 1803 const content::NotificationSource& source,
1776 const content::NotificationDetails& details); 1804 const content::NotificationDetails& details) OVERRIDE;
1777 1805
1778 private: 1806 private:
1779 content::NotificationRegistrar registrar_; 1807 content::NotificationRegistrar registrar_;
1780 base::WeakPtr<AutomationProvider> automation_; 1808 base::WeakPtr<AutomationProvider> automation_;
1781 scoped_ptr<IPC::Message> reply_message_; 1809 scoped_ptr<IPC::Message> reply_message_;
1782 base::ProcessId renderer_id_; 1810 base::ProcessId renderer_id_;
1783 1811
1784 DISALLOW_COPY_AND_ASSIGN(V8HeapStatsObserver); 1812 DISALLOW_COPY_AND_ASSIGN(V8HeapStatsObserver);
1785 }; 1813 };
1786 1814
1787 // Observes when a new FPS value is computed for a renderer process. 1815 // Observes when a new FPS value is computed for a renderer process.
1788 class FPSObserver : public content::NotificationObserver { 1816 class FPSObserver : public content::NotificationObserver {
1789 public: 1817 public:
1790 FPSObserver(AutomationProvider* automation, 1818 FPSObserver(AutomationProvider* automation,
1791 IPC::Message* reply_message, 1819 IPC::Message* reply_message,
1792 base::ProcessId renderer_id, 1820 base::ProcessId renderer_id,
1793 int routing_id); 1821 int routing_id);
1794 virtual ~FPSObserver(); 1822 virtual ~FPSObserver();
1795 1823
1824 // Overridden from content::NotificationObserver:
1796 virtual void Observe(int type, 1825 virtual void Observe(int type,
1797 const content::NotificationSource& source, 1826 const content::NotificationSource& source,
1798 const content::NotificationDetails& details); 1827 const content::NotificationDetails& details) OVERRIDE;
1799 1828
1800 private: 1829 private:
1801 content::NotificationRegistrar registrar_; 1830 content::NotificationRegistrar registrar_;
1802 base::WeakPtr<AutomationProvider> automation_; 1831 base::WeakPtr<AutomationProvider> automation_;
1803 scoped_ptr<IPC::Message> reply_message_; 1832 scoped_ptr<IPC::Message> reply_message_;
1804 base::ProcessId renderer_id_; 1833 base::ProcessId renderer_id_;
1805 int routing_id_; 1834 int routing_id_;
1806 1835
1807 DISALLOW_COPY_AND_ASSIGN(FPSObserver); 1836 DISALLOW_COPY_AND_ASSIGN(FPSObserver);
1808 }; 1837 };
1809 1838
1810 // Manages the process of creating a new Profile and opening a new browser with 1839 // Manages the process of creating a new Profile and opening a new browser with
1811 // that profile. This observer should be created, and then a new Profile 1840 // that profile. This observer should be created, and then a new Profile
1812 // should be created through the ProfileManager using 1841 // should be created through the ProfileManager using
1813 // profile_manager->CreateMultiProfileAsync(). The Observer watches for profile 1842 // profile_manager->CreateMultiProfileAsync(). The Observer watches for profile
1814 // creation, upon which it creates a new browser window; after observing 1843 // creation, upon which it creates a new browser window; after observing
1815 // window creation, it creates a new tab and then finally observes it finish 1844 // window creation, it creates a new tab and then finally observes it finish
1816 // loading. 1845 // loading.
1817 class BrowserOpenedWithNewProfileNotificationObserver 1846 class BrowserOpenedWithNewProfileNotificationObserver
1818 : public content::NotificationObserver { 1847 : public content::NotificationObserver {
1819 public: 1848 public:
1820 BrowserOpenedWithNewProfileNotificationObserver( 1849 BrowserOpenedWithNewProfileNotificationObserver(
1821 AutomationProvider* automation, 1850 AutomationProvider* automation,
1822 IPC::Message* reply_message); 1851 IPC::Message* reply_message);
1823 virtual ~BrowserOpenedWithNewProfileNotificationObserver(); 1852 virtual ~BrowserOpenedWithNewProfileNotificationObserver();
1824 1853
1854 // Overridden from content::NotificationObserver:
1825 virtual void Observe(int type, 1855 virtual void Observe(int type,
1826 const content::NotificationSource& source, 1856 const content::NotificationSource& source,
1827 const content::NotificationDetails& details); 1857 const content::NotificationDetails& details) OVERRIDE;
1828 1858
1829 private: 1859 private:
1830 content::NotificationRegistrar registrar_; 1860 content::NotificationRegistrar registrar_;
1831 base::WeakPtr<AutomationProvider> automation_; 1861 base::WeakPtr<AutomationProvider> automation_;
1832 scoped_ptr<IPC::Message> reply_message_; 1862 scoped_ptr<IPC::Message> reply_message_;
1833 int new_window_id_; 1863 int new_window_id_;
1834 1864
1835 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedWithNewProfileNotificationObserver); 1865 DISALLOW_COPY_AND_ASSIGN(BrowserOpenedWithNewProfileNotificationObserver);
1836 }; 1866 };
1837 1867
1838 // Waits for an extension popup to appear and load. 1868 // Waits for an extension popup to appear and load.
1839 class ExtensionPopupObserver : public content::NotificationObserver { 1869 class ExtensionPopupObserver : public content::NotificationObserver {
1840 public: 1870 public:
1841 ExtensionPopupObserver( 1871 ExtensionPopupObserver(
1842 AutomationProvider* automation, 1872 AutomationProvider* automation,
1843 IPC::Message* reply_message, 1873 IPC::Message* reply_message,
1844 const std::string& extension_id); 1874 const std::string& extension_id);
1845 ~ExtensionPopupObserver(); 1875 ~ExtensionPopupObserver();
1846 1876
1877 // Overridden from content::NotificationObserver:
1847 virtual void Observe(int type, 1878 virtual void Observe(int type,
1848 const content::NotificationSource& source, 1879 const content::NotificationSource& source,
1849 const content::NotificationDetails& details) OVERRIDE; 1880 const content::NotificationDetails& details) OVERRIDE;
1850 1881
1851 private: 1882 private:
1852 base::WeakPtr<AutomationProvider> automation_; 1883 base::WeakPtr<AutomationProvider> automation_;
1853 scoped_ptr<IPC::Message> reply_message_; 1884 scoped_ptr<IPC::Message> reply_message_;
1854 std::string extension_id_; 1885 std::string extension_id_;
1855 content::NotificationRegistrar registrar_; 1886 content::NotificationRegistrar registrar_;
1856 1887
1857 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver); 1888 DISALLOW_COPY_AND_ASSIGN(ExtensionPopupObserver);
1858 }; 1889 };
1859 1890
1891 // Allows the automation provider to wait for a WINDOW_MAXIMIZED notification.
1892 class WindowMaximizedObserver : public content::NotificationObserver {
1893 public:
1894 WindowMaximizedObserver(AutomationProvider* automation,
1895 IPC::Message* reply_message);
1896 virtual ~WindowMaximizedObserver();
1897
1898 // Overridden from content::NotificationObserver:
1899 virtual void Observe(int type,
1900 const content::NotificationSource& source,
1901 const content::NotificationDetails& details) OVERRIDE;
1902
1903 private:
1904 content::NotificationRegistrar registrar_;
1905 base::WeakPtr<AutomationProvider> automation_;
1906 scoped_ptr<IPC::Message> reply_message_;
1907
1908 DISALLOW_COPY_AND_ASSIGN(WindowMaximizedObserver);
1909 };
1910
1911
1912
1860 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_ 1913 #endif // CHROME_BROWSER_AUTOMATION_AUTOMATION_PROVIDER_OBSERVERS_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/automation/automation_provider_observers.cc » ('j') | chrome/browser/ui/gtk/browser_window_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698