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

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

Issue 10843071: Create chrome/browser/api directory. Move infobar delegates used by Autofill to the directory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/infobars/infobar_delegate.h"
6
7 #include "base/logging.h"
8 #include "build/build_config.h"
9 #include "chrome/browser/infobars/infobar_tab_helper.h"
10 #include "content/public/browser/navigation_controller.h"
11 #include "content/public/browser/navigation_details.h"
12 #include "content/public/browser/navigation_entry.h"
13 #include "content/public/browser/web_contents.h"
14
15 using content::NavigationEntry;
16
17 // InfoBarDelegate ------------------------------------------------------------
18
19 InfoBarDelegate::~InfoBarDelegate() {
20 }
21
22 InfoBarDelegate::InfoBarAutomationType
23 InfoBarDelegate::GetInfoBarAutomationType() const {
24 return UNKNOWN_INFOBAR;
25 }
26
27 bool InfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const {
28 return false;
29 }
30
31 bool InfoBarDelegate::ShouldExpire(
32 const content::LoadCommittedDetails& details) const {
33 if (!details.is_navigation_to_different_page())
34 return false;
35
36 return ShouldExpireInternal(details);
37 }
38
39 void InfoBarDelegate::InfoBarDismissed() {
40 }
41
42 void InfoBarDelegate::InfoBarClosed() {
43 delete this;
44 }
45
46 gfx::Image* InfoBarDelegate::GetIcon() const {
47 return NULL;
48 }
49
50 InfoBarDelegate::Type InfoBarDelegate::GetInfoBarType() const {
51 return WARNING_TYPE;
52 }
53
54 AutoLoginInfoBarDelegate* InfoBarDelegate::AsAutoLoginInfoBarDelegate() {
55 return NULL;
56 }
57
58 ConfirmInfoBarDelegate* InfoBarDelegate::AsConfirmInfoBarDelegate() {
59 return NULL;
60 }
61
62 ExtensionInfoBarDelegate* InfoBarDelegate::AsExtensionInfoBarDelegate() {
63 return NULL;
64 }
65
66 InsecureContentInfoBarDelegate*
67 InfoBarDelegate::AsInsecureContentInfoBarDelegate() {
68 return NULL;
69 }
70
71 LinkInfoBarDelegate* InfoBarDelegate::AsLinkInfoBarDelegate() {
72 return NULL;
73 }
74
75 MediaStreamInfoBarDelegate* InfoBarDelegate::AsMediaStreamInfoBarDelegate() {
76 return NULL;
77 }
78
79 RegisterProtocolHandlerInfoBarDelegate*
80 InfoBarDelegate::AsRegisterProtocolHandlerInfoBarDelegate() {
81 return NULL;
82 }
83
84 ThemeInstalledInfoBarDelegate*
85 InfoBarDelegate::AsThemePreviewInfobarDelegate() {
86 return NULL;
87 }
88
89 TranslateInfoBarDelegate* InfoBarDelegate::AsTranslateInfoBarDelegate() {
90 return NULL;
91 }
92
93 InfoBarDelegate::InfoBarDelegate(InfoBarTabHelper* infobar_helper)
94 : contents_unique_id_(0),
95 owner_(infobar_helper) {
96 if (infobar_helper)
97 StoreActiveEntryUniqueID(infobar_helper);
98 }
99
100 void InfoBarDelegate::StoreActiveEntryUniqueID(
101 InfoBarTabHelper* infobar_helper) {
102 NavigationEntry* active_entry =
103 infobar_helper->web_contents()->GetController().GetActiveEntry();
104 contents_unique_id_ = active_entry ? active_entry->GetUniqueID() : 0;
105 }
106
107 bool InfoBarDelegate::ShouldExpireInternal(
108 const content::LoadCommittedDetails& details) const {
109 return (contents_unique_id_ != details.entry->GetUniqueID()) ||
110 (content::PageTransitionStripQualifier(
111 details.entry->GetTransitionType()) ==
112 content::PAGE_TRANSITION_RELOAD);
113 }
114
115 void InfoBarDelegate::RemoveSelf() {
116 if (owner_)
117 owner_->RemoveInfoBar(this); // Clears |owner_|.
118 }
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobar_delegate.h ('k') | chrome/browser/infobars/infobar_extension_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698