| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/api/messaging/incognito_connectability.h" | 5 #include "chrome/browser/extensions/api/messaging/incognito_connectability.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/string16.h" | 9 #include "base/strings/string16.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // delegate is destroyed. | 43 // delegate is destroyed. |
| 44 void set_answered() { answered_ = true; } | 44 void set_answered() { answered_ = true; } |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 IncognitoConnectabilityInfoBarDelegate(const base::string16& message, | 47 IncognitoConnectabilityInfoBarDelegate(const base::string16& message, |
| 48 const InfoBarCallback& callback); | 48 const InfoBarCallback& callback); |
| 49 ~IncognitoConnectabilityInfoBarDelegate() override; | 49 ~IncognitoConnectabilityInfoBarDelegate() override; |
| 50 | 50 |
| 51 // ConfirmInfoBarDelegate: | 51 // ConfirmInfoBarDelegate: |
| 52 Type GetInfoBarType() const override; | 52 Type GetInfoBarType() const override; |
| 53 std::string GetIdentifier() const override; |
| 53 base::string16 GetMessageText() const override; | 54 base::string16 GetMessageText() const override; |
| 54 base::string16 GetButtonLabel(InfoBarButton button) const override; | 55 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 55 bool Accept() override; | 56 bool Accept() override; |
| 56 bool Cancel() override; | 57 bool Cancel() override; |
| 57 | 58 |
| 58 base::string16 message_; | 59 base::string16 message_; |
| 59 bool answered_; | 60 bool answered_; |
| 60 InfoBarCallback callback_; | 61 InfoBarCallback callback_; |
| 61 }; | 62 }; |
| 62 | 63 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 84 // should show an interactive prompt. | 85 // should show an interactive prompt. |
| 85 callback_.Run(IncognitoConnectability::ScopedAlertTracker::INTERACTIVE); | 86 callback_.Run(IncognitoConnectability::ScopedAlertTracker::INTERACTIVE); |
| 86 } | 87 } |
| 87 } | 88 } |
| 88 | 89 |
| 89 infobars::InfoBarDelegate::Type | 90 infobars::InfoBarDelegate::Type |
| 90 IncognitoConnectabilityInfoBarDelegate::GetInfoBarType() const { | 91 IncognitoConnectabilityInfoBarDelegate::GetInfoBarType() const { |
| 91 return PAGE_ACTION_TYPE; | 92 return PAGE_ACTION_TYPE; |
| 92 } | 93 } |
| 93 | 94 |
| 95 std::string IncognitoConnectabilityInfoBarDelegate::GetIdentifier() const { |
| 96 return "IncognitoConnectabilityInfoBarDelegate"; |
| 97 } |
| 98 |
| 94 base::string16 IncognitoConnectabilityInfoBarDelegate::GetMessageText() const { | 99 base::string16 IncognitoConnectabilityInfoBarDelegate::GetMessageText() const { |
| 95 return message_; | 100 return message_; |
| 96 } | 101 } |
| 97 | 102 |
| 98 base::string16 IncognitoConnectabilityInfoBarDelegate::GetButtonLabel( | 103 base::string16 IncognitoConnectabilityInfoBarDelegate::GetButtonLabel( |
| 99 InfoBarButton button) const { | 104 InfoBarButton button) const { |
| 100 return l10n_util::GetStringUTF16( | 105 return l10n_util::GetStringUTF16( |
| 101 (button == BUTTON_OK) ? IDS_PERMISSION_ALLOW : IDS_PERMISSION_DENY); | 106 (button == BUTTON_OK) ? IDS_PERMISSION_ALLOW : IDS_PERMISSION_DENY); |
| 102 } | 107 } |
| 103 | 108 |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = | 289 BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = |
| 285 LAZY_INSTANCE_INITIALIZER; | 290 LAZY_INSTANCE_INITIALIZER; |
| 286 | 291 |
| 287 // static | 292 // static |
| 288 BrowserContextKeyedAPIFactory<IncognitoConnectability>* | 293 BrowserContextKeyedAPIFactory<IncognitoConnectability>* |
| 289 IncognitoConnectability::GetFactoryInstance() { | 294 IncognitoConnectability::GetFactoryInstance() { |
| 290 return g_factory.Pointer(); | 295 return g_factory.Pointer(); |
| 291 } | 296 } |
| 292 | 297 |
| 293 } // namespace extensions | 298 } // namespace extensions |
| OLD | NEW |