| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
| 9 #include "chrome/browser/app_modal_dialog_queue.h" | 9 #include "chrome/browser/app_modal_dialog_queue.h" |
| 10 #include "chrome/browser/automation/automation_provider_list.h" | 10 #include "chrome/browser/automation/automation_provider_list.h" |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 source_url, &consumer_, | 1064 source_url, &consumer_, |
| 1065 NewCallback(this, &AutomationProvider::OnRedirectQueryComplete)); | 1065 NewCallback(this, &AutomationProvider::OnRedirectQueryComplete)); |
| 1066 return; // Response will be sent when query completes. | 1066 return; // Response will be sent when query completes. |
| 1067 } | 1067 } |
| 1068 } | 1068 } |
| 1069 | 1069 |
| 1070 // Send failure response. | 1070 // Send failure response. |
| 1071 IPC::Message* msg = new IPC::Message( | 1071 IPC::Message* msg = new IPC::Message( |
| 1072 message.routing_id(), AutomationMsg_RedirectsFromResponse::ID, | 1072 message.routing_id(), AutomationMsg_RedirectsFromResponse::ID, |
| 1073 IPC::Message::PRIORITY_NORMAL); | 1073 IPC::Message::PRIORITY_NORMAL); |
| 1074 msg->WriteInt(-1); // Negative string count indicates an error. | 1074 msg->WriteBool(false); |
| 1075 std::vector<GURL> empty; |
| 1076 ParamTraits<std::vector<GURL>>::Write(msg, empty); |
| 1075 Send(msg); | 1077 Send(msg); |
| 1076 } | 1078 } |
| 1077 | 1079 |
| 1078 void AutomationProvider::GetActiveTabIndex(const IPC::Message& message, | 1080 void AutomationProvider::GetActiveTabIndex(const IPC::Message& message, |
| 1079 int handle) { | 1081 int handle) { |
| 1080 int active_tab_index = -1; // -1 is the error code | 1082 int active_tab_index = -1; // -1 is the error code |
| 1081 if (browser_tracker_->ContainsHandle(handle)) { | 1083 if (browser_tracker_->ContainsHandle(handle)) { |
| 1082 Browser* browser = browser_tracker_->GetResource(handle); | 1084 Browser* browser = browser_tracker_->GetResource(handle); |
| 1083 active_tab_index = browser->selected_index(); | 1085 active_tab_index = browser->selected_index(); |
| 1084 } | 1086 } |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1547 HistoryService::Handle request_handle, | 1549 HistoryService::Handle request_handle, |
| 1548 GURL from_url, | 1550 GURL from_url, |
| 1549 bool success, | 1551 bool success, |
| 1550 HistoryService::RedirectList* redirects) { | 1552 HistoryService::RedirectList* redirects) { |
| 1551 DCHECK(request_handle == redirect_query_); | 1553 DCHECK(request_handle == redirect_query_); |
| 1552 | 1554 |
| 1553 // Respond to the pending request for the redirect list. | 1555 // Respond to the pending request for the redirect list. |
| 1554 IPC::Message* msg = new IPC::Message(redirect_query_routing_id_, | 1556 IPC::Message* msg = new IPC::Message(redirect_query_routing_id_, |
| 1555 AutomationMsg_RedirectsFromResponse::ID, | 1557 AutomationMsg_RedirectsFromResponse::ID, |
| 1556 IPC::Message::PRIORITY_NORMAL); | 1558 IPC::Message::PRIORITY_NORMAL); |
| 1559 std::vector<GURL> redirects_gurl; |
| 1557 if (success) { | 1560 if (success) { |
| 1558 msg->WriteInt(static_cast<int>(redirects->size())); | 1561 msg->WriteBool(true); |
| 1559 for (size_t i = 0; i < redirects->size(); i++) | 1562 for (size_t i = 0; i < redirects->size(); i++) |
| 1560 IPC::ParamTraits<GURL>::Write(msg, redirects->at(i)); | 1563 redirects_gurl.push_back(redirects->at(i)); |
| 1561 } else { | 1564 } else { |
| 1562 msg->WriteInt(-1); // Negative count indicates failure. | 1565 msg->WriteInt(-1); // Negative count indicates failure. |
| 1563 } | 1566 } |
| 1564 | 1567 |
| 1568 ParamTraits<std::vector<GURL>>::Write(msg, redirects_gurl); |
| 1569 |
| 1565 Send(msg); | 1570 Send(msg); |
| 1566 redirect_query_ = NULL; | 1571 redirect_query_ = NULL; |
| 1567 } | 1572 } |
| 1568 | 1573 |
| 1569 bool AutomationProvider::Send(IPC::Message* msg) { | 1574 bool AutomationProvider::Send(IPC::Message* msg) { |
| 1570 DCHECK(channel_.get()); | 1575 DCHECK(channel_.get()); |
| 1571 return channel_->Send(msg); | 1576 return channel_->Send(msg); |
| 1572 } | 1577 } |
| 1573 | 1578 |
| 1574 Browser* AutomationProvider::FindAndActivateTab( | 1579 Browser* AutomationProvider::FindAndActivateTab( |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2599 } | 2604 } |
| 2600 } | 2605 } |
| 2601 Send(new AutomationMsg_OverrideEncodingResponse(message.routing_id(), | 2606 Send(new AutomationMsg_OverrideEncodingResponse(message.routing_id(), |
| 2602 succeed)); | 2607 succeed)); |
| 2603 } | 2608 } |
| 2604 | 2609 |
| 2605 void AutomationProvider::SavePackageShouldPromptUser( | 2610 void AutomationProvider::SavePackageShouldPromptUser( |
| 2606 const IPC::Message& message, bool should_prompt) { | 2611 const IPC::Message& message, bool should_prompt) { |
| 2607 SavePackage::SetShouldPromptUser(should_prompt); | 2612 SavePackage::SetShouldPromptUser(should_prompt); |
| 2608 } | 2613 } |
| OLD | NEW |