OLD | NEW |
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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 } | 1143 } |
1144 | 1144 |
1145 FindInPageNotificationObserver::FindInPageNotificationObserver( | 1145 FindInPageNotificationObserver::FindInPageNotificationObserver( |
1146 AutomationProvider* automation, TabContents* parent_tab, | 1146 AutomationProvider* automation, TabContents* parent_tab, |
1147 bool reply_with_json, IPC::Message* reply_message) | 1147 bool reply_with_json, IPC::Message* reply_message) |
1148 : automation_(automation->AsWeakPtr()), | 1148 : automation_(automation->AsWeakPtr()), |
1149 active_match_ordinal_(-1), | 1149 active_match_ordinal_(-1), |
1150 reply_with_json_(reply_with_json), | 1150 reply_with_json_(reply_with_json), |
1151 reply_message_(reply_message) { | 1151 reply_message_(reply_message) { |
1152 registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, | 1152 registrar_.Add(this, chrome::NOTIFICATION_FIND_RESULT_AVAILABLE, |
1153 content::Source<TabContents>(parent_tab)); | 1153 content::Source<WebContents>(parent_tab)); |
1154 } | 1154 } |
1155 | 1155 |
1156 FindInPageNotificationObserver::~FindInPageNotificationObserver() { | 1156 FindInPageNotificationObserver::~FindInPageNotificationObserver() { |
1157 } | 1157 } |
1158 | 1158 |
1159 void FindInPageNotificationObserver::Observe( | 1159 void FindInPageNotificationObserver::Observe( |
1160 int type, const content::NotificationSource& source, | 1160 int type, const content::NotificationSource& source, |
1161 const content::NotificationDetails& details) { | 1161 const content::NotificationDetails& details) { |
1162 content::Details<FindNotificationDetails> find_details(details); | 1162 content::Details<FindNotificationDetails> find_details(details); |
1163 if (!(find_details->final_update() && reply_message_ != NULL)) { | 1163 if (!(find_details->final_update() && reply_message_ != NULL)) { |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1356 return; | 1356 return; |
1357 } | 1357 } |
1358 MetricEventDurationDetails* metric_event_duration = | 1358 MetricEventDurationDetails* metric_event_duration = |
1359 content::Details<MetricEventDurationDetails>(details).ptr(); | 1359 content::Details<MetricEventDurationDetails>(details).ptr(); |
1360 durations_[metric_event_duration->event_name] = | 1360 durations_[metric_event_duration->event_name] = |
1361 metric_event_duration->duration_ms; | 1361 metric_event_duration->duration_ms; |
1362 } | 1362 } |
1363 | 1363 |
1364 PageTranslatedObserver::PageTranslatedObserver(AutomationProvider* automation, | 1364 PageTranslatedObserver::PageTranslatedObserver(AutomationProvider* automation, |
1365 IPC::Message* reply_message, | 1365 IPC::Message* reply_message, |
1366 TabContents* tab_contents) | 1366 WebContents* web_contents) |
1367 : automation_(automation->AsWeakPtr()), | 1367 : automation_(automation->AsWeakPtr()), |
1368 reply_message_(reply_message) { | 1368 reply_message_(reply_message) { |
1369 registrar_.Add(this, chrome::NOTIFICATION_PAGE_TRANSLATED, | 1369 registrar_.Add(this, chrome::NOTIFICATION_PAGE_TRANSLATED, |
1370 content::Source<TabContents>(tab_contents)); | 1370 content::Source<WebContents>(web_contents)); |
1371 } | 1371 } |
1372 | 1372 |
1373 PageTranslatedObserver::~PageTranslatedObserver() {} | 1373 PageTranslatedObserver::~PageTranslatedObserver() {} |
1374 | 1374 |
1375 void PageTranslatedObserver::Observe( | 1375 void PageTranslatedObserver::Observe( |
1376 int type, | 1376 int type, |
1377 const content::NotificationSource& source, | 1377 const content::NotificationSource& source, |
1378 const content::NotificationDetails& details) { | 1378 const content::NotificationDetails& details) { |
1379 if (!automation_) { | 1379 if (!automation_) { |
1380 delete this; | 1380 delete this; |
(...skipping 14 matching lines...) Expand all Loading... |
1395 } | 1395 } |
1396 | 1396 |
1397 TabLanguageDeterminedObserver::TabLanguageDeterminedObserver( | 1397 TabLanguageDeterminedObserver::TabLanguageDeterminedObserver( |
1398 AutomationProvider* automation, IPC::Message* reply_message, | 1398 AutomationProvider* automation, IPC::Message* reply_message, |
1399 TabContents* tab_contents, TranslateInfoBarDelegate* translate_bar) | 1399 TabContents* tab_contents, TranslateInfoBarDelegate* translate_bar) |
1400 : automation_(automation->AsWeakPtr()), | 1400 : automation_(automation->AsWeakPtr()), |
1401 reply_message_(reply_message), | 1401 reply_message_(reply_message), |
1402 tab_contents_(tab_contents), | 1402 tab_contents_(tab_contents), |
1403 translate_bar_(translate_bar) { | 1403 translate_bar_(translate_bar) { |
1404 registrar_.Add(this, chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, | 1404 registrar_.Add(this, chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED, |
1405 content::Source<TabContents>(tab_contents)); | 1405 content::Source<WebContents>(tab_contents)); |
1406 } | 1406 } |
1407 | 1407 |
1408 TabLanguageDeterminedObserver::~TabLanguageDeterminedObserver() {} | 1408 TabLanguageDeterminedObserver::~TabLanguageDeterminedObserver() {} |
1409 | 1409 |
1410 void TabLanguageDeterminedObserver::Observe( | 1410 void TabLanguageDeterminedObserver::Observe( |
1411 int type, const content::NotificationSource& source, | 1411 int type, const content::NotificationSource& source, |
1412 const content::NotificationDetails& details) { | 1412 const content::NotificationDetails& details) { |
1413 DCHECK(type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED); | 1413 DCHECK(type == chrome::NOTIFICATION_TAB_LANGUAGE_DETERMINED); |
1414 | 1414 |
1415 if (!automation_) { | 1415 if (!automation_) { |
(...skipping 1682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3098 } | 3098 } |
3099 | 3099 |
3100 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); | 3100 ExtensionHost* host = content::Details<ExtensionHost>(details).ptr(); |
3101 if (host->extension_id() == extension_id_ && | 3101 if (host->extension_id() == extension_id_ && |
3102 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { | 3102 host->extension_host_type() == chrome::VIEW_TYPE_EXTENSION_POPUP) { |
3103 AutomationJSONReply(automation_, reply_message_.release()) | 3103 AutomationJSONReply(automation_, reply_message_.release()) |
3104 .SendSuccess(NULL); | 3104 .SendSuccess(NULL); |
3105 delete this; | 3105 delete this; |
3106 } | 3106 } |
3107 } | 3107 } |
OLD | NEW |