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

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

Issue 8919017: Split UserMetrics into API vs. implementation. Move API to content/public. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Version for commit (merged again). Created 9 years 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) 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 #include "chrome/browser/extensions/file_manager_util.h" 4 #include "chrome/browser/extensions/file_manager_util.h"
5 5
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/json/json_writer.h" 7 #include "base/json/json_writer.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/string_util.h" 11 #include "base/string_util.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 13 #include "base/values.h"
14 #include "chrome/browser/plugin_prefs.h" 14 #include "chrome/browser/plugin_prefs.h"
15 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
16 #include "chrome/browser/simple_message_box.h" 16 #include "chrome/browser/simple_message_box.h"
17 #include "chrome/browser/ui/browser.h" 17 #include "chrome/browser/ui/browser.h"
18 #include "chrome/browser/ui/browser_list.h" 18 #include "chrome/browser/ui/browser_list.h"
19 #include "chrome/browser/ui/browser_window.h" 19 #include "chrome/browser/ui/browser_window.h"
20 #include "chrome/common/chrome_paths.h" 20 #include "chrome/common/chrome_paths.h"
21 #include "chrome/common/url_constants.h" 21 #include "chrome/common/url_constants.h"
22 #include "content/browser/plugin_service.h" 22 #include "content/browser/plugin_service.h"
23 #include "content/browser/user_metrics.h"
24 #include "content/public/browser/browser_thread.h" 23 #include "content/public/browser/browser_thread.h"
24 #include "content/public/browser/user_metrics.h"
25 #include "grit/generated_resources.h" 25 #include "grit/generated_resources.h"
26 #include "net/base/escape.h" 26 #include "net/base/escape.h"
27 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
28 #include "webkit/fileapi/file_system_context.h" 28 #include "webkit/fileapi/file_system_context.h"
29 #include "webkit/fileapi/file_system_mount_point_provider.h" 29 #include "webkit/fileapi/file_system_mount_point_provider.h"
30 #include "webkit/fileapi/file_system_util.h" 30 #include "webkit/fileapi/file_system_util.h"
31 31
32 #if defined(OS_CHROMEOS) 32 #if defined(OS_CHROMEOS)
33 #include "chrome/browser/chromeos/media/media_player.h" 33 #include "chrome/browser/chromeos/media/media_player.h"
34 #endif 34 #endif
35 35
36 using content::BrowserThread; 36 using content::BrowserThread;
37 using content::UserMetricsAction;
37 38
38 #define FILEBROWSER_DOMAIN "hhaomjibdihmijegdhdafkllkbggdgoj" 39 #define FILEBROWSER_DOMAIN "hhaomjibdihmijegdhdafkllkbggdgoj"
39 const char kFileBrowserDomain[] = FILEBROWSER_DOMAIN; 40 const char kFileBrowserDomain[] = FILEBROWSER_DOMAIN;
40 41
41 namespace file_manager_util { 42 namespace file_manager_util {
42 namespace { 43 namespace {
43 44
44 #define FILEBROWSER_URL(PATH) \ 45 #define FILEBROWSER_URL(PATH) \
45 ("chrome-extension://" FILEBROWSER_DOMAIN "/" PATH) 46 ("chrome-extension://" FILEBROWSER_DOMAIN "/" PATH)
46 // This is the "well known" url for the file manager extension from 47 // This is the "well known" url for the file manager extension from
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 273
273 FilePath virtual_path; 274 FilePath virtual_path;
274 if (!ConvertFileToRelativeFileSystemPath(browser->profile(), dir, 275 if (!ConvertFileToRelativeFileSystemPath(browser->profile(), dir,
275 &virtual_path)) { 276 &virtual_path)) {
276 return; 277 return;
277 } 278 }
278 279
279 std::string url = chrome::kChromeUIFileManagerURL; 280 std::string url = chrome::kChromeUIFileManagerURL;
280 url += "#/" + net::EscapeUrlEncodedData(virtual_path.value(), false); 281 url += "#/" + net::EscapeUrlEncodedData(virtual_path.value(), false);
281 282
282 UserMetrics::RecordAction(UserMetricsAction("ShowFileBrowserFullTab")); 283 content::RecordAction(UserMetricsAction("ShowFileBrowserFullTab"));
283 browser->ShowSingletonTabRespectRef(GURL(url)); 284 browser->ShowSingletonTabRespectRef(GURL(url));
284 } 285 }
285 286
286 void ViewFile(const FilePath& full_path, bool enqueue) { 287 void ViewFile(const FilePath& full_path, bool enqueue) {
287 if (!TryViewingFile(full_path, enqueue)) { 288 if (!TryViewingFile(full_path, enqueue)) {
288 Browser* browser = BrowserList::GetLastActive(); 289 Browser* browser = BrowserList::GetLastActive();
289 if (!browser) 290 if (!browser)
290 return; 291 return;
291 browser::ShowErrorBox( 292 browser::ShowErrorBox(
292 browser->window()->GetNativeHandle(), 293 browser->window()->GetNativeHandle(),
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 kUMATrackingExtensions, 342 kUMATrackingExtensions,
342 arraysize(kUMATrackingExtensions)); 343 arraysize(kUMATrackingExtensions));
343 UMA_HISTOGRAM_ENUMERATION("FileBrowser.OpeningFileType", 344 UMA_HISTOGRAM_ENUMERATION("FileBrowser.OpeningFileType",
344 extension_index, 345 extension_index,
345 arraysize(kUMATrackingExtensions) - 1); 346 arraysize(kUMATrackingExtensions) - 1);
346 return false; 347 return false;
347 } 348 }
348 349
349 } // namespace file_manager_util 350 } // namespace file_manager_util
350 351
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service.cc ('k') | chrome/browser/extensions/installed_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698