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

Side by Side Diff: chrome/browser/infobars/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/infobars/infobar_delegate.h" 5 #include "chrome/browser/infobars/infobar_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "chrome/browser/infobars/infobar.h" 9 #include "chrome/browser/infobars/infobar.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ThemeInstalledInfoBarDelegate* 88 ThemeInstalledInfoBarDelegate*
89 InfoBarDelegate::AsThemePreviewInfobarDelegate() { 89 InfoBarDelegate::AsThemePreviewInfobarDelegate() {
90 return NULL; 90 return NULL;
91 } 91 }
92 92
93 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() { 93 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() {
94 return NULL; 94 return NULL;
95 } 95 }
96 96
97 void InfoBarDelegate::StoreActiveEntryUniqueID() { 97 void InfoBarDelegate::StoreActiveEntryUniqueID() {
98 DCHECK(web_contents()); 98 // TODO(droger): Remove this dependency on InfoBarService, see
99 // http://crbug.com/354379.
100 content::WebContents* web_contents =
101 InfoBarService::WebContentsFromInfoBar(infobar());
102 DCHECK(web_contents);
99 NavigationEntry* active_entry = 103 NavigationEntry* active_entry =
100 web_contents()->GetController().GetActiveEntry(); 104 web_contents->GetController().GetActiveEntry();
101 contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0; 105 contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0;
102 } 106 }
103 107
104 gfx::Image InfoBarDelegate::GetIcon() const { 108 gfx::Image InfoBarDelegate::GetIcon() const {
105 int icon_id = GetIconID(); 109 int icon_id = GetIconID();
106 return (icon_id == kNoIconID) ? gfx::Image() : 110 return (icon_id == kNoIconID) ? gfx::Image() :
107 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); 111 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id);
108 } 112 }
109 113
110 content::WebContents* InfoBarDelegate::web_contents() {
111 return InfoBarService::WebContentsFromInfoBar(infobar_);
112 }
113
114 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { 114 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) {
115 } 115 }
116 116
117 bool InfoBarDelegate::ShouldExpireInternal( 117 bool InfoBarDelegate::ShouldExpireInternal(
118 const NavigationDetails& details) const { 118 const NavigationDetails& details) const {
119 // NOTE: If you change this, be sure to check and adjust the behavior of 119 // NOTE: If you change this, be sure to check and adjust the behavior of
120 // anyone who overrides this as necessary! 120 // anyone who overrides this as necessary!
121 return (contents_unique_id_ != details.entry_id) || details.is_reload; 121 return (contents_unique_id_ != details.entry_id) || details.is_reload;
122 } 122 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobar_delegate.h ('k') | chrome/browser/infobars/insecure_content_infobar_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698