diff options
author | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-18 02:02:05 +0000 |
---|---|---|
committer | michaeln@chromium.org <michaeln@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-18 02:02:05 +0000 |
commit | 53c570b58354034db920c09d711ed7d9b3429f30 (patch) | |
tree | cec472d625b0fb5cfd338197ab60766c43b37627 /webkit/appcache | |
parent | 2980fdcdf74dd4c25c8718f12f3f147d2581177d (diff) | |
download | chromium_src-53c570b58354034db920c09d711ed7d9b3429f30.zip chromium_src-53c570b58354034db920c09d711ed7d9b3429f30.tar.gz chromium_src-53c570b58354034db920c09d711ed7d9b3429f30.tar.bz2 |
AppCache: add plumbing to deliver logging messages to the renderer process. These messages will be plumbed thru to the console output for the page associated with 'host_id'.BUG=13685TEST=none
Review URL: http://codereview.chromium.org/2861007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50197 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache')
-rw-r--r-- | webkit/appcache/appcache_frontend_impl.cc | 7 | ||||
-rw-r--r-- | webkit/appcache/appcache_frontend_impl.h | 2 | ||||
-rw-r--r-- | webkit/appcache/appcache_group_unittest.cc | 4 | ||||
-rw-r--r-- | webkit/appcache/appcache_host_unittest.cc | 4 | ||||
-rw-r--r-- | webkit/appcache/appcache_interfaces.h | 9 | ||||
-rw-r--r-- | webkit/appcache/appcache_request_handler_unittest.cc | 3 | ||||
-rw-r--r-- | webkit/appcache/appcache_update_job_unittest.cc | 4 | ||||
-rw-r--r-- | webkit/appcache/web_application_cache_host_impl.cc | 6 | ||||
-rw-r--r-- | webkit/appcache/web_application_cache_host_impl.h | 1 |
9 files changed, 39 insertions, 1 deletions
diff --git a/webkit/appcache/appcache_frontend_impl.cc b/webkit/appcache/appcache_frontend_impl.cc index 3535bf1..2365a912d 100644 --- a/webkit/appcache/appcache_frontend_impl.cc +++ b/webkit/appcache/appcache_frontend_impl.cc @@ -53,6 +53,13 @@ void AppCacheFrontendImpl::OnProgressEventRaised( } } +void AppCacheFrontendImpl::OnLogMessage(int host_id, LogLevel log_level, + const std::string& message) { + WebApplicationCacheHostImpl* host = GetHost(host_id); + if (host) + host->OnLogMessage(log_level, message); +} + void AppCacheFrontendImpl::OnContentBlocked(int host_id) { WebApplicationCacheHostImpl* host = GetHost(host_id); if (host) diff --git a/webkit/appcache/appcache_frontend_impl.h b/webkit/appcache/appcache_frontend_impl.h index 99e5c2c..6617082 100644 --- a/webkit/appcache/appcache_frontend_impl.h +++ b/webkit/appcache/appcache_frontend_impl.h @@ -21,6 +21,8 @@ class AppCacheFrontendImpl : public AppCacheFrontend { virtual void OnProgressEventRaised(const std::vector<int>& host_ids, const GURL& url, int num_total, int num_complete); + virtual void OnLogMessage(int host_id, LogLevel log_level, + const std::string& message); virtual void OnContentBlocked(int host_id); }; diff --git a/webkit/appcache/appcache_group_unittest.cc b/webkit/appcache/appcache_group_unittest.cc index b1c7425..a88808d 100644 --- a/webkit/appcache/appcache_group_unittest.cc +++ b/webkit/appcache/appcache_group_unittest.cc @@ -38,6 +38,10 @@ class TestAppCacheFrontend : public appcache::AppCacheFrontend { int num_total, int num_complete) { } + virtual void OnLogMessage(int host_id, appcache::LogLevel log_level, + const std::string& message) { + } + virtual void OnContentBlocked(int host_id) { } diff --git a/webkit/appcache/appcache_host_unittest.cc b/webkit/appcache/appcache_host_unittest.cc index b618ce9..f2e8a04 100644 --- a/webkit/appcache/appcache_host_unittest.cc +++ b/webkit/appcache/appcache_host_unittest.cc @@ -57,6 +57,10 @@ class AppCacheHostTest : public testing::Test { last_event_id_ = PROGRESS_EVENT; } + virtual void OnLogMessage(int host_id, appcache::LogLevel log_level, + const std::string& message) { + } + virtual void OnContentBlocked(int host_id) { } diff --git a/webkit/appcache/appcache_interfaces.h b/webkit/appcache/appcache_interfaces.h index 5f1c369..a57ba67 100644 --- a/webkit/appcache/appcache_interfaces.h +++ b/webkit/appcache/appcache_interfaces.h @@ -44,6 +44,12 @@ enum EventID { OBSOLETE_EVENT }; +enum LogLevel { + LOG_INFO, + LOG_WARNING, + LOG_ERROR, +}; + // Interface used by backend (browser-process) to talk to frontend (renderer). class AppCacheFrontend { public: @@ -57,7 +63,8 @@ class AppCacheFrontend { const GURL& url, int num_total, int num_complete) = 0; virtual void OnContentBlocked(int host_id) = 0; - + virtual void OnLogMessage(int host_id, LogLevel log_level, + const std::string& message) = 0; virtual ~AppCacheFrontend() {} }; diff --git a/webkit/appcache/appcache_request_handler_unittest.cc b/webkit/appcache/appcache_request_handler_unittest.cc index 85db41a..1793209 100644 --- a/webkit/appcache/appcache_request_handler_unittest.cc +++ b/webkit/appcache/appcache_request_handler_unittest.cc @@ -36,6 +36,9 @@ class AppCacheRequestHandlerTest : public testing::Test { const GURL& url, int num_total, int num_complete) {} + virtual void OnLogMessage(int host_id, appcache::LogLevel log_level, + const std::string& message) {} + virtual void OnContentBlocked(int host_id) {} }; diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 665150a..06ac167 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -216,6 +216,10 @@ class MockFrontend : public AppCacheFrontend { } } + virtual void OnLogMessage(int host_id, appcache::LogLevel log_level, + const std::string& message) { + } + virtual void OnContentBlocked(int host_id) { } diff --git a/webkit/appcache/web_application_cache_host_impl.cc b/webkit/appcache/web_application_cache_host_impl.cc index 267f20b..0f1258d 100644 --- a/webkit/appcache/web_application_cache_host_impl.cc +++ b/webkit/appcache/web_application_cache_host_impl.cc @@ -92,6 +92,12 @@ void WebApplicationCacheHostImpl::OnProgressEventRaised( client_->notifyEventListener(WebApplicationCacheHost::ProgressEvent); } +void WebApplicationCacheHostImpl::OnLogMessage( + LogLevel log_level, const std::string& message) { + // TODO(michaeln): Widen the webkit api with this addition. + // client_->notifyLogMessage(log_level, message); +} + void WebApplicationCacheHostImpl::willStartMainResourceRequest( WebURLRequest& request) { request.setAppCacheHostID(host_id_); diff --git a/webkit/appcache/web_application_cache_host_impl.h b/webkit/appcache/web_application_cache_host_impl.h index ccba47e..6f19b0d 100644 --- a/webkit/appcache/web_application_cache_host_impl.h +++ b/webkit/appcache/web_application_cache_host_impl.h @@ -36,6 +36,7 @@ class WebApplicationCacheHostImpl : public WebKit::WebApplicationCacheHost { void OnStatusChanged(appcache::Status); void OnEventRaised(appcache::EventID); void OnProgressEventRaised(const GURL& url, int num_total, int num_complete); + void OnLogMessage(LogLevel log_level, const std::string& message); virtual void OnContentBlocked() {} // WebApplicationCacheHost methods |