| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 #if defined(OS_ANDROID) | 297 #if defined(OS_ANDROID) |
| 298 using blink::WebFloatPoint; | 298 using blink::WebFloatPoint; |
| 299 using blink::WebFloatRect; | 299 using blink::WebFloatRect; |
| 300 #endif | 300 #endif |
| 301 | 301 |
| 302 namespace content { | 302 namespace content { |
| 303 | 303 |
| 304 namespace { | 304 namespace { |
| 305 | 305 |
| 306 const char kDefaultAcceptHeader[] = | |
| 307 "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/" | |
| 308 "*;q=0.8"; | |
| 309 const char kAcceptHeader[] = "Accept"; | |
| 310 | |
| 311 const size_t kExtraCharsBeforeAndAfterSelection = 100; | 306 const size_t kExtraCharsBeforeAndAfterSelection = 100; |
| 312 | 307 |
| 313 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap; | 308 typedef std::map<int, RenderFrameImpl*> RoutingIDFrameMap; |
| 314 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = | 309 static base::LazyInstance<RoutingIDFrameMap> g_routing_id_frame_map = |
| 315 LAZY_INSTANCE_INITIALIZER; | 310 LAZY_INSTANCE_INITIALIZER; |
| 316 | 311 |
| 317 typedef std::map<blink::WebFrame*, RenderFrameImpl*> FrameMap; | 312 typedef std::map<blink::WebFrame*, RenderFrameImpl*> FrameMap; |
| 318 base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER; | 313 base::LazyInstance<FrameMap> g_frame_map = LAZY_INSTANCE_INITIALIZER; |
| 319 | 314 |
| 320 int64_t ExtractPostId(const WebHistoryItem& item) { | 315 int64_t ExtractPostId(const WebHistoryItem& item) { |
| (...skipping 3425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3746 requested_with = old_extra_data->requested_with(); | 3741 requested_with = old_extra_data->requested_with(); |
| 3747 if (!requested_with.isNull()) { | 3742 if (!requested_with.isNull()) { |
| 3748 if (requested_with.isEmpty()) | 3743 if (requested_with.isEmpty()) |
| 3749 request.clearHTTPHeaderField("X-Requested-With"); | 3744 request.clearHTTPHeaderField("X-Requested-With"); |
| 3750 else | 3745 else |
| 3751 request.setHTTPHeaderField("X-Requested-With", requested_with); | 3746 request.setHTTPHeaderField("X-Requested-With", requested_with); |
| 3752 } | 3747 } |
| 3753 stream_override = old_extra_data->TakeStreamOverrideOwnership(); | 3748 stream_override = old_extra_data->TakeStreamOverrideOwnership(); |
| 3754 } | 3749 } |
| 3755 | 3750 |
| 3756 // Add the default accept header for frame request if it has not been set | |
| 3757 // already. | |
| 3758 if ((request.getFrameType() == blink::WebURLRequest::FrameTypeTopLevel || | |
| 3759 request.getFrameType() == blink::WebURLRequest::FrameTypeNested) && | |
| 3760 request.httpHeaderField(WebString::fromUTF8(kAcceptHeader)).isEmpty()) { | |
| 3761 request.setHTTPHeaderField(WebString::fromUTF8(kAcceptHeader), | |
| 3762 WebString::fromUTF8(kDefaultAcceptHeader)); | |
| 3763 } | |
| 3764 | |
| 3765 // Add an empty HTTP origin header for non GET methods if none is currently | 3751 // Add an empty HTTP origin header for non GET methods if none is currently |
| 3766 // present. | 3752 // present. |
| 3767 request.addHTTPOriginIfNeeded(WebString()); | 3753 request.addHTTPOriginIfNeeded(WebString()); |
| 3768 | 3754 |
| 3769 // Attach |should_replace_current_entry| state to requests so that, should | 3755 // Attach |should_replace_current_entry| state to requests so that, should |
| 3770 // this navigation later require a request transfer, all state is preserved | 3756 // this navigation later require a request transfer, all state is preserved |
| 3771 // when it is re-created in the new process. | 3757 // when it is re-created in the new process. |
| 3772 bool should_replace_current_entry = data_source->replacesCurrentHistoryItem(); | 3758 bool should_replace_current_entry = data_source->replacesCurrentHistoryItem(); |
| 3773 | 3759 |
| 3774 int provider_id = kInvalidServiceWorkerProviderId; | 3760 int provider_id = kInvalidServiceWorkerProviderId; |
| (...skipping 2257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6032 int match_count, | 6018 int match_count, |
| 6033 int ordinal, | 6019 int ordinal, |
| 6034 const WebRect& selection_rect, | 6020 const WebRect& selection_rect, |
| 6035 bool final_status_update) { | 6021 bool final_status_update) { |
| 6036 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6022 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
| 6037 selection_rect, ordinal, | 6023 selection_rect, ordinal, |
| 6038 final_status_update)); | 6024 final_status_update)); |
| 6039 } | 6025 } |
| 6040 | 6026 |
| 6041 } // namespace content | 6027 } // namespace content |
| OLD | NEW |