| Index: chrome/browser/ui/webui/ntp/ntp_login_handler.cc
|
| diff --git a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
|
| index 144c75e19d831574775b37690dba5d58ac3c971f..ea4ba5038b396e9037eb8064ebc579e6d4b836d0 100644
|
| --- a/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
|
| +++ b/chrome/browser/ui/webui/ntp/ntp_login_handler.cc
|
| @@ -13,6 +13,10 @@
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/sync/profile_sync_service.h"
|
| #include "chrome/browser/sync/sync_setup_flow.h"
|
| +#include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
|
| +#include "chrome/browser/ui/browser.h"
|
| +#include "chrome/browser/ui/browser_list.h"
|
| +#include "chrome/browser/ui/browser_window.h"
|
| #include "chrome/browser/ui/webui/sync_promo_ui.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| #include "chrome/common/pref_names.h"
|
| @@ -60,16 +64,24 @@ void NTPLoginHandler::HandleLoginContainerClicked(const ListValue* args) {
|
| Profile* profile = Profile::FromWebUI(web_ui_);
|
| std::string username = profile->GetPrefs()->GetString(
|
| prefs::kGoogleServicesUsername);
|
| +
|
| if (username.empty()) {
|
| // The user isn't signed in, show the sync promo.
|
| if (SyncPromoUI::ShouldShowSyncPromo()) {
|
| - web_ui_->tab_contents()->OpenURL(GURL(chrome::kChromeUISyncPromoURL),
|
| - GURL(), CURRENT_TAB,
|
| - PageTransition::LINK);
|
| + web_ui_->tab_contents()->OpenURL(GURL(chrome::kChromeUISyncPromoURL),
|
| + GURL(), CURRENT_TAB,
|
| + PageTransition::LINK);
|
| }
|
| - } else {
|
| + } else if (args->GetSize() == 2) {
|
| // The user is signed in, show the profiles menu.
|
| - // TODO(sail): Need to implement this.
|
| + double x = 0;
|
| + double y = 0;
|
| + CHECK(args->GetDouble(0, &x));
|
| + CHECK(args->GetDouble(1, &y));
|
| + Browser* browser = GetBrowser();
|
| + if (!browser)
|
| + return;
|
| + browser->window()->ShowAvatarBubble(web_ui_->tab_contents(), x, y);
|
| }
|
| }
|
|
|
| @@ -100,3 +112,12 @@ bool NTPLoginHandler::ShouldShow(Profile* profile) {
|
|
|
| return profile->GetOriginalProfile()->IsSyncAccessible();
|
| }
|
| +
|
| +Browser* NTPLoginHandler::GetBrowser() {
|
| + for (TabContentsIterator it; !it.done(); ++it) {
|
| + TabContents* tab = it->tab_contents();
|
| + if (tab == web_ui_->tab_contents())
|
| + return it.browser();
|
| + }
|
| + return NULL;
|
| +}
|
|
|