OLD | NEW |
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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 static infobars::InfoBarDelegate::NavigationDetails | 30 static infobars::InfoBarDelegate::NavigationDetails |
31 NavigationDetailsFromLoadCommittedDetails( | 31 NavigationDetailsFromLoadCommittedDetails( |
32 const content::LoadCommittedDetails& details); | 32 const content::LoadCommittedDetails& details); |
33 | 33 |
34 // 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 |
35 // 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 |
36 // NULL). | 36 // NULL). |
37 static content::WebContents* WebContentsFromInfoBar( | 37 static content::WebContents* WebContentsFromInfoBar( |
38 infobars::InfoBar* infobar); | 38 infobars::InfoBar* infobar); |
39 | 39 |
| 40 // Makes it so the next reload is ignored. That is, if the next commit is a |
| 41 // reload then it is treated as if nothing happened and no infobars are |
| 42 // attempted to be closed. |
| 43 // This is useful for non-user triggered reloads that should not dismiss |
| 44 // infobars. For example, instant may trigger a reload when the google URL |
| 45 // changes. |
| 46 void set_ignore_next_reload() { ignore_next_reload_ = true; } |
| 47 |
40 private: | 48 private: |
41 friend class content::WebContentsUserData<InfoBarService>; | 49 friend class content::WebContentsUserData<InfoBarService>; |
42 | 50 |
43 explicit InfoBarService(content::WebContents* web_contents); | 51 explicit InfoBarService(content::WebContents* web_contents); |
44 virtual ~InfoBarService(); | 52 virtual ~InfoBarService(); |
45 | 53 |
46 // InfoBarManager: | 54 // InfoBarManager: |
47 virtual int GetActiveEntryID() OVERRIDE; | 55 virtual int GetActiveEntryID() OVERRIDE; |
48 // TODO(droger): Remove these functions once infobar notifications are | 56 // TODO(droger): Remove these functions once infobar notifications are |
49 // removed. See http://crbug.com/354380 | 57 // removed. See http://crbug.com/354380 |
50 virtual void NotifyInfoBarAdded(infobars::InfoBar* infobar) OVERRIDE; | 58 virtual void NotifyInfoBarAdded(infobars::InfoBar* infobar) OVERRIDE; |
51 virtual void NotifyInfoBarRemoved(infobars::InfoBar* infobar, | 59 virtual void NotifyInfoBarRemoved(infobars::InfoBar* infobar, |
52 bool animate) OVERRIDE; | 60 bool animate) OVERRIDE; |
53 | 61 |
54 // content::WebContentsObserver: | 62 // content::WebContentsObserver: |
55 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 63 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
| 64 virtual void DidStartNavigationToPendingEntry( |
| 65 const GURL& url, |
| 66 content::NavigationController::ReloadType reload_type) OVERRIDE; |
56 virtual void NavigationEntryCommitted( | 67 virtual void NavigationEntryCommitted( |
57 const content::LoadCommittedDetails& load_details) OVERRIDE; | 68 const content::LoadCommittedDetails& load_details) OVERRIDE; |
58 virtual void WebContentsDestroyed() OVERRIDE; | 69 virtual void WebContentsDestroyed() OVERRIDE; |
59 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 70 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
60 | 71 |
61 // Message handlers. | 72 // Message handlers. |
62 void OnDidBlockDisplayingInsecureContent(); | 73 void OnDidBlockDisplayingInsecureContent(); |
63 void OnDidBlockRunningInsecureContent(); | 74 void OnDidBlockRunningInsecureContent(); |
64 | 75 |
| 76 // See description in set_ignore_next_reload(). |
| 77 bool ignore_next_reload_; |
65 | 78 |
66 DISALLOW_COPY_AND_ASSIGN(InfoBarService); | 79 DISALLOW_COPY_AND_ASSIGN(InfoBarService); |
67 }; | 80 }; |
68 | 81 |
69 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ | 82 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ |
OLD | NEW |