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 28 matching lines...) Expand all Loading... |
39 #include "chrome/common/url_constants.h" | 39 #include "chrome/common/url_constants.h" |
40 #include "chrome/grit/generated_resources.h" | 40 #include "chrome/grit/generated_resources.h" |
41 #include "components/bookmarks/browser/bookmark_model.h" | 41 #include "components/bookmarks/browser/bookmark_model.h" |
42 #include "components/bookmarks/browser/bookmark_utils.h" | 42 #include "components/bookmarks/browser/bookmark_utils.h" |
43 #include "components/history/core/browser/history_service.h" | 43 #include "components/history/core/browser/history_service.h" |
44 #include "components/history/core/browser/history_types.h" | 44 #include "components/history/core/browser/history_types.h" |
45 #include "components/history/core/browser/web_history_service.h" | 45 #include "components/history/core/browser/web_history_service.h" |
46 #include "components/search/search.h" | 46 #include "components/search/search.h" |
47 #include "components/signin/core/browser/signin_manager.h" | 47 #include "components/signin/core/browser/signin_manager.h" |
48 #include "components/sync_driver/device_info.h" | 48 #include "components/sync_driver/device_info.h" |
| 49 #include "components/url_formatter/url_formatter.h" |
49 #include "content/public/browser/url_data_source.h" | 50 #include "content/public/browser/url_data_source.h" |
50 #include "content/public/browser/web_ui.h" | 51 #include "content/public/browser/web_ui.h" |
51 #include "content/public/browser/web_ui_data_source.h" | 52 #include "content/public/browser/web_ui_data_source.h" |
52 #include "grit/browser_resources.h" | 53 #include "grit/browser_resources.h" |
53 #include "grit/theme_resources.h" | 54 #include "grit/theme_resources.h" |
54 #include "net/base/escape.h" | 55 #include "net/base/escape.h" |
55 #include "net/base/net_util.h" | |
56 #include "sync/protocol/history_delete_directive_specifics.pb.h" | 56 #include "sync/protocol/history_delete_directive_specifics.pb.h" |
57 #include "ui/base/l10n/l10n_util.h" | 57 #include "ui/base/l10n/l10n_util.h" |
58 #include "ui/base/l10n/time_format.h" | 58 #include "ui/base/l10n/time_format.h" |
59 #include "ui/base/resource/resource_bundle.h" | 59 #include "ui/base/resource/resource_bundle.h" |
60 #include "ui/base/webui/web_ui_util.h" | 60 #include "ui/base/webui/web_ui_util.h" |
61 | 61 |
62 #if defined(ENABLE_EXTENSIONS) | 62 #if defined(ENABLE_EXTENSIONS) |
63 #include "chrome/browser/extensions/activity_log/activity_log.h" | 63 #include "chrome/browser/extensions/activity_log/activity_log.h" |
64 #endif | 64 #endif |
65 | 65 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 result->SetString("title", title_to_set); | 345 result->SetString("title", title_to_set); |
346 } | 346 } |
347 | 347 |
348 scoped_ptr<base::DictionaryValue> BrowsingHistoryHandler::HistoryEntry::ToValue( | 348 scoped_ptr<base::DictionaryValue> BrowsingHistoryHandler::HistoryEntry::ToValue( |
349 BookmarkModel* bookmark_model, | 349 BookmarkModel* bookmark_model, |
350 SupervisedUserService* supervised_user_service, | 350 SupervisedUserService* supervised_user_service, |
351 const ProfileSyncService* sync_service) const { | 351 const ProfileSyncService* sync_service) const { |
352 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); | 352 scoped_ptr<base::DictionaryValue> result(new base::DictionaryValue()); |
353 SetUrlAndTitle(result.get()); | 353 SetUrlAndTitle(result.get()); |
354 | 354 |
355 base::string16 domain = net::IDNToUnicode(url.host(), accept_languages); | 355 base::string16 domain = |
| 356 url_formatter::IDNToUnicode(url.host(), accept_languages); |
356 // When the domain is empty, use the scheme instead. This allows for a | 357 // When the domain is empty, use the scheme instead. This allows for a |
357 // sensible treatment of e.g. file: URLs when group by domain is on. | 358 // sensible treatment of e.g. file: URLs when group by domain is on. |
358 if (domain.empty()) | 359 if (domain.empty()) |
359 domain = base::UTF8ToUTF16(url.scheme() + ":"); | 360 domain = base::UTF8ToUTF16(url.scheme() + ":"); |
360 | 361 |
361 // The items which are to be written into result are also described in | 362 // The items which are to be written into result are also described in |
362 // chrome/browser/resources/history/history.js in @typedef for | 363 // chrome/browser/resources/history/history.js in @typedef for |
363 // HistoryEntry. Please update it whenever you add or remove | 364 // HistoryEntry. Please update it whenever you add or remove |
364 // any keys in result. | 365 // any keys in result. |
365 result->SetString("domain", domain); | 366 result->SetString("domain", domain); |
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1049 } | 1050 } |
1050 | 1051 |
1051 HistoryUI::~HistoryUI() {} | 1052 HistoryUI::~HistoryUI() {} |
1052 | 1053 |
1053 // static | 1054 // static |
1054 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 1055 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
1055 ui::ScaleFactor scale_factor) { | 1056 ui::ScaleFactor scale_factor) { |
1056 return ResourceBundle::GetSharedInstance(). | 1057 return ResourceBundle::GetSharedInstance(). |
1057 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); | 1058 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
1058 } | 1059 } |
OLD | NEW |