Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4132)

Unified Diff: chrome/browser/views/bookmark_manager_view.cc

Issue 452024: Manually merge r33152 into the 249 branch. The merge could not be done automa... (Closed) Base URL: svn://chrome-svn/chrome/branches/249/src/
Patch Set: Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/views/bookmark_manager_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/bookmark_manager_view.cc
===================================================================
--- chrome/browser/views/bookmark_manager_view.cc (revision 33366)
+++ chrome/browser/views/bookmark_manager_view.cc (working copy)
@@ -9,6 +9,7 @@
#include "app/gfx/canvas.h"
#include "app/gfx/color_utils.h"
#include "app/l10n_util.h"
+#include "app/resource_bundle.h"
#include "base/keyboard_codes.h"
#include "base/thread.h"
#include "chrome/browser/bookmarks/bookmark_folder_tree_model.h"
@@ -31,6 +32,7 @@
#include "chrome/common/pref_service.h"
#include "grit/generated_resources.h"
#include "grit/locale_settings.h"
+#include "grit/theme_resources.h"
#include "skia/ext/skia_utils.h"
#include "third_party/skia/include/core/SkShader.h"
#include "views/controls/button/menu_button.h"
@@ -167,6 +169,7 @@
tree_view_(NULL),
sync_status_button_(NULL),
sync_service_(NULL),
+ sync_relogin_required_(false),
ALLOW_THIS_IN_INITIALIZER_LIST(search_factory_(this)) {
search_tf_ = new views::Textfield();
search_tf_->set_default_width_in_chars(30);
@@ -512,8 +515,13 @@
void BookmarkManagerView::ButtonPressed(views::Button* sender,
const views::Event& event) {
if (sender == sync_status_button_) {
- UserMetrics::RecordAction(L"BookmarkManager_Sync", profile_);
- OpenSyncMyBookmarksDialog();
+ if (sync_relogin_required_) {
+ DCHECK(sync_service_);
+ sync_service_->ShowLoginDialog();
+ } else {
+ UserMetrics::RecordAction(L"BookmarkManager_Sync", profile_);
+ OpenSyncMyBookmarksDialog();
+ }
}
}
@@ -816,18 +824,38 @@
void BookmarkManagerView::UpdateSyncStatus() {
DCHECK(sync_service_);
- std::wstring status_label;
- std::wstring link_label;
- bool synced = SyncStatusUIHelper::GetLabels(sync_service_,
- &status_label, &link_label) == SyncStatusUIHelper::SYNCED;
+ string16 status_label;
+ string16 link_label;
+ sync_relogin_required_ = SyncStatusUIHelper::GetLabels(sync_service_,
+ &status_label, &link_label) == SyncStatusUIHelper::SYNC_ERROR;
+ if (sync_relogin_required_) {
+ sync_status_button_->SetText(
+ l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR));
+ // The tooltip is the only way we have to display text explaining the error
+ // to the user.
+ sync_status_button_->SetTooltipText(
+ l10n_util::GetString(IDS_SYNC_BOOKMARK_BAR_ERROR_DESC));
+ sync_status_button_->SetAccessibleName(
+ l10n_util::GetString(IDS_ACCNAME_SYNC_ERROR_BUTTON));
+ sync_status_button_->SetIcon(
+ *ResourceBundle::GetSharedInstance().GetBitmapNamed(IDR_WARNING));
+ sync_status_button_->GetParent()->Layout();
+ return;
+ }
+
if (sync_service_->HasSyncSetupCompleted()) {
std::wstring username = sync_service_->GetAuthenticatedUsername();
status_label = l10n_util::GetStringF(IDS_SYNC_NTP_SYNCED_TO, username);
- } else if (!sync_service_->SetupInProgress() && !synced) {
+ } else if (sync_service_->SetupInProgress()) {
+ status_label = l10n_util::GetString(IDS_SYNC_NTP_SETUP_IN_PROGRESS);
+ } else {
status_label = l10n_util::GetString(IDS_SYNC_START_SYNC_BUTTON_LABEL);
}
sync_status_button_->SetText(status_label);
+ sync_status_button_->SetTooltipText(L"");
+ sync_status_button_->SetAccessibleName(L"");
+ sync_status_button_->SetIcon(SkBitmap());
sync_status_button_->GetParent()->Layout();
}
« no previous file with comments | « chrome/browser/views/bookmark_manager_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698