| 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" |
| 11 #include "components/infobars/core/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 namespace infobars { |
| 21 class InfoBar; | 21 class InfoBar; |
| 22 struct InfoBarConstants; |
| 22 } | 23 } |
| 23 | 24 |
| 25 // Constants used by InfoBar animations. |
| 26 extern const infobars::InfoBarConstants kChromeInfoBarConstants; |
| 27 |
| 24 // Associates a Tab to a InfoBarManager and manages its lifetime. | 28 // Associates a Tab to a InfoBarManager and manages its lifetime. |
| 25 // It manages the infobar notifications and responds to navigation events. | 29 // It manages the infobar notifications and responds to navigation events. |
| 26 class InfoBarService : public infobars::InfoBarManager, | 30 class InfoBarService : public infobars::InfoBarManager, |
| 27 public content::WebContentsObserver, | 31 public content::WebContentsObserver, |
| 28 public content::WebContentsUserData<InfoBarService> { | 32 public content::WebContentsUserData<InfoBarService> { |
| 29 public: | 33 public: |
| 30 static infobars::InfoBarDelegate::NavigationDetails | 34 static infobars::InfoBarDelegate::NavigationDetails |
| 31 NavigationDetailsFromLoadCommittedDetails( | 35 NavigationDetailsFromLoadCommittedDetails( |
| 32 const content::LoadCommittedDetails& details); | 36 const content::LoadCommittedDetails& details); |
| 33 | 37 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 46 void set_ignore_next_reload() { ignore_next_reload_ = true; } | 50 void set_ignore_next_reload() { ignore_next_reload_ = true; } |
| 47 | 51 |
| 48 private: | 52 private: |
| 49 friend class content::WebContentsUserData<InfoBarService>; | 53 friend class content::WebContentsUserData<InfoBarService>; |
| 50 | 54 |
| 51 explicit InfoBarService(content::WebContents* web_contents); | 55 explicit InfoBarService(content::WebContents* web_contents); |
| 52 ~InfoBarService() override; | 56 ~InfoBarService() override; |
| 53 | 57 |
| 54 // InfoBarManager: | 58 // InfoBarManager: |
| 55 int GetActiveEntryID() override; | 59 int GetActiveEntryID() override; |
| 60 const infobars::InfoBarConstants& GetInfoBarConstants() const override; |
| 61 |
| 56 // TODO(droger): Remove these functions once infobar notifications are | 62 // TODO(droger): Remove these functions once infobar notifications are |
| 57 // removed. See http://crbug.com/354380 | 63 // removed. See http://crbug.com/354380 |
| 58 void NotifyInfoBarAdded(infobars::InfoBar* infobar) override; | 64 void NotifyInfoBarAdded(infobars::InfoBar* infobar) override; |
| 59 void NotifyInfoBarRemoved(infobars::InfoBar* infobar, bool animate) override; | 65 void NotifyInfoBarRemoved(infobars::InfoBar* infobar, bool animate) override; |
| 60 | 66 |
| 61 // content::WebContentsObserver: | 67 // content::WebContentsObserver: |
| 62 void RenderProcessGone(base::TerminationStatus status) override; | 68 void RenderProcessGone(base::TerminationStatus status) override; |
| 63 void DidStartNavigationToPendingEntry( | 69 void DidStartNavigationToPendingEntry( |
| 64 const GURL& url, | 70 const GURL& url, |
| 65 content::NavigationController::ReloadType reload_type) override; | 71 content::NavigationController::ReloadType reload_type) override; |
| 66 void NavigationEntryCommitted( | 72 void NavigationEntryCommitted( |
| 67 const content::LoadCommittedDetails& load_details) override; | 73 const content::LoadCommittedDetails& load_details) override; |
| 68 void WebContentsDestroyed() override; | 74 void WebContentsDestroyed() override; |
| 69 bool OnMessageReceived(const IPC::Message& message) override; | 75 bool OnMessageReceived(const IPC::Message& message) override; |
| 70 | 76 |
| 71 // Message handlers. | 77 // Message handlers. |
| 72 void OnDidBlockDisplayingInsecureContent(); | 78 void OnDidBlockDisplayingInsecureContent(); |
| 73 void OnDidBlockRunningInsecureContent(); | 79 void OnDidBlockRunningInsecureContent(); |
| 74 | 80 |
| 75 // See description in set_ignore_next_reload(). | 81 // See description in set_ignore_next_reload(). |
| 76 bool ignore_next_reload_; | 82 bool ignore_next_reload_; |
| 77 | 83 |
| 78 DISALLOW_COPY_AND_ASSIGN(InfoBarService); | 84 DISALLOW_COPY_AND_ASSIGN(InfoBarService); |
| 79 }; | 85 }; |
| 80 | 86 |
| 81 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ | 87 #endif // CHROME_BROWSER_INFOBARS_INFOBAR_SERVICE_H_ |
| OLD | NEW |