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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/i18n/rtl.h" | 12 #include "base/i18n/rtl.h" |
13 #include "base/i18n/time_formatting.h" | 13 #include "base/i18n/time_formatting.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
16 #include "base/metrics/histogram.h" | 16 #include "base/metrics/histogram.h" |
17 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
18 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
21 #include "base/time/time.h" | 21 #include "base/time/time.h" |
22 #include "base/values.h" | 22 #include "base/values.h" |
23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 23 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
24 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
25 #include "chrome/browser/history/history_notifications.h" | 25 #include "chrome/browser/history/history_notifications.h" |
26 #include "chrome/browser/history/history_service_factory.h" | 26 #include "chrome/browser/history/history_service_factory.h" |
27 #include "chrome/browser/history/web_history_service.h" | 27 #include "chrome/browser/history/web_history_service.h" |
28 #include "chrome/browser/history/web_history_service_factory.h" | 28 #include "chrome/browser/history/web_history_service_factory.h" |
29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
30 #include "chrome/browser/sync/glue/device_info.h" | |
31 #include "chrome/browser/sync/profile_sync_service.h" | 30 #include "chrome/browser/sync/profile_sync_service.h" |
32 #include "chrome/browser/sync/profile_sync_service_factory.h" | 31 #include "chrome/browser/sync/profile_sync_service_factory.h" |
33 #include "chrome/browser/ui/browser_finder.h" | 32 #include "chrome/browser/ui/browser_finder.h" |
34 #include "chrome/browser/ui/chrome_pages.h" | 33 #include "chrome/browser/ui/chrome_pages.h" |
35 #include "chrome/browser/ui/webui/favicon_source.h" | 34 #include "chrome/browser/ui/webui/favicon_source.h" |
36 #include "chrome/browser/ui/webui/metrics_handler.h" | 35 #include "chrome/browser/ui/webui/metrics_handler.h" |
37 #include "chrome/common/chrome_switches.h" | 36 #include "chrome/common/chrome_switches.h" |
38 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
39 #include "chrome/common/url_constants.h" | 38 #include "chrome/common/url_constants.h" |
40 #include "chrome/grit/generated_resources.h" | 39 #include "chrome/grit/generated_resources.h" |
41 #include "components/bookmarks/browser/bookmark_model.h" | 40 #include "components/bookmarks/browser/bookmark_model.h" |
42 #include "components/bookmarks/browser/bookmark_utils.h" | 41 #include "components/bookmarks/browser/bookmark_utils.h" |
43 #include "components/history/core/browser/history_types.h" | 42 #include "components/history/core/browser/history_types.h" |
44 #include "components/search/search.h" | 43 #include "components/search/search.h" |
| 44 #include "components/sync_driver/device_info.h" |
45 #include "content/public/browser/notification_details.h" | 45 #include "content/public/browser/notification_details.h" |
46 #include "content/public/browser/notification_source.h" | 46 #include "content/public/browser/notification_source.h" |
47 #include "content/public/browser/url_data_source.h" | 47 #include "content/public/browser/url_data_source.h" |
48 #include "content/public/browser/web_ui.h" | 48 #include "content/public/browser/web_ui.h" |
49 #include "content/public/browser/web_ui_data_source.h" | 49 #include "content/public/browser/web_ui_data_source.h" |
50 #include "grit/browser_resources.h" | 50 #include "grit/browser_resources.h" |
51 #include "grit/theme_resources.h" | 51 #include "grit/theme_resources.h" |
52 #include "net/base/escape.h" | 52 #include "net/base/escape.h" |
53 #include "net/base/net_util.h" | 53 #include "net/base/net_util.h" |
54 #include "sync/protocol/history_delete_directive_specifics.pb.h" | 54 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // DeviceInfoTracker becomes available when Sync backend gets initialed. | 236 // DeviceInfoTracker becomes available when Sync backend gets initialed. |
237 // It must exist in order for remote history entries to be available. | 237 // It must exist in order for remote history entries to be available. |
238 if (sync_service && sync_service->GetDeviceInfoTracker()) { | 238 if (sync_service && sync_service->GetDeviceInfoTracker()) { |
239 scoped_ptr<browser_sync::DeviceInfo> device_info = | 239 scoped_ptr<sync_driver::DeviceInfo> device_info = |
240 sync_service->GetDeviceInfoTracker()->GetDeviceInfo(client_id); | 240 sync_service->GetDeviceInfoTracker()->GetDeviceInfo(client_id); |
241 if (device_info.get()) { | 241 if (device_info.get()) { |
242 *name = device_info->client_name(); | 242 *name = device_info->client_name(); |
243 switch (device_info->device_type()) { | 243 switch (device_info->device_type()) { |
244 case sync_pb::SyncEnums::TYPE_PHONE: | 244 case sync_pb::SyncEnums::TYPE_PHONE: |
245 *type = kDeviceTypePhone; | 245 *type = kDeviceTypePhone; |
246 break; | 246 break; |
247 case sync_pb::SyncEnums::TYPE_TABLET: | 247 case sync_pb::SyncEnums::TYPE_TABLET: |
248 *type = kDeviceTypeTablet; | 248 *type = kDeviceTypeTablet; |
249 break; | 249 break; |
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1017 Profile* profile = Profile::FromWebUI(web_ui); | 1017 Profile* profile = Profile::FromWebUI(web_ui); |
1018 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); | 1018 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); |
1019 } | 1019 } |
1020 | 1020 |
1021 // static | 1021 // static |
1022 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 1022 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
1023 ui::ScaleFactor scale_factor) { | 1023 ui::ScaleFactor scale_factor) { |
1024 return ResourceBundle::GetSharedInstance(). | 1024 return ResourceBundle::GetSharedInstance(). |
1025 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); | 1025 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
1026 } | 1026 } |
OLD | NEW |