| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/extension_infobar_delegate.h" | 5 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
| 6 | 6 |
| 7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
| 8 #include "chrome/browser/profile.h" | 8 #include "chrome/browser/profile.h" |
| 9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
| 10 #include "chrome/browser/extensions/extension_process_manager.h" | 10 #include "chrome/browser/extensions/extension_process_manager.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "chrome/common/notification_details.h" | 12 #include "chrome/common/notification_details.h" |
| 13 #include "chrome/common/notification_source.h" | 13 #include "chrome/common/notification_source.h" |
| 14 #include "chrome/common/notification_type.h" | 14 #include "chrome/common/notification_type.h" |
| 15 | 15 |
| 16 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser, | 16 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser, |
| 17 TabContents* tab_contents, | 17 TabContents* tab_contents, |
| 18 Extension* extension, | 18 Extension* extension, |
| 19 const GURL& url) | 19 const GURL& url) |
| 20 : InfoBarDelegate(tab_contents), | 20 : InfoBarDelegate(tab_contents), |
| 21 observer_(NULL), | 21 observer_(NULL), |
| 22 extension_(extension), | 22 extension_(extension), |
| 23 tab_contents_(tab_contents) { | 23 tab_contents_(tab_contents) { |
| 24 ExtensionProcessManager* manager = | 24 ExtensionProcessManager* manager = |
| 25 browser->profile()->GetExtensionProcessManager(); | 25 browser->profile()->GetExtensionProcessManager(); |
| 26 extension_host_.reset(manager->CreateInfobar(url, browser)); | 26 extension_host_.reset(manager->CreateInfobar(url, browser)); |
| 27 extension_host_->set_associated_tab_contents(tab_contents); |
| 27 | 28 |
| 28 registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, | 29 registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, |
| 29 Source<Profile>(browser->profile())); | 30 Source<Profile>(browser->profile())); |
| 30 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, | 31 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, |
| 31 Source<Profile>(browser->profile())); | 32 Source<Profile>(browser->profile())); |
| 32 } | 33 } |
| 33 | 34 |
| 34 ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() { | 35 ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() { |
| 35 if (observer_) | 36 if (observer_) |
| 36 observer_->OnDelegateDeleted(); | 37 observer_->OnDelegateDeleted(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 if (extension_ == extension) | 79 if (extension_ == extension) |
| 79 tab_contents_->RemoveInfoBar(this); | 80 tab_contents_->RemoveInfoBar(this); |
| 80 break; | 81 break; |
| 81 } | 82 } |
| 82 default: { | 83 default: { |
| 83 NOTREACHED() << "Unknown message"; | 84 NOTREACHED() << "Unknown message"; |
| 84 break; | 85 break; |
| 85 } | 86 } |
| 86 } | 87 } |
| 87 } | 88 } |
| OLD | NEW |