| 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 #if defined(OS_ANDROID) | 127 #if defined(OS_ANDROID) |
| 128 const char kWebContentsAndroidKey[] = "web_contents_android"; | 128 const char kWebContentsAndroidKey[] = "web_contents_android"; |
| 129 #endif // OS_ANDROID | 129 #endif // OS_ANDROID |
| 130 | 130 |
| 131 base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> > | 131 base::LazyInstance<std::vector<WebContentsImpl::CreatedCallback> > |
| 132 g_created_callbacks = LAZY_INSTANCE_INITIALIZER; | 132 g_created_callbacks = LAZY_INSTANCE_INITIALIZER; |
| 133 | 133 |
| 134 static int StartDownload(RenderFrameHost* rfh, | 134 static int StartDownload(RenderFrameHost* rfh, |
| 135 const GURL& url, | 135 const GURL& url, |
| 136 bool is_favicon, | 136 bool is_favicon, |
| 137 uint32_t max_bitmap_size) { | 137 uint32_t max_bitmap_size, |
| 138 bool bypass_cache) { |
| 138 static int g_next_image_download_id = 0; | 139 static int g_next_image_download_id = 0; |
| 139 rfh->Send(new ImageMsg_DownloadImage(rfh->GetRoutingID(), | 140 rfh->Send(new ImageMsg_DownloadImage(rfh->GetRoutingID(), |
| 140 ++g_next_image_download_id, | 141 ++g_next_image_download_id, |
| 141 url, | 142 url, |
| 142 is_favicon, | 143 is_favicon, |
| 143 max_bitmap_size)); | 144 max_bitmap_size, |
| 145 bypass_cache)); |
| 144 return g_next_image_download_id; | 146 return g_next_image_download_id; |
| 145 } | 147 } |
| 146 | 148 |
| 147 void NotifyCacheOnIO( | 149 void NotifyCacheOnIO( |
| 148 scoped_refptr<net::URLRequestContextGetter> request_context, | 150 scoped_refptr<net::URLRequestContextGetter> request_context, |
| 149 const GURL& url, | 151 const GURL& url, |
| 150 const std::string& http_method) { | 152 const std::string& http_method) { |
| 151 net::HttpCache* cache = request_context->GetURLRequestContext()-> | 153 net::HttpCache* cache = request_context->GetURLRequestContext()-> |
| 152 http_transaction_factory()->GetCache(); | 154 http_transaction_factory()->GetCache(); |
| 153 if (cache) | 155 if (cache) |
| (...skipping 2405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2559 return; | 2561 return; |
| 2560 | 2562 |
| 2561 rfh->Send(new FrameMsg_DidEndColorChooser( | 2563 rfh->Send(new FrameMsg_DidEndColorChooser( |
| 2562 rfh->GetRoutingID(), color_chooser_info_->identifier)); | 2564 rfh->GetRoutingID(), color_chooser_info_->identifier)); |
| 2563 color_chooser_info_.reset(); | 2565 color_chooser_info_.reset(); |
| 2564 } | 2566 } |
| 2565 | 2567 |
| 2566 int WebContentsImpl::DownloadImage(const GURL& url, | 2568 int WebContentsImpl::DownloadImage(const GURL& url, |
| 2567 bool is_favicon, | 2569 bool is_favicon, |
| 2568 uint32_t max_bitmap_size, | 2570 uint32_t max_bitmap_size, |
| 2571 bool bypass_cache, |
| 2569 const ImageDownloadCallback& callback) { | 2572 const ImageDownloadCallback& callback) { |
| 2570 int id = StartDownload(GetMainFrame(), url, is_favicon, max_bitmap_size); | 2573 int id = StartDownload(GetMainFrame(), url, is_favicon, max_bitmap_size, |
| 2574 bypass_cache); |
| 2571 image_download_map_[id] = callback; | 2575 image_download_map_[id] = callback; |
| 2572 return id; | 2576 return id; |
| 2573 } | 2577 } |
| 2574 | 2578 |
| 2575 bool WebContentsImpl::IsSubframe() const { | 2579 bool WebContentsImpl::IsSubframe() const { |
| 2576 return is_subframe_; | 2580 return is_subframe_; |
| 2577 } | 2581 } |
| 2578 | 2582 |
| 2579 void WebContentsImpl::Find(int request_id, | 2583 void WebContentsImpl::Find(int request_id, |
| 2580 const base::string16& search_text, | 2584 const base::string16& search_text, |
| (...skipping 2067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4648 node->render_manager()->ResumeResponseDeferredAtStart(); | 4652 node->render_manager()->ResumeResponseDeferredAtStart(); |
| 4649 } | 4653 } |
| 4650 | 4654 |
| 4651 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { | 4655 void WebContentsImpl::SetForceDisableOverscrollContent(bool force_disable) { |
| 4652 force_disable_overscroll_content_ = force_disable; | 4656 force_disable_overscroll_content_ = force_disable; |
| 4653 if (view_) | 4657 if (view_) |
| 4654 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); | 4658 view_->SetOverscrollControllerEnabled(CanOverscrollContent()); |
| 4655 } | 4659 } |
| 4656 | 4660 |
| 4657 } // namespace content | 4661 } // namespace content |
| OLD | NEW |