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

Unified Diff: chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc

Issue 18603006: Bookmark sync promo for Views. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test for CrOS Created 7 years, 5 months 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
Index: chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc
diff --git a/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc b/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9ac9c8c4d5546c1f7ccd68baa02a21274e832cce
--- /dev/null
+++ b/chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.cc
@@ -0,0 +1,48 @@
+// Copyright 2013 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.
+
+#include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h"
+
+#include "chrome/browser/ui/browser.h"
+#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/chrome_pages.h"
+#include "chrome/browser/ui/sync/sync_promo_ui.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
+
+BookmarkBubbleSignInDelegate::BookmarkBubbleSignInDelegate(Browser* browser)
+ : browser_(browser),
+ profile_(browser->profile()),
+ desktop_type_(browser->host_desktop_type()) {
+ BrowserList::AddObserver(this);
+}
+
+BookmarkBubbleSignInDelegate::~BookmarkBubbleSignInDelegate() {
+ BrowserList::RemoveObserver(this);
+}
+
+void BookmarkBubbleSignInDelegate::OnSignInLinkClicked() {
+ EnsureBrowser();
+ chrome::ShowBrowserSignin(browser_, SyncPromoUI::SOURCE_BOOKMARK_BUBBLE);
+ DCHECK(!browser_->tab_strip_model()->empty());
+ browser_->window()->Show();
+}
+
+void BookmarkBubbleSignInDelegate::OnBrowserRemoved(Browser* browser) {
+ if (browser == browser_)
+ browser_ = NULL;
+}
+
+void BookmarkBubbleSignInDelegate::EnsureBrowser() {
+ if (!browser_) {
+ Profile* original_profile = profile_->GetOriginalProfile();
+ browser_ = chrome::FindLastActiveWithProfile(original_profile,
+ desktop_type_);
+ if (!browser_) {
+ browser_ = new Browser(Browser::CreateParams(original_profile,
+ desktop_type_));
+ }
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698