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 infobars::InfoBarDelegate::InfoBarIdentifier 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 infobars::InfoBarDelegate::InfoBarIdentifier |
| 96 IncognitoConnectabilityInfoBarDelegate::GetIdentifier() const { |
| 97 return INCOGNITO_CONNECTABILITY_INFOBAR_DELEGATE; |
| 98 } |
| 99 |
94 base::string16 IncognitoConnectabilityInfoBarDelegate::GetMessageText() const { | 100 base::string16 IncognitoConnectabilityInfoBarDelegate::GetMessageText() const { |
95 return message_; | 101 return message_; |
96 } | 102 } |
97 | 103 |
98 base::string16 IncognitoConnectabilityInfoBarDelegate::GetButtonLabel( | 104 base::string16 IncognitoConnectabilityInfoBarDelegate::GetButtonLabel( |
99 InfoBarButton button) const { | 105 InfoBarButton button) const { |
100 return l10n_util::GetStringUTF16( | 106 return l10n_util::GetStringUTF16( |
101 (button == BUTTON_OK) ? IDS_PERMISSION_ALLOW : IDS_PERMISSION_DENY); | 107 (button == BUTTON_OK) ? IDS_PERMISSION_ALLOW : IDS_PERMISSION_DENY); |
102 } | 108 } |
103 | 109 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = | 290 BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = |
285 LAZY_INSTANCE_INITIALIZER; | 291 LAZY_INSTANCE_INITIALIZER; |
286 | 292 |
287 // static | 293 // static |
288 BrowserContextKeyedAPIFactory<IncognitoConnectability>* | 294 BrowserContextKeyedAPIFactory<IncognitoConnectability>* |
289 IncognitoConnectability::GetFactoryInstance() { | 295 IncognitoConnectability::GetFactoryInstance() { |
290 return g_factory.Pointer(); | 296 return g_factory.Pointer(); |
291 } | 297 } |
292 | 298 |
293 } // namespace extensions | 299 } // namespace extensions |
OLD | NEW |