| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
| 9 #include "chrome/browser/automation/automation_provider.h" | 9 #include "chrome/browser/automation/automation_provider.h" |
| 10 #include "chrome/browser/dom_operation_notification_details.h" | 10 #include "chrome/browser/dom_operation_notification_details.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 ConditionMet(AUTOMATION_MSG_NAVIGATION_SUCCESS); | 167 ConditionMet(AUTOMATION_MSG_NAVIGATION_SUCCESS); |
| 168 } | 168 } |
| 169 } else if (type == NotificationType::AUTH_SUPPLIED) { | 169 } else if (type == NotificationType::AUTH_SUPPLIED) { |
| 170 // The LoginHandler for this tab is no longer valid. | 170 // The LoginHandler for this tab is no longer valid. |
| 171 automation_->RemoveLoginHandler(controller_); | 171 automation_->RemoveLoginHandler(controller_); |
| 172 | 172 |
| 173 // Treat this as if navigation started again, since load start/stop don't | 173 // Treat this as if navigation started again, since load start/stop don't |
| 174 // occur while authentication is ongoing. | 174 // occur while authentication is ongoing. |
| 175 navigation_started_ = true; | 175 navigation_started_ = true; |
| 176 } else if (type == NotificationType::AUTH_NEEDED) { | 176 } else if (type == NotificationType::AUTH_NEEDED) { |
| 177 if (navigation_started_) { | 177 // Remember the login handler that wants authentication. |
| 178 // Remember the login handler that wants authentication. | 178 // We do this in all cases (not just when navigation_started_ == true) so |
| 179 LoginHandler* handler = | 179 // tests can still wait for auth dialogs outside of navigation. |
| 180 Details<LoginNotificationDetails>(details)->handler(); | 180 LoginHandler* handler = |
| 181 automation_->AddLoginHandler(controller_, handler); | 181 Details<LoginNotificationDetails>(details)->handler(); |
| 182 automation_->AddLoginHandler(controller_, handler); |
| 182 | 183 |
| 183 // Respond that authentication is needed. | 184 // Respond that authentication is needed. |
| 184 navigation_started_ = false; | 185 navigation_started_ = false; |
| 185 ConditionMet(AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED); | 186 ConditionMet(AUTOMATION_MSG_NAVIGATION_AUTH_NEEDED); |
| 186 } else { | |
| 187 NOTREACHED(); | |
| 188 } | |
| 189 } else { | 187 } else { |
| 190 NOTREACHED(); | 188 NOTREACHED(); |
| 191 } | 189 } |
| 192 } | 190 } |
| 193 | 191 |
| 194 void NavigationNotificationObserver::ConditionMet( | 192 void NavigationNotificationObserver::ConditionMet( |
| 195 AutomationMsg_NavigationResponseValues navigation_result) { | 193 AutomationMsg_NavigationResponseValues navigation_result) { |
| 196 DCHECK(reply_message_ != NULL); | 194 DCHECK(reply_message_ != NULL); |
| 197 | 195 |
| 198 IPC::ParamTraits<AutomationMsg_NavigationResponseValues>::Write( | 196 IPC::ParamTraits<AutomationMsg_NavigationResponseValues>::Write( |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 705 const NotificationSource& source, const NotificationDetails& details) { | 703 const NotificationSource& source, const NotificationDetails& details) { |
| 706 if (type != NotificationType::METRIC_EVENT_DURATION) { | 704 if (type != NotificationType::METRIC_EVENT_DURATION) { |
| 707 NOTREACHED(); | 705 NOTREACHED(); |
| 708 return; | 706 return; |
| 709 } | 707 } |
| 710 MetricEventDurationDetails* metric_event_duration = | 708 MetricEventDurationDetails* metric_event_duration = |
| 711 Details<MetricEventDurationDetails>(details).ptr(); | 709 Details<MetricEventDurationDetails>(details).ptr(); |
| 712 durations_[metric_event_duration->event_name] = | 710 durations_[metric_event_duration->event_name] = |
| 713 metric_event_duration->duration_ms; | 711 metric_event_duration->duration_ms; |
| 714 } | 712 } |
| OLD | NEW |