OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profiles/profile_impl.h" | 5 #include "chrome/browser/profiles/profile_impl.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/environment.h" | 9 #include "base/environment.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 #if defined(OS_MACOSX) | 149 #if defined(OS_MACOSX) |
150 // Capacity for mock keychain used for testing. | 150 // Capacity for mock keychain used for testing. |
151 static const int kMockKeychainSize = 1000; | 151 static const int kMockKeychainSize = 1000; |
152 #endif | 152 #endif |
153 | 153 |
154 enum ContextType { | 154 enum ContextType { |
155 kNormalContext, | 155 kNormalContext, |
156 kMediaContext | 156 kMediaContext |
157 }; | 157 }; |
158 | 158 |
| 159 typedef std::list<std::pair<FilePath::StringType, int> > |
| 160 ComponentExtensionList; |
| 161 |
| 162 #if defined(FILE_MANAGER_EXTENSION) |
| 163 void AddFileManagerExtension(ComponentExtensionList* component_extensions) { |
| 164 #ifndef NDEBUG |
| 165 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 166 if (command_line->HasSwitch(switches::kFileManagerExtensionPath)) { |
| 167 FilePath filemgr_extension_path = |
| 168 command_line->GetSwitchValuePath(switches::kFileManagerExtensionPath); |
| 169 component_extensions->push_back(std::make_pair( |
| 170 filemgr_extension_path.value(), |
| 171 IDR_FILEMANAGER_MANIFEST)); |
| 172 return; |
| 173 } |
| 174 #endif // NDEBUG |
| 175 component_extensions->push_back(std::make_pair( |
| 176 FILE_PATH_LITERAL("file_manager"), |
| 177 IDR_FILEMANAGER_MANIFEST)); |
| 178 } |
| 179 #endif // defined(FILE_MANAGER_EXTENSION) |
| 180 |
159 // Gets the cache parameters from the command line. |type| is the type of | 181 // Gets the cache parameters from the command line. |type| is the type of |
160 // request context that we need, |cache_path| will be set to the user provided | 182 // request context that we need, |cache_path| will be set to the user provided |
161 // path, or will not be touched if there is not an argument. |max_size| will | 183 // path, or will not be touched if there is not an argument. |max_size| will |
162 // be the user provided value or zero by default. | 184 // be the user provided value or zero by default. |
163 void GetCacheParameters(ContextType type, FilePath* cache_path, | 185 void GetCacheParameters(ContextType type, FilePath* cache_path, |
164 int* max_size) { | 186 int* max_size) { |
165 DCHECK(cache_path); | 187 DCHECK(cache_path); |
166 DCHECK(max_size); | 188 DCHECK(max_size); |
167 | 189 |
168 // Override the cache location if specified by the user. | 190 // Override the cache location if specified by the user. |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 typedef std::list<std::pair<FilePath::StringType, int> > | 626 typedef std::list<std::pair<FilePath::StringType, int> > |
605 ComponentExtensionList; | 627 ComponentExtensionList; |
606 ComponentExtensionList component_extensions; | 628 ComponentExtensionList component_extensions; |
607 | 629 |
608 // Bookmark manager. | 630 // Bookmark manager. |
609 component_extensions.push_back(std::make_pair( | 631 component_extensions.push_back(std::make_pair( |
610 FILE_PATH_LITERAL("bookmark_manager"), | 632 FILE_PATH_LITERAL("bookmark_manager"), |
611 IDR_BOOKMARKS_MANIFEST)); | 633 IDR_BOOKMARKS_MANIFEST)); |
612 | 634 |
613 #if defined(FILE_MANAGER_EXTENSION) | 635 #if defined(FILE_MANAGER_EXTENSION) |
614 const CommandLine* command_line = CommandLine::ForCurrentProcess(); | 636 AddFileManagerExtension(&component_extensions); |
615 #ifndef NDEBUG | |
616 if (command_line->HasSwitch(switches::kFileManagerExtensionPath)) { | |
617 FilePath filemgr_extension_path = | |
618 command_line->GetSwitchValuePath(switches::kFileManagerExtensionPath); | |
619 component_extensions.push_back(std::make_pair( | |
620 filemgr_extension_path.value(), | |
621 IDR_FILEMANAGER_MANIFEST)); | |
622 } else { | |
623 component_extensions.push_back(std::make_pair( | |
624 FILE_PATH_LITERAL("file_manager"), | |
625 IDR_FILEMANAGER_MANIFEST)); | |
626 } | |
627 #else | |
628 component_extensions.push_back(std::make_pair( | |
629 FILE_PATH_LITERAL("file_manager"), | |
630 IDR_FILEMANAGER_MANIFEST)); | |
631 #endif | |
632 #endif | 637 #endif |
633 | 638 |
634 #if defined(TOUCH_UI) | 639 #if defined(TOUCH_UI) |
635 component_extensions.push_back(std::make_pair( | 640 component_extensions.push_back(std::make_pair( |
636 FILE_PATH_LITERAL("keyboard"), | 641 FILE_PATH_LITERAL("keyboard"), |
637 IDR_KEYBOARD_MANIFEST)); | 642 IDR_KEYBOARD_MANIFEST)); |
638 #endif | 643 #endif |
639 | 644 |
640 #if defined(OS_CHROMEOS) | 645 #if defined(OS_CHROMEOS) |
641 component_extensions.push_back(std::make_pair( | 646 component_extensions.push_back(std::make_pair( |
642 FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"), | 647 FILE_PATH_LITERAL("/usr/share/chromeos-assets/mobile"), |
643 IDR_MOBILE_MANIFEST)); | 648 IDR_MOBILE_MANIFEST)); |
644 | 649 |
| 650 const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
645 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { | 651 if (command_line->HasSwitch(switches::kAuthExtensionPath)) { |
646 FilePath auth_extension_path = | 652 FilePath auth_extension_path = |
647 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); | 653 command_line->GetSwitchValuePath(switches::kAuthExtensionPath); |
648 component_extensions.push_back(std::make_pair( | 654 component_extensions.push_back(std::make_pair( |
649 auth_extension_path.value(), | 655 auth_extension_path.value(), |
650 IDR_GAIA_TEST_AUTH_MANIFEST)); | 656 IDR_GAIA_TEST_AUTH_MANIFEST)); |
651 } else { | 657 } else { |
652 component_extensions.push_back(std::make_pair( | 658 component_extensions.push_back(std::make_pair( |
653 FILE_PATH_LITERAL("/usr/share/chromeos-assets/gaia_auth"), | 659 FILE_PATH_LITERAL("/usr/share/chromeos-assets/gaia_auth"), |
654 IDR_GAIA_AUTH_MANIFEST)); | 660 IDR_GAIA_AUTH_MANIFEST)); |
(...skipping 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1831 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { | 1837 SpellCheckProfile* ProfileImpl::GetSpellCheckProfile() { |
1832 if (!spellcheck_profile_.get()) | 1838 if (!spellcheck_profile_.get()) |
1833 spellcheck_profile_.reset(new SpellCheckProfile()); | 1839 spellcheck_profile_.reset(new SpellCheckProfile()); |
1834 return spellcheck_profile_.get(); | 1840 return spellcheck_profile_.get(); |
1835 } | 1841 } |
1836 | 1842 |
1837 void ProfileImpl::SetDownloadManagerDelegate( | 1843 void ProfileImpl::SetDownloadManagerDelegate( |
1838 ChromeDownloadManagerDelegate* delegate) { | 1844 ChromeDownloadManagerDelegate* delegate) { |
1839 download_manager_delegate_ = delegate; | 1845 download_manager_delegate_ = delegate; |
1840 } | 1846 } |
OLD | NEW |