OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/new_tab_page_sync_handler.h" | 5 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 waiting_for_initial_page_load_ = false; | 87 waiting_for_initial_page_load_ = false; |
88 BuildAndSendSyncStatus(); | 88 BuildAndSendSyncStatus(); |
89 } | 89 } |
90 | 90 |
91 void NewTabPageSyncHandler::HideSyncStatusSection() { | 91 void NewTabPageSyncHandler::HideSyncStatusSection() { |
92 SendSyncMessageToPage(HIDE, std::string(), std::string()); | 92 SendSyncMessageToPage(HIDE, std::string(), std::string()); |
93 } | 93 } |
94 | 94 |
95 void NewTabPageSyncHandler::BuildAndSendSyncStatus() { | 95 void NewTabPageSyncHandler::BuildAndSendSyncStatus() { |
96 DCHECK(!waiting_for_initial_page_load_); | 96 DCHECK(!waiting_for_initial_page_load_); |
97 SigninManager* signin = SigninManagerFactory::GetForProfile( | 97 SigninManagerBase* signin = SigninManagerFactory::GetForProfile( |
98 Profile::FromWebUI(web_ui())); | 98 Profile::FromWebUI(web_ui())); |
99 | 99 |
100 // Hide the sync status section if sync is managed or disabled entirely. | 100 // Hide the sync status section if sync is managed or disabled entirely. |
101 if (!sync_service_ || | 101 if (!sync_service_ || |
102 sync_service_->IsManaged() || | 102 sync_service_->IsManaged() || |
103 !signin || | 103 !signin || |
104 !signin->IsSigninAllowed()) { | 104 !signin->IsSigninAllowed()) { |
105 HideSyncStatusSection(); | 105 HideSyncStatusSection(); |
106 return; | 106 return; |
107 } | 107 } |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (linkurl.empty()) { | 201 if (linkurl.empty()) { |
202 value.SetBoolean("linkurlisset", false); | 202 value.SetBoolean("linkurlisset", false); |
203 } else { | 203 } else { |
204 value.SetBoolean("linkurlisset", true); | 204 value.SetBoolean("linkurlisset", true); |
205 value.SetString("linkurl", linkurl); | 205 value.SetString("linkurl", linkurl); |
206 } | 206 } |
207 } | 207 } |
208 } | 208 } |
209 web_ui()->CallJavascriptFunction("ntp.syncMessageChanged", value); | 209 web_ui()->CallJavascriptFunction("ntp.syncMessageChanged", value); |
210 } | 210 } |
OLD | NEW |