| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/chromeos/hats/hats_dialog.h" | 5 #include "chrome/browser/chromeos/hats/hats_dialog.h" |
| 6 | 6 |
| 7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/task_scheduler/post_task.h" | 9 #include "base/task_scheduler/post_task.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 void HatsDialog::CreateAndShow(bool is_google_account) { | 118 void HatsDialog::CreateAndShow(bool is_google_account) { |
| 119 Profile* profile = ProfileManager::GetActiveUserProfile(); | 119 Profile* profile = ProfileManager::GetActiveUserProfile(); |
| 120 std::string user_locale = | 120 std::string user_locale = |
| 121 profile->GetPrefs()->GetString(prefs::kApplicationLocale); | 121 profile->GetPrefs()->GetString(prefs::kApplicationLocale); |
| 122 if (!user_locale.length()) | 122 if (!user_locale.length()) |
| 123 user_locale = kDefaultProfileLocale; | 123 user_locale = kDefaultProfileLocale; |
| 124 | 124 |
| 125 std::unique_ptr<HatsDialog> hats_dialog(new HatsDialog); | 125 std::unique_ptr<HatsDialog> hats_dialog(new HatsDialog); |
| 126 | 126 |
| 127 base::PostTaskWithTraitsAndReplyWithResult( | 127 base::PostTaskWithTraitsAndReplyWithResult( |
| 128 FROM_HERE, base::TaskTraits().MayBlock().WithPriority( | 128 FROM_HERE, {base::MayBlock(), base::TaskPriority::BACKGROUND}, |
| 129 base::TaskPriority::BACKGROUND), | |
| 130 base::Bind(&GetFormattedSiteContext, user_locale, kDeviceInfoStopKeyword), | 129 base::Bind(&GetFormattedSiteContext, user_locale, kDeviceInfoStopKeyword), |
| 131 base::Bind(&HatsDialog::Show, base::Passed(&hats_dialog), | 130 base::Bind(&HatsDialog::Show, base::Passed(&hats_dialog), |
| 132 is_google_account ? kGooglerSiteID : kSiteID)); | 131 is_google_account ? kGooglerSiteID : kSiteID)); |
| 133 } | 132 } |
| 134 | 133 |
| 135 // static | 134 // static |
| 136 void HatsDialog::Show(std::unique_ptr<HatsDialog> hats_dialog, | 135 void HatsDialog::Show(std::unique_ptr<HatsDialog> hats_dialog, |
| 137 std::string site_id, | 136 std::string site_id, |
| 138 std::string site_context) { | 137 std::string site_context) { |
| 139 // Load and set the html data that needs to be displayed in the dialog. | 138 // Load and set the html data that needs to be displayed in the dialog. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 bool HatsDialog::ShouldShowDialogTitle() const { | 185 bool HatsDialog::ShouldShowDialogTitle() const { |
| 187 return false; | 186 return false; |
| 188 } | 187 } |
| 189 | 188 |
| 190 bool HatsDialog::HandleContextMenu(const content::ContextMenuParams& params) { | 189 bool HatsDialog::HandleContextMenu(const content::ContextMenuParams& params) { |
| 191 // Disable context menu. | 190 // Disable context menu. |
| 192 return true; | 191 return true; |
| 193 } | 192 } |
| 194 | 193 |
| 195 } // namespace chromeos | 194 } // namespace chromeos |
| OLD | NEW |