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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/file_manager_util.cc

Issue 18308004: Update CrOS to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 5 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 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h" 4 #include "chrome/browser/chromeos/extensions/file_manager/file_manager_util.h"
5 5
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return base::strcasecmp(file_extension, kCRXExtension) == 0; 124 return base::strcasecmp(file_extension, kCRXExtension) == 0;
125 } 125 }
126 126
127 bool IsPepperPluginEnabled(Profile* profile, 127 bool IsPepperPluginEnabled(Profile* profile,
128 const base::FilePath& plugin_path) { 128 const base::FilePath& plugin_path) {
129 content::PepperPluginInfo* pepper_info = 129 content::PepperPluginInfo* pepper_info =
130 PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(plugin_path); 130 PluginService::GetInstance()->GetRegisteredPpapiPluginInfo(plugin_path);
131 if (!pepper_info) 131 if (!pepper_info)
132 return false; 132 return false;
133 133
134 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile); 134 scoped_refptr<PluginPrefs> plugin_prefs = PluginPrefs::GetForProfile(profile);
135 if (!plugin_prefs) 135 if (!plugin_prefs.get())
136 return false; 136 return false;
137 137
138 return plugin_prefs->IsPluginEnabled(pepper_info->ToWebPluginInfo()); 138 return plugin_prefs->IsPluginEnabled(pepper_info->ToWebPluginInfo());
139 } 139 }
140 140
141 bool IsPdfPluginEnabled(Profile* profile) { 141 bool IsPdfPluginEnabled(Profile* profile) {
142 base::FilePath plugin_path; 142 base::FilePath plugin_path;
143 PathService::Get(chrome::FILE_PDF_PLUGIN, &plugin_path); 143 PathService::Get(chrome::FILE_PDF_PLUGIN, &plugin_path);
144 return IsPepperPluginEnabled(profile, plugin_path); 144 return IsPepperPluginEnabled(profile, plugin_path);
145 } 145 }
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 files.insert(std::make_pair(path, mime_type)); 341 files.insert(std::make_pair(path, mime_type));
342 const extensions::FileHandlerInfo* first_handler = NULL; 342 const extensions::FileHandlerInfo* first_handler = NULL;
343 const extensions::Extension* extension_for_first_handler = NULL; 343 const extensions::Extension* extension_for_first_handler = NULL;
344 344
345 // If we find the default handler, we execute it immediately, but otherwise, 345 // If we find the default handler, we execute it immediately, but otherwise,
346 // we remember the first handler, and if there was no default handler, simply 346 // we remember the first handler, and if there was no default handler, simply
347 // execute the first one. 347 // execute the first one.
348 for (ExtensionSet::const_iterator iter = service->extensions()->begin(); 348 for (ExtensionSet::const_iterator iter = service->extensions()->begin();
349 iter != service->extensions()->end(); 349 iter != service->extensions()->end();
350 ++iter) { 350 ++iter) {
351 const Extension* extension = *iter; 351 const Extension* extension = iter->get();
352 352
353 // We don't support using hosted apps to open files. 353 // We don't support using hosted apps to open files.
354 if (!extension->is_platform_app()) 354 if (!extension->is_platform_app())
355 continue; 355 continue;
356 356
357 // We only support apps that specify "incognito: split" if in incognito 357 // We only support apps that specify "incognito: split" if in incognito
358 // mode. 358 // mode.
359 if (profile->IsOffTheRecord() && 359 if (profile->IsOffTheRecord() &&
360 !service->IsIncognitoEnabled(extension->id())) 360 !service->IsIncognitoEnabled(extension->id()))
361 continue; 361 continue;
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 // If the file doesn't have an extension or its mime-type cannot be 855 // If the file doesn't have an extension or its mime-type cannot be
856 // determined, then indicate that it has the empty mime-type. This will 856 // determined, then indicate that it has the empty mime-type. This will
857 // only be matched if the Web Intents accepts "*" or "*/*". 857 // only be matched if the Web Intents accepts "*" or "*/*".
858 return ""; 858 return "";
859 } else { 859 } else {
860 return mime_type; 860 return mime_type;
861 } 861 }
862 } 862 }
863 863
864 } // namespace file_manager_util 864 } // namespace file_manager_util
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698