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

Side by Side Diff: apps/app_shim/extension_app_shim_handler_mac.cc

Issue 17524003: Fix ProfileForPath in ExtensionAppShimHandler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "apps/app_shim/extension_app_shim_handler_mac.h" 5 #include "apps/app_shim/extension_app_shim_handler_mac.h"
6 6
7 #include "apps/app_lifetime_monitor_factory.h" 7 #include "apps/app_lifetime_monitor_factory.h"
8 #include "apps/app_shim/app_shim_messages.h" 8 #include "apps/app_shim/app_shim_messages.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 ProfileManager* profile_manager = g_browser_process->profile_manager(); 50 ProfileManager* profile_manager = g_browser_process->profile_manager();
51 // Check for the profile name in the profile info cache to ensure that we 51 // Check for the profile name in the profile info cache to ensure that we
52 // never access any directory that isn't a known profile. 52 // never access any directory that isn't a known profile.
53 base::FilePath full_path = profile_manager->user_data_dir().Append(path); 53 base::FilePath full_path = profile_manager->user_data_dir().Append(path);
54 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache(); 54 ProfileInfoCache& cache = profile_manager->GetProfileInfoCache();
55 return cache.GetIndexOfProfileWithPath(full_path) != std::string::npos; 55 return cache.GetIndexOfProfileWithPath(full_path) != std::string::npos;
56 } 56 }
57 57
58 Profile* ExtensionAppShimHandler::ProfileManagerFacade::ProfileForPath( 58 Profile* ExtensionAppShimHandler::ProfileManagerFacade::ProfileForPath(
59 const base::FilePath& path) { 59 const base::FilePath& path) {
60 return g_browser_process->profile_manager()->GetProfile(path); 60 ProfileManager* profile_manager = g_browser_process->profile_manager();
61 base::FilePath full_path = profile_manager->user_data_dir().Append(path);
62 return profile_manager->GetProfile(full_path);
61 } 63 }
62 64
63 ExtensionAppShimHandler::ExtensionAppShimHandler() 65 ExtensionAppShimHandler::ExtensionAppShimHandler()
64 : profile_manager_facade_(new ProfileManagerFacade) { 66 : profile_manager_facade_(new ProfileManagerFacade) {
65 // This is instantiated in BrowserProcessImpl::PreMainMessageLoopRun with 67 // This is instantiated in BrowserProcessImpl::PreMainMessageLoopRun with
66 // AppShimHostManager. Since PROFILE_CREATED is not fired until 68 // AppShimHostManager. Since PROFILE_CREATED is not fired until
67 // ProfileManager::GetLastUsedProfile/GetLastOpenedProfiles, this should catch 69 // ProfileManager::GetLastUsedProfile/GetLastOpenedProfiles, this should catch
68 // notifications for all profiles. 70 // notifications for all profiles.
69 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED, 71 registrar_.Add(this, chrome::NOTIFICATION_PROFILE_CREATED,
70 content::NotificationService::AllBrowserContextsAndSources()); 72 content::NotificationService::AllBrowserContextsAndSources());
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 if (it != hosts_.end()) 230 if (it != hosts_.end())
229 it->second->OnAppClosed(); 231 it->second->OnAppClosed();
230 } 232 }
231 233
232 void ExtensionAppShimHandler::OnAppStop(Profile* profile, 234 void ExtensionAppShimHandler::OnAppStop(Profile* profile,
233 const std::string& app_id) {} 235 const std::string& app_id) {}
234 236
235 void ExtensionAppShimHandler::OnChromeTerminating() {} 237 void ExtensionAppShimHandler::OnChromeTerminating() {}
236 238
237 } // namespace apps 239 } // namespace apps
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698