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