OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 void NTPLoginHandler::HandleShowSyncLoginUI(const ListValue* args) { | 67 void NTPLoginHandler::HandleShowSyncLoginUI(const ListValue* args) { |
68 Profile* profile = Profile::FromWebUI(web_ui_); | 68 Profile* profile = Profile::FromWebUI(web_ui_); |
69 std::string username = profile->GetPrefs()->GetString( | 69 std::string username = profile->GetPrefs()->GetString( |
70 prefs::kGoogleServicesUsername); | 70 prefs::kGoogleServicesUsername); |
71 | 71 |
72 if (username.empty()) { | 72 if (username.empty()) { |
73 // The user isn't signed in, show the sync promo. | 73 // The user isn't signed in, show the sync promo. |
74 if (SyncPromoUI::ShouldShowSyncPromo(profile)) { | 74 if (SyncPromoUI::ShouldShowSyncPromo(profile)) { |
75 web_ui_->tab_contents()->OpenURL(GURL(chrome::kChromeUISyncPromoURL), | 75 web_ui_->tab_contents()->OpenURL(GURL(chrome::kChromeUISyncPromoURL), |
76 GURL(), CURRENT_TAB, | 76 GURL(), CURRENT_TAB, |
77 PageTransition::LINK); | 77 content::PAGE_TRANSITION_LINK); |
78 } | 78 } |
79 } else if (args->GetSize() == 4) { | 79 } else if (args->GetSize() == 4) { |
80 // The user is signed in, show the profiles menu. | 80 // The user is signed in, show the profiles menu. |
81 Browser* browser = GetBrowser(); | 81 Browser* browser = GetBrowser(); |
82 if (!browser) | 82 if (!browser) |
83 return; | 83 return; |
84 double x = 0; | 84 double x = 0; |
85 double y = 0; | 85 double y = 0; |
86 double width = 0; | 86 double width = 0; |
87 double height = 0; | 87 double height = 0; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 } | 137 } |
138 | 138 |
139 Browser* NTPLoginHandler::GetBrowser() { | 139 Browser* NTPLoginHandler::GetBrowser() { |
140 for (TabContentsIterator it; !it.done(); ++it) { | 140 for (TabContentsIterator it; !it.done(); ++it) { |
141 TabContents* tab = it->tab_contents(); | 141 TabContents* tab = it->tab_contents(); |
142 if (tab == web_ui_->tab_contents()) | 142 if (tab == web_ui_->tab_contents()) |
143 return it.browser(); | 143 return it.browser(); |
144 } | 144 } |
145 return NULL; | 145 return NULL; |
146 } | 146 } |
OLD | NEW |