summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorkuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-29 16:41:53 +0000
committerkuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-29 16:41:53 +0000
commit8db841ac0528a7eba71e89260526da9ba33dbb54 (patch)
tree79501d52aa828b2bbaf87e91064f978851d702d2 /chrome/browser/renderer_host
parent89e29d25efa776ed1f564e576d764fd3e9ddecfc (diff)
downloadchromium_src-8db841ac0528a7eba71e89260526da9ba33dbb54.zip
chromium_src-8db841ac0528a7eba71e89260526da9ba33dbb54.tar.gz
chromium_src-8db841ac0528a7eba71e89260526da9ba33dbb54.tar.bz2
implement error state for translate infobar
- this cl implements the UI on Windows and the partial backend of IPC messaging to include error type - implement error state - add translate error types - use a structure as details for IPC messaging between render view and browser so as to include error type (was using std::pair) - translate delegate handles error state and provides mapping to error messages - infobar handles visual error states - modify background painting to handle normal and error backgrounds, and animation of cross-fading between the 2 backgrounds - infobar now stores state (and translation_pending flag) that it's currently displaying to user, instead of just relying on TransateInfoBarDelegate's - if infobar receives PAGE_TRANSLAED notification before delegate does (possible because order is not fixed), delegate's state won't be updated to be used by infobar. - after all the observers have received the notification, both infobar and delegate will end up with matching states, so there's no worries of out-of-sync. - update unittests accordingly - update mac and linux code accordingly to make build pass - jay will implement the remaining backend to pass actual translate error types to the IPC message (tracked by bug 37778) BUG=38548 TEST=none yet, until bug 37778 is also fixed. Review URL: http://codereview.chromium.org/1321003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/render_view_host.cc8
-rw-r--r--chrome/browser/renderer_host/render_view_host.h4
-rw-r--r--chrome/browser/renderer_host/render_view_host_delegate.h4
3 files changed, 11 insertions, 5 deletions
diff --git a/chrome/browser/renderer_host/render_view_host.cc b/chrome/browser/renderer_host/render_view_host.cc
index 548410b..c8c4df0 100644
--- a/chrome/browser/renderer_host/render_view_host.cc
+++ b/chrome/browser/renderer_host/render_view_host.cc
@@ -37,6 +37,7 @@
#include "chrome/common/result_codes.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/thumbnail_score.h"
+#include "chrome/common/translate_errors.h"
#include "chrome/common/url_constants.h"
#include "gfx/native_widget_types.h"
#include "net/base/net_util.h"
@@ -1849,13 +1850,14 @@ void RenderViewHost::OnPageContents(const GURL& url,
void RenderViewHost::OnPageTranslated(int32 page_id,
const std::string& original_lang,
- const std::string& translated_lang) {
+ const std::string& translated_lang,
+ TranslateErrors::Type error_type) {
RenderViewHostDelegate::BrowserIntegration* integration_delegate =
delegate_->GetBrowserIntegrationDelegate();
if (!integration_delegate)
return;
- integration_delegate->OnPageTranslated(page_id,
- original_lang, translated_lang);
+ integration_delegate->OnPageTranslated(page_id, original_lang,
+ translated_lang, error_type);
}
void RenderViewHost::OnContentBlocked(ContentSettingsType type) {
diff --git a/chrome/browser/renderer_host/render_view_host.h b/chrome/browser/renderer_host/render_view_host.h
index 96b314c..d628a79 100644
--- a/chrome/browser/renderer_host/render_view_host.h
+++ b/chrome/browser/renderer_host/render_view_host.h
@@ -13,6 +13,7 @@
#include "chrome/browser/renderer_host/render_widget_host.h"
#include "chrome/common/content_settings_types.h"
#include "chrome/common/page_zoom.h"
+#include "chrome/common/translate_errors.h"
#include "chrome/common/view_types.h"
#include "net/base/load_states.h"
#include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h"
@@ -618,7 +619,8 @@ class RenderViewHost : public RenderWidgetHost {
const std::string& language);
void OnPageTranslated(int32 page_id,
const std::string& original_lang,
- const std::string& translated_lang);
+ const std::string& translated_lang,
+ TranslateErrors::Type error_type);
void OnContentBlocked(ContentSettingsType type);
diff --git a/chrome/browser/renderer_host/render_view_host_delegate.h b/chrome/browser/renderer_host/render_view_host_delegate.h
index 3ac57b9..8c9127b 100644
--- a/chrome/browser/renderer_host/render_view_host_delegate.h
+++ b/chrome/browser/renderer_host/render_view_host_delegate.h
@@ -11,6 +11,7 @@
#include "base/basictypes.h"
#include "base/string16.h"
#include "chrome/common/content_settings_types.h"
+#include "chrome/common/translate_errors.h"
#include "chrome/common/view_types.h"
#include "net/base/load_states.h"
#include "third_party/WebKit/WebKit/chromium/public/WebDragOperation.h"
@@ -234,7 +235,8 @@ class RenderViewHostDelegate {
// Notification that the page has been translated.
virtual void OnPageTranslated(int32 page_id,
const std::string& original_lang,
- const std::string& translated_lang) = 0;
+ const std::string& translated_lang,
+ TranslateErrors::Type error_type) = 0;
};
// Resource ------------------------------------------------------------------