Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_INFOBAR_DELEGATE_H_ | |
| 6 #define COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_INFOBAR_DELEGATE_H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/strings/string16.h" | |
| 11 #include "components/infobars/core/confirm_infobar_delegate.h" | |
| 12 | |
| 13 class PrefService; | |
| 14 | |
| 15 namespace infobars { | |
| 16 class InfoBarManager; | |
| 17 } // namespace infobars | |
| 18 | |
| 19 // Informs the user that a desktop search has been redirected to the default | |
| 20 // search engine. | |
| 21 class DesktopSearchRedirectionInfobarDelegate : public ConfirmInfoBarDelegate { | |
| 22 public: | |
| 23 // Creates a search redirection infobar and delegate and adds the infobar to | |
| 24 // |infobar_manager|. Records in |pref_service| that such an infobar was | |
| 25 // shown. |default_search_engine_name| is the name of the default search | |
| 26 // engine. |manage_search_settings_callback| opens the search settings page. | |
|
Peter Kasting
2016/01/22 00:38:57
Nit: opens -> should open
fdoray
2016/02/01 15:15:53
Done.
| |
| 27 static void Show(infobars::InfoBarManager* infobar_manager, | |
| 28 const base::string16& default_search_engine_name, | |
| 29 const base::Closure& manage_search_settings_callback, | |
| 30 PrefService* pref_service); | |
| 31 | |
| 32 private: | |
| 33 DesktopSearchRedirectionInfobarDelegate( | |
| 34 const base::string16& default_search_engine_name, | |
| 35 const base::Closure& manage_search_settings_callback); | |
| 36 virtual ~DesktopSearchRedirectionInfobarDelegate(); | |
|
Peter Kasting
2016/01/22 00:38:57
Nit: ~DesktopSearchRedirectionInfobarDelegate() ov
fdoray
2016/02/01 15:15:53
Done.
| |
| 37 | |
| 38 // ConfirmInfoBarDelegate: | |
| 39 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; | |
| 40 void InfoBarDismissed() override; | |
| 41 base::string16 GetMessageText() const override; | |
| 42 int GetButtons() const override; | |
| 43 base::string16 GetButtonLabel(InfoBarButton button) const override; | |
| 44 bool Accept() override; | |
| 45 | |
| 46 base::string16 default_search_engine_name_; | |
| 47 base::Closure manage_search_settings_callback_; | |
| 48 | |
| 49 // True when the infobar has been closed explicitly by the user. | |
| 50 bool closed_by_user_; | |
| 51 | |
| 52 DISALLOW_COPY_AND_ASSIGN(DesktopSearchRedirectionInfobarDelegate); | |
| 53 }; | |
| 54 | |
| 55 #endif // COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_INFOBAR_DELEGATE_H_ | |
| OLD | NEW |