summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-20 16:24:52 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-20 16:24:52 +0000
commitdea1d7d21976d078a41b2d321e8d626379c7a1fd (patch)
tree02587faedfbf8242cc8b557874d3c37a435739de /chrome/browser
parent6c2e391ce50adde6f5080245b1256838656063d3 (diff)
downloadchromium_src-dea1d7d21976d078a41b2d321e8d626379c7a1fd.zip
chromium_src-dea1d7d21976d078a41b2d321e8d626379c7a1fd.tar.gz
chromium_src-dea1d7d21976d078a41b2d321e8d626379c7a1fd.tar.bz2
Add new PathService paths for Windows' All Users Desktop and Quick Launch folders.
Re-commit, reverted in http://crrev.com/157680 (original commit in http://crrev.com/157667). This allows usage of PathService to cache the shortcut install paths and more importantly to mock them in shortcut tests! Also move chrome::DIR_USER_DESKTOP to base::DIR_USER_DESKTOP; this is really where it belongs. In fact it is only in chrome_paths.h because it used to be called DIR_DEFAULT_DOWNLOAD and cpu@ renamed it to DIR_USER_DESKTOP in http://crrev.com/1753 (early days!) after that it started to be used all over the place as the Desktop path. Finally bringing it to base_paths.h, beside DIR_START_MENU and friends, is the right thing to do imo. TBR=brettw@chromium.org BUG=148539 TEST=Quick Launch shortcut installed in the right place on XP (both Default and current user) Desktop shortcuts installed in the right place (both All Users and per-user installs). installer_util_unittests.exe --gtest_filter=ShellUtilShortcutTest* unit_tests.exe --gtest_filter=ProfileShortcutManagerTest* base_unittests --gtest_filter=PathServiceTest* Review URL: https://chromiumcodereview.appspot.com/10964007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@157779 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/download/download_util.cc2
-rw-r--r--chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc10
-rw-r--r--chrome/browser/shell_integration_linux.cc7
-rw-r--r--chrome/browser/shell_integration_win.cc3
-rw-r--r--chrome/browser/ui/views/test/ui_test_utils_win.cc3
-rw-r--r--chrome/browser/ui/web_applications/web_app_ui.cc3
-rw-r--r--chrome/browser/web_applications/web_app_win.cc3
7 files changed, 16 insertions, 15 deletions
diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc
index 3dd5840..d18d876 100644
--- a/chrome/browser/download/download_util.cc
+++ b/chrome/browser/download/download_util.cc
@@ -138,7 +138,7 @@ bool DownloadPathIsDangerous(const FilePath& download_path) {
return false;
#else
FilePath desktop_dir;
- if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_dir)) {
+ if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop_dir)) {
NOTREACHED();
return false;
}
diff --git a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
index 6625964..81be184 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
+++ b/chrome/browser/profiles/profile_shortcut_manager_unittest_win.cc
@@ -61,7 +61,12 @@ class ProfileShortcutManagerTest : public testing::Test {
file_thread_(BrowserThread::FILE, &message_loop_) {
}
- virtual void SetUp() {
+ virtual void SetUp() OVERRIDE {
+ // Mock the user's Desktop into a temp directory.
+ ASSERT_TRUE(fake_user_desktop_.CreateUniqueTempDir());
+ ASSERT_TRUE(PathService::Override(base::DIR_USER_DESKTOP,
+ fake_user_desktop_.path()));
+
TestingBrowserProcess* browser_process =
static_cast<TestingBrowserProcess*>(g_browser_process);
profile_manager_.reset(new TestingProfileManager(browser_process));
@@ -80,7 +85,7 @@ class ProfileShortcutManagerTest : public testing::Test {
second_profile_name_ = ASCIIToUTF16("My profile 2");
}
- virtual void TearDown() {
+ virtual void TearDown() OVERRIDE {
message_loop_.RunAllPending();
int num_profiles =
@@ -148,6 +153,7 @@ class ProfileShortcutManagerTest : public testing::Test {
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
scoped_ptr<TestingProfileManager> profile_manager_;
+ ScopedTempDir fake_user_desktop_;
FilePath dest_path_;
string16 profile_name_;
FilePath second_dest_path_;
diff --git a/chrome/browser/shell_integration_linux.cc b/chrome/browser/shell_integration_linux.cc
index b4f7942..e478893 100644
--- a/chrome/browser/shell_integration_linux.cc
+++ b/chrome/browser/shell_integration_linux.cc
@@ -32,7 +32,6 @@
#include "build/build_config.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_thread.h"
#include "googleurl/src/gurl.h"
#include "ui/gfx/codec/png_codec.h"
@@ -119,7 +118,7 @@ bool CreateShortcutOnDesktop(const FilePath& shortcut_filename,
DCHECK_EQ(shortcut_filename.BaseName().value(), shortcut_filename.value());
FilePath desktop_path;
- if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_path))
+ if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop_path))
return false;
int desktop_fd = open(desktop_path.value().c_str(), O_RDONLY | O_DIRECTORY);
@@ -156,7 +155,7 @@ bool CreateShortcutOnDesktop(const FilePath& shortcut_filename,
void DeleteShortcutOnDesktop(const FilePath& shortcut_filename) {
FilePath desktop_path;
- if (PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_path))
+ if (PathService::Get(base::DIR_USER_DESKTOP, &desktop_path))
file_util::Delete(desktop_path.Append(shortcut_filename), false);
}
@@ -484,7 +483,7 @@ FilePath GetWebShortcutFilename(const GURL& url) {
file_util::ReplaceIllegalCharactersInPath(&filename, '_');
FilePath desktop_path;
- if (!PathService::Get(chrome::DIR_USER_DESKTOP, &desktop_path))
+ if (!PathService::Get(base::DIR_USER_DESKTOP, &desktop_path))
return FilePath();
FilePath filepath = desktop_path.Append(filename);
diff --git a/chrome/browser/shell_integration_win.cc b/chrome/browser/shell_integration_win.cc
index 08b9885..4782a3c 100644
--- a/chrome/browser/shell_integration_win.cc
+++ b/chrome/browser/shell_integration_win.cc
@@ -25,7 +25,6 @@
#include "base/win/windows_version.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/installer/setup/setup_util.h"
@@ -364,7 +363,7 @@ void MigrateChromiumShortcutsCallback() {
base::DIR_APP_DATA,
L"Microsoft\\Internet Explorer\\Quick Launch\\User Pinned\\TaskBar"
}, {
- chrome::DIR_USER_DESKTOP,
+ base::DIR_USER_DESKTOP,
NULL
}, {
base::DIR_START_MENU,
diff --git a/chrome/browser/ui/views/test/ui_test_utils_win.cc b/chrome/browser/ui/views/test/ui_test_utils_win.cc
index 81460a4..cad080b 100644
--- a/chrome/browser/ui/views/test/ui_test_utils_win.cc
+++ b/chrome/browser/ui/views/test/ui_test_utils_win.cc
@@ -15,7 +15,6 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/window_snapshot/window_snapshot.h"
-#include "chrome/common/chrome_paths.h"
#include "ui/base/win/foreground_helper.h"
#include "ui/ui_controls/ui_controls.h"
#include "ui/views/focus/focus_manager.h"
@@ -144,7 +143,7 @@ bool SaveScreenSnapshotToDirectory(const FilePath& directory,
bool SaveScreenSnapshotToDesktop(FilePath* screenshot_path) {
FilePath desktop;
- return PathService::Get(chrome::DIR_USER_DESKTOP, &desktop) &&
+ return PathService::Get(base::DIR_USER_DESKTOP, &desktop) &&
SaveScreenSnapshotToDirectory(desktop, screenshot_path);
}
diff --git a/chrome/browser/ui/web_applications/web_app_ui.cc b/chrome/browser/ui/web_applications/web_app_ui.cc
index 48ab162..6b764be 100644
--- a/chrome/browser/ui/web_applications/web_app_ui.cc
+++ b/chrome/browser/ui/web_applications/web_app_ui.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/ui/tab_contents/tab_contents.h"
#include "chrome/browser/web_applications/web_app.h"
#include "chrome/common/chrome_notification_types.h"
-#include "chrome/common/chrome_paths.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_registrar.h"
@@ -191,7 +190,7 @@ void UpdateShortcutWorker::CheckExistingShortcuts() {
} locations[] = {
{
shortcut_info_.create_on_desktop,
- chrome::DIR_USER_DESKTOP,
+ base::DIR_USER_DESKTOP,
NULL
}, {
shortcut_info_.create_in_applications_menu,
diff --git a/chrome/browser/web_applications/web_app_win.cc b/chrome/browser/web_applications/web_app_win.cc
index cfc68e1..d1d5634 100644
--- a/chrome/browser/web_applications/web_app_win.cc
+++ b/chrome/browser/web_applications/web_app_win.cc
@@ -15,7 +15,6 @@
#include "base/utf_string_conversions.h"
#include "base/win/shortcut.h"
#include "base/win/windows_version.h"
-#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "content/public/browser/browser_thread.h"
#include "ui/gfx/icon_util.h"
@@ -82,7 +81,7 @@ std::vector<FilePath> GetShortcutPaths(
} locations[] = {
{
shortcut_info.create_on_desktop,
- chrome::DIR_USER_DESKTOP,
+ base::DIR_USER_DESKTOP,
NULL
}, {
shortcut_info.create_in_applications_menu,