Index: chrome/browser/ui/metro_pin_tab_helper_win.cc |
diff --git a/chrome/browser/ui/metro_pin_tab_helper_win.cc b/chrome/browser/ui/metro_pin_tab_helper_win.cc |
index 6491efa71cfdd04e38b9a93b3559196e82b0f558..a8e0579ef850cca70688ece812f5561888bcad53 100644 |
--- a/chrome/browser/ui/metro_pin_tab_helper_win.cc |
+++ b/chrome/browser/ui/metro_pin_tab_helper_win.cc |
@@ -13,6 +13,7 @@ |
#include "base/logging.h" |
#include "base/memory/ref_counted.h" |
#include "base/memory/ref_counted_memory.h" |
+#include "base/metrics/histogram.h" |
#include "base/path_service.h" |
#include "base/string_number_conversions.h" |
#include "base/utf_string_conversions.h" |
@@ -35,11 +36,15 @@ |
#include "ui/gfx/image/image.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/size.h" |
+#include "win8/metro_driver/secondary_tile_types.h" |
DEFINE_WEB_CONTENTS_USER_DATA_KEY(MetroPinTabHelper) |
namespace { |
+// Histogram name for site-specific tile pinning metrics. |
+const char kMetroPinMetric[] = "Metro.SecondaryTilePin"; |
+ |
// Generate an ID for the tile based on |url_str|. The ID is simply a hash of |
// the URL. |
string16 GenerateTileId(const string16& url_str) { |
@@ -158,6 +163,13 @@ bool GetPathToBackupLogo(const FilePath& logo_dir, |
return file_util::CopyFile(default_logo_path, *logo_path); |
} |
+// UMA reporting callback for site-specific secondary tile creation. |
+void PinPageReportUMACallback(win8::MetroSecondaryTilePinState result) { |
+ UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric, |
+ result, |
+ win8::METRO_PIN_STATE_LIMIT); |
+} |
+ |
// The PinPageTaskRunner class performs the necessary FILE thread actions to |
// pin a page, such as generating or copying the tile image file. When it |
// has performed these actions it will send the tile creation request to the |
@@ -218,22 +230,27 @@ void PinPageTaskRunner::RunOnFileThread() { |
LOG(ERROR) << "Count not get path to logo tile."; |
return; |
} |
+ UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric, |
+ win8::METRO_PIN_LOGO_READY, |
+ win8::METRO_PIN_STATE_LIMIT); |
HMODULE metro_module = base::win::GetMetroModule(); |
if (!metro_module) |
return; |
- typedef void (*MetroPinToStartScreen)(const string16&, const string16&, |
- const string16&, const FilePath&); |
- MetroPinToStartScreen metro_pin_to_start_screen = |
- reinterpret_cast<MetroPinToStartScreen>( |
+ win8::MetroPinToStartScreen metro_pin_to_start_screen = |
+ reinterpret_cast<win8::MetroPinToStartScreen>( |
::GetProcAddress(metro_module, "MetroPinToStartScreen")); |
if (!metro_pin_to_start_screen) { |
NOTREACHED(); |
return; |
} |
- metro_pin_to_start_screen(tile_id, title_, url_, logo_path); |
+ metro_pin_to_start_screen(tile_id, |
+ title_, |
+ url_, |
+ logo_path, |
+ base::Bind(&PinPageReportUMACallback)); |
} |
} // namespace |
@@ -378,10 +395,16 @@ bool MetroPinTabHelper::IsPinned() const { |
void MetroPinTabHelper::TogglePinnedToStartScreen() { |
if (IsPinned()) { |
+ UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric, |
+ win8::METRO_UNPIN_INITIATED, |
+ win8::METRO_PIN_STATE_LIMIT); |
UnPinPageFromStartScreen(); |
return; |
} |
+ UMA_HISTOGRAM_ENUMERATION(kMetroPinMetric, |
+ win8::METRO_PIN_INITIATED, |
+ win8::METRO_PIN_STATE_LIMIT); |
GURL url = web_contents()->GetURL(); |
string16 url_str = UTF8ToUTF16(url.spec()); |
string16 title = web_contents()->GetTitle(); |
@@ -445,9 +468,8 @@ void MetroPinTabHelper::UnPinPageFromStartScreen() { |
if (!metro_module) |
return; |
- typedef void (*MetroUnPinFromStartScreen)(const string16&); |
- MetroUnPinFromStartScreen metro_un_pin_from_start_screen = |
- reinterpret_cast<MetroUnPinFromStartScreen>( |
+ win8::MetroUnPinFromStartScreen metro_un_pin_from_start_screen = |
+ reinterpret_cast<win8::MetroUnPinFromStartScreen>( |
::GetProcAddress(metro_module, "MetroUnPinFromStartScreen")); |
if (!metro_un_pin_from_start_screen) { |
NOTREACHED(); |
@@ -456,7 +478,8 @@ void MetroPinTabHelper::UnPinPageFromStartScreen() { |
GURL url = web_contents()->GetURL(); |
string16 tile_id = GenerateTileId(UTF8ToUTF16(url.spec())); |
- metro_un_pin_from_start_screen(tile_id); |
+ metro_un_pin_from_start_screen(tile_id, |
+ base::Bind(&PinPageReportUMACallback)); |
} |
void MetroPinTabHelper::FaviconDownloaderFinished() { |