OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 #if defined(OS_ANDROID) | 131 #if defined(OS_ANDROID) |
132 const char kWebContentsAndroidKey[] = "web_contents_android"; | 132 const char kWebContentsAndroidKey[] = "web_contents_android"; |
133 #endif // OS_ANDROID | 133 #endif // OS_ANDROID |
134 | 134 |
135 base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> > | 135 base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> > |
136 g_created_callbacks = LAZY_INSTANCE_INITIALIZER; | 136 g_created_callbacks = LAZY_INSTANCE_INITIALIZER; |
137 | 137 |
138 static int StartDownload(RenderFrameHost* rfh, | 138 static int StartDownload(RenderFrameHost* rfh, |
139 const GURL& url, | 139 const GURL& url, |
140 bool is_favicon, | 140 bool is_favicon, |
| 141 blink::WebURLRequest::CachePolicy cache_policy, |
141 uint32_t max_bitmap_size) { | 142 uint32_t max_bitmap_size) { |
142 static int g_next_image_download_id = 0; | 143 static int g_next_image_download_id = 0; |
143 rfh->Send(new ImageMsg_DownloadImage(rfh->GetRoutingID(), | 144 rfh->Send(new ImageMsg_DownloadImage(rfh->GetRoutingID(), |
144 ++g_next_image_download_id, | 145 ++g_next_image_download_id, |
145 url, | 146 url, |
146 is_favicon, | 147 is_favicon, |
147 max_bitmap_size)); | 148 max_bitmap_size, |
| 149 cache_policy)); |
148 return g_next_image_download_id; | 150 return g_next_image_download_id; |
149 } | 151 } |
150 | 152 |
151 void NotifyCacheOnIO( | 153 void NotifyCacheOnIO( |
152 scoped_refptr<net::URLRequestContextGetter> request_context, | 154 scoped_refptr<net::URLRequestContextGetter> request_context, |
153 const GURL& url, | 155 const GURL& url, |
154 const std::string& http_method) { | 156 const std::string& http_method) { |
155 request_context->GetURLRequestContext()->http_transaction_factory()-> | 157 request_context->GetURLRequestContext()->http_transaction_factory()-> |
156 GetCache()->OnExternalCacheHit(url, http_method); | 158 GetCache()->OnExternalCacheHit(url, http_method); |
157 } | 159 } |
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2446 color_chooser_info_->render_process_id, | 2448 color_chooser_info_->render_process_id, |
2447 color_chooser_info_->render_frame_id); | 2449 color_chooser_info_->render_frame_id); |
2448 if (!rfh) | 2450 if (!rfh) |
2449 return; | 2451 return; |
2450 | 2452 |
2451 rfh->Send(new FrameMsg_DidEndColorChooser( | 2453 rfh->Send(new FrameMsg_DidEndColorChooser( |
2452 rfh->GetRoutingID(), color_chooser_info_->identifier)); | 2454 rfh->GetRoutingID(), color_chooser_info_->identifier)); |
2453 color_chooser_info_.reset(); | 2455 color_chooser_info_.reset(); |
2454 } | 2456 } |
2455 | 2457 |
2456 int WebContentsImpl::DownloadImage(const GURL& url, | 2458 int WebContentsImpl::DownloadImage( |
2457 bool is_favicon, | 2459 const GURL& url, |
2458 uint32_t max_bitmap_size, | 2460 bool is_favicon, |
2459 const ImageDownloadCallback& callback) { | 2461 uint32_t max_bitmap_size, |
2460 int id = StartDownload(GetMainFrame(), url, is_favicon, max_bitmap_size); | 2462 blink::WebURLRequest::CachePolicy cache_policy, |
| 2463 const ImageDownloadCallback& callback) { |
| 2464 int id = StartDownload(GetMainFrame(), url, is_favicon, cache_policy, |
| 2465 max_bitmap_size); |
2461 image_download_map_[id] = callback; | 2466 image_download_map_[id] = callback; |
2462 return id; | 2467 return id; |
2463 } | 2468 } |
2464 | 2469 |
2465 bool WebContentsImpl::IsSubframe() const { | 2470 bool WebContentsImpl::IsSubframe() const { |
2466 return is_subframe_; | 2471 return is_subframe_; |
2467 } | 2472 } |
2468 | 2473 |
2469 void WebContentsImpl::Find(int request_id, | 2474 void WebContentsImpl::Find(int request_id, |
2470 const base::string16& search_text, | 2475 const base::string16& search_text, |
(...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4511 node->render_manager()->ResumeResponseDeferredAtStart(); | 4516 node->render_manager()->ResumeResponseDeferredAtStart(); |
4512 } | 4517 } |
4513 | 4518 |
4514 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4519 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
4515 force_disable_overscroll_content_ = force_disable; | 4520 force_disable_overscroll_content_ = force_disable; |
4516 if (view_) | 4521 if (view_) |
4517 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4522 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
4518 } | 4523 } |
4519 | 4524 |
4520 } // namespace content | 4525 } // namespace content |
OLD | NEW |