| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // SupervisedUserWarningInfoBarDelegate --------------------------------------- | 78 // SupervisedUserWarningInfoBarDelegate --------------------------------------- |
| 79 | 79 |
| 80 class SupervisedUserWarningInfoBarDelegate : public ConfirmInfoBarDelegate { | 80 class SupervisedUserWarningInfoBarDelegate : public ConfirmInfoBarDelegate { |
| 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 ~SupervisedUserWarningInfoBarDelegate() override; |
| 89 | 89 |
| 90 // ConfirmInfoBarDelegate: | 90 // ConfirmInfoBarDelegate: |
| 91 virtual bool ShouldExpire(const NavigationDetails& details) const override; | 91 bool ShouldExpire(const NavigationDetails& details) const override; |
| 92 virtual void InfoBarDismissed() override; | 92 void InfoBarDismissed() override; |
| 93 virtual base::string16 GetMessageText() const override; | 93 base::string16 GetMessageText() const override; |
| 94 virtual int GetButtons() const override; | 94 int GetButtons() const override; |
| 95 virtual base::string16 GetButtonLabel(InfoBarButton button) const override; | 95 base::string16 GetButtonLabel(InfoBarButton button) const override; |
| 96 virtual bool Accept() override; | 96 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 |