Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(622)

Side by Side Diff: chrome/browser/ui/webui/md_history_ui.cc

Issue 2450663003: MD History: hide tooltip promo when drawer is swiped open (Closed)
Patch Set: on-lonely="fixUpCode_" Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 17 matching lines...) Expand all
28 #include "components/search/search.h" 28 #include "components/search/search.h"
29 #include "components/signin/core/browser/signin_manager.h" 29 #include "components/signin/core/browser/signin_manager.h"
30 #include "components/strings/grit/components_strings.h" 30 #include "components/strings/grit/components_strings.h"
31 #include "content/public/browser/web_ui.h" 31 #include "content/public/browser/web_ui.h"
32 #include "content/public/browser/web_ui_data_source.h" 32 #include "content/public/browser/web_ui_data_source.h"
33 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
34 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
35 35
36 namespace { 36 namespace {
37 37
38 constexpr char kShowMenuPromoKey[] = "showMenuPromo";
39
40 content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile, 38 content::WebUIDataSource* CreateMdHistoryUIHTMLSource(Profile* profile,
41 bool use_test_title) { 39 bool use_test_title) {
42 content::WebUIDataSource* source = 40 content::WebUIDataSource* source =
43 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost); 41 content::WebUIDataSource::Create(chrome::kChromeUIHistoryHost);
44 42
45 // Localized strings (alphabetical order). 43 // Localized strings (alphabetical order).
46 source->AddLocalizedString("bookmarked", IDS_HISTORY_ENTRY_BOOKMARKED); 44 source->AddLocalizedString("bookmarked", IDS_HISTORY_ENTRY_BOOKMARKED);
47 source->AddLocalizedString("cancel", IDS_CANCEL); 45 source->AddLocalizedString("cancel", IDS_CANCEL);
48 source->AddLocalizedString("clearBrowsingData", 46 source->AddLocalizedString("clearBrowsingData",
49 IDS_CLEAR_BROWSING_DATA_TITLE); 47 IDS_CLEAR_BROWSING_DATA_TITLE);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 l10n_util::GetStringFUTF16( 110 l10n_util::GetStringFUTF16(
113 IDS_HISTORY_OTHER_FORMS_OF_HISTORY, 111 IDS_HISTORY_OTHER_FORMS_OF_HISTORY,
114 l10n_util::GetStringUTF16( 112 l10n_util::GetStringUTF16(
115 IDS_SETTINGS_CLEAR_DATA_WEB_HISTORY_URL_IN_HISTORY))); 113 IDS_SETTINGS_CLEAR_DATA_WEB_HISTORY_URL_IN_HISTORY)));
116 114
117 PrefService* prefs = profile->GetPrefs(); 115 PrefService* prefs = profile->GetPrefs();
118 bool allow_deleting_history = 116 bool allow_deleting_history =
119 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory); 117 prefs->GetBoolean(prefs::kAllowDeletingBrowserHistory);
120 source->AddBoolean("allowDeletingHistory", allow_deleting_history); 118 source->AddBoolean("allowDeletingHistory", allow_deleting_history);
121 119
122 source->AddBoolean(kShowMenuPromoKey, 120 source->AddBoolean("showMenuPromo",
123 !prefs->GetBoolean(prefs::kMdHistoryMenuPromoShown)); 121 !prefs->GetBoolean(prefs::kMdHistoryMenuPromoShown));
124 122
125 bool group_by_domain = base::CommandLine::ForCurrentProcess()->HasSwitch( 123 bool group_by_domain = base::CommandLine::ForCurrentProcess()->HasSwitch(
126 switches::kHistoryEnableGroupByDomain) || profile->IsSupervised(); 124 switches::kHistoryEnableGroupByDomain) || profile->IsSupervised();
127 source->AddBoolean("groupByDomain", group_by_domain); 125 source->AddBoolean("groupByDomain", group_by_domain);
128 126
129 source->AddBoolean("isGuestSession", profile->IsGuestSession()); 127 source->AddBoolean("isGuestSession", profile->IsGuestSession());
130 128
131 SigninManagerBase* signin_manager = 129 SigninManagerBase* signin_manager =
132 SigninManagerFactory::GetForProfile(profile); 130 SigninManagerFactory::GetForProfile(profile);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 content::WebUIDataSource* data_source = 270 content::WebUIDataSource* data_source =
273 CreateMdHistoryUIHTMLSource(profile, use_test_title_); 271 CreateMdHistoryUIHTMLSource(profile, use_test_title_);
274 content::WebUIDataSource::Add(profile, data_source); 272 content::WebUIDataSource::Add(profile, data_source);
275 } 273 }
276 274
277 void MdHistoryUI::HandleMenuPromoShown(const base::ListValue* args) { 275 void MdHistoryUI::HandleMenuPromoShown(const base::ListValue* args) {
278 Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean( 276 Profile::FromWebUI(web_ui())->GetPrefs()->SetBoolean(
279 prefs::kMdHistoryMenuPromoShown, true); 277 prefs::kMdHistoryMenuPromoShown, true);
280 CreateDataSource(); 278 CreateDataSource();
281 } 279 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698