| 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/mock_content_browser_client.h" | 5 #include "content/browser/mock_content_browser_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "content/test/test_web_contents_view.h" | 11 #include "content/test/test_web_contents_view.h" |
| 12 #include "googleurl/src/gurl.h" | 12 #include "googleurl/src/gurl.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | 13 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 #include "ui/base/clipboard/clipboard.h" | 14 #include "ui/base/clipboard/clipboard.h" |
| 15 | 15 |
| 16 namespace content { | 16 namespace content { |
| 17 | 17 |
| 18 MockContentBrowserClient::MockContentBrowserClient() { | 18 MockContentBrowserClient::MockContentBrowserClient() { |
| 19 } | 19 } |
| 20 | 20 |
| 21 MockContentBrowserClient::~MockContentBrowserClient() { | 21 MockContentBrowserClient::~MockContentBrowserClient() { |
| 22 } | 22 } |
| 23 | 23 |
| 24 BrowserMainParts* MockContentBrowserClient::CreateBrowserMainParts( | 24 BrowserMainParts* MockContentBrowserClient::CreateBrowserMainParts( |
| 25 const content::MainFunctionParams& parameters) { | 25 const MainFunctionParams& parameters) { |
| 26 return NULL; | 26 return NULL; |
| 27 } | 27 } |
| 28 | 28 |
| 29 WebContentsView* MockContentBrowserClient::CreateWebContentsView( | 29 WebContentsView* MockContentBrowserClient::CreateWebContentsView( |
| 30 WebContents* web_contents) { | 30 WebContents* web_contents) { |
| 31 return new TestWebContentsView; | 31 return new TestWebContentsView; |
| 32 } | 32 } |
| 33 | 33 |
| 34 void MockContentBrowserClient::RenderViewHostCreated( | 34 void MockContentBrowserClient::RenderViewHostCreated( |
| 35 RenderViewHost* render_view_host) { | 35 RenderViewHost* render_view_host) { |
| 36 } | 36 } |
| 37 | 37 |
| 38 void MockContentBrowserClient::RenderProcessHostCreated( | 38 void MockContentBrowserClient::RenderProcessHostCreated( |
| 39 RenderProcessHost* host) { | 39 RenderProcessHost* host) { |
| 40 } | 40 } |
| 41 | 41 |
| 42 WebUIControllerFactory* MockContentBrowserClient::GetWebUIControllerFactory() { | 42 WebUIControllerFactory* MockContentBrowserClient::GetWebUIControllerFactory() { |
| 43 return NULL; | 43 return NULL; |
| 44 } | 44 } |
| 45 | 45 |
| 46 GURL MockContentBrowserClient::GetEffectiveURL( | 46 GURL MockContentBrowserClient::GetEffectiveURL(BrowserContext* browser_context, |
| 47 content::BrowserContext* browser_context, const GURL& url) { | 47 const GURL& url) { |
| 48 return url; | 48 return url; |
| 49 } | 49 } |
| 50 | 50 |
| 51 bool MockContentBrowserClient::ShouldUseProcessPerSite( | 51 bool MockContentBrowserClient::ShouldUseProcessPerSite( |
| 52 BrowserContext* browser_context, const GURL& effective_url) { | 52 BrowserContext* browser_context, const GURL& effective_url) { |
| 53 return false; | 53 return false; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool MockContentBrowserClient::IsHandledURL(const GURL& url) { | 56 bool MockContentBrowserClient::IsHandledURL(const GURL& url) { |
| 57 return false; | 57 return false; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 88 } | 88 } |
| 89 | 89 |
| 90 void MockContentBrowserClient::AppendExtraCommandLineSwitches( | 90 void MockContentBrowserClient::AppendExtraCommandLineSwitches( |
| 91 CommandLine* command_line, int child_process_id) { | 91 CommandLine* command_line, int child_process_id) { |
| 92 } | 92 } |
| 93 | 93 |
| 94 std::string MockContentBrowserClient::GetApplicationLocale() { | 94 std::string MockContentBrowserClient::GetApplicationLocale() { |
| 95 return std::string(); | 95 return std::string(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 std::string MockContentBrowserClient::GetAcceptLangs( | 98 std::string MockContentBrowserClient::GetAcceptLangs(BrowserContext* context) { |
| 99 content::BrowserContext* context) { | |
| 100 return std::string(); | 99 return std::string(); |
| 101 } | 100 } |
| 102 | 101 |
| 103 SkBitmap* MockContentBrowserClient::GetDefaultFavicon() { | 102 SkBitmap* MockContentBrowserClient::GetDefaultFavicon() { |
| 104 static SkBitmap empty; | 103 static SkBitmap empty; |
| 105 return ∅ | 104 return ∅ |
| 106 } | 105 } |
| 107 | 106 |
| 108 bool MockContentBrowserClient::AllowAppCache( | 107 bool MockContentBrowserClient::AllowAppCache(const GURL& manifest_url, |
| 109 const GURL& manifest_url, const GURL& first_party, | 108 const GURL& first_party, |
| 110 content::ResourceContext* context) { | 109 ResourceContext* context) { |
| 111 return true; | 110 return true; |
| 112 } | 111 } |
| 113 | 112 |
| 114 bool MockContentBrowserClient::AllowGetCookie( | 113 bool MockContentBrowserClient::AllowGetCookie( |
| 115 const GURL& url, | 114 const GURL& url, |
| 116 const GURL& first_party, | 115 const GURL& first_party, |
| 117 const net::CookieList& cookie_list, | 116 const net::CookieList& cookie_list, |
| 118 content::ResourceContext* context, | 117 ResourceContext* context, |
| 119 int render_process_id, | 118 int render_process_id, |
| 120 int render_view_id) { | 119 int render_view_id) { |
| 121 return true; | 120 return true; |
| 122 } | 121 } |
| 123 | 122 |
| 124 bool MockContentBrowserClient::AllowSetCookie( | 123 bool MockContentBrowserClient::AllowSetCookie(const GURL& url, |
| 125 const GURL& url, | 124 const GURL& first_party, |
| 126 const GURL& first_party, | 125 const std::string& cookie_line, |
| 127 const std::string& cookie_line, | 126 ResourceContext* context, |
| 128 content::ResourceContext* context, | 127 int render_process_id, |
| 129 int render_process_id, | 128 int render_view_id, |
| 130 int render_view_id, | 129 net::CookieOptions* options) { |
| 131 net::CookieOptions* options) { | |
| 132 return true; | 130 return true; |
| 133 } | 131 } |
| 134 | 132 |
| 135 bool MockContentBrowserClient::AllowSaveLocalState( | 133 bool MockContentBrowserClient::AllowSaveLocalState(ResourceContext* context) { |
| 136 content::ResourceContext* context) { | |
| 137 return true; | 134 return true; |
| 138 } | 135 } |
| 139 | 136 |
| 140 bool MockContentBrowserClient::AllowWorkerDatabase( | 137 bool MockContentBrowserClient::AllowWorkerDatabase( |
| 141 const GURL& url, | 138 const GURL& url, |
| 142 const string16& name, | 139 const string16& name, |
| 143 const string16& display_name, | 140 const string16& display_name, |
| 144 unsigned long estimated_size, | 141 unsigned long estimated_size, |
| 145 content::ResourceContext* context, | 142 ResourceContext* context, |
| 146 const std::vector<std::pair<int, int> >& render_views) { | 143 const std::vector<std::pair<int, int> >& render_views) { |
| 147 return true; | 144 return true; |
| 148 } | 145 } |
| 149 | 146 |
| 150 bool MockContentBrowserClient::AllowWorkerFileSystem( | 147 bool MockContentBrowserClient::AllowWorkerFileSystem( |
| 151 const GURL& url, | 148 const GURL& url, |
| 152 content::ResourceContext* context, | 149 ResourceContext* context, |
| 153 const std::vector<std::pair<int, int> >& render_views) { | 150 const std::vector<std::pair<int, int> >& render_views) { |
| 154 return true; | 151 return true; |
| 155 } | 152 } |
| 156 | 153 |
| 157 QuotaPermissionContext* | 154 QuotaPermissionContext* |
| 158 MockContentBrowserClient::CreateQuotaPermissionContext() { | 155 MockContentBrowserClient::CreateQuotaPermissionContext() { |
| 159 return NULL; | 156 return NULL; |
| 160 } | 157 } |
| 161 | 158 |
| 162 net::URLRequestContext* MockContentBrowserClient::OverrideRequestContextForURL( | 159 net::URLRequestContext* MockContentBrowserClient::OverrideRequestContextForURL( |
| 163 const GURL& url, content::ResourceContext* context) { | 160 const GURL& url, ResourceContext* context) { |
| 164 return NULL; | 161 return NULL; |
| 165 } | 162 } |
| 166 | 163 |
| 167 void MockContentBrowserClient::OpenItem(const FilePath& path) { | 164 void MockContentBrowserClient::OpenItem(const FilePath& path) { |
| 168 } | 165 } |
| 169 | 166 |
| 170 void MockContentBrowserClient::ShowItemInFolder(const FilePath& path) { | 167 void MockContentBrowserClient::ShowItemInFolder(const FilePath& path) { |
| 171 } | 168 } |
| 172 | 169 |
| 173 void MockContentBrowserClient::AllowCertificateError( | 170 void MockContentBrowserClient::AllowCertificateError( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 190 } | 187 } |
| 191 | 188 |
| 192 void MockContentBrowserClient::AddNewCertificate( | 189 void MockContentBrowserClient::AddNewCertificate( |
| 193 net::URLRequest* request, | 190 net::URLRequest* request, |
| 194 net::X509Certificate* cert, | 191 net::X509Certificate* cert, |
| 195 int render_process_id, | 192 int render_process_id, |
| 196 int render_view_id) { | 193 int render_view_id) { |
| 197 } | 194 } |
| 198 | 195 |
| 199 void MockContentBrowserClient::RequestMediaAccessPermission( | 196 void MockContentBrowserClient::RequestMediaAccessPermission( |
| 200 const content::MediaStreamRequest* request, | 197 const MediaStreamRequest* request, |
| 201 const content::MediaResponseCallback& callback) { | 198 const MediaResponseCallback& callback) { |
| 202 } | 199 } |
| 203 | 200 |
| 204 void MockContentBrowserClient::RequestDesktopNotificationPermission( | 201 void MockContentBrowserClient::RequestDesktopNotificationPermission( |
| 205 const GURL& source_origin, | 202 const GURL& source_origin, |
| 206 int callback_context, | 203 int callback_context, |
| 207 int render_process_id, | 204 int render_process_id, |
| 208 int render_view_id) { | 205 int render_view_id) { |
| 209 } | 206 } |
| 210 | 207 |
| 211 WebKit::WebNotificationPresenter::Permission | 208 WebKit::WebNotificationPresenter::Permission |
| 212 MockContentBrowserClient::CheckDesktopNotificationPermission( | 209 MockContentBrowserClient::CheckDesktopNotificationPermission( |
| 213 const GURL& source_origin, | 210 const GURL& source_origin, |
| 214 content::ResourceContext* context, | 211 ResourceContext* context, |
| 215 int render_process_id) { | 212 int render_process_id) { |
| 216 return WebKit::WebNotificationPresenter::PermissionAllowed; | 213 return WebKit::WebNotificationPresenter::PermissionAllowed; |
| 217 } | 214 } |
| 218 | 215 |
| 219 void MockContentBrowserClient::ShowDesktopNotification( | 216 void MockContentBrowserClient::ShowDesktopNotification( |
| 220 const content::ShowDesktopNotificationHostMsgParams& params, | 217 const ShowDesktopNotificationHostMsgParams& params, |
| 221 int render_process_id, | 218 int render_process_id, |
| 222 int render_view_id, | 219 int render_view_id, |
| 223 bool worker) { | 220 bool worker) { |
| 224 } | 221 } |
| 225 | 222 |
| 226 void MockContentBrowserClient::CancelDesktopNotification( | 223 void MockContentBrowserClient::CancelDesktopNotification( |
| 227 int render_process_id, | 224 int render_process_id, |
| 228 int render_view_id, | 225 int render_view_id, |
| 229 int notification_id) { | 226 int notification_id) { |
| 230 } | 227 } |
| 231 | 228 |
| 232 bool MockContentBrowserClient::CanCreateWindow( | 229 bool MockContentBrowserClient::CanCreateWindow( |
| 233 const GURL& source_origin, | 230 const GURL& source_origin, |
| 234 WindowContainerType container_type, | 231 WindowContainerType container_type, |
| 235 content::ResourceContext* context, | 232 ResourceContext* context, |
| 236 int render_process_id) { | 233 int render_process_id) { |
| 237 return true; | 234 return true; |
| 238 } | 235 } |
| 239 | 236 |
| 240 std::string MockContentBrowserClient::GetWorkerProcessTitle( | 237 std::string MockContentBrowserClient::GetWorkerProcessTitle( |
| 241 const GURL& url, content::ResourceContext* context) { | 238 const GURL& url, ResourceContext* context) { |
| 242 return std::string(); | 239 return std::string(); |
| 243 } | 240 } |
| 244 | 241 |
| 245 void MockContentBrowserClient::ResourceDispatcherHostCreated() { | 242 void MockContentBrowserClient::ResourceDispatcherHostCreated() { |
| 246 } | 243 } |
| 247 | 244 |
| 248 SpeechInputManagerDelegate* | 245 SpeechInputManagerDelegate* |
| 249 MockContentBrowserClient::GetSpeechInputManagerDelegate() { | 246 MockContentBrowserClient::GetSpeechInputManagerDelegate() { |
| 250 return NULL; | 247 return NULL; |
| 251 } | 248 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 #endif | 315 #endif |
| 319 | 316 |
| 320 #if defined(USE_NSS) | 317 #if defined(USE_NSS) |
| 321 crypto::CryptoModuleBlockingPasswordDelegate* | 318 crypto::CryptoModuleBlockingPasswordDelegate* |
| 322 MockContentBrowserClient::GetCryptoPasswordDelegate(const GURL& url) { | 319 MockContentBrowserClient::GetCryptoPasswordDelegate(const GURL& url) { |
| 323 return NULL; | 320 return NULL; |
| 324 } | 321 } |
| 325 #endif | 322 #endif |
| 326 | 323 |
| 327 } // namespace content | 324 } // namespace content |
| OLD | NEW |