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

Side by Side Diff: chrome/browser/infobars/infobar_service.h

Issue 240193003: Move Infobars core files to the Infobars component (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix nib name on mac 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
« no previous file with comments | « chrome/browser/infobars/infobar_manager.cc ('k') | chrome/browser/infobars/infobar_service.cc » ('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 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ 5 #ifndef CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_
6 #define CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ 6 #define CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "chrome/browser/infobars/infobar_manager.h" 11 #include "components/infobars/core/infobar_manager.h"
12 #include "content/public/browser/web_contents_observer.h" 12 #include "content/public/browser/web_contents_observer.h"
13 #include "content/public/browser/web_contents_user_data.h" 13 #include "content/public/browser/web_contents_user_data.h"
14 14
15 namespace content { 15 namespace content {
16 struct LoadCommittedDetails; 16 struct LoadCommittedDetails;
17 class WebContents; 17 class WebContents;
18 } 18 }
19 19
20 namespace infobars {
20 class InfoBar; 21 class InfoBar;
22 }
21 23
22 // Associates a Tab to a InfoBarManager and manages its lifetime. 24 // Associates a Tab to a InfoBarManager and manages its lifetime.
23 // It manages the infobar notifications and responds to navigation events. 25 // It manages the infobar notifications and responds to navigation events.
24 class InfoBarService : public InfoBarManager, 26 class InfoBarService : public infobars::InfoBarManager,
25 public content::WebContentsObserver, 27 public content::WebContentsObserver,
26 public content::WebContentsUserData<InfoBarService> { 28 public content::WebContentsUserData<InfoBarService> {
27 public: 29 public:
28 static InfoBarDelegate::NavigationDetails 30 static infobars::InfoBarDelegate::NavigationDetails
29 NavigationDetailsFromLoadCommittedDetails( 31 NavigationDetailsFromLoadCommittedDetails(
30 const content::LoadCommittedDetails& details); 32 const content::LoadCommittedDetails& details);
31 33
32 // This function must only be called on infobars that are owned by an 34 // This function must only be called on infobars that are owned by an
33 // InfoBarService instance (or not owned at all, in which case this returns 35 // InfoBarService instance (or not owned at all, in which case this returns
34 // NULL). 36 // NULL).
35 static content::WebContents* WebContentsFromInfoBar(InfoBar* infobar); 37 static content::WebContents* WebContentsFromInfoBar(
38 infobars::InfoBar* infobar);
36 39
37 // Retrieve the WebContents for the tab this service is associated with. 40 // Retrieve the WebContents for the tab this service is associated with.
38 content::WebContents* web_contents() { 41 content::WebContents* web_contents() {
39 return content::WebContentsObserver::web_contents(); 42 return content::WebContentsObserver::web_contents();
40 } 43 }
41 44
42 private: 45 private:
43 friend class content::WebContentsUserData<InfoBarService>; 46 friend class content::WebContentsUserData<InfoBarService>;
44 47
45 explicit InfoBarService(content::WebContents* web_contents); 48 explicit InfoBarService(content::WebContents* web_contents);
46 virtual ~InfoBarService(); 49 virtual ~InfoBarService();
47 50
48 // InfoBarManager: 51 // InfoBarManager:
49 virtual int GetActiveEntryID() OVERRIDE; 52 virtual int GetActiveEntryID() OVERRIDE;
50 // TODO(droger): Remove these functions once infobar notifications are 53 // TODO(droger): Remove these functions once infobar notifications are
51 // removed. See http://crbug.com/354380 54 // removed. See http://crbug.com/354380
52 virtual void NotifyInfoBarAdded(InfoBar* infobar) OVERRIDE; 55 virtual void NotifyInfoBarAdded(infobars::InfoBar* infobar) OVERRIDE;
53 virtual void NotifyInfoBarRemoved(InfoBar* infobar, bool animate) OVERRIDE; 56 virtual void NotifyInfoBarRemoved(infobars::InfoBar* infobar,
54 virtual void NotifyInfoBarReplaced(InfoBar* old_infobar, 57 bool animate) OVERRIDE;
55 InfoBar* new_infobar) OVERRIDE; 58 virtual void NotifyInfoBarReplaced(infobars::InfoBar* old_infobar,
59 infobars::InfoBar* new_infobar) OVERRIDE;
56 60
57 // content::WebContentsObserver: 61 // content::WebContentsObserver:
58 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; 62 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE;
59 virtual void NavigationEntryCommitted( 63 virtual void NavigationEntryCommitted(
60 const content::LoadCommittedDetails& load_details) OVERRIDE; 64 const content::LoadCommittedDetails& load_details) OVERRIDE;
61 virtual void WebContentsDestroyed( 65 virtual void WebContentsDestroyed(
62 content::WebContents* web_contents) OVERRIDE; 66 content::WebContents* web_contents) OVERRIDE;
63 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; 67 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE;
64 68
65 // Message handlers. 69 // Message handlers.
66 void OnDidBlockDisplayingInsecureContent(); 70 void OnDidBlockDisplayingInsecureContent();
67 void OnDidBlockRunningInsecureContent(); 71 void OnDidBlockRunningInsecureContent();
68 72
69 73
70 DISALLOW_COPY_AND_ASSIGN(InfoBarService); 74 DISALLOW_COPY_AND_ASSIGN(InfoBarService);
71 }; 75 };
72 76
73 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ 77 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/infobars/infobar_manager.cc ('k') | chrome/browser/infobars/infobar_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698