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->WriteBool(false); | 1074 msg->WriteInt(-1); // Negative string count indicates an error. |
1075 std::vector<GURL> empty; | |
1076 ParamTraits<std::vector<GURL>>::Write(msg, empty); | |
1077 Send(msg); | 1075 Send(msg); |
1078 } | 1076 } |
1079 | 1077 |
1080 void AutomationProvider::GetActiveTabIndex(const IPC::Message& message, | 1078 void AutomationProvider::GetActiveTabIndex(const IPC::Message& message, |
1081 int handle) { | 1079 int handle) { |
1082 int active_tab_index = -1; // -1 is the error code | 1080 int active_tab_index = -1; // -1 is the error code |
1083 if (browser_tracker_->ContainsHandle(handle)) { | 1081 if (browser_tracker_->ContainsHandle(handle)) { |
1084 Browser* browser = browser_tracker_->GetResource(handle); | 1082 Browser* browser = browser_tracker_->GetResource(handle); |
1085 active_tab_index = browser->selected_index(); | 1083 active_tab_index = browser->selected_index(); |
1086 } | 1084 } |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 HistoryService::Handle request_handle, | 1547 HistoryService::Handle request_handle, |
1550 GURL from_url, | 1548 GURL from_url, |
1551 bool success, | 1549 bool success, |
1552 HistoryService::RedirectList* redirects) { | 1550 HistoryService::RedirectList* redirects) { |
1553 DCHECK(request_handle == redirect_query_); | 1551 DCHECK(request_handle == redirect_query_); |
1554 | 1552 |
1555 // Respond to the pending request for the redirect list. | 1553 // Respond to the pending request for the redirect list. |
1556 IPC::Message* msg = new IPC::Message(redirect_query_routing_id_, | 1554 IPC::Message* msg = new IPC::Message(redirect_query_routing_id_, |
1557 AutomationMsg_RedirectsFromResponse::ID, | 1555 AutomationMsg_RedirectsFromResponse::ID, |
1558 IPC::Message::PRIORITY_NORMAL); | 1556 IPC::Message::PRIORITY_NORMAL); |
1559 std::vector<GURL> redirects_gurl; | |
1560 if (success) { | 1557 if (success) { |
1561 msg->WriteBool(true); | 1558 msg->WriteInt(static_cast<int>(redirects->size())); |
1562 for (size_t i = 0; i < redirects->size(); i++) | 1559 for (size_t i = 0; i < redirects->size(); i++) |
1563 redirects_gurl.push_back(redirects->at(i)); | 1560 IPC::ParamTraits<GURL>::Write(msg, redirects->at(i)); |
1564 } else { | 1561 } else { |
1565 msg->WriteInt(-1); // Negative count indicates failure. | 1562 msg->WriteInt(-1); // Negative count indicates failure. |
1566 } | 1563 } |
1567 | 1564 |
1568 ParamTraits<std::vector<GURL>>::Write(msg, redirects_gurl); | |
1569 | |
1570 Send(msg); | 1565 Send(msg); |
1571 redirect_query_ = NULL; | 1566 redirect_query_ = NULL; |
1572 } | 1567 } |
1573 | 1568 |
1574 bool AutomationProvider::Send(IPC::Message* msg) { | 1569 bool AutomationProvider::Send(IPC::Message* msg) { |
1575 DCHECK(channel_.get()); | 1570 DCHECK(channel_.get()); |
1576 return channel_->Send(msg); | 1571 return channel_->Send(msg); |
1577 } | 1572 } |
1578 | 1573 |
1579 Browser* AutomationProvider::FindAndActivateTab( | 1574 Browser* AutomationProvider::FindAndActivateTab( |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2604 } | 2599 } |
2605 } | 2600 } |
2606 Send(new AutomationMsg_OverrideEncodingResponse(message.routing_id(), | 2601 Send(new AutomationMsg_OverrideEncodingResponse(message.routing_id(), |
2607 succeed)); | 2602 succeed)); |
2608 } | 2603 } |
2609 | 2604 |
2610 void AutomationProvider::SavePackageShouldPromptUser( | 2605 void AutomationProvider::SavePackageShouldPromptUser( |
2611 const IPC::Message& message, bool should_prompt) { | 2606 const IPC::Message& message, bool should_prompt) { |
2612 SavePackage::SetShouldPromptUser(should_prompt); | 2607 SavePackage::SetShouldPromptUser(should_prompt); |
2613 } | 2608 } |
OLD | NEW |