| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory)); | 177 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory)); |
| 178 source->AddBoolean("isInstantExtendedApiEnabled", | 178 source->AddBoolean("isInstantExtendedApiEnabled", |
| 179 chrome::IsInstantExtendedAPIEnabled()); | 179 chrome::IsInstantExtendedAPIEnabled()); |
| 180 | 180 |
| 181 source->SetJsonPath(kStringsJsFile); | 181 source->SetJsonPath(kStringsJsFile); |
| 182 source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS); | 182 source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS); |
| 183 source->AddResourcePath(kOtherDevicesJsFile, IDR_OTHER_DEVICES_JS); | 183 source->AddResourcePath(kOtherDevicesJsFile, IDR_OTHER_DEVICES_JS); |
| 184 source->SetDefaultResource(IDR_HISTORY_HTML); | 184 source->SetDefaultResource(IDR_HISTORY_HTML); |
| 185 source->SetUseJsonJSFormatV2(); | 185 source->SetUseJsonJSFormatV2(); |
| 186 source->DisableDenyXFrameOptions(); | 186 source->DisableDenyXFrameOptions(); |
| 187 source->AddBoolean("isManagedProfile", profile->IsManaged()); | 187 source->AddBoolean("isManagedProfile", profile->IsSupervised()); |
| 188 source->AddBoolean("showDeleteVisitUI", !profile->IsManaged()); | 188 source->AddBoolean("showDeleteVisitUI", !profile->IsSupervised()); |
| 189 | 189 |
| 190 return source; | 190 return source; |
| 191 } | 191 } |
| 192 | 192 |
| 193 // Returns a localized version of |visit_time| including a relative | 193 // Returns a localized version of |visit_time| including a relative |
| 194 // indicator (e.g. today, yesterday). | 194 // indicator (e.g. today, yesterday). |
| 195 base::string16 getRelativeDateLocalized(const base::Time& visit_time) { | 195 base::string16 getRelativeDateLocalized(const base::Time& visit_time) { |
| 196 base::Time midnight = base::Time::Now().LocalMidnight(); | 196 base::Time midnight = base::Time::Now().LocalMidnight(); |
| 197 base::string16 date_str = ui::TimeFormat::RelativeDate(visit_time, &midnight); | 197 base::string16 date_str = ui::TimeFormat::RelativeDate(visit_time, &midnight); |
| 198 if (date_str.empty()) { | 198 if (date_str.empty()) { |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 } | 704 } |
| 705 } | 705 } |
| 706 results->swap(new_results); | 706 results->swap(new_results); |
| 707 } | 707 } |
| 708 | 708 |
| 709 void BrowsingHistoryHandler::ReturnResultsToFrontEnd() { | 709 void BrowsingHistoryHandler::ReturnResultsToFrontEnd() { |
| 710 Profile* profile = Profile::FromWebUI(web_ui()); | 710 Profile* profile = Profile::FromWebUI(web_ui()); |
| 711 BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile); | 711 BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile); |
| 712 ManagedUserService* managed_user_service = NULL; | 712 ManagedUserService* managed_user_service = NULL; |
| 713 #if defined(ENABLE_MANAGED_USERS) | 713 #if defined(ENABLE_MANAGED_USERS) |
| 714 if (profile->IsManaged()) | 714 if (profile->IsSupervised()) |
| 715 managed_user_service = ManagedUserServiceFactory::GetForProfile(profile); | 715 managed_user_service = ManagedUserServiceFactory::GetForProfile(profile); |
| 716 #endif | 716 #endif |
| 717 ProfileSyncService* sync_service = | 717 ProfileSyncService* sync_service = |
| 718 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); | 718 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile); |
| 719 | 719 |
| 720 // Combine the local and remote results into |query_results_|, and remove | 720 // Combine the local and remote results into |query_results_|, and remove |
| 721 // any duplicates. | 721 // any duplicates. |
| 722 if (!web_history_query_results_.empty()) { | 722 if (!web_history_query_results_.empty()) { |
| 723 int local_result_count = query_results_.size(); | 723 int local_result_count = query_results_.size(); |
| 724 query_results_.insert(query_results_.end(), | 724 query_results_.insert(query_results_.end(), |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1001 Profile* profile = Profile::FromWebUI(web_ui); | 1001 Profile* profile = Profile::FromWebUI(web_ui); |
| 1002 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); | 1002 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); |
| 1003 } | 1003 } |
| 1004 | 1004 |
| 1005 // static | 1005 // static |
| 1006 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 1006 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
| 1007 ui::ScaleFactor scale_factor) { | 1007 ui::ScaleFactor scale_factor) { |
| 1008 return ResourceBundle::GetSharedInstance(). | 1008 return ResourceBundle::GetSharedInstance(). |
| 1009 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); | 1009 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
| 1010 } | 1010 } |
| OLD | NEW |