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_interstitial.h" | 5 #include "chrome/browser/supervised_user/supervised_user_interstitial.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/infobars/infobar_service.h" | 17 #include "chrome/browser/infobars/infobar_service.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/browser/supervised_user/supervised_user_service.h" | 19 #include "chrome/browser/supervised_user/supervised_user_service.h" |
20 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 20 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
21 #include "chrome/common/features.h" | |
22 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
23 #include "chrome/grit/generated_resources.h" | 22 #include "chrome/grit/generated_resources.h" |
24 #include "components/infobars/core/infobar.h" | 23 #include "components/infobars/core/infobar.h" |
25 #include "components/infobars/core/infobar_delegate.h" | 24 #include "components/infobars/core/infobar_delegate.h" |
26 #include "components/prefs/pref_service.h" | 25 #include "components/prefs/pref_service.h" |
27 #include "content/public/browser/browser_thread.h" | 26 #include "content/public/browser/browser_thread.h" |
28 #include "content/public/browser/interstitial_page.h" | 27 #include "content/public/browser/interstitial_page.h" |
29 #include "content/public/browser/navigation_controller.h" | 28 #include "content/public/browser/navigation_controller.h" |
30 #include "content/public/browser/navigation_details.h" | 29 #include "content/public/browser/navigation_details.h" |
31 #include "content/public/browser/navigation_entry.h" | 30 #include "content/public/browser/navigation_entry.h" |
32 #include "content/public/browser/render_frame_host.h" | 31 #include "content/public/browser/render_frame_host.h" |
33 #include "content/public/browser/render_view_host.h" | 32 #include "content/public/browser/render_view_host.h" |
34 #include "content/public/browser/web_contents.h" | 33 #include "content/public/browser/web_contents.h" |
35 #include "content/public/browser/web_contents_user_data.h" | 34 #include "content/public/browser/web_contents_user_data.h" |
36 #include "content/public/browser/web_ui.h" | 35 #include "content/public/browser/web_ui.h" |
37 #include "ui/base/l10n/l10n_util.h" | 36 #include "ui/base/l10n/l10n_util.h" |
38 #include "ui/base/resource/resource_bundle.h" | 37 #include "ui/base/resource/resource_bundle.h" |
39 #include "ui/base/webui/jstemplate_builder.h" | 38 #include "ui/base/webui/jstemplate_builder.h" |
40 #include "ui/base/webui/web_ui_util.h" | 39 #include "ui/base/webui/web_ui_util.h" |
41 | 40 |
42 #if BUILDFLAG(ANDROID_JAVA_UI) | 41 #if defined(OS_ANDROID) |
43 #include "chrome/browser/supervised_user/child_accounts/child_account_feedback_r
eporter_android.h" | 42 #include "chrome/browser/supervised_user/child_accounts/child_account_feedback_r
eporter_android.h" |
44 #elif !defined(OS_ANDROID) | 43 #else |
45 #include "chrome/browser/ui/browser_finder.h" | 44 #include "chrome/browser/ui/browser_finder.h" |
46 #include "chrome/browser/ui/chrome_pages.h" | 45 #include "chrome/browser/ui/chrome_pages.h" |
47 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 46 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
48 #endif | 47 #endif |
49 | 48 |
50 using content::BrowserThread; | 49 using content::BrowserThread; |
51 using content::WebContents; | 50 using content::WebContents; |
52 | 51 |
53 namespace { | 52 namespace { |
54 | 53 |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 SupervisedUserServiceFactory::GetForProfile(profile_); | 261 SupervisedUserServiceFactory::GetForProfile(profile_); |
263 base::string16 second_custodian = | 262 base::string16 second_custodian = |
264 base::UTF8ToUTF16(supervised_user_service->GetSecondCustodianName()); | 263 base::UTF8ToUTF16(supervised_user_service->GetSecondCustodianName()); |
265 | 264 |
266 if (command == "\"feedback\"") { | 265 if (command == "\"feedback\"") { |
267 base::string16 reason = | 266 base::string16 reason = |
268 l10n_util::GetStringUTF16(supervised_user_error_page::GetBlockMessageID( | 267 l10n_util::GetStringUTF16(supervised_user_error_page::GetBlockMessageID( |
269 reason_, true, second_custodian.empty())); | 268 reason_, true, second_custodian.empty())); |
270 std::string message = l10n_util::GetStringFUTF8( | 269 std::string message = l10n_util::GetStringFUTF8( |
271 IDS_BLOCK_INTERSTITIAL_DEFAULT_FEEDBACK_TEXT, reason); | 270 IDS_BLOCK_INTERSTITIAL_DEFAULT_FEEDBACK_TEXT, reason); |
272 #if BUILDFLAG(ANDROID_JAVA_UI) | 271 #if defined(OS_ANDROID) |
273 ReportChildAccountFeedback(web_contents_, message, url_); | 272 ReportChildAccountFeedback(web_contents_, message, url_); |
274 #else | 273 #else |
275 chrome::ShowFeedbackPage(chrome::FindBrowserWithWebContents(web_contents_), | 274 chrome::ShowFeedbackPage(chrome::FindBrowserWithWebContents(web_contents_), |
276 message, std::string()); | 275 message, std::string()); |
277 #endif | 276 #endif |
278 return; | 277 return; |
279 } | 278 } |
280 | 279 |
281 NOTREACHED(); | 280 NOTREACHED(); |
282 } | 281 } |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 supervised_user_service->RemoveObserver(this); | 329 supervised_user_service->RemoveObserver(this); |
331 | 330 |
332 if (!callback_.is_null()) | 331 if (!callback_.is_null()) |
333 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 332 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
334 base::Bind(callback_, continue_request)); | 333 base::Bind(callback_, continue_request)); |
335 | 334 |
336 // After this, the WebContents may be destroyed. Make sure we don't try to use | 335 // After this, the WebContents may be destroyed. Make sure we don't try to use |
337 // it again. | 336 // it again. |
338 web_contents_ = NULL; | 337 web_contents_ = NULL; |
339 } | 338 } |
OLD | NEW |