OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/supervised_user/supervised_user_navigation_observer.h" | 5 #include "chrome/browser/supervised_user/supervised_user_navigation_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 public: | 81 public: |
82 // Creates a supervised user warning infobar and delegate and adds the infobar | 82 // Creates a supervised user warning infobar and delegate and adds the infobar |
83 // to |infobar_service|. Returns the infobar if it was successfully added. | 83 // to |infobar_service|. Returns the infobar if it was successfully added. |
84 static infobars::InfoBar* Create(InfoBarService* infobar_service); | 84 static infobars::InfoBar* Create(InfoBarService* infobar_service); |
85 | 85 |
86 private: | 86 private: |
87 SupervisedUserWarningInfoBarDelegate(); | 87 SupervisedUserWarningInfoBarDelegate(); |
88 virtual ~SupervisedUserWarningInfoBarDelegate(); | 88 virtual ~SupervisedUserWarningInfoBarDelegate(); |
89 | 89 |
90 // ConfirmInfoBarDelegate: | 90 // ConfirmInfoBarDelegate: |
91 virtual bool ShouldExpire(const NavigationDetails& details) const OVERRIDE; | 91 virtual bool ShouldExpire(const NavigationDetails& details) const override; |
92 virtual void InfoBarDismissed() OVERRIDE; | 92 virtual void InfoBarDismissed() override; |
93 virtual base::string16 GetMessageText() const OVERRIDE; | 93 virtual base::string16 GetMessageText() const override; |
94 virtual int GetButtons() const OVERRIDE; | 94 virtual int GetButtons() const override; |
95 virtual base::string16 GetButtonLabel(InfoBarButton button) const OVERRIDE; | 95 virtual base::string16 GetButtonLabel(InfoBarButton button) const override; |
96 virtual bool Accept() OVERRIDE; | 96 virtual bool Accept() override; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(SupervisedUserWarningInfoBarDelegate); | 98 DISALLOW_COPY_AND_ASSIGN(SupervisedUserWarningInfoBarDelegate); |
99 }; | 99 }; |
100 | 100 |
101 // static | 101 // static |
102 infobars::InfoBar* SupervisedUserWarningInfoBarDelegate::Create( | 102 infobars::InfoBar* SupervisedUserWarningInfoBarDelegate::Create( |
103 InfoBarService* infobar_service) { | 103 InfoBarService* infobar_service) { |
104 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( | 104 return infobar_service->AddInfoBar(ConfirmInfoBarDelegate::CreateInfoBar( |
105 scoped_ptr<ConfirmInfoBarDelegate>( | 105 scoped_ptr<ConfirmInfoBarDelegate>( |
106 new SupervisedUserWarningInfoBarDelegate()))); | 106 new SupervisedUserWarningInfoBarDelegate()))); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 history_service->AddPage(add_page_args); | 243 history_service->AddPage(add_page_args); |
244 | 244 |
245 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); | 245 scoped_ptr<NavigationEntry> entry(NavigationEntry::Create()); |
246 entry->SetVirtualURL(url); | 246 entry->SetVirtualURL(url); |
247 entry->SetTimestamp(timestamp); | 247 entry->SetTimestamp(timestamp); |
248 blocked_navigations_.push_back(entry.release()); | 248 blocked_navigations_.push_back(entry.release()); |
249 SupervisedUserService* supervised_user_service = | 249 SupervisedUserService* supervised_user_service = |
250 SupervisedUserServiceFactory::GetForProfile(profile); | 250 SupervisedUserServiceFactory::GetForProfile(profile); |
251 supervised_user_service->DidBlockNavigation(web_contents()); | 251 supervised_user_service->DidBlockNavigation(web_contents()); |
252 } | 252 } |
OLD | NEW |