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 20 matching lines...) Expand all Loading... |
31 class IncognitoConnectabilityInfoBarDelegate : public ConfirmInfoBarDelegate { | 31 class IncognitoConnectabilityInfoBarDelegate : public ConfirmInfoBarDelegate { |
32 public: | 32 public: |
33 typedef base::Callback<void( | 33 typedef base::Callback<void( |
34 IncognitoConnectability::ScopedAlertTracker::Mode)> InfoBarCallback; | 34 IncognitoConnectability::ScopedAlertTracker::Mode)> InfoBarCallback; |
35 | 35 |
36 // Creates a confirmation infobar and delegate and adds the infobar to | 36 // Creates a confirmation infobar and delegate and adds the infobar to |
37 // |infobar_service|. | 37 // |infobar_service|. |
38 static InfoBar* Create(InfoBarManager* infobar_manager, | 38 static InfoBar* Create(InfoBarManager* infobar_manager, |
39 const base::string16& message, | 39 const base::string16& message, |
40 const InfoBarCallback& callback) { | 40 const InfoBarCallback& callback) { |
41 return infobar_manager->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 41 return infobar_manager->AddInfoBar(infobar_manager->CreateConfirmInfoBar( |
42 scoped_ptr<ConfirmInfoBarDelegate>( | 42 scoped_ptr<ConfirmInfoBarDelegate>( |
43 new IncognitoConnectabilityInfoBarDelegate(message, callback)))); | 43 new IncognitoConnectabilityInfoBarDelegate(message, callback)))); |
44 } | 44 } |
45 | 45 |
46 // Set the infobar answered so that the callback is not executed when the | 46 // Set the infobar answered so that the callback is not executed when the |
47 // delegate is destroyed. | 47 // delegate is destroyed. |
48 void SetAnswered() { answered_ = true; } | 48 void SetAnswered() { answered_ = true; } |
49 | 49 |
50 private: | 50 private: |
51 IncognitoConnectabilityInfoBarDelegate(const base::string16& message, | 51 IncognitoConnectabilityInfoBarDelegate(const base::string16& message, |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = | 258 BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = |
259 LAZY_INSTANCE_INITIALIZER; | 259 LAZY_INSTANCE_INITIALIZER; |
260 | 260 |
261 // static | 261 // static |
262 BrowserContextKeyedAPIFactory<IncognitoConnectability>* | 262 BrowserContextKeyedAPIFactory<IncognitoConnectability>* |
263 IncognitoConnectability::GetFactoryInstance() { | 263 IncognitoConnectability::GetFactoryInstance() { |
264 return g_factory.Pointer(); | 264 return g_factory.Pointer(); |
265 } | 265 } |
266 | 266 |
267 } // namespace extensions | 267 } // namespace extensions |
OLD | NEW |