| 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/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 // Amount of time we wait between when a key event is received and the renderer | 148 // Amount of time we wait between when a key event is received and the renderer |
| 149 // is queried for its state and pushed to the NavigationEntry. | 149 // is queried for its state and pushed to the NavigationEntry. |
| 150 const int kQueryStateDelay = 5000; | 150 const int kQueryStateDelay = 5000; |
| 151 | 151 |
| 152 const int kSyncWaitDelay = 40; | 152 const int kSyncWaitDelay = 40; |
| 153 | 153 |
| 154 const char kDotGoogleDotCom[] = ".google.com"; | 154 const char kDotGoogleDotCom[] = ".google.com"; |
| 155 | 155 |
| 156 static int StartDownload(content::RenderViewHost* rvh, | 156 static int StartDownload(content::RenderViewHost* rvh, |
| 157 const GURL& url, | 157 const GURL& url, |
| 158 DownloadImageType image_type, |
| 158 int image_size) { | 159 int image_size) { |
| 159 static int g_next_favicon_download_id = 0; | 160 static int g_next_favicon_download_id = 0; |
| 160 rvh->Send(new IconMsg_DownloadFavicon(rvh->GetRoutingID(), | 161 rvh->Send(new IconMsg_DownloadFavicon(rvh->GetRoutingID(), |
| 161 ++g_next_favicon_download_id, | 162 ++g_next_favicon_download_id, |
| 162 url, | 163 url, |
| 164 image_type, |
| 163 image_size)); | 165 image_size)); |
| 164 return g_next_favicon_download_id; | 166 return g_next_favicon_download_id; |
| 165 } | 167 } |
| 166 | 168 |
| 167 ViewMsg_Navigate_Type::Value GetNavigationType( | 169 ViewMsg_Navigate_Type::Value GetNavigationType( |
| 168 BrowserContext* browser_context, const NavigationEntryImpl& entry, | 170 BrowserContext* browser_context, const NavigationEntryImpl& entry, |
| 169 NavigationController::ReloadType reload_type) { | 171 NavigationController::ReloadType reload_type) { |
| 170 switch (reload_type) { | 172 switch (reload_type) { |
| 171 case NavigationControllerImpl::RELOAD: | 173 case NavigationControllerImpl::RELOAD: |
| 172 return ViewMsg_Navigate_Type::RELOAD; | 174 return ViewMsg_Navigate_Type::RELOAD; |
| (...skipping 1862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2035 GetRoutingID(), color_chooser_id, color)); | 2037 GetRoutingID(), color_chooser_id, color)); |
| 2036 } | 2038 } |
| 2037 | 2039 |
| 2038 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { | 2040 void WebContentsImpl::DidEndColorChooser(int color_chooser_id) { |
| 2039 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), color_chooser_id)); | 2041 Send(new ViewMsg_DidEndColorChooser(GetRoutingID(), color_chooser_id)); |
| 2040 if (delegate_) | 2042 if (delegate_) |
| 2041 delegate_->DidEndColorChooser(); | 2043 delegate_->DidEndColorChooser(); |
| 2042 color_chooser_ = NULL; | 2044 color_chooser_ = NULL; |
| 2043 } | 2045 } |
| 2044 | 2046 |
| 2045 int WebContentsImpl::DownloadFavicon(const GURL& url, int image_size, | 2047 int WebContentsImpl::DownloadFavicon(const GURL& url, |
| 2046 const FaviconDownloadCallback& callback) { | 2048 DownloadImageType type, |
| 2049 int image_size, |
| 2050 const FaviconDownloadCallback& callback) { |
| 2047 RenderViewHost* host = GetRenderViewHost(); | 2051 RenderViewHost* host = GetRenderViewHost(); |
| 2048 int id = StartDownload(host, url, image_size); | 2052 int id = StartDownload(host, url, type, image_size); |
| 2049 favicon_download_map_[id] = callback; | 2053 favicon_download_map_[id] = callback; |
| 2050 return id; | 2054 return id; |
| 2051 } | 2055 } |
| 2052 | 2056 |
| 2053 bool WebContentsImpl::FocusLocationBarByDefault() { | 2057 bool WebContentsImpl::FocusLocationBarByDefault() { |
| 2054 WebUI* web_ui = GetWebUIForCurrentState(); | 2058 WebUI* web_ui = GetWebUIForCurrentState(); |
| 2055 if (web_ui) | 2059 if (web_ui) |
| 2056 return web_ui->ShouldFocusLocationBarByDefault(); | 2060 return web_ui->ShouldFocusLocationBarByDefault(); |
| 2057 NavigationEntry* entry = controller_.GetActiveEntry(); | 2061 NavigationEntry* entry = controller_.GetActiveEntry(); |
| 2058 if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)) | 2062 if (entry && entry->GetURL() == GURL(chrome::kAboutBlankURL)) |
| (...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3536 } | 3540 } |
| 3537 | 3541 |
| 3538 BrowserPluginGuestManager* | 3542 BrowserPluginGuestManager* |
| 3539 WebContentsImpl::GetBrowserPluginGuestManager() const { | 3543 WebContentsImpl::GetBrowserPluginGuestManager() const { |
| 3540 return static_cast<BrowserPluginGuestManager*>( | 3544 return static_cast<BrowserPluginGuestManager*>( |
| 3541 GetBrowserContext()->GetUserData( | 3545 GetBrowserContext()->GetUserData( |
| 3542 browser_plugin::kBrowserPluginGuestManagerKeyName)); | 3546 browser_plugin::kBrowserPluginGuestManagerKeyName)); |
| 3543 } | 3547 } |
| 3544 | 3548 |
| 3545 } // namespace content | 3549 } // namespace content |
| OLD | NEW |