OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/infobars/insecure_content_infobar_delegate.h" | 5 #include "chrome/browser/infobars/insecure_content_infobar_delegate.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
10 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
11 #include "chrome/common/render_messages.h" | 12 #include "chrome/common/render_messages.h" |
12 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
13 #include "components/content_settings/content/common/content_settings_messages.h
" | 14 #include "components/content_settings/content/common/content_settings_messages.h
" |
14 #include "components/google/core/browser/google_util.h" | 15 #include "components/google/core/browser/google_util.h" |
15 #include "components/infobars/core/infobar.h" | 16 #include "components/infobars/core/infobar.h" |
16 #include "content/public/browser/render_frame_host.h" | 17 #include "content/public/browser/render_frame_host.h" |
17 #include "content/public/browser/render_view_host.h" | 18 #include "content/public/browser/render_view_host.h" |
(...skipping 10 matching lines...) Expand all Loading... |
28 | 29 |
29 scoped_ptr<infobars::InfoBar> new_infobar( | 30 scoped_ptr<infobars::InfoBar> new_infobar( |
30 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( | 31 infobar_service->CreateConfirmInfoBar(scoped_ptr<ConfirmInfoBarDelegate>( |
31 new InsecureContentInfoBarDelegate()))); | 32 new InsecureContentInfoBarDelegate()))); |
32 | 33 |
33 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { | 34 for (size_t i = 0; i < infobar_service->infobar_count(); ++i) { |
34 infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); | 35 infobars::InfoBar* old_infobar = infobar_service->infobar_at(i); |
35 InsecureContentInfoBarDelegate* delegate = | 36 InsecureContentInfoBarDelegate* delegate = |
36 old_infobar->delegate()->AsInsecureContentInfoBarDelegate(); | 37 old_infobar->delegate()->AsInsecureContentInfoBarDelegate(); |
37 if (delegate != nullptr) { | 38 if (delegate != nullptr) { |
38 infobar_service->ReplaceInfoBar(old_infobar, new_infobar.Pass()); | 39 infobar_service->ReplaceInfoBar(old_infobar, std::move(new_infobar)); |
39 return; | 40 return; |
40 } | 41 } |
41 } | 42 } |
42 | 43 |
43 infobar_service->AddInfoBar(new_infobar.Pass()); | 44 infobar_service->AddInfoBar(std::move(new_infobar)); |
44 } | 45 } |
45 | 46 |
46 InsecureContentInfoBarDelegate::InsecureContentInfoBarDelegate() | 47 InsecureContentInfoBarDelegate::InsecureContentInfoBarDelegate() |
47 : ConfirmInfoBarDelegate() { | 48 : ConfirmInfoBarDelegate() { |
48 } | 49 } |
49 | 50 |
50 InsecureContentInfoBarDelegate::~InsecureContentInfoBarDelegate() { | 51 InsecureContentInfoBarDelegate::~InsecureContentInfoBarDelegate() { |
51 } | 52 } |
52 | 53 |
53 void InsecureContentInfoBarDelegate::InfoBarDismissed() { | 54 void InsecureContentInfoBarDelegate::InfoBarDismissed() { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 return true; | 96 return true; |
96 } | 97 } |
97 | 98 |
98 base::string16 InsecureContentInfoBarDelegate::GetLinkText() const { | 99 base::string16 InsecureContentInfoBarDelegate::GetLinkText() const { |
99 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); | 100 return l10n_util::GetStringUTF16(IDS_LEARN_MORE); |
100 } | 101 } |
101 | 102 |
102 GURL InsecureContentInfoBarDelegate::GetLinkURL() const { | 103 GURL InsecureContentInfoBarDelegate::GetLinkURL() const { |
103 return GURL("https://support.google.com/chrome/answer/1342714"); | 104 return GURL("https://support.google.com/chrome/answer/1342714"); |
104 } | 105 } |
OLD | NEW |