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

Side by Side Diff: chrome/browser/infobars/infobar_delegate.cc

Issue 230853002: Remove remaining dependencies of infobars on content/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use virtual method 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_manager.h"
11 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/navigation_details.h"
13 #include "content/public/browser/navigation_entry.h"
14 #include "content/public/browser/web_contents.h"
15 #include "ui/base/resource/resource_bundle.h" 11 #include "ui/base/resource/resource_bundle.h"
16 12
17 using content::NavigationEntry;
18
19 // InfoBarDelegate ------------------------------------------------------------
20
21 const int InfoBarDelegate::kNoIconID = 0; 13 const int InfoBarDelegate::kNoIconID = 0;
22 14
23 InfoBarDelegate::~InfoBarDelegate() { 15 InfoBarDelegate::~InfoBarDelegate() {
24 } 16 }
25 17
26 InfoBarDelegate::InfoBarAutomationType 18 InfoBarDelegate::InfoBarAutomationType
27 InfoBarDelegate::GetInfoBarAutomationType() const { 19 InfoBarDelegate::GetInfoBarAutomationType() const {
28 return UNKNOWN_INFOBAR; 20 return UNKNOWN_INFOBAR;
29 } 21 }
30 22
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ThemeInstalledInfoBarDelegate* 80 ThemeInstalledInfoBarDelegate*
89 InfoBarDelegate::AsThemePreviewInfobarDelegate() { 81 InfoBarDelegate::AsThemePreviewInfobarDelegate() {
90 return NULL; 82 return NULL;
91 } 83 }
92 84
93 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() { 85 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() {
94 return NULL; 86 return NULL;
95 } 87 }
96 88
97 void InfoBarDelegate::StoreActiveEntryUniqueID() { 89 void InfoBarDelegate::StoreActiveEntryUniqueID() {
98 // TODO(droger): Remove this dependency on InfoBarService, see 90 int entry_id = 0;
99 // http://crbug.com/354379. 91 if (infobar() && infobar()->owner())
100 content::WebContents* web_contents = 92 entry_id = infobar()->owner()->GetActiveEntryID();
droger 2014/04/09 16:10:52 We could maybe rename StoreActiveEntryUniqueID() a
Peter Kasting 2014/04/10 00:17:20 I don't have an opinion.
101 InfoBarService::WebContentsFromInfoBar(infobar()); 93 contents_unique_id_ = entry_id;
Peter Kasting 2014/04/10 00:17:20 Nit: Shorter: contents_unique_id_ = (infobar()
droger 2014/04/10 17:18:07 Done.
102 DCHECK(web_contents);
103 NavigationEntry* active_entry =
104 web_contents->GetController().GetActiveEntry();
105 contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0;
106 } 94 }
107 95
108 gfx::Image InfoBarDelegate::GetIcon() const { 96 gfx::Image InfoBarDelegate::GetIcon() const {
109 int icon_id = GetIconID(); 97 int icon_id = GetIconID();
110 return (icon_id == kNoIconID) ? gfx::Image() : 98 return (icon_id == kNoIconID) ? gfx::Image() :
111 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id); 99 ResourceBundle::GetSharedInstance().GetNativeImageNamed(icon_id);
112 } 100 }
113 101
114 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) { 102 InfoBarDelegate::InfoBarDelegate() : contents_unique_id_(0) {
115 } 103 }
116 104
117 bool InfoBarDelegate::ShouldExpireInternal( 105 bool InfoBarDelegate::ShouldExpireInternal(
118 const NavigationDetails& details) const { 106 const NavigationDetails& details) const {
119 // NOTE: If you change this, be sure to check and adjust the behavior of 107 // NOTE: If you change this, be sure to check and adjust the behavior of
120 // anyone who overrides this as necessary! 108 // anyone who overrides this as necessary!
121 return (contents_unique_id_ != details.entry_id) || details.is_reload; 109 return (contents_unique_id_ != details.entry_id) || details.is_reload;
122 } 110 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698