| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 // Supervised users get the "group by domain" version, but not on mobile, | 202 // Supervised users get the "group by domain" version, but not on mobile, |
| 203 // because that version isn't adjusted for small screens yet. crbug.com/452859 | 203 // because that version isn't adjusted for small screens yet. crbug.com/452859 |
| 204 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 204 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 205 group_by_domain = group_by_domain || profile->IsSupervised(); | 205 group_by_domain = group_by_domain || profile->IsSupervised(); |
| 206 #endif | 206 #endif |
| 207 source->AddBoolean("groupByDomain", group_by_domain); | 207 source->AddBoolean("groupByDomain", group_by_domain); |
| 208 bool allow_deleting_history = | 208 bool allow_deleting_history = |
| 209 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); | 209 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); |
| 210 source->AddBoolean("allowDeletingHistory", allow_deleting_history); | 210 source->AddBoolean("allowDeletingHistory", allow_deleting_history); |
| 211 source->AddBoolean("isInstantExtendedApiEnabled", | 211 source->AddBoolean("isInstantExtendedApiEnabled", |
| 212 chrome::IsInstantExtendedAPIEnabled()); | 212 search::IsInstantExtendedAPIEnabled()); |
| 213 source->AddBoolean("isSupervisedProfile", profile->IsSupervised()); | 213 source->AddBoolean("isSupervisedProfile", profile->IsSupervised()); |
| 214 source->AddBoolean("hideDeleteVisitUI", | 214 source->AddBoolean("hideDeleteVisitUI", |
| 215 profile->IsSupervised() && !allow_deleting_history); | 215 profile->IsSupervised() && !allow_deleting_history); |
| 216 | 216 |
| 217 source->SetJsonPath(kStringsJsFile); | 217 source->SetJsonPath(kStringsJsFile); |
| 218 source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS); | 218 source->AddResourcePath(kHistoryJsFile, IDR_HISTORY_JS); |
| 219 source->AddResourcePath(kOtherDevicesJsFile, IDR_OTHER_DEVICES_JS); | 219 source->AddResourcePath(kOtherDevicesJsFile, IDR_OTHER_DEVICES_JS); |
| 220 source->SetDefaultResource(IDR_HISTORY_HTML); | 220 source->SetDefaultResource(IDR_HISTORY_HTML); |
| 221 source->DisableDenyXFrameOptions(); | 221 source->DisableDenyXFrameOptions(); |
| 222 | 222 |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 // HistoryUI | 1030 // HistoryUI |
| 1031 // | 1031 // |
| 1032 //////////////////////////////////////////////////////////////////////////////// | 1032 //////////////////////////////////////////////////////////////////////////////// |
| 1033 | 1033 |
| 1034 HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { | 1034 HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { |
| 1035 web_ui->AddMessageHandler(new BrowsingHistoryHandler()); | 1035 web_ui->AddMessageHandler(new BrowsingHistoryHandler()); |
| 1036 web_ui->AddMessageHandler(new MetricsHandler()); | 1036 web_ui->AddMessageHandler(new MetricsHandler()); |
| 1037 | 1037 |
| 1038 // On mobile we deal with foreign sessions differently. | 1038 // On mobile we deal with foreign sessions differently. |
| 1039 #if !defined(OS_ANDROID) && !defined(OS_IOS) | 1039 #if !defined(OS_ANDROID) && !defined(OS_IOS) |
| 1040 if (chrome::IsInstantExtendedAPIEnabled()) { | 1040 if (search::IsInstantExtendedAPIEnabled()) { |
| 1041 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); | 1041 web_ui->AddMessageHandler(new browser_sync::ForeignSessionHandler()); |
| 1042 web_ui->AddMessageHandler(new HistoryLoginHandler()); | 1042 web_ui->AddMessageHandler(new HistoryLoginHandler()); |
| 1043 } | 1043 } |
| 1044 #endif | 1044 #endif |
| 1045 | 1045 |
| 1046 // Set up the chrome://history-frame/ source. | 1046 // Set up the chrome://history-frame/ source. |
| 1047 Profile* profile = Profile::FromWebUI(web_ui); | 1047 Profile* profile = Profile::FromWebUI(web_ui); |
| 1048 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); | 1048 content::WebUIDataSource::Add(profile, CreateHistoryUIHTMLSource(profile)); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 HistoryUI::~HistoryUI() {} | 1051 HistoryUI::~HistoryUI() {} |
| 1052 | 1052 |
| 1053 // static | 1053 // static |
| 1054 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( | 1054 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( |
| 1055 ui::ScaleFactor scale_factor) { | 1055 ui::ScaleFactor scale_factor) { |
| 1056 return ResourceBundle::GetSharedInstance(). | 1056 return ResourceBundle::GetSharedInstance(). |
| 1057 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); | 1057 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); |
| 1058 } | 1058 } |
| OLD | NEW |