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

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

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/extensions/extension_view_host.h" 8 #include "chrome/browser/extensions/extension_view_host.h"
9 #include "chrome/browser/extensions/extension_view_host_factory.h" 9 #include "chrome/browser/extensions/extension_view_host_factory.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 #endif 43 #endif
44 extension_(extension), 44 extension_(extension),
45 extension_registry_observer_(this), 45 extension_registry_observer_(this),
46 closing_(false) { 46 closing_(false) {
47 extension_view_host_.reset( 47 extension_view_host_.reset(
48 extensions::ExtensionViewHostFactory::CreateInfobarHost(url, browser)); 48 extensions::ExtensionViewHostFactory::CreateInfobarHost(url, browser));
49 extension_view_host_->SetAssociatedWebContents(web_contents); 49 extension_view_host_->SetAssociatedWebContents(web_contents);
50 50
51 extension_registry_observer_.Add( 51 extension_registry_observer_.Add(
52 extensions::ExtensionRegistry::Get(browser->profile())); 52 extensions::ExtensionRegistry::Get(browser->profile()));
53 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, 53 registrar_.Add(this,
54 extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
54 content::Source<Profile>(browser->profile())); 55 content::Source<Profile>(browser->profile()));
55 56
56 height_ = std::max(0, height); 57 height_ = std::max(0, height);
57 height_ = std::min(2 * infobars::InfoBar::kDefaultBarTargetHeight, height_); 58 height_ = std::min(2 * infobars::InfoBar::kDefaultBarTargetHeight, height_);
58 if (height_ == 0) 59 if (height_ == 0)
59 height_ = infobars::InfoBar::kDefaultBarTargetHeight; 60 height_ = infobars::InfoBar::kDefaultBarTargetHeight;
60 } 61 }
61 62
62 content::WebContents* ExtensionInfoBarDelegate::GetWebContents() { 63 content::WebContents* ExtensionInfoBarDelegate::GetWebContents() {
63 return InfoBarService::WebContentsFromInfoBar(infobar()); 64 return InfoBarService::WebContentsFromInfoBar(infobar());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 const extensions::Extension* extension, 103 const extensions::Extension* extension,
103 extensions::UnloadedExtensionInfo::Reason reason) { 104 extensions::UnloadedExtensionInfo::Reason reason) {
104 if (extension_ == extension) 105 if (extension_ == extension)
105 infobar()->RemoveSelf(); 106 infobar()->RemoveSelf();
106 } 107 }
107 108
108 void ExtensionInfoBarDelegate::Observe( 109 void ExtensionInfoBarDelegate::Observe(
109 int type, 110 int type,
110 const content::NotificationSource& source, 111 const content::NotificationSource& source,
111 const content::NotificationDetails& details) { 112 const content::NotificationDetails& details) {
112 DCHECK_EQ(type, chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE); 113 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE);
113 if (extension_view_host_.get() == 114 if (extension_view_host_.get() ==
114 content::Details<extensions::ExtensionHost>(details).ptr()) 115 content::Details<extensions::ExtensionHost>(details).ptr())
115 infobar()->RemoveSelf(); 116 infobar()->RemoveSelf();
116 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698