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

Unified Diff: components/search_engines/desktop_search_infobar_delegate_win.h

Issue 1598553003: Implement the Windows desktop search redirection feature. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't assume that a Browser exists + fix nits Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: components/search_engines/desktop_search_infobar_delegate_win.h
diff --git a/components/search_engines/desktop_search_infobar_delegate_win.h b/components/search_engines/desktop_search_infobar_delegate_win.h
new file mode 100644
index 0000000000000000000000000000000000000000..1cc1f42334168fc188df601048b63de6c3739418
--- /dev/null
+++ b/components/search_engines/desktop_search_infobar_delegate_win.h
@@ -0,0 +1,62 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_INFOBAR_DELEGATE_WIN_H_
+#define COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_INFOBAR_DELEGATE_WIN_H_
+
+#include "base/gtest_prod_util.h"
+#include "base/macros.h"
+#include "base/strings/string16.h"
+#include "components/infobars/core/confirm_infobar_delegate.h"
+#include "url/gurl.h"
+
+class PrefService;
+
+namespace infobars {
+class InfoBarManager;
+} // namespace infobars
+
+// The delegate for the infobar informing the user that a Windows desktop search
Peter Kasting 2016/01/20 03:03:01 Nit: I'd probably just say "Informs the user that.
fdoray 2016/01/21 21:02:33 Done.
+// has been redirected to the default search engine.
+class WindowsDesktopSearchInfobarDelegate : public ConfirmInfoBarDelegate {
+ public:
+ // Adds to |infobar_manager| an infobar informing the user that a Windows
+ // desktop search has been redirected to the default search engine.
+ // |default_search_engine_name| is the name of the default search engine.
+ // |search_settings_url| is the URL of the search settings. The function
+ // records in |pref_service| that the infobar has been shown.
Peter Kasting 2016/01/20 03:03:01 Nit: Simpler, and more parallel to other infobars'
fdoray 2016/01/21 21:02:33 Done.
+ static void Show(infobars::InfoBarManager* infobar_manager,
+ const base::string16& default_search_engine_name,
+ const GURL& search_settings_url,
+ PrefService* pref_service);
+
+ private:
+ FRIEND_TEST_ALL_PREFIXES(WindowsDesktopSearchInfobarDelegateTest,
+ ManageSearchSettings);
+
+ WindowsDesktopSearchInfobarDelegate(
+ const base::string16& default_search_engine_name,
+ const GURL& search_settings_url);
+ virtual ~WindowsDesktopSearchInfobarDelegate();
+
+ // ConfirmInfoBarDelegate:
Peter Kasting 2016/01/20 03:03:01 It seems like we really ought to have a Learn More
fdoray 2016/01/21 21:02:33 UI review decided not to have an option to disable
Peter Kasting 2016/01/22 00:38:57 Fair enough. Make sure you ultimately remove any
+ base::string16 GetMessageText() const override;
+ int GetButtons() const override;
+ base::string16 GetButtonLabel(InfoBarButton button) const override;
+ bool Accept() override;
+
+ // infobars::InfoBarDelegate:
Peter Kasting 2016/01/20 03:03:01 You don't directly subclass this class, so these o
fdoray 2016/01/21 21:02:33 Done.
+ infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override;
+ void InfoBarDismissed() override;
+
+ base::string16 default_search_engine_name_;
+ GURL search_settings_url_;
+
+ // True when the infobar has been closed by clicking on the close button.
+ bool closed_by_user_;
+
+ DISALLOW_COPY_AND_ASSIGN(WindowsDesktopSearchInfobarDelegate);
+};
+
+#endif // COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_INFOBAR_DELEGATE_WIN_H_

Powered by Google App Engine
This is Rietveld 408576698