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

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

Powered by Google App Engine
This is Rietveld 408576698