| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/md_history_ui.h" | 5 #include "chrome/browser/ui/webui/md_history_ui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 IDS_HISTORY_OTHER_FORMS_OF_HISTORY, | 125 IDS_HISTORY_OTHER_FORMS_OF_HISTORY, |
| 126 l10n_util::GetStringUTF16( | 126 l10n_util::GetStringUTF16( |
| 127 IDS_SETTINGS_CLEAR_DATA_WEB_HISTORY_URL_IN_HISTORY))); | 127 IDS_SETTINGS_CLEAR_DATA_WEB_HISTORY_URL_IN_HISTORY))); |
| 128 | 128 |
| 129 PrefService* prefs = profile->GetPrefs(); | 129 PrefService* prefs = profile->GetPrefs(); |
| 130 bool allow_deleting_history = | 130 bool allow_deleting_history = |
| 131 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); | 131 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); |
| 132 source->AddBoolean("allowDeletingHistory", allow_deleting_history); | 132 source->AddBoolean("allowDeletingHistory", allow_deleting_history); |
| 133 | 133 |
| 134 source->AddBoolean(kShowMenuPromoKey, !MenuPromoShown(profile)); | 134 source->AddBoolean(kShowMenuPromoKey, !MenuPromoShown(profile)); |
| 135 | |
| 136 bool group_by_domain = base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 137 switches::kHistoryEnableGroupByDomain) || profile->IsSupervised(); | |
| 138 source->AddBoolean("groupByDomain", group_by_domain); | |
| 139 | |
| 140 source->AddBoolean("isGuestSession", profile->IsGuestSession()); | 135 source->AddBoolean("isGuestSession", profile->IsGuestSession()); |
| 141 | 136 |
| 142 source->AddBoolean(kIsUserSignedInKey, IsUserSignedIn(profile)); | 137 source->AddBoolean(kIsUserSignedInKey, IsUserSignedIn(profile)); |
| 143 | 138 |
| 144 struct UncompressedResource { | 139 struct UncompressedResource { |
| 145 const char* path; | 140 const char* path; |
| 146 int idr; | 141 int idr; |
| 147 }; | 142 }; |
| 148 const UncompressedResource uncompressed_resources[] = { | 143 const UncompressedResource uncompressed_resources[] = { |
| 149 {"constants.html", IDR_MD_HISTORY_CONSTANTS_HTML}, | 144 {"constants.html", IDR_MD_HISTORY_CONSTANTS_HTML}, |
| 150 {"constants.js", IDR_MD_HISTORY_CONSTANTS_JS}, | 145 {"constants.js", IDR_MD_HISTORY_CONSTANTS_JS}, |
| 151 {"history.js", IDR_MD_HISTORY_HISTORY_JS}, | 146 {"history.js", IDR_MD_HISTORY_HISTORY_JS}, |
| 152 {"images/100/sign_in_promo.jpg", | 147 {"images/100/sign_in_promo.jpg", |
| 153 IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_JPG}, | 148 IDR_MD_HISTORY_IMAGES_100_SIGN_IN_PROMO_JPG}, |
| 154 {"images/200/sign_in_promo.jpg", | 149 {"images/200/sign_in_promo.jpg", |
| 155 IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_JPG}, | 150 IDR_MD_HISTORY_IMAGES_200_SIGN_IN_PROMO_JPG}, |
| 156 #if !BUILDFLAG(USE_VULCANIZE) | 151 #if !BUILDFLAG(USE_VULCANIZE) |
| 157 {"app.html", IDR_MD_HISTORY_APP_HTML}, | 152 {"app.html", IDR_MD_HISTORY_APP_HTML}, |
| 158 {"app.js", IDR_MD_HISTORY_APP_JS}, | 153 {"app.js", IDR_MD_HISTORY_APP_JS}, |
| 159 {"browser_service.html", IDR_MD_HISTORY_BROWSER_SERVICE_HTML}, | 154 {"browser_service.html", IDR_MD_HISTORY_BROWSER_SERVICE_HTML}, |
| 160 {"browser_service.js", IDR_MD_HISTORY_BROWSER_SERVICE_JS}, | 155 {"browser_service.js", IDR_MD_HISTORY_BROWSER_SERVICE_JS}, |
| 161 {"grouped_list.html", IDR_MD_HISTORY_GROUPED_LIST_HTML}, | |
| 162 {"grouped_list.js", IDR_MD_HISTORY_GROUPED_LIST_JS}, | |
| 163 {"history_item.html", IDR_MD_HISTORY_HISTORY_ITEM_HTML}, | 156 {"history_item.html", IDR_MD_HISTORY_HISTORY_ITEM_HTML}, |
| 164 {"history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS}, | 157 {"history_item.js", IDR_MD_HISTORY_HISTORY_ITEM_JS}, |
| 165 {"history_list.html", IDR_MD_HISTORY_HISTORY_LIST_HTML}, | 158 {"history_list.html", IDR_MD_HISTORY_HISTORY_LIST_HTML}, |
| 166 {"history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS}, | 159 {"history_list.js", IDR_MD_HISTORY_HISTORY_LIST_JS}, |
| 167 {"history_list_behavior.html", IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML}, | 160 {"history_list_behavior.html", IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_HTML}, |
| 168 {"history_list_behavior.js", IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS}, | 161 {"history_list_behavior.js", IDR_MD_HISTORY_HISTORY_LIST_BEHAVIOR_JS}, |
| 169 {"history_toolbar.html", IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML}, | 162 {"history_toolbar.html", IDR_MD_HISTORY_HISTORY_TOOLBAR_HTML}, |
| 170 {"history_toolbar.js", IDR_MD_HISTORY_HISTORY_TOOLBAR_JS}, | 163 {"history_toolbar.js", IDR_MD_HISTORY_HISTORY_TOOLBAR_JS}, |
| 171 {"icons.html", IDR_MD_HISTORY_ICONS_HTML}, | 164 {"icons.html", IDR_MD_HISTORY_ICONS_HTML}, |
| 172 {"lazy_load.html", IDR_MD_HISTORY_LAZY_LOAD_HTML}, | 165 {"lazy_load.html", IDR_MD_HISTORY_LAZY_LOAD_HTML}, |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 263 |
| 271 content::WebUIDataSource::Update(profile, chrome::kChromeUIHistoryHost, | 264 content::WebUIDataSource::Update(profile, chrome::kChromeUIHistoryHost, |
| 272 std::move(update)); | 265 std::move(update)); |
| 273 } | 266 } |
| 274 | 267 |
| 275 void MdHistoryUI::HandleMenuPromoShown(const base::ListValue* args) { | 268 void MdHistoryUI::HandleMenuPromoShown(const base::ListValue* args) { |
| 276 Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean( | 269 Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean( |
| 277 prefs::kMdHistoryMenuPromoShown, true); | 270 prefs::kMdHistoryMenuPromoShown, true); |
| 278 UpdateDataSource(); | 271 UpdateDataSource(); |
| 279 } | 272 } |
| OLD | NEW |