Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: chrome/browser/extensions/extension_infobar_delegate.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_host.h" 7 #include "chrome/browser/extensions/extension_host.h"
8 #include "chrome/browser/extensions/extension_process_manager.h" 8 #include "chrome/browser/extensions/extension_process_manager.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 11 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
12 #include "chrome/common/chrome_notification_types.h"
12 #include "chrome/common/extensions/extension.h" 13 #include "chrome/common/extensions/extension.h"
13 #include "content/common/notification_details.h" 14 #include "content/common/notification_details.h"
14 #include "content/common/notification_source.h" 15 #include "content/common/notification_source.h"
15 #include "content/common/notification_type.h"
16 16
17 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser, 17 ExtensionInfoBarDelegate::ExtensionInfoBarDelegate(Browser* browser,
18 TabContents* tab_contents, 18 TabContents* tab_contents,
19 const Extension* extension, 19 const Extension* extension,
20 const GURL& url) 20 const GURL& url)
21 : InfoBarDelegate(tab_contents), 21 : InfoBarDelegate(tab_contents),
22 observer_(NULL), 22 observer_(NULL),
23 extension_(extension), 23 extension_(extension),
24 tab_contents_(tab_contents), 24 tab_contents_(tab_contents),
25 closing_(false) { 25 closing_(false) {
26 ExtensionProcessManager* manager = 26 ExtensionProcessManager* manager =
27 browser->profile()->GetExtensionProcessManager(); 27 browser->profile()->GetExtensionProcessManager();
28 extension_host_.reset(manager->CreateInfobarHost(url, browser)); 28 extension_host_.reset(manager->CreateInfobarHost(url, browser));
29 extension_host_->set_associated_tab_contents(tab_contents); 29 extension_host_->set_associated_tab_contents(tab_contents);
30 30
31 registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, 31 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
32 Source<Profile>(browser->profile())); 32 Source<Profile>(browser->profile()));
33 registrar_.Add(this, NotificationType::EXTENSION_UNLOADED, 33 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED,
34 Source<Profile>(browser->profile())); 34 Source<Profile>(browser->profile()));
35 } 35 }
36 36
37 ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() { 37 ExtensionInfoBarDelegate::~ExtensionInfoBarDelegate() {
38 if (observer_) 38 if (observer_)
39 observer_->OnDelegateDeleted(); 39 observer_->OnDelegateDeleted();
40 } 40 }
41 41
42 bool ExtensionInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { 42 bool ExtensionInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
43 ExtensionInfoBarDelegate* extension_delegate = 43 ExtensionInfoBarDelegate* extension_delegate =
(...skipping 17 matching lines...) Expand all
61 61
62 InfoBarDelegate::Type ExtensionInfoBarDelegate::GetInfoBarType() const { 62 InfoBarDelegate::Type ExtensionInfoBarDelegate::GetInfoBarType() const {
63 return PAGE_ACTION_TYPE; 63 return PAGE_ACTION_TYPE;
64 } 64 }
65 65
66 ExtensionInfoBarDelegate* 66 ExtensionInfoBarDelegate*
67 ExtensionInfoBarDelegate::AsExtensionInfoBarDelegate() { 67 ExtensionInfoBarDelegate::AsExtensionInfoBarDelegate() {
68 return this; 68 return this;
69 } 69 }
70 70
71 void ExtensionInfoBarDelegate::Observe(NotificationType type, 71 void ExtensionInfoBarDelegate::Observe(int type,
72 const NotificationSource& source, 72 const NotificationSource& source,
73 const NotificationDetails& details) { 73 const NotificationDetails& details) {
74 TabContentsWrapper* wrapper = 74 TabContentsWrapper* wrapper =
75 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_); 75 TabContentsWrapper::GetCurrentWrapperForContents(tab_contents_);
76 switch (type.value) { 76 switch (type) {
77 case NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE: { 77 case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: {
78 const ExtensionHost* result = Details<ExtensionHost>(details).ptr(); 78 const ExtensionHost* result = Details<ExtensionHost>(details).ptr();
79 if (extension_host_.get() == result) 79 if (extension_host_.get() == result)
80 wrapper->RemoveInfoBar(this); 80 wrapper->RemoveInfoBar(this);
81 break; 81 break;
82 } 82 }
83 case NotificationType::EXTENSION_UNLOADED: { 83 case chrome::NOTIFICATION_EXTENSION_UNLOADED: {
84 const Extension* extension = 84 const Extension* extension =
85 Details<UnloadedExtensionInfo>(details)->extension; 85 Details<UnloadedExtensionInfo>(details)->extension;
86 if (extension_ == extension) 86 if (extension_ == extension)
87 wrapper->RemoveInfoBar(this); 87 wrapper->RemoveInfoBar(this);
88 break; 88 break;
89 } 89 }
90 default: { 90 default: {
91 NOTREACHED() << "Unknown message"; 91 NOTREACHED() << "Unknown message";
92 break; 92 break;
93 } 93 }
94 } 94 }
95 } 95 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_infobar_delegate.h ('k') | chrome/browser/extensions/extension_input_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698