| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/thread_restrictions.h" |
| 9 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chromeos/login/help_app_launcher.h" | 11 #include "chrome/browser/chromeos/login/help_app_launcher.h" |
| 11 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
| 12 #include "grit/generated_resources.h" | 13 #include "grit/generated_resources.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 14 #include "ui/base/l10n/l10n_util.h" |
| 14 | 15 |
| 15 namespace chromeos { | 16 namespace chromeos { |
| 16 | 17 |
| 17 namespace { | 18 namespace { |
| 18 const char kHelpTopicBasePath[] = "/usr/share/chromeos-assets/help/"; | 19 const char kHelpTopicBasePath[] = "/usr/share/chromeos-assets/help/"; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 // HelpApp, public: | 33 // HelpApp, public: |
| 33 | 34 |
| 34 HelpAppLauncher::HelpAppLauncher(gfx::NativeWindow parent_window) | 35 HelpAppLauncher::HelpAppLauncher(gfx::NativeWindow parent_window) |
| 35 : parent_window_(parent_window) { | 36 : parent_window_(parent_window) { |
| 36 } | 37 } |
| 37 | 38 |
| 38 // Checks whether local file exists at specified base path and | 39 // Checks whether local file exists at specified base path and |
| 39 // returns GURL instance for it. Otherwise returns an empty GURL. | 40 // returns GURL instance for it. Otherwise returns an empty GURL. |
| 40 static GURL GetLocalFileUrl(const std::string& base_path, | 41 static GURL GetLocalFileUrl(const std::string& base_path, |
| 41 const std::string& filename) { | 42 const std::string& filename) { |
| 43 // Checking for help dir existence causes us to do blocking IO on UI thread. |
| 44 // Temporarily allow it until we fix http://crosbug.com/11105 |
| 45 base::ThreadRestrictions::ScopedAllowIO allow_io; |
| 42 FilePath file_path(base_path + filename); | 46 FilePath file_path(base_path + filename); |
| 43 if (file_util::PathExists(file_path)) { | 47 if (file_util::PathExists(file_path)) { |
| 44 const std::string path_url = std::string(chrome::kFileScheme) + | 48 const std::string path_url = std::string(chrome::kFileScheme) + |
| 45 chrome::kStandardSchemeSeparator + file_path.value(); | 49 chrome::kStandardSchemeSeparator + file_path.value(); |
| 46 return GURL(path_url); | 50 return GURL(path_url); |
| 47 } else { | 51 } else { |
| 48 return GURL(); | 52 return GURL(); |
| 49 } | 53 } |
| 50 } | 54 } |
| 51 | 55 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 78 l10n_util::GetStringUTF16(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE)), | 82 l10n_util::GetStringUTF16(IDS_LOGIN_OOBE_HELP_DIALOG_TITLE)), |
| 79 topic_url, | 83 topic_url, |
| 80 LoginHtmlDialog::STYLE_BUBBLE)); | 84 LoginHtmlDialog::STYLE_BUBBLE)); |
| 81 } else { | 85 } else { |
| 82 dialog_->set_url(topic_url); | 86 dialog_->set_url(topic_url); |
| 83 } | 87 } |
| 84 dialog_->Show(); | 88 dialog_->Show(); |
| 85 } | 89 } |
| 86 | 90 |
| 87 } // namespace chromeos | 91 } // namespace chromeos |
| OLD | NEW |