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

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

Issue 230453004: Remove InfoBarDelegate::web_contents() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix compile Created 6 years, 8 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.h" 10 #include "chrome/browser/infobars/infobar.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 content::Source<Profile>(browser->profile())); 50 content::Source<Profile>(browser->profile()));
51 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 51 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
52 content::Source<Profile>(browser->profile())); 52 content::Source<Profile>(browser->profile()));
53 53
54 height_ = std::max(0, height); 54 height_ = std::max(0, height);
55 height_ = std::min(2 * InfoBar::kDefaultBarTargetHeight, height_); 55 height_ = std::min(2 * InfoBar::kDefaultBarTargetHeight, height_);
56 if (height_ == 0) 56 if (height_ == 0)
57 height_ = InfoBar::kDefaultBarTargetHeight; 57 height_ = InfoBar::kDefaultBarTargetHeight;
58 } 58 }
59 59
60 content::WebContents* ExtensionInfoBarDelegate::GetWebContents() {
61 return InfoBarService::WebContentsFromInfoBar(infobar());
62 }
63
60 // ExtensionInfoBarDelegate::CreateInfoBar() is implemented in platform-specific 64 // ExtensionInfoBarDelegate::CreateInfoBar() is implemented in platform-specific
61 // files. 65 // files.
62 66
63 bool ExtensionInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { 67 bool ExtensionInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
64 ExtensionInfoBarDelegate* extension_delegate = 68 ExtensionInfoBarDelegate* extension_delegate =
65 delegate->AsExtensionInfoBarDelegate(); 69 delegate->AsExtensionInfoBarDelegate();
66 // When an extension crashes, an InfoBar is shown (for the crashed extension). 70 // When an extension crashes, an InfoBar is shown (for the crashed extension).
67 // That will result in a call to this function (to see if this InfoBarDelegate 71 // That will result in a call to this function (to see if this InfoBarDelegate
68 // is already showing the 'extension crashed InfoBar', which it never is), but 72 // is already showing the 'extension crashed InfoBar', which it never is), but
69 // if it is our extension that crashes, the extension delegate is NULL so 73 // if it is our extension that crashes, the extension delegate is NULL so
(...skipping 27 matching lines...) Expand all
97 if (extension_view_host_.get() == 101 if (extension_view_host_.get() ==
98 content::Details<extensions::ExtensionHost>(details).ptr()) 102 content::Details<extensions::ExtensionHost>(details).ptr())
99 infobar()->RemoveSelf(); 103 infobar()->RemoveSelf();
100 } else { 104 } else {
101 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED); 105 DCHECK(type == chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED);
102 if (extension_ == content::Details<extensions::UnloadedExtensionInfo>( 106 if (extension_ == content::Details<extensions::UnloadedExtensionInfo>(
103 details)->extension) 107 details)->extension)
104 infobar()->RemoveSelf(); 108 infobar()->RemoveSelf();
105 } 109 }
106 } 110 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_infobar_delegate.h ('k') | chrome/browser/geolocation/geolocation_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698