| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/ui/extensions/extension_action_view_controller.h" | 5 #include "chrome/browser/ui/extensions/extension_action_view_controller.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/extensions/api/commands/command_service.h" | 9 #include "chrome/browser/extensions/api/commands/command_service.h" |
| 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" | 10 #include "chrome/browser/extensions/api/extension_action/extension_action_api.h" |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // same one as a desire to close it (like clicking a menu button that was | 281 // same one as a desire to close it (like clicking a menu button that was |
| 282 // already open). | 282 // already open). |
| 283 if (already_showing) | 283 if (already_showing) |
| 284 return false; | 284 return false; |
| 285 | 285 |
| 286 popup_host_ = platform_delegate_->ShowPopupWithUrl( | 286 popup_host_ = platform_delegate_->ShowPopupWithUrl( |
| 287 show_action, popup_url, grant_tab_permissions); | 287 show_action, popup_url, grant_tab_permissions); |
| 288 if (popup_host_) { | 288 if (popup_host_) { |
| 289 // Lazily register for notifications about extension host destructions. | 289 // Lazily register for notifications about extension host destructions. |
| 290 static const int kType = extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED; | 290 static const int kType = extensions::NOTIFICATION_EXTENSION_HOST_DESTROYED; |
| 291 content::Source<content::BrowserContext> source(browser_->profile()); | 291 content::Source<content::BrowserContext> source( |
| 292 browser_->profile()->GetOriginalProfile()); |
| 292 if (!registrar_.IsRegistered(this, kType, source)) | 293 if (!registrar_.IsRegistered(this, kType, source)) |
| 293 registrar_.Add(this, kType, source); | 294 registrar_.Add(this, kType, source); |
| 294 | 295 |
| 295 view_delegate_->OnPopupShown(grant_tab_permissions); | 296 view_delegate_->OnPopupShown(grant_tab_permissions); |
| 296 } | 297 } |
| 297 return is_showing_popup(); | 298 return is_showing_popup(); |
| 298 } | 299 } |
| 299 | 300 |
| 300 void ExtensionActionViewController::OnPopupClosed() { | 301 void ExtensionActionViewController::OnPopupClosed() { |
| 301 popup_host_ = nullptr; | 302 popup_host_ = nullptr; |
| 302 view_delegate_->OnPopupClosed(); | 303 view_delegate_->OnPopupClosed(); |
| 303 } | 304 } |
| OLD | NEW |