Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Side by Side Diff: chrome/browser/ui/webui/version_handler.cc

Issue 13196006: Move path functions from file_util to FilePath object. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: git try Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/ui/webui/version_handler.h" 5 #include "chrome/browser/ui/webui/version_handler.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "chrome/browser/plugins/plugin_prefs.h" 11 #include "chrome/browser/plugins/plugin_prefs.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/metrics/variations/variations_util.h" 13 #include "chrome/common/metrics/variations/variations_util.h"
14 #include "content/public/browser/browser_thread.h" 14 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/plugin_service.h" 15 #include "content/public/browser/plugin_service.h"
16 #include "content/public/browser/web_ui.h" 16 #include "content/public/browser/web_ui.h"
17 #include "googleurl/src/gurl.h" 17 #include "googleurl/src/gurl.h"
18 #include "grit/generated_resources.h" 18 #include "grit/generated_resources.h"
19 #include "ui/base/l10n/l10n_util.h" 19 #include "ui/base/l10n/l10n_util.h"
20 #include "webkit/plugins/plugin_constants.h" 20 #include "webkit/plugins/plugin_constants.h"
21 21
22 namespace { 22 namespace {
23 23
24 // Retrieves the executable and profile paths on the FILE thread. 24 // Retrieves the executable and profile paths on the FILE thread.
25 void GetFilePaths(const base::FilePath& profile_path, 25 void GetFilePaths(const base::FilePath& profile_path,
26 string16* exec_path_out, 26 string16* exec_path_out,
27 string16* profile_path_out) { 27 string16* profile_path_out) {
28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 28 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE));
29 29
30 base::FilePath executable_path = 30 base::FilePath executable_path = base::MakeAbsoluteFilePath(
31 CommandLine::ForCurrentProcess()->GetProgram(); 31 CommandLine::ForCurrentProcess()->GetProgram());
32 if (file_util::AbsolutePath(&executable_path)) { 32 if (!executable_path.empty()) {
33 *exec_path_out = executable_path.LossyDisplayName(); 33 *exec_path_out = executable_path.LossyDisplayName();
34 } else { 34 } else {
35 *exec_path_out = 35 *exec_path_out =
36 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND); 36 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND);
37 } 37 }
38 38
39 base::FilePath profile_path_copy(profile_path); 39 base::FilePath profile_path_copy(base::MakeAbsoluteFilePath(profile_path));
40 if (!profile_path.empty() && file_util::AbsolutePath(&profile_path_copy)) { 40 if (!profile_path.empty() && !profile_path_copy.empty()) {
41 *profile_path_out = profile_path.LossyDisplayName(); 41 *profile_path_out = profile_path.LossyDisplayName();
42 } else { 42 } else {
43 *profile_path_out = 43 *profile_path_out =
44 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND); 44 l10n_util::GetStringUTF16(IDS_ABOUT_VERSION_PATH_NOTFOUND);
45 } 45 }
46 } 46 }
47 47
48 } // namespace 48 } // namespace
49 49
50 VersionHandler::VersionHandler() 50 VersionHandler::VersionHandler()
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 flash_version = info_array[i].version; 144 flash_version = info_array[i].version;
145 break; 145 break;
146 } 146 }
147 } 147 }
148 } 148 }
149 149
150 StringValue arg(flash_version); 150 StringValue arg(flash_version);
151 web_ui()->CallJavascriptFunction("returnFlashVersion", arg); 151 web_ui()->CallJavascriptFunction("returnFlashVersion", arg);
152 } 152 }
153 #endif // defined(ENABLE_PLUGINS) 153 #endif // defined(ENABLE_PLUGINS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698