diff options
author | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-29 16:41:53 +0000 |
---|---|---|
committer | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-29 16:41:53 +0000 |
commit | 8db841ac0528a7eba71e89260526da9ba33dbb54 (patch) | |
tree | 79501d52aa828b2bbaf87e91064f978851d702d2 /chrome/common | |
parent | 89e29d25efa776ed1f564e576d764fd3e9ddecfc (diff) | |
download | chromium_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/common')
-rw-r--r-- | chrome/common/render_messages.h | 6 | ||||
-rw-r--r-- | chrome/common/render_messages_internal.h | 10 | ||||
-rw-r--r-- | chrome/common/translate_errors.h | 24 |
3 files changed, 36 insertions, 4 deletions
diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 8274846..808f668 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -26,6 +26,7 @@ #include "chrome/common/page_transition_types.h" #include "chrome/common/renderer_preferences.h" #include "chrome/common/resource_response.h" +#include "chrome/common/translate_errors.h" #include "chrome/common/view_types.h" #include "chrome/common/webkit_param_traits.h" #include "gfx/native_widget_types.h" @@ -2660,6 +2661,11 @@ struct ParamTraits<ViewHostMsg_TranslateTextParam> { } }; +template <> +struct SimilarTypeTraits<TranslateErrors::Type> { + typedef int Type; +}; + } // namespace IPC diff --git a/chrome/common/render_messages_internal.h b/chrome/common/render_messages_internal.h index c06da08..94f2fcb 100644 --- a/chrome/common/render_messages_internal.h +++ b/chrome/common/render_messages_internal.h @@ -23,6 +23,7 @@ #include "chrome/common/nacl_types.h" #include "chrome/common/notification_type.h" #include "chrome/common/page_zoom.h" +#include "chrome/common/translate_errors.h" #include "gfx/rect.h" #include "ipc/ipc_channel_handle.h" #include "ipc/ipc_message.h" @@ -2162,10 +2163,11 @@ IPC_BEGIN_MESSAGES(ViewHost) std::string /* the language */) // Notifies the browser that a page has been translated. - IPC_MESSAGE_ROUTED3(ViewHostMsg_PageTranslated, - int, /* page id */ - std::string /* the original language */, - std::string /* the translated language */) + IPC_MESSAGE_ROUTED4(ViewHostMsg_PageTranslated, + int, /* page id */ + std::string /* the original language */, + std::string /* the translated language */, + TranslateErrors::Type /* the error type if available */) //--------------------------------------------------------------------------- // Socket Stream messages: diff --git a/chrome/common/translate_errors.h b/chrome/common/translate_errors.h new file mode 100644 index 0000000..de2e3bd --- /dev/null +++ b/chrome/common/translate_errors.h @@ -0,0 +1,24 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_COMMON_TRANSLATE_ERRORS_H_ +#define CHROME_COMMON_TRANSLATE_ERRORS_H_ + +// This file consolidates all the error types for translation of a page. + +class TranslateErrors { + public: + enum Type { + NONE = 0, + NETWORK = 1, + SERVER, + }; + + private: + TranslateErrors() {} + + DISALLOW_COPY_AND_ASSIGN(TranslateErrors); +}; + +#endif // CHROME_COMMON_TRANSLATE_ERRORS_H_ |