Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chrome/browser/ui/bookmarks/bookmark_bubble_sign_in_delegate.h" | |
| 6 | |
| 7 #include "chrome/browser/ui/browser.h" | |
| 8 #include "chrome/browser/ui/browser_finder.h" | |
| 9 #include "chrome/browser/ui/browser_list.h" | |
| 10 #include "chrome/browser/ui/browser_window.h" | |
| 11 #include "chrome/browser/ui/chrome_pages.h" | |
| 12 #include "chrome/browser/ui/sync/sync_promo_ui.h" | |
| 13 | |
| 14 BookmarkBubbleSignInDelegate::BookmarkBubbleSignInDelegate(Browser* browser) | |
| 15 : browser_(browser), | |
| 16 profile_(browser->profile()), | |
| 17 desktop_type_(browser->host_desktop_type()) { | |
| 18 BrowserList::AddObserver(this); | |
| 19 } | |
| 20 | |
| 21 BookmarkBubbleSignInDelegate::~BookmarkBubbleSignInDelegate() { | |
| 22 BrowserList::RemoveObserver(this); | |
| 23 } | |
| 24 | |
| 25 void BookmarkBubbleSignInDelegate::OnSignInLinkClicked() { | |
| 26 EnsureBrowser(); | |
| 27 chrome::ShowBrowserSignin(browser_, SyncPromoUI::SOURCE_BOOKMARK_BUBBLE); | |
| 28 } | |
| 29 | |
| 30 void BookmarkBubbleSignInDelegate::OnBrowserRemoved(Browser* browser) { | |
| 31 if (browser == browser_) | |
| 32 browser_ = NULL; | |
| 33 } | |
| 34 | |
| 35 void BookmarkBubbleSignInDelegate::EnsureBrowser() { | |
| 36 if (!browser_) { | |
| 37 browser_ = chrome::FindLastActiveWithProfile(profile_, desktop_type_); | |
| 38 if (!browser_) { | |
| 39 browser_ = new Browser(Browser::CreateParams(profile_, | |
|
sky
2013/07/17 21:42:54
Does this do the right thing if profile_ is OTR?
fdoray
2013/07/17 23:22:53
Done. The new code prevents the creation of 1 inco
| |
| 40 desktop_type_)); | |
| 41 } | |
| 42 browser_->window()->Show(); | |
| 43 } | |
| 44 } | |
| OLD | NEW |