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

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

Issue 765643003: Remove dependency from infobars component to the embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation Created 6 years 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
« no previous file with comments | « no previous file | chrome/browser/infobars/chrome_infobar_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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, 53 registrar_.Add(this,
54 extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE, 54 extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE,
55 content::Source<Profile>(browser->profile())); 55 content::Source<Profile>(browser->profile()));
56 56
57 height_ = std::max(0, height); 57 height_ = std::max(0, height);
58 height_ = std::min(2 * infobars::InfoBar::kDefaultBarTargetHeight, height_); 58 height_ =
59 std::min(2 * kChromeInfoBarConstants.default_bar_target_height, height_);
59 if (height_ == 0) 60 if (height_ == 0)
60 height_ = infobars::InfoBar::kDefaultBarTargetHeight; 61 height_ = kChromeInfoBarConstants.default_bar_target_height;
61 } 62 }
62 63
63 content::WebContents* ExtensionInfoBarDelegate::GetWebContents() { 64 content::WebContents* ExtensionInfoBarDelegate::GetWebContents() {
64 return InfoBarService::WebContentsFromInfoBar(infobar()); 65 return InfoBarService::WebContentsFromInfoBar(infobar());
65 } 66 }
66 67
67 // ExtensionInfoBarDelegate::CreateInfoBar() is implemented in platform-specific 68 // ExtensionInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
68 // files. 69 // files.
69 70
70 bool ExtensionInfoBarDelegate::EqualsDelegate( 71 bool ExtensionInfoBarDelegate::EqualsDelegate(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 109
109 void ExtensionInfoBarDelegate::Observe( 110 void ExtensionInfoBarDelegate::Observe(
110 int type, 111 int type,
111 const content::NotificationSource& source, 112 const content::NotificationSource& source,
112 const content::NotificationDetails& details) { 113 const content::NotificationDetails& details) {
113 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE); 114 DCHECK_EQ(type, extensions::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE);
114 if (extension_view_host_.get() == 115 if (extension_view_host_.get() ==
115 content::Details<extensions::ExtensionHost>(details).ptr()) 116 content::Details<extensions::ExtensionHost>(details).ptr())
116 infobar()->RemoveSelf(); 117 infobar()->RemoveSelf();
117 } 118 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/infobars/chrome_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698