| 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/foreign_session_handler.h" | 5 #include "chrome/browser/ui/webui/foreign_session_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 // static | 146 // static |
| 147 OpenTabsUIDelegate* ForeignSessionHandler::GetOpenTabsUIDelegate( | 147 OpenTabsUIDelegate* ForeignSessionHandler::GetOpenTabsUIDelegate( |
| 148 content::WebUI* web_ui) { | 148 content::WebUI* web_ui) { |
| 149 Profile* profile = Profile::FromWebUI(web_ui); | 149 Profile* profile = Profile::FromWebUI(web_ui); |
| 150 ProfileSyncService* service = | 150 ProfileSyncService* service = |
| 151 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 151 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
| 152 | 152 |
| 153 // Only return the delegate if it exists and it is done syncing sessions. | 153 // Only return the delegate if it exists and it is done syncing sessions. |
| 154 if (service && service->SyncActive()) | 154 if (service && service->IsSyncActive()) |
| 155 return service->GetOpenTabsUIDelegate(); | 155 return service->GetOpenTabsUIDelegate(); |
| 156 | 156 |
| 157 return NULL; | 157 return NULL; |
| 158 } | 158 } |
| 159 | 159 |
| 160 void ForeignSessionHandler::RegisterMessages() { | 160 void ForeignSessionHandler::RegisterMessages() { |
| 161 Profile* profile = Profile::FromWebUI(web_ui()); | 161 Profile* profile = Profile::FromWebUI(web_ui()); |
| 162 ProfileSyncService* service = | 162 ProfileSyncService* service = |
| 163 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 163 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
| 164 registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, | 164 registrar_.Add(this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 407 last_synced < base::TimeDelta::FromMinutes(1) ? | 407 last_synced < base::TimeDelta::FromMinutes(1) ? |
| 408 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : | 408 l10n_util::GetStringUTF16(IDS_SYNC_TIME_JUST_NOW) : |
| 409 ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED, | 409 ui::TimeFormat::Simple(ui::TimeFormat::FORMAT_ELAPSED, |
| 410 ui::TimeFormat::LENGTH_SHORT, last_synced)); | 410 ui::TimeFormat::LENGTH_SHORT, last_synced)); |
| 411 dictionary->SetInteger("sessionId", window.window_id.id()); | 411 dictionary->SetInteger("sessionId", window.window_id.id()); |
| 412 dictionary->Set("tabs", tab_values.release()); | 412 dictionary->Set("tabs", tab_values.release()); |
| 413 return true; | 413 return true; |
| 414 } | 414 } |
| 415 | 415 |
| 416 } // namespace browser_sync | 416 } // namespace browser_sync |
| OLD | NEW |