Chromium Code Reviews| 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/history_ui.h" | 5 #include "chrome/browser/ui/webui/history_ui.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 226 bool IsLocalOnlyResult(const BrowsingHistoryHandler::HistoryEntry& entry) { | 226 bool IsLocalOnlyResult(const BrowsingHistoryHandler::HistoryEntry& entry) { |
| 227 return entry.entry_type == BrowsingHistoryHandler::HistoryEntry::LOCAL_ENTRY; | 227 return entry.entry_type == BrowsingHistoryHandler::HistoryEntry::LOCAL_ENTRY; |
| 228 } | 228 } |
| 229 | 229 |
| 230 // Gets the name and type of a device for the given sync client ID. | 230 // Gets the name and type of a device for the given sync client ID. |
| 231 // |name| and |type| are out parameters. | 231 // |name| and |type| are out parameters. |
| 232 void GetDeviceNameAndType(const ProfileSyncService* sync_service, | 232 void GetDeviceNameAndType(const ProfileSyncService* sync_service, |
| 233 const std::string& client_id, | 233 const std::string& client_id, |
| 234 std::string* name, | 234 std::string* name, |
| 235 std::string* type) { | 235 std::string* type) { |
| 236 if (sync_service && sync_service->sync_initialized()) { | 236 if (sync_service && sync_service->GetDeviceInfoTracker()) { |
| 237 scoped_ptr<browser_sync::DeviceInfo> device_info = | 237 scoped_ptr<browser_sync::DeviceInfo> device_info = |
| 238 sync_service->GetDeviceInfo(client_id); | 238 sync_service->GetDeviceInfoTracker()->GetDeviceInfo(client_id); |
|
pavely
2014/09/17 23:04:38
Same issue: Under what conditions GetDeviceInfoTra
stanisc
2014/09/18 22:46:54
This one should be fine. GetDeviceInfoTracker() sh
| |
| 239 if (device_info.get()) { | 239 if (device_info.get()) { |
| 240 *name = device_info->client_name(); | 240 *name = device_info->client_name(); |
| 241 switch (device_info->device_type()) { | 241 switch (device_info->device_type()) { |
| 242 case sync_pb::SyncEnums::TYPE_PHONE: | 242 case sync_pb::SyncEnums::TYPE_PHONE: |
| 243 *type = kDeviceTypePhone; | 243 *type = kDeviceTypePhone; |
| 244 break; | 244 break; |
| 245 case sync_pb::SyncEnums::TYPE_TABLET: | 245 case sync_pb::SyncEnums::TYPE_TABLET: |
| 246 *type = kDeviceTypeTablet; | 246 *type = kDeviceTypeTablet; |
| 247 break; | 247 break; |
| 248 default: | 248 default: |
| 249 *type = kDeviceTypeLaptop; | 249 *type = kDeviceTypeLaptop; |
| 250 } | 250 } |
| 251 return; | 251 return; |
| 252 } | 252 } |
| 253 } else { | 253 } else { |
| 254 NOTREACHED() << "Got a remote history entry but no ProfileSyncService."; | 254 NOTREACHED() << "Got a remote history entry but no DeviceInfoTracker."; |
| 255 } | 255 } |
| 256 *name = l10n_util::GetStringUTF8(IDS_HISTORY_UNKNOWN_DEVICE); | 256 *name = l10n_util::GetStringUTF8(IDS_HISTORY_UNKNOWN_DEVICE); |
| 257 *type = kDeviceTypeLaptop; | 257 *type = kDeviceTypeLaptop; |
| 258 } | 258 } |
| 259 | 259 |
| 260 } // namespace | 260 } // namespace |
| 261 | 261 |
| 262 //////////////////////////////////////////////////////////////////////////////// | 262 //////////////////////////////////////////////////////////////////////////////// |
| 263 // | 263 // |
| 264 // BrowsingHistoryHandler | 264 // BrowsingHistoryHandler |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1015 Profile* profile = Profile::FromWebUI(web_ui); | 1015 Profile* profile = Profile::FromWebUI(web_ui); |
| 1016 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); | 1016 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); |
| 1017 } | 1017 } |
| 1018 | 1018 |
| 1019 // static | 1019 // static |
| 1020 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 1020 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
| 1021 ui::ScaleFactor scale_factor) { | 1021 ui::ScaleFactor scale_factor) { |
| 1022 return ResourceBundle::GetSharedInstance(). | 1022 return ResourceBundle::GetSharedInstance(). |
| 1023 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); | 1023 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
| 1024 } | 1024 } |
| OLD | NEW |