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

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

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/automation/automation_provider_observers.h" 5 #include "chrome/browser/automation/automation_provider_observers.h"
6 6
7 #include <deque> 7 #include <deque>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h" 69 #include "chrome/browser/ui/webui/ntp/recently_closed_tabs_handler.h"
70 #include "chrome/common/automation_messages.h" 70 #include "chrome/common/automation_messages.h"
71 #include "chrome/common/chrome_notification_types.h" 71 #include "chrome/common/chrome_notification_types.h"
72 #include "chrome/common/extensions/extension.h" 72 #include "chrome/common/extensions/extension.h"
73 #include "content/browser/download/save_package.h" 73 #include "content/browser/download/save_package.h"
74 #include "content/browser/renderer_host/render_process_host.h" 74 #include "content/browser/renderer_host/render_process_host.h"
75 #include "content/browser/renderer_host/render_view_host.h" 75 #include "content/browser/renderer_host/render_view_host.h"
76 #include "content/browser/tab_contents/navigation_controller.h" 76 #include "content/browser/tab_contents/navigation_controller.h"
77 #include "content/browser/tab_contents/tab_contents.h" 77 #include "content/browser/tab_contents/tab_contents.h"
78 #include "content/common/child_process_info.h" 78 #include "content/common/child_process_info.h"
79 #include "content/common/notification_service.h" 79 #include "content/public/browser/notification_service.h"
80 #include "googleurl/src/gurl.h" 80 #include "googleurl/src/gurl.h"
81 #include "third_party/skia/include/core/SkBitmap.h" 81 #include "third_party/skia/include/core/SkBitmap.h"
82 #include "ui/gfx/codec/png_codec.h" 82 #include "ui/gfx/codec/png_codec.h"
83 #include "ui/gfx/rect.h" 83 #include "ui/gfx/rect.h"
84 84
85 // Holds onto start and stop timestamps for a particular tab 85 // Holds onto start and stop timestamps for a particular tab
86 class InitialLoadObserver::TabTime { 86 class InitialLoadObserver::TabTime {
87 public: 87 public:
88 explicit TabTime(base::TimeTicks started) 88 explicit TabTime(base::TimeTicks started)
89 : load_start_time_(started) { 89 : load_start_time_(started) {
(...skipping 13 matching lines...) Expand all
103 }; 103 };
104 104
105 InitialLoadObserver::InitialLoadObserver(size_t tab_count, 105 InitialLoadObserver::InitialLoadObserver(size_t tab_count,
106 AutomationProvider* automation) 106 AutomationProvider* automation)
107 : automation_(automation->AsWeakPtr()), 107 : automation_(automation->AsWeakPtr()),
108 crashed_tab_count_(0), 108 crashed_tab_count_(0),
109 outstanding_tab_count_(tab_count), 109 outstanding_tab_count_(tab_count),
110 init_time_(base::TimeTicks::Now()) { 110 init_time_(base::TimeTicks::Now()) {
111 if (outstanding_tab_count_ > 0) { 111 if (outstanding_tab_count_ > 0) {
112 registrar_.Add(this, content::NOTIFICATION_LOAD_START, 112 registrar_.Add(this, content::NOTIFICATION_LOAD_START,
113 NotificationService::AllSources()); 113 content::NotificationService::AllSources());
114 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 114 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
115 NotificationService::AllSources()); 115 content::NotificationService::AllSources());
116 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 116 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
117 NotificationService::AllSources()); 117 content::NotificationService::AllSources());
118 } 118 }
119 } 119 }
120 120
121 InitialLoadObserver::~InitialLoadObserver() { 121 InitialLoadObserver::~InitialLoadObserver() {
122 } 122 }
123 123
124 void InitialLoadObserver::Observe(int type, 124 void InitialLoadObserver::Observe(int type,
125 const content::NotificationSource& source, 125 const content::NotificationSource& source,
126 const content::NotificationDetails& details) { 126 const content::NotificationDetails& details) {
127 if (type == content::NOTIFICATION_LOAD_START) { 127 if (type == content::NOTIFICATION_LOAD_START) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 AutomationProvider* automation, 226 AutomationProvider* automation,
227 NavigationController* controller, 227 NavigationController* controller,
228 IPC::Message* reply_message) 228 IPC::Message* reply_message)
229 : automation_(automation->AsWeakPtr()), 229 : automation_(automation->AsWeakPtr()),
230 controller_(controller), 230 controller_(controller),
231 reply_message_(reply_message) { 231 reply_message_(reply_message) {
232 if (FinishedRestoring()) { 232 if (FinishedRestoring()) {
233 SendDone(); 233 SendDone();
234 } else { 234 } else {
235 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 235 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
236 NotificationService::AllSources()); 236 content::NotificationService::AllSources());
237 } 237 }
238 } 238 }
239 239
240 NavigationControllerRestoredObserver::~NavigationControllerRestoredObserver() { 240 NavigationControllerRestoredObserver::~NavigationControllerRestoredObserver() {
241 } 241 }
242 242
243 void NavigationControllerRestoredObserver::Observe( 243 void NavigationControllerRestoredObserver::Observe(
244 int type, const content::NotificationSource& source, 244 int type, const content::NotificationSource& source,
245 const content::NotificationDetails& details) { 245 const content::NotificationDetails& details) {
246 if (FinishedRestoring()) { 246 if (FinishedRestoring()) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 use_json_interface_(use_json_interface) { 278 use_json_interface_(use_json_interface) {
279 DCHECK_LT(0, navigations_remaining_); 279 DCHECK_LT(0, navigations_remaining_);
280 content::Source<NavigationController> source(controller_); 280 content::Source<NavigationController> source(controller_);
281 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source); 281 registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, source);
282 registrar_.Add(this, content::NOTIFICATION_LOAD_START, source); 282 registrar_.Add(this, content::NOTIFICATION_LOAD_START, source);
283 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); 283 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source);
284 registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source); 284 registrar_.Add(this, chrome::NOTIFICATION_AUTH_NEEDED, source);
285 registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source); 285 registrar_.Add(this, chrome::NOTIFICATION_AUTH_SUPPLIED, source);
286 registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source); 286 registrar_.Add(this, chrome::NOTIFICATION_AUTH_CANCELLED, source);
287 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 287 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
288 NotificationService::AllSources()); 288 content::NotificationService::AllSources());
289 289
290 if (include_current_navigation && controller->tab_contents()->IsLoading()) 290 if (include_current_navigation && controller->tab_contents()->IsLoading())
291 navigation_started_ = true; 291 navigation_started_ = true;
292 } 292 }
293 293
294 NavigationNotificationObserver::~NavigationNotificationObserver() { 294 NavigationNotificationObserver::~NavigationNotificationObserver() {
295 } 295 }
296 296
297 void NavigationNotificationObserver::Observe( 297 void NavigationNotificationObserver::Observe(
298 int type, const content::NotificationSource& source, 298 int type, const content::NotificationSource& source,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 359 }
360 } 360 }
361 361
362 delete this; 362 delete this;
363 } 363 }
364 364
365 TabStripNotificationObserver::TabStripNotificationObserver( 365 TabStripNotificationObserver::TabStripNotificationObserver(
366 int notification, AutomationProvider* automation) 366 int notification, AutomationProvider* automation)
367 : automation_(automation->AsWeakPtr()), 367 : automation_(automation->AsWeakPtr()),
368 notification_(notification) { 368 notification_(notification) {
369 registrar_.Add(this, notification_, NotificationService::AllSources()); 369 registrar_.Add(this, notification_,
370 content::NotificationService::AllSources());
370 } 371 }
371 372
372 TabStripNotificationObserver::~TabStripNotificationObserver() { 373 TabStripNotificationObserver::~TabStripNotificationObserver() {
373 } 374 }
374 375
375 void TabStripNotificationObserver::Observe( 376 void TabStripNotificationObserver::Observe(
376 int type, 377 int type,
377 const content::NotificationSource& source, 378 const content::NotificationSource& source,
378 const content::NotificationDetails& details) { 379 const content::NotificationDetails& details) {
379 if (type == notification_) { 380 if (type == notification_) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 508 }
508 509
509 ExtensionUninstallObserver::ExtensionUninstallObserver( 510 ExtensionUninstallObserver::ExtensionUninstallObserver(
510 AutomationProvider* automation, 511 AutomationProvider* automation,
511 IPC::Message* reply_message, 512 IPC::Message* reply_message,
512 const std::string& id) 513 const std::string& id)
513 : automation_(automation->AsWeakPtr()), 514 : automation_(automation->AsWeakPtr()),
514 reply_message_(reply_message), 515 reply_message_(reply_message),
515 id_(id) { 516 id_(id) {
516 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, 517 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED,
517 NotificationService::AllSources()); 518 content::NotificationService::AllSources());
518 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED, 519 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALL_NOT_ALLOWED,
519 NotificationService::AllSources()); 520 content::NotificationService::AllSources());
520 } 521 }
521 522
522 ExtensionUninstallObserver::~ExtensionUninstallObserver() { 523 ExtensionUninstallObserver::~ExtensionUninstallObserver() {
523 } 524 }
524 525
525 void ExtensionUninstallObserver::Observe( 526 void ExtensionUninstallObserver::Observe(
526 int type, 527 int type,
527 const content::NotificationSource& source, 528 const content::NotificationSource& source,
528 const content::NotificationDetails& details) { 529 const content::NotificationDetails& details) {
529 if (!automation_) { 530 if (!automation_) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 ExtensionReadyNotificationObserver::ExtensionReadyNotificationObserver( 566 ExtensionReadyNotificationObserver::ExtensionReadyNotificationObserver(
566 ExtensionProcessManager* manager, ExtensionService* service, 567 ExtensionProcessManager* manager, ExtensionService* service,
567 AutomationProvider* automation, int id, IPC::Message* reply_message) 568 AutomationProvider* automation, int id, IPC::Message* reply_message)
568 : manager_(manager), 569 : manager_(manager),
569 service_(service), 570 service_(service),
570 automation_(automation->AsWeakPtr()), 571 automation_(automation->AsWeakPtr()),
571 id_(id), 572 id_(id),
572 reply_message_(reply_message), 573 reply_message_(reply_message),
573 extension_(NULL) { 574 extension_(NULL) {
574 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 575 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
575 NotificationService::AllSources()); 576 content::NotificationService::AllSources());
576 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 577 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
577 NotificationService::AllSources()); 578 content::NotificationService::AllSources());
578 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, 579 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOAD_ERROR,
579 NotificationService::AllSources()); 580 content::NotificationService::AllSources());
580 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, 581 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
581 NotificationService::AllSources()); 582 content::NotificationService::AllSources());
582 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, 583 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
583 NotificationService::AllSources()); 584 content::NotificationService::AllSources());
584 } 585 }
585 586
586 ExtensionReadyNotificationObserver::~ExtensionReadyNotificationObserver() { 587 ExtensionReadyNotificationObserver::~ExtensionReadyNotificationObserver() {
587 } 588 }
588 589
589 void ExtensionReadyNotificationObserver::Observe( 590 void ExtensionReadyNotificationObserver::Observe(
590 int type, const content::NotificationSource& source, 591 int type, const content::NotificationSource& source,
591 const content::NotificationDetails& details) { 592 const content::NotificationDetails& details) {
592 if (!automation_) { 593 if (!automation_) {
593 delete this; 594 delete this;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 LOG(ERROR) << "Cannot write reply params for unknown message id."; 636 LOG(ERROR) << "Cannot write reply params for unknown message id.";
636 } 637 }
637 638
638 automation_->Send(reply_message_.release()); 639 automation_->Send(reply_message_.release());
639 delete this; 640 delete this;
640 } 641 }
641 642
642 ExtensionUnloadNotificationObserver::ExtensionUnloadNotificationObserver() 643 ExtensionUnloadNotificationObserver::ExtensionUnloadNotificationObserver()
643 : did_receive_unload_notification_(false) { 644 : did_receive_unload_notification_(false) {
644 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, 645 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
645 NotificationService::AllSources()); 646 content::NotificationService::AllSources());
646 } 647 }
647 648
648 ExtensionUnloadNotificationObserver::~ExtensionUnloadNotificationObserver() { 649 ExtensionUnloadNotificationObserver::~ExtensionUnloadNotificationObserver() {
649 } 650 }
650 651
651 void ExtensionUnloadNotificationObserver::Observe( 652 void ExtensionUnloadNotificationObserver::Observe(
652 int type, const content::NotificationSource& source, 653 int type, const content::NotificationSource& source,
653 const content::NotificationDetails& details) { 654 const content::NotificationDetails& details) {
654 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { 655 if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) {
655 did_receive_unload_notification_ = true; 656 did_receive_unload_notification_ = true;
656 } else { 657 } else {
657 NOTREACHED(); 658 NOTREACHED();
658 } 659 }
659 } 660 }
660 661
661 ExtensionsUpdatedObserver::ExtensionsUpdatedObserver( 662 ExtensionsUpdatedObserver::ExtensionsUpdatedObserver(
662 ExtensionProcessManager* manager, AutomationProvider* automation, 663 ExtensionProcessManager* manager, AutomationProvider* automation,
663 IPC::Message* reply_message) 664 IPC::Message* reply_message)
664 : manager_(manager), automation_(automation->AsWeakPtr()), 665 : manager_(manager), automation_(automation->AsWeakPtr()),
665 reply_message_(reply_message), updater_finished_(false) { 666 reply_message_(reply_message), updater_finished_(false) {
666 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING, 667 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING,
667 NotificationService::AllSources()); 668 content::NotificationService::AllSources());
668 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, 669 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR,
669 NotificationService::AllSources()); 670 content::NotificationService::AllSources());
670 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED, 671 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED,
671 NotificationService::AllSources()); 672 content::NotificationService::AllSources());
672 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, 673 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED,
673 NotificationService::AllSources()); 674 content::NotificationService::AllSources());
674 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, 675 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED,
675 NotificationService::AllSources()); 676 content::NotificationService::AllSources());
676 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, 677 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND,
677 NotificationService::AllSources()); 678 content::NotificationService::AllSources());
678 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED, 679 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED,
679 NotificationService::AllSources()); 680 content::NotificationService::AllSources());
680 } 681 }
681 682
682 ExtensionsUpdatedObserver::~ExtensionsUpdatedObserver() { 683 ExtensionsUpdatedObserver::~ExtensionsUpdatedObserver() {
683 } 684 }
684 685
685 void ExtensionsUpdatedObserver::Observe( 686 void ExtensionsUpdatedObserver::Observe(
686 int type, const content::NotificationSource& source, 687 int type, const content::NotificationSource& source,
687 const content::NotificationDetails& details) { 688 const content::NotificationDetails& details) {
688 if (!automation_) { 689 if (!automation_) {
689 delete this; 690 delete this;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 AutomationJSONReply reply(automation_, reply_message_.release()); 750 AutomationJSONReply reply(automation_, reply_message_.release());
750 reply.SendSuccess(NULL); 751 reply.SendSuccess(NULL);
751 delete this; 752 delete this;
752 } 753 }
753 } 754 }
754 755
755 ExtensionTestResultNotificationObserver:: 756 ExtensionTestResultNotificationObserver::
756 ExtensionTestResultNotificationObserver(AutomationProvider* automation) 757 ExtensionTestResultNotificationObserver(AutomationProvider* automation)
757 : automation_(automation->AsWeakPtr()) { 758 : automation_(automation->AsWeakPtr()) {
758 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_PASSED, 759 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_PASSED,
759 NotificationService::AllSources()); 760 content::NotificationService::AllSources());
760 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_FAILED, 761 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_TEST_FAILED,
761 NotificationService::AllSources()); 762 content::NotificationService::AllSources());
762 } 763 }
763 764
764 ExtensionTestResultNotificationObserver:: 765 ExtensionTestResultNotificationObserver::
765 ~ExtensionTestResultNotificationObserver() { 766 ~ExtensionTestResultNotificationObserver() {
766 } 767 }
767 768
768 void ExtensionTestResultNotificationObserver::Observe( 769 void ExtensionTestResultNotificationObserver::Observe(
769 int type, const content::NotificationSource& source, 770 int type, const content::NotificationSource& source,
770 const content::NotificationDetails& details) { 771 const content::NotificationDetails& details) {
771 switch (type) { 772 switch (type) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 } 808 }
808 809
809 BrowserOpenedNotificationObserver::BrowserOpenedNotificationObserver( 810 BrowserOpenedNotificationObserver::BrowserOpenedNotificationObserver(
810 AutomationProvider* automation, 811 AutomationProvider* automation,
811 IPC::Message* reply_message) 812 IPC::Message* reply_message)
812 : automation_(automation->AsWeakPtr()), 813 : automation_(automation->AsWeakPtr()),
813 reply_message_(reply_message), 814 reply_message_(reply_message),
814 new_window_id_(extension_misc::kUnknownWindowId), 815 new_window_id_(extension_misc::kUnknownWindowId),
815 for_browser_command_(false) { 816 for_browser_command_(false) {
816 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, 817 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
817 NotificationService::AllBrowserContextsAndSources()); 818 content::NotificationService::AllBrowserContextsAndSources());
818 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 819 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
819 NotificationService::AllBrowserContextsAndSources()); 820 content::NotificationService::AllBrowserContextsAndSources());
820 } 821 }
821 822
822 BrowserOpenedNotificationObserver::~BrowserOpenedNotificationObserver() { 823 BrowserOpenedNotificationObserver::~BrowserOpenedNotificationObserver() {
823 } 824 }
824 825
825 void BrowserOpenedNotificationObserver::Observe( 826 void BrowserOpenedNotificationObserver::Observe(
826 int type, const content::NotificationSource& source, 827 int type, const content::NotificationSource& source,
827 const content::NotificationDetails& details) { 828 const content::NotificationDetails& details) {
828 if (!automation_) { 829 if (!automation_) {
829 delete this; 830 delete this;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 } 904 }
904 905
905 BrowserCountChangeNotificationObserver::BrowserCountChangeNotificationObserver( 906 BrowserCountChangeNotificationObserver::BrowserCountChangeNotificationObserver(
906 int target_count, 907 int target_count,
907 AutomationProvider* automation, 908 AutomationProvider* automation,
908 IPC::Message* reply_message) 909 IPC::Message* reply_message)
909 : target_count_(target_count), 910 : target_count_(target_count),
910 automation_(automation->AsWeakPtr()), 911 automation_(automation->AsWeakPtr()),
911 reply_message_(reply_message) { 912 reply_message_(reply_message) {
912 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, 913 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
913 NotificationService::AllBrowserContextsAndSources()); 914 content::NotificationService::AllBrowserContextsAndSources());
914 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, 915 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED,
915 NotificationService::AllBrowserContextsAndSources()); 916 content::NotificationService::AllBrowserContextsAndSources());
916 } 917 }
917 918
918 BrowserCountChangeNotificationObserver:: 919 BrowserCountChangeNotificationObserver::
919 ~BrowserCountChangeNotificationObserver() {} 920 ~BrowserCountChangeNotificationObserver() {}
920 921
921 void BrowserCountChangeNotificationObserver::Observe( 922 void BrowserCountChangeNotificationObserver::Observe(
922 int type, 923 int type,
923 const content::NotificationSource& source, 924 const content::NotificationSource& source,
924 const content::NotificationDetails& details) { 925 const content::NotificationDetails& details) {
925 DCHECK(type == chrome::NOTIFICATION_BROWSER_OPENED || 926 DCHECK(type == chrome::NOTIFICATION_BROWSER_OPENED ||
(...skipping 17 matching lines...) Expand all
943 automation_->Send(reply_message_.release()); 944 automation_->Send(reply_message_.release());
944 delete this; 945 delete this;
945 } 946 }
946 } 947 }
947 948
948 AppModalDialogShownObserver::AppModalDialogShownObserver( 949 AppModalDialogShownObserver::AppModalDialogShownObserver(
949 AutomationProvider* automation, IPC::Message* reply_message) 950 AutomationProvider* automation, IPC::Message* reply_message)
950 : automation_(automation->AsWeakPtr()), 951 : automation_(automation->AsWeakPtr()),
951 reply_message_(reply_message) { 952 reply_message_(reply_message) {
952 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 953 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
953 NotificationService::AllSources()); 954 content::NotificationService::AllSources());
954 } 955 }
955 956
956 AppModalDialogShownObserver::~AppModalDialogShownObserver() { 957 AppModalDialogShownObserver::~AppModalDialogShownObserver() {
957 } 958 }
958 959
959 void AppModalDialogShownObserver::Observe( 960 void AppModalDialogShownObserver::Observe(
960 int type, const content::NotificationSource& source, 961 int type, const content::NotificationSource& source,
961 const content::NotificationDetails& details) { 962 const content::NotificationDetails& details) {
962 DCHECK(type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN); 963 DCHECK(type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN);
963 964
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1067 ExecuteBrowserCommandObserver::ExecuteBrowserCommandObserver( 1068 ExecuteBrowserCommandObserver::ExecuteBrowserCommandObserver(
1068 AutomationProvider* automation, IPC::Message* reply_message) 1069 AutomationProvider* automation, IPC::Message* reply_message)
1069 : automation_(automation->AsWeakPtr()), 1070 : automation_(automation->AsWeakPtr()),
1070 notification_type_(content::NOTIFICATION_ALL), 1071 notification_type_(content::NOTIFICATION_ALL),
1071 reply_message_(reply_message) { 1072 reply_message_(reply_message) {
1072 } 1073 }
1073 1074
1074 bool ExecuteBrowserCommandObserver::Register(int command) { 1075 bool ExecuteBrowserCommandObserver::Register(int command) {
1075 if (!Getint(command, &notification_type_)) 1076 if (!Getint(command, &notification_type_))
1076 return false; 1077 return false;
1077 registrar_.Add(this, notification_type_, NotificationService::AllSources()); 1078 registrar_.Add(this, notification_type_,
1079 content::NotificationService::AllSources());
1078 return true; 1080 return true;
1079 } 1081 }
1080 1082
1081 bool ExecuteBrowserCommandObserver::Getint( 1083 bool ExecuteBrowserCommandObserver::Getint(
1082 int command, int* type) { 1084 int command, int* type) {
1083 if (!type) 1085 if (!type)
1084 return false; 1086 return false;
1085 bool found = false; 1087 bool found = false;
1086 for (unsigned int i = 0; i < arraysize(command_notifications); i++) { 1088 for (unsigned int i = 0; i < arraysize(command_notifications); i++) {
1087 if (command_notifications[i].command == command) { 1089 if (command_notifications[i].command == command) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 } 1152 }
1151 } 1153 }
1152 } 1154 }
1153 } 1155 }
1154 1156
1155 // static 1157 // static
1156 const int FindInPageNotificationObserver::kFindInPageRequestId = -1; 1158 const int FindInPageNotificationObserver::kFindInPageRequestId = -1;
1157 1159
1158 DomOperationObserver::DomOperationObserver() { 1160 DomOperationObserver::DomOperationObserver() {
1159 registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE, 1161 registrar_.Add(this, chrome::NOTIFICATION_DOM_OPERATION_RESPONSE,
1160 NotificationService::AllSources()); 1162 content::NotificationService::AllSources());
1161 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 1163 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
1162 NotificationService::AllSources()); 1164 content::NotificationService::AllSources());
1163 } 1165 }
1164 1166
1165 DomOperationObserver::~DomOperationObserver() {} 1167 DomOperationObserver::~DomOperationObserver() {}
1166 1168
1167 void DomOperationObserver::Observe( 1169 void DomOperationObserver::Observe(
1168 int type, const content::NotificationSource& source, 1170 int type, const content::NotificationSource& source,
1169 const content::NotificationDetails& details) { 1171 const content::NotificationDetails& details) {
1170 if (type == chrome::NOTIFICATION_DOM_OPERATION_RESPONSE) { 1172 if (type == chrome::NOTIFICATION_DOM_OPERATION_RESPONSE) {
1171 content::Details<DomOperationNotificationDetails> dom_op_details(details); 1173 content::Details<DomOperationNotificationDetails> dom_op_details(details);
1172 OnDomOperationCompleted(dom_op_details->json()); 1174 OnDomOperationCompleted(dom_op_details->json());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1210 delete this; 1212 delete this;
1211 } 1213 }
1212 } 1214 }
1213 1215
1214 DocumentPrintedNotificationObserver::DocumentPrintedNotificationObserver( 1216 DocumentPrintedNotificationObserver::DocumentPrintedNotificationObserver(
1215 AutomationProvider* automation, IPC::Message* reply_message) 1217 AutomationProvider* automation, IPC::Message* reply_message)
1216 : automation_(automation->AsWeakPtr()), 1218 : automation_(automation->AsWeakPtr()),
1217 success_(false), 1219 success_(false),
1218 reply_message_(reply_message) { 1220 reply_message_(reply_message) {
1219 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT, 1221 registrar_.Add(this, chrome::NOTIFICATION_PRINT_JOB_EVENT,
1220 NotificationService::AllSources()); 1222 content::NotificationService::AllSources());
1221 } 1223 }
1222 1224
1223 DocumentPrintedNotificationObserver::~DocumentPrintedNotificationObserver() { 1225 DocumentPrintedNotificationObserver::~DocumentPrintedNotificationObserver() {
1224 if (automation_) { 1226 if (automation_) {
1225 AutomationMsg_PrintNow::WriteReplyParams(reply_message_.get(), success_); 1227 AutomationMsg_PrintNow::WriteReplyParams(reply_message_.get(), success_);
1226 automation_->Send(reply_message_.release()); 1228 automation_->Send(reply_message_.release());
1227 } 1229 }
1228 } 1230 }
1229 1231
1230 void DocumentPrintedNotificationObserver::Observe( 1232 void DocumentPrintedNotificationObserver::Observe(
(...skipping 26 matching lines...) Expand all
1257 } 1259 }
1258 default: { 1260 default: {
1259 NOTREACHED(); 1261 NOTREACHED();
1260 break; 1262 break;
1261 } 1263 }
1262 } 1264 }
1263 } 1265 }
1264 1266
1265 MetricEventDurationObserver::MetricEventDurationObserver() { 1267 MetricEventDurationObserver::MetricEventDurationObserver() {
1266 registrar_.Add(this, chrome::NOTIFICATION_METRIC_EVENT_DURATION, 1268 registrar_.Add(this, chrome::NOTIFICATION_METRIC_EVENT_DURATION,
1267 NotificationService::AllSources()); 1269 content::NotificationService::AllSources());
1268 } 1270 }
1269 1271
1270 MetricEventDurationObserver::~MetricEventDurationObserver() {} 1272 MetricEventDurationObserver::~MetricEventDurationObserver() {}
1271 1273
1272 int MetricEventDurationObserver::GetEventDurationMs( 1274 int MetricEventDurationObserver::GetEventDurationMs(
1273 const std::string& event_name) { 1275 const std::string& event_name) {
1274 EventDurationMap::const_iterator it = durations_.find(event_name); 1276 EventDurationMap::const_iterator it = durations_.find(event_name);
1275 if (it == durations_.end()) 1277 if (it == durations_.end())
1276 return -1; 1278 return -1;
1277 return it->second; 1279 return it->second;
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1748 BrowserThread::DB, 1750 BrowserThread::DB,
1749 FROM_HERE, 1751 FROM_HERE,
1750 base::Bind(&PasswordStoreLoginsChangedObserver::RegisterObserversTask, 1752 base::Bind(&PasswordStoreLoginsChangedObserver::RegisterObserversTask,
1751 this)); 1753 this));
1752 done_event_.Wait(); 1754 done_event_.Wait();
1753 } 1755 }
1754 1756
1755 void PasswordStoreLoginsChangedObserver::RegisterObserversTask() { 1757 void PasswordStoreLoginsChangedObserver::RegisterObserversTask() {
1756 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 1758 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
1757 registrar_.Add(this, chrome::NOTIFICATION_LOGINS_CHANGED, 1759 registrar_.Add(this, chrome::NOTIFICATION_LOGINS_CHANGED,
1758 NotificationService::AllSources()); 1760 content::NotificationService::AllSources());
1759 done_event_.Signal(); 1761 done_event_.Signal();
1760 } 1762 }
1761 1763
1762 void PasswordStoreLoginsChangedObserver::Observe( 1764 void PasswordStoreLoginsChangedObserver::Observe(
1763 int type, 1765 int type,
1764 const content::NotificationSource& source, 1766 const content::NotificationSource& source,
1765 const content::NotificationDetails& details) { 1767 const content::NotificationDetails& details) {
1766 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 1768 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
1767 DCHECK(type == chrome::NOTIFICATION_LOGINS_CHANGED); 1769 DCHECK(type == chrome::NOTIFICATION_LOGINS_CHANGED);
1768 PasswordStoreChangeList* change_details = 1770 PasswordStoreChangeList* change_details =
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 reply_message_(reply_message), 2182 reply_message_(reply_message),
2181 launch_container_(launch_container), 2183 launch_container_(launch_container),
2182 new_window_id_(extension_misc::kUnknownWindowId) { 2184 new_window_id_(extension_misc::kUnknownWindowId) {
2183 if (launch_container_ == extension_misc::LAUNCH_TAB) { 2185 if (launch_container_ == extension_misc::LAUNCH_TAB) {
2184 // Need to wait for the currently-active tab to reload. 2186 // Need to wait for the currently-active tab to reload.
2185 content::Source<NavigationController> source(controller_); 2187 content::Source<NavigationController> source(controller_);
2186 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source); 2188 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, source);
2187 } else { 2189 } else {
2188 // Need to wait for a new tab in a new window to load. 2190 // Need to wait for a new tab in a new window to load.
2189 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 2191 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
2190 NotificationService::AllSources()); 2192 content::NotificationService::AllSources());
2191 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY, 2193 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_WINDOW_READY,
2192 NotificationService::AllSources()); 2194 content::NotificationService::AllSources());
2193 } 2195 }
2194 } 2196 }
2195 2197
2196 AppLaunchObserver::~AppLaunchObserver() {} 2198 AppLaunchObserver::~AppLaunchObserver() {}
2197 2199
2198 void AppLaunchObserver::Observe(int type, 2200 void AppLaunchObserver::Observe(int type,
2199 const content::NotificationSource& source, 2201 const content::NotificationSource& source,
2200 const content::NotificationDetails& details) { 2202 const content::NotificationDetails& details) {
2201 if (type == content::NOTIFICATION_LOAD_STOP) { 2203 if (type == content::NOTIFICATION_LOAD_STOP) {
2202 if (launch_container_ == extension_misc::LAUNCH_TAB) { 2204 if (launch_container_ == extension_misc::LAUNCH_TAB) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 BrowserThread::PostTask( 2285 BrowserThread::PostTask(
2284 BrowserThread::DB, 2286 BrowserThread::DB,
2285 FROM_HERE, 2287 FROM_HERE,
2286 base::Bind(&AutofillChangedObserver::RegisterObserversTask, this)); 2288 base::Bind(&AutofillChangedObserver::RegisterObserversTask, this));
2287 done_event_.Wait(); 2289 done_event_.Wait();
2288 } 2290 }
2289 2291
2290 void AutofillChangedObserver::RegisterObserversTask() { 2292 void AutofillChangedObserver::RegisterObserversTask() {
2291 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 2293 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
2292 registrar_.Add(this, chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED, 2294 registrar_.Add(this, chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED,
2293 NotificationService::AllSources()); 2295 content::NotificationService::AllSources());
2294 registrar_.Add(this, chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED, 2296 registrar_.Add(this, chrome::NOTIFICATION_AUTOFILL_PROFILE_CHANGED,
2295 NotificationService::AllSources()); 2297 content::NotificationService::AllSources());
2296 done_event_.Signal(); 2298 done_event_.Signal();
2297 } 2299 }
2298 2300
2299 void AutofillChangedObserver::Observe( 2301 void AutofillChangedObserver::Observe(
2300 int type, 2302 int type,
2301 const content::NotificationSource& source, 2303 const content::NotificationSource& source,
2302 const content::NotificationDetails& details) { 2304 const content::NotificationDetails& details) {
2303 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB)); 2305 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::DB));
2304 2306
2305 if (type == chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED) { 2307 if (type == chrome::NOTIFICATION_AUTOFILL_CREDIT_CARD_CHANGED) {
(...skipping 28 matching lines...) Expand all
2334 AutofillFormSubmittedObserver::AutofillFormSubmittedObserver( 2336 AutofillFormSubmittedObserver::AutofillFormSubmittedObserver(
2335 AutomationProvider* automation, 2337 AutomationProvider* automation,
2336 IPC::Message* reply_message, 2338 IPC::Message* reply_message,
2337 PersonalDataManager* pdm) 2339 PersonalDataManager* pdm)
2338 : automation_(automation->AsWeakPtr()), 2340 : automation_(automation->AsWeakPtr()),
2339 reply_message_(reply_message), 2341 reply_message_(reply_message),
2340 pdm_(pdm), 2342 pdm_(pdm),
2341 infobar_helper_(NULL) { 2343 infobar_helper_(NULL) {
2342 pdm_->SetObserver(this); 2344 pdm_->SetObserver(this);
2343 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 2345 registrar_.Add(this, chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
2344 NotificationService::AllSources()); 2346 content::NotificationService::AllSources());
2345 } 2347 }
2346 2348
2347 AutofillFormSubmittedObserver::~AutofillFormSubmittedObserver() { 2349 AutofillFormSubmittedObserver::~AutofillFormSubmittedObserver() {
2348 pdm_->RemoveObserver(this); 2350 pdm_->RemoveObserver(this);
2349 2351
2350 if (infobar_helper_) { 2352 if (infobar_helper_) {
2351 InfoBarDelegate* infobar = NULL; 2353 InfoBarDelegate* infobar = NULL;
2352 if (infobar_helper_->infobar_count() > 0 && 2354 if (infobar_helper_->infobar_count() > 0 &&
2353 (infobar = infobar_helper_->GetInfoBarDelegateAt(0))) { 2355 (infobar = infobar_helper_->GetInfoBarDelegateAt(0))) {
2354 infobar_helper_->RemoveInfoBar(infobar); 2356 infobar_helper_->RemoveInfoBar(infobar);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
2424 2426
2425 GetAllNotificationsObserver::GetAllNotificationsObserver( 2427 GetAllNotificationsObserver::GetAllNotificationsObserver(
2426 AutomationProvider* automation, 2428 AutomationProvider* automation,
2427 IPC::Message* reply_message) 2429 IPC::Message* reply_message)
2428 : automation_(automation->AsWeakPtr()), 2430 : automation_(automation->AsWeakPtr()),
2429 reply_message_(reply_message) { 2431 reply_message_(reply_message) {
2430 if (AreActiveNotificationProcessesReady()) { 2432 if (AreActiveNotificationProcessesReady()) {
2431 SendMessage(); 2433 SendMessage();
2432 } else { 2434 } else {
2433 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, 2435 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED,
2434 NotificationService::AllSources()); 2436 content::NotificationService::AllSources());
2435 } 2437 }
2436 } 2438 }
2437 2439
2438 GetAllNotificationsObserver::~GetAllNotificationsObserver() {} 2440 GetAllNotificationsObserver::~GetAllNotificationsObserver() {}
2439 2441
2440 void GetAllNotificationsObserver::Observe( 2442 void GetAllNotificationsObserver::Observe(
2441 int type, 2443 int type,
2442 const content::NotificationSource& source, 2444 const content::NotificationSource& source,
2443 const content::NotificationDetails& details) { 2445 const content::NotificationDetails& details) {
2444 if (!automation_) { 2446 if (!automation_) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
2488 reply_message_.release()).SendSuccess(&return_value); 2490 reply_message_.release()).SendSuccess(&return_value);
2489 delete this; 2491 delete this;
2490 } 2492 }
2491 2493
2492 NewNotificationBalloonObserver::NewNotificationBalloonObserver( 2494 NewNotificationBalloonObserver::NewNotificationBalloonObserver(
2493 AutomationProvider* provider, 2495 AutomationProvider* provider,
2494 IPC::Message* reply_message) 2496 IPC::Message* reply_message)
2495 : automation_(provider->AsWeakPtr()), 2497 : automation_(provider->AsWeakPtr()),
2496 reply_message_(reply_message) { 2498 reply_message_(reply_message) {
2497 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, 2499 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED,
2498 NotificationService::AllSources()); 2500 content::NotificationService::AllSources());
2499 } 2501 }
2500 2502
2501 NewNotificationBalloonObserver::~NewNotificationBalloonObserver() { } 2503 NewNotificationBalloonObserver::~NewNotificationBalloonObserver() { }
2502 2504
2503 void NewNotificationBalloonObserver::Observe( 2505 void NewNotificationBalloonObserver::Observe(
2504 int type, 2506 int type,
2505 const content::NotificationSource& source, 2507 const content::NotificationSource& source,
2506 const content::NotificationDetails& details) { 2508 const content::NotificationDetails& details) {
2507 if (automation_) { 2509 if (automation_) {
2508 AutomationJSONReply(automation_, 2510 AutomationJSONReply(automation_,
2509 reply_message_.release()).SendSuccess(NULL); 2511 reply_message_.release()).SendSuccess(NULL);
2510 } 2512 }
2511 delete this; 2513 delete this;
2512 } 2514 }
2513 2515
2514 OnNotificationBalloonCountObserver::OnNotificationBalloonCountObserver( 2516 OnNotificationBalloonCountObserver::OnNotificationBalloonCountObserver(
2515 AutomationProvider* provider, 2517 AutomationProvider* provider,
2516 IPC::Message* reply_message, 2518 IPC::Message* reply_message,
2517 int count) 2519 int count)
2518 : automation_(provider->AsWeakPtr()), 2520 : automation_(provider->AsWeakPtr()),
2519 reply_message_(reply_message), 2521 reply_message_(reply_message),
2520 collection_( 2522 collection_(
2521 g_browser_process->notification_ui_manager()->balloon_collection()), 2523 g_browser_process->notification_ui_manager()->balloon_collection()),
2522 count_(count) { 2524 count_(count) {
2523 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED, 2525 registrar_.Add(this, chrome::NOTIFICATION_NOTIFY_BALLOON_CONNECTED,
2524 NotificationService::AllSources()); 2526 content::NotificationService::AllSources());
2525 collection_->set_on_collection_changed_callback( 2527 collection_->set_on_collection_changed_callback(
2526 base::Bind(&OnNotificationBalloonCountObserver::CheckBalloonCount, 2528 base::Bind(&OnNotificationBalloonCountObserver::CheckBalloonCount,
2527 base::Unretained(this))); 2529 base::Unretained(this)));
2528 CheckBalloonCount(); 2530 CheckBalloonCount();
2529 } 2531 }
2530 2532
2531 OnNotificationBalloonCountObserver::~OnNotificationBalloonCountObserver() { 2533 OnNotificationBalloonCountObserver::~OnNotificationBalloonCountObserver() {
2532 } 2534 }
2533 2535
2534 void OnNotificationBalloonCountObserver::Observe( 2536 void OnNotificationBalloonCountObserver::Observe(
(...skipping 17 matching lines...) Expand all
2552 delete this; 2554 delete this;
2553 } 2555 }
2554 } 2556 }
2555 2557
2556 RendererProcessClosedObserver::RendererProcessClosedObserver( 2558 RendererProcessClosedObserver::RendererProcessClosedObserver(
2557 AutomationProvider* automation, 2559 AutomationProvider* automation,
2558 IPC::Message* reply_message) 2560 IPC::Message* reply_message)
2559 : automation_(automation->AsWeakPtr()), 2561 : automation_(automation->AsWeakPtr()),
2560 reply_message_(reply_message) { 2562 reply_message_(reply_message) {
2561 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, 2563 registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
2562 NotificationService::AllSources()); 2564 content::NotificationService::AllSources());
2563 } 2565 }
2564 2566
2565 RendererProcessClosedObserver::~RendererProcessClosedObserver() {} 2567 RendererProcessClosedObserver::~RendererProcessClosedObserver() {}
2566 2568
2567 void RendererProcessClosedObserver::Observe( 2569 void RendererProcessClosedObserver::Observe(
2568 int type, 2570 int type,
2569 const content::NotificationSource& source, 2571 const content::NotificationSource& source,
2570 const content::NotificationDetails& details) { 2572 const content::NotificationDetails& details) {
2571 if (automation_) { 2573 if (automation_) {
2572 AutomationJSONReply(automation_, 2574 AutomationJSONReply(automation_,
2573 reply_message_.release()).SendSuccess(NULL); 2575 reply_message_.release()).SendSuccess(NULL);
2574 } 2576 }
2575 delete this; 2577 delete this;
2576 } 2578 }
2577 2579
2578 InputEventAckNotificationObserver::InputEventAckNotificationObserver( 2580 InputEventAckNotificationObserver::InputEventAckNotificationObserver(
2579 AutomationProvider* automation, 2581 AutomationProvider* automation,
2580 IPC::Message* reply_message, 2582 IPC::Message* reply_message,
2581 int event_type, 2583 int event_type,
2582 int count) 2584 int count)
2583 : automation_(automation->AsWeakPtr()), 2585 : automation_(automation->AsWeakPtr()),
2584 reply_message_(reply_message), 2586 reply_message_(reply_message),
2585 event_type_(event_type), 2587 event_type_(event_type),
2586 count_(count) { 2588 count_(count) {
2587 DCHECK(1 <= count); 2589 DCHECK(1 <= count);
2588 registrar_.Add( 2590 registrar_.Add(
2589 this, 2591 this,
2590 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK, 2592 content::NOTIFICATION_RENDER_WIDGET_HOST_DID_RECEIVE_INPUT_EVENT_ACK,
2591 NotificationService::AllSources()); 2593 content::NotificationService::AllSources());
2592 registrar_.Add( 2594 registrar_.Add(
2593 this, 2595 this,
2594 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 2596 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
2595 NotificationService::AllSources()); 2597 content::NotificationService::AllSources());
2596 } 2598 }
2597 2599
2598 InputEventAckNotificationObserver::~InputEventAckNotificationObserver() {} 2600 InputEventAckNotificationObserver::~InputEventAckNotificationObserver() {}
2599 2601
2600 void InputEventAckNotificationObserver::Observe( 2602 void InputEventAckNotificationObserver::Observe(
2601 int type, 2603 int type,
2602 const content::NotificationSource& source, 2604 const content::NotificationSource& source,
2603 const content::NotificationDetails& details) { 2605 const content::NotificationDetails& details) {
2604 if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) { 2606 if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) {
2605 AutomationJSONReply(automation_, 2607 AutomationJSONReply(automation_,
(...skipping 17 matching lines...) Expand all
2623 } 2625 }
2624 } 2626 }
2625 2627
2626 AllTabsStoppedLoadingObserver::AllTabsStoppedLoadingObserver( 2628 AllTabsStoppedLoadingObserver::AllTabsStoppedLoadingObserver(
2627 AutomationProvider* automation, 2629 AutomationProvider* automation,
2628 IPC::Message* reply_message) 2630 IPC::Message* reply_message)
2629 : automation_(automation->AsWeakPtr()), 2631 : automation_(automation->AsWeakPtr()),
2630 reply_message_(reply_message) { 2632 reply_message_(reply_message) {
2631 registrar_.Add(this, 2633 registrar_.Add(this,
2632 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 2634 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
2633 NotificationService::AllSources()); 2635 content::NotificationService::AllSources());
2634 for (BrowserList::const_iterator iter = BrowserList::begin(); 2636 for (BrowserList::const_iterator iter = BrowserList::begin();
2635 iter != BrowserList::end(); 2637 iter != BrowserList::end();
2636 ++iter) { 2638 ++iter) {
2637 Browser* browser = *iter; 2639 Browser* browser = *iter;
2638 for (int i = 0; i < browser->tab_count(); ++i) { 2640 for (int i = 0; i < browser->tab_count(); ++i) {
2639 TabContentsWrapper* contents_wrapper = 2641 TabContentsWrapper* contents_wrapper =
2640 browser->GetTabContentsWrapperAt(i); 2642 browser->GetTabContentsWrapperAt(i);
2641 StartObserving(contents_wrapper->automation_tab_helper()); 2643 StartObserving(contents_wrapper->automation_tab_helper());
2642 if (contents_wrapper->automation_tab_helper()->has_pending_loads()) 2644 if (contents_wrapper->automation_tab_helper()->has_pending_loads())
2643 pending_tabs_.insert(contents_wrapper->tab_contents()); 2645 pending_tabs_.insert(contents_wrapper->tab_contents());
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
2695 } 2697 }
2696 } 2698 }
2697 2699
2698 NewTabObserver::NewTabObserver(AutomationProvider* automation, 2700 NewTabObserver::NewTabObserver(AutomationProvider* automation,
2699 IPC::Message* reply_message) 2701 IPC::Message* reply_message)
2700 : automation_(automation->AsWeakPtr()), 2702 : automation_(automation->AsWeakPtr()),
2701 reply_message_(reply_message) { 2703 reply_message_(reply_message) {
2702 // Use TAB_PARENTED to detect the new tab. 2704 // Use TAB_PARENTED to detect the new tab.
2703 registrar_.Add(this, 2705 registrar_.Add(this,
2704 content::NOTIFICATION_TAB_PARENTED, 2706 content::NOTIFICATION_TAB_PARENTED,
2705 NotificationService::AllSources()); 2707 content::NotificationService::AllSources());
2706 } 2708 }
2707 2709
2708 void NewTabObserver::Observe(int type, 2710 void NewTabObserver::Observe(int type,
2709 const content::NotificationSource& source, 2711 const content::NotificationSource& source,
2710 const content::NotificationDetails& details) { 2712 const content::NotificationDetails& details) {
2711 DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type); 2713 DCHECK_EQ(content::NOTIFICATION_TAB_PARENTED, type);
2712 NavigationController* controller = 2714 NavigationController* controller =
2713 &(content::Source<TabContentsWrapper>(source).ptr()->controller()); 2715 &(content::Source<TabContentsWrapper>(source).ptr()->controller());
2714 if (automation_) { 2716 if (automation_) {
2715 // TODO(phajdan.jr): Clean up this hack. We write the correct return type 2717 // TODO(phajdan.jr): Clean up this hack. We write the correct return type
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
2775 } 2777 }
2776 2778
2777 DragTargetDropAckNotificationObserver::DragTargetDropAckNotificationObserver( 2779 DragTargetDropAckNotificationObserver::DragTargetDropAckNotificationObserver(
2778 AutomationProvider* automation, 2780 AutomationProvider* automation,
2779 IPC::Message* reply_message) 2781 IPC::Message* reply_message)
2780 : automation_(automation->AsWeakPtr()), 2782 : automation_(automation->AsWeakPtr()),
2781 reply_message_(reply_message) { 2783 reply_message_(reply_message) {
2782 registrar_.Add( 2784 registrar_.Add(
2783 this, 2785 this,
2784 content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK, 2786 content::NOTIFICATION_RENDER_VIEW_HOST_DID_RECEIVE_DRAG_TARGET_DROP_ACK,
2785 NotificationService::AllSources()); 2787 content::NotificationService::AllSources());
2786 registrar_.Add( 2788 registrar_.Add(
2787 this, 2789 this,
2788 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, 2790 chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN,
2789 NotificationService::AllSources()); 2791 content::NotificationService::AllSources());
2790 } 2792 }
2791 2793
2792 DragTargetDropAckNotificationObserver:: 2794 DragTargetDropAckNotificationObserver::
2793 ~DragTargetDropAckNotificationObserver() {} 2795 ~DragTargetDropAckNotificationObserver() {}
2794 2796
2795 void DragTargetDropAckNotificationObserver::Observe( 2797 void DragTargetDropAckNotificationObserver::Observe(
2796 int type, 2798 int type,
2797 const content::NotificationSource& source, 2799 const content::NotificationSource& source,
2798 const content::NotificationDetails& details) { 2800 const content::NotificationDetails& details) {
2799 if (automation_) { 2801 if (automation_) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
2885 } 2887 }
2886 2888
2887 BrowserOpenedWithNewProfileNotificationObserver:: 2889 BrowserOpenedWithNewProfileNotificationObserver::
2888 BrowserOpenedWithNewProfileNotificationObserver( 2890 BrowserOpenedWithNewProfileNotificationObserver(
2889 AutomationProvider* automation, 2891 AutomationProvider* automation,
2890 IPC::Message* reply_message) 2892 IPC::Message* reply_message)
2891 : automation_(automation->AsWeakPtr()), 2893 : automation_(automation->AsWeakPtr()),
2892 reply_message_(reply_message), 2894 reply_message_(reply_message),
2893 new_window_id_(extension_misc::kUnknownWindowId) { 2895 new_window_id_(extension_misc::kUnknownWindowId) {
2894 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, 2896 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
2895 NotificationService::AllBrowserContextsAndSources()); 2897 content::NotificationService::AllBrowserContextsAndSources());
2896 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, 2898 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED,
2897 NotificationService::AllBrowserContextsAndSources()); 2899 content::NotificationService::AllBrowserContextsAndSources());
2898 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, 2900 registrar_.Add(this, content::NOTIFICATION_LOAD_STOP,
2899 NotificationService::AllBrowserContextsAndSources()); 2901 content::NotificationService::AllBrowserContextsAndSources());
2900 } 2902 }
2901 2903
2902 BrowserOpenedWithNewProfileNotificationObserver:: 2904 BrowserOpenedWithNewProfileNotificationObserver::
2903 ~BrowserOpenedWithNewProfileNotificationObserver() { 2905 ~BrowserOpenedWithNewProfileNotificationObserver() {
2904 } 2906 }
2905 2907
2906 void BrowserOpenedWithNewProfileNotificationObserver::Observe( 2908 void BrowserOpenedWithNewProfileNotificationObserver::Observe(
2907 int type, 2909 int type,
2908 const content::NotificationSource& source, 2910 const content::NotificationSource& source,
2909 const content::NotificationDetails& details) { 2911 const content::NotificationDetails& details) {
(...skipping 27 matching lines...) Expand all
2937 if (automation_) { 2939 if (automation_) {
2938 AutomationJSONReply(automation_, reply_message_.release()) 2940 AutomationJSONReply(automation_, reply_message_.release())
2939 .SendSuccess(NULL); 2941 .SendSuccess(NULL);
2940 } 2942 }
2941 delete this; 2943 delete this;
2942 } 2944 }
2943 } else { 2945 } else {
2944 NOTREACHED(); 2946 NOTREACHED();
2945 } 2947 }
2946 } 2948 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698