Chromium Code Reviews| 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 "base/memory/weak_ptr.h" | 7 #include "base/memory/weak_ptr.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/infobars/infobar_service.h" | 15 #include "chrome/browser/infobars/infobar_service.h" |
| 16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
| 17 #include "chrome/browser/supervised_user/supervised_user_service.h" | 17 #include "chrome/browser/supervised_user/supervised_user_service.h" |
| 18 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" | 18 #include "chrome/browser/supervised_user/supervised_user_service_factory.h" |
| 19 #include "chrome/common/features.h" | |
| 19 #include "chrome/common/pref_names.h" | 20 #include "chrome/common/pref_names.h" |
| 20 #include "chrome/grit/generated_resources.h" | 21 #include "chrome/grit/generated_resources.h" |
| 21 #include "components/infobars/core/infobar.h" | 22 #include "components/infobars/core/infobar.h" |
| 22 #include "components/infobars/core/infobar_delegate.h" | 23 #include "components/infobars/core/infobar_delegate.h" |
| 23 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/interstitial_page.h" | 25 #include "content/public/browser/interstitial_page.h" |
| 25 #include "content/public/browser/navigation_controller.h" | 26 #include "content/public/browser/navigation_controller.h" |
| 26 #include "content/public/browser/navigation_details.h" | 27 #include "content/public/browser/navigation_details.h" |
| 27 #include "content/public/browser/navigation_entry.h" | 28 #include "content/public/browser/navigation_entry.h" |
| 28 #include "content/public/browser/render_frame_host.h" | 29 #include "content/public/browser/render_frame_host.h" |
| 29 #include "content/public/browser/render_view_host.h" | 30 #include "content/public/browser/render_view_host.h" |
| 30 #include "content/public/browser/web_contents.h" | 31 #include "content/public/browser/web_contents.h" |
| 31 #include "content/public/browser/web_contents_user_data.h" | 32 #include "content/public/browser/web_contents_user_data.h" |
| 32 #include "content/public/browser/web_ui.h" | 33 #include "content/public/browser/web_ui.h" |
| 33 #include "grit/browser_resources.h" | 34 #include "grit/browser_resources.h" |
| 34 #include "ui/base/l10n/l10n_util.h" | 35 #include "ui/base/l10n/l10n_util.h" |
| 35 #include "ui/base/resource/resource_bundle.h" | 36 #include "ui/base/resource/resource_bundle.h" |
| 36 #include "ui/base/webui/jstemplate_builder.h" | 37 #include "ui/base/webui/jstemplate_builder.h" |
| 37 #include "ui/base/webui/web_ui_util.h" | 38 #include "ui/base/webui/web_ui_util.h" |
| 38 | 39 |
| 39 #if defined(OS_ANDROID) | 40 #if defined(OS_ANDROID) |
|
Bernhard Bauer
2015/12/04 09:31:25
You probably want to change this to #if BUILDFLAG(
no sievers
2015/12/04 17:58:38
Done.
| |
| 40 #include "chrome/browser/supervised_user/child_accounts/child_account_feedback_r eporter_android.h" | 41 #include "chrome/browser/supervised_user/child_accounts/child_account_feedback_r eporter_android.h" |
| 41 #else | 42 #else |
| 42 #include "chrome/browser/ui/browser_finder.h" | 43 #include "chrome/browser/ui/browser_finder.h" |
| 43 #include "chrome/browser/ui/chrome_pages.h" | 44 #include "chrome/browser/ui/chrome_pages.h" |
| 44 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 45 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 45 #endif | 46 #endif |
| 46 | 47 |
| 47 using content::BrowserThread; | 48 using content::BrowserThread; |
| 48 using content::WebContents; | 49 using content::WebContents; |
| 49 | 50 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 333 url_, base::Bind(&SupervisedUserInterstitial::OnAccessRequestAdded, | 334 url_, base::Bind(&SupervisedUserInterstitial::OnAccessRequestAdded, |
| 334 weak_ptr_factory_.GetWeakPtr())); | 335 weak_ptr_factory_.GetWeakPtr())); |
| 335 return; | 336 return; |
| 336 } | 337 } |
| 337 | 338 |
| 338 if (command == "\"feedback\"") { | 339 if (command == "\"feedback\"") { |
| 339 base::string16 reason = l10n_util::GetStringUTF16( | 340 base::string16 reason = l10n_util::GetStringUTF16( |
| 340 SupervisedUserURLFilter::GetBlockMessageID(reason_)); | 341 SupervisedUserURLFilter::GetBlockMessageID(reason_)); |
| 341 std::string message = l10n_util::GetStringFUTF8( | 342 std::string message = l10n_util::GetStringFUTF8( |
| 342 IDS_BLOCK_INTERSTITIAL_DEFAULT_FEEDBACK_TEXT, reason); | 343 IDS_BLOCK_INTERSTITIAL_DEFAULT_FEEDBACK_TEXT, reason); |
| 343 #if defined(OS_ANDROID) | 344 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 344 ReportChildAccountFeedback(web_contents_, message, url_); | 345 ReportChildAccountFeedback(web_contents_, message, url_); |
| 345 #else | 346 #else |
| 346 chrome::ShowFeedbackPage(chrome::FindBrowserWithWebContents(web_contents_), | 347 chrome::ShowFeedbackPage(chrome::FindBrowserWithWebContents(web_contents_), |
| 347 message, std::string()); | 348 message, std::string()); |
| 348 #endif | 349 #endif |
| 349 return; | 350 return; |
| 350 } | 351 } |
| 351 | 352 |
| 352 NOTREACHED(); | 353 NOTREACHED(); |
| 353 } | 354 } |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 supervised_user_service->RemoveObserver(this); | 402 supervised_user_service->RemoveObserver(this); |
| 402 | 403 |
| 403 if (!callback_.is_null()) | 404 if (!callback_.is_null()) |
| 404 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 405 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
| 405 base::Bind(callback_, continue_request)); | 406 base::Bind(callback_, continue_request)); |
| 406 | 407 |
| 407 // After this, the WebContents may be destroyed. Make sure we don't try to use | 408 // After this, the WebContents may be destroyed. Make sure we don't try to use |
| 408 // it again. | 409 // it again. |
| 409 web_contents_ = NULL; | 410 web_contents_ = NULL; |
| 410 } | 411 } |
| OLD | NEW |