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| should open the search settings |
| 27 // page. |
| 28 static void Show(infobars::InfoBarManager* infobar_manager, |
| 29 const base::string16& default_search_engine_name, |
| 30 const base::Closure& manage_search_settings_callback, |
| 31 PrefService* pref_service); |
| 32 |
| 33 private: |
| 34 DesktopSearchRedirectionInfobarDelegate( |
| 35 const base::string16& default_search_engine_name, |
| 36 const base::Closure& manage_search_settings_callback); |
| 37 ~DesktopSearchRedirectionInfobarDelegate() override; |
| 38 |
| 39 // ConfirmInfoBarDelegate: |
| 40 infobars::InfoBarDelegate::InfoBarIdentifier GetIdentifier() const override; |
| 41 void InfoBarDismissed() override; |
| 42 base::string16 GetMessageText() const override; |
| 43 int GetButtons() const override; |
| 44 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 45 bool Accept() override; |
| 46 |
| 47 base::string16 default_search_engine_name_; |
| 48 base::Closure manage_search_settings_callback_; |
| 49 |
| 50 // True when the infobar has been closed explicitly by the user. |
| 51 bool closed_by_user_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(DesktopSearchRedirectionInfobarDelegate); |
| 54 }; |
| 55 |
| 56 #endif // COMPONENTS_SEARCH_ENGINES_DESKTOP_SEARCH_INFOBAR_DELEGATE_H_ |
OLD | NEW |