OLD | NEW |
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 #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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 } | 897 } |
898 | 898 |
899 if (current_count == target_count_) { | 899 if (current_count == target_count_) { |
900 AutomationMsg_WaitForBrowserWindowCountToBecome::WriteReplyParams( | 900 AutomationMsg_WaitForBrowserWindowCountToBecome::WriteReplyParams( |
901 reply_message_.get(), true); | 901 reply_message_.get(), true); |
902 automation_->Send(reply_message_.release()); | 902 automation_->Send(reply_message_.release()); |
903 delete this; | 903 delete this; |
904 } | 904 } |
905 } | 905 } |
906 | 906 |
907 AppModalDialogShownObserver::AppModalDialogShownObserver( | |
908 AutomationProvider* automation, IPC::Message* reply_message) | |
909 : automation_(automation->AsWeakPtr()), | |
910 reply_message_(reply_message) { | |
911 registrar_.Add(this, chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN, | |
912 content::NotificationService::AllSources()); | |
913 } | |
914 | |
915 AppModalDialogShownObserver::~AppModalDialogShownObserver() { | |
916 } | |
917 | |
918 void AppModalDialogShownObserver::Observe( | |
919 int type, const content::NotificationSource& source, | |
920 const content::NotificationDetails& details) { | |
921 DCHECK(type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN); | |
922 | |
923 if (automation_) { | |
924 AutomationMsg_WaitForAppModalDialogToBeShown::WriteReplyParams( | |
925 reply_message_.get(), true); | |
926 automation_->Send(reply_message_.release()); | |
927 } | |
928 delete this; | |
929 } | |
930 | |
931 namespace { | 907 namespace { |
932 | 908 |
933 // Define mapping from command to notification | 909 // Define mapping from command to notification |
934 struct CommandNotification { | 910 struct CommandNotification { |
935 int command; | 911 int command; |
936 int notification_type; | 912 int notification_type; |
937 }; | 913 }; |
938 | 914 |
939 const struct CommandNotification command_notifications[] = { | 915 const struct CommandNotification command_notifications[] = { |
940 {IDC_DUPLICATE_TAB, chrome::NOTIFICATION_TAB_PARENTED}, | 916 {IDC_DUPLICATE_TAB, chrome::NOTIFICATION_TAB_PARENTED}, |
(...skipping 2030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2971 } | 2947 } |
2972 | 2948 |
2973 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); | 2949 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); |
2974 if (host->extension_id() == extension_id_ && | 2950 if (host->extension_id() == extension_id_ && |
2975 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 2951 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
2976 AutomationJSONReply(automation_, reply_message_.release()) | 2952 AutomationJSONReply(automation_, reply_message_.release()) |
2977 .SendSuccess(NULL); | 2953 .SendSuccess(NULL); |
2978 delete this; | 2954 delete this; |
2979 } | 2955 } |
2980 } | 2956 } |
OLD | NEW |