Chromium Code Reviews| 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..7bdc5a3ca23456382471fd36e4d8bedbf79fdd37 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,29 @@ 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() == 4) { |
| // The user is signed in, show the profiles menu. |
| - // TODO(sail): Need to implement this. |
| + Browser* browser = GetBrowser(); |
| + if (!browser) |
| + return; |
| + double x = 0; |
| + double y = 0; |
| + double width = 0; |
| + double height = 0; |
| + CHECK(args->GetDouble(0, &x)); |
|
James Hawkins
2011/10/05 16:37:32
Why are these CHECKs?
sail
2011/10/05 16:40:54
I just copy pasted these from else where. Should I
James Hawkins
2011/10/05 16:43:53
Yes. CHECK should only be used to debug problems i
sail
2011/10/05 16:58:31
Fixed by using DCHECK(success) instead.
|
| + CHECK(args->GetDouble(1, &y)); |
| + CHECK(args->GetDouble(2, &width)); |
| + CHECK(args->GetDouble(3, &height)); |
| + gfx::Rect rect(x, y, width, height); |
| + browser->window()->ShowAvatarBubble(web_ui_->tab_contents(), rect); |
| } |
| } |
| @@ -100,3 +117,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; |
| +} |