| 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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 break; | 235 break; |
| 236 case ScopedAlertTracker::ALWAYS_DENY: | 236 case ScopedAlertTracker::ALWAYS_DENY: |
| 237 disallowed_origins_[extension_id].insert(origin); | 237 disallowed_origins_[extension_id].insert(origin); |
| 238 break; | 238 break; |
| 239 default: | 239 default: |
| 240 // Otherwise the user has not expressed an explicit preference and so | 240 // Otherwise the user has not expressed an explicit preference and so |
| 241 // nothing should be permanently recorded. | 241 // nothing should be permanently recorded. |
| 242 break; | 242 break; |
| 243 } | 243 } |
| 244 | 244 |
| 245 DCHECK(ContainsKey(pending_origins_, make_pair(extension_id, origin))); | 245 DCHECK(base::ContainsKey(pending_origins_, make_pair(extension_id, origin))); |
| 246 PendingOrigin& pending_origin = | 246 PendingOrigin& pending_origin = |
| 247 pending_origins_[make_pair(extension_id, origin)]; | 247 pending_origins_[make_pair(extension_id, origin)]; |
| 248 DCHECK(ContainsKey(pending_origin, infobar_manager)); | 248 DCHECK(base::ContainsKey(pending_origin, infobar_manager)); |
| 249 | 249 |
| 250 std::vector<base::Callback<void(bool)>> callbacks; | 250 std::vector<base::Callback<void(bool)>> callbacks; |
| 251 if (response == ScopedAlertTracker::INTERACTIVE) { | 251 if (response == ScopedAlertTracker::INTERACTIVE) { |
| 252 // No definitive answer for this extension and origin. Execute only the | 252 // No definitive answer for this extension and origin. Execute only the |
| 253 // callbacks associated with this tab. | 253 // callbacks associated with this tab. |
| 254 TabContext& tab_context = pending_origin[infobar_manager]; | 254 TabContext& tab_context = pending_origin[infobar_manager]; |
| 255 callbacks.swap(tab_context.callbacks); | 255 callbacks.swap(tab_context.callbacks); |
| 256 pending_origin.erase(infobar_manager); | 256 pending_origin.erase(infobar_manager); |
| 257 } else { | 257 } else { |
| 258 // We have a definitive answer for this extension and origin. Close all | 258 // We have a definitive answer for this extension and origin. Close all |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = | 293 BrowserContextKeyedAPIFactory<IncognitoConnectability> > g_factory = |
| 294 LAZY_INSTANCE_INITIALIZER; | 294 LAZY_INSTANCE_INITIALIZER; |
| 295 | 295 |
| 296 // static | 296 // static |
| 297 BrowserContextKeyedAPIFactory<IncognitoConnectability>* | 297 BrowserContextKeyedAPIFactory<IncognitoConnectability>* |
| 298 IncognitoConnectability::GetFactoryInstance() { | 298 IncognitoConnectability::GetFactoryInstance() { |
| 299 return g_factory.Pointer(); | 299 return g_factory.Pointer(); |
| 300 } | 300 } |
| 301 | 301 |
| 302 } // namespace extensions | 302 } // namespace extensions |
| OLD | NEW |