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

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc

Issue 17226003: Add metrics for interactions with the Apps Launcher promo dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed gyp file. :-/ 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 4
5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "apps/app_launcher.h" 10 #include "apps/app_launcher.h"
11 #include "apps/field_trial_names.h"
12 #include "apps/pref_names.h" 11 #include "apps/pref_names.h"
13 #include "base/command_line.h" 12 #include "base/command_line.h"
14 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/ref_counted_memory.h"
15 #include "base/metrics/field_trial.h"
16 #include "base/prefs/pref_service.h" 14 #include "base/prefs/pref_service.h"
17 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
18 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
20 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
21 #include "base/values.h" 19 #include "base/values.h"
22 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
23 #include "chrome/browser/first_run/first_run.h" 21 #include "chrome/browser/first_run/first_run.h"
24 #include "chrome/browser/google/google_util.h" 22 #include "chrome/browser/google/google_util.h"
25 #include "chrome/browser/policy/browser_policy_connector.h" 23 #include "chrome/browser/policy/browser_policy_connector.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 329
332 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html); 330 new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html);
333 } 331 }
334 332
335 void NTPResourceCache::CreateNewTabHTML() { 333 void NTPResourceCache::CreateNewTabHTML() {
336 // TODO(estade): these strings should be defined in their relevant handlers 334 // TODO(estade): these strings should be defined in their relevant handlers
337 // (in GetLocalizedValues) and should have more legible names. 335 // (in GetLocalizedValues) and should have more legible names.
338 // Show the profile name in the title and most visited labels if the current 336 // Show the profile name in the title and most visited labels if the current
339 // profile is not the default. 337 // profile is not the default.
340 PrefService* prefs = profile_->GetPrefs(); 338 PrefService* prefs = profile_->GetPrefs();
341 PrefService* local_state = g_browser_process->local_state();
342 DictionaryValue load_time_data; 339 DictionaryValue load_time_data;
343 load_time_data.SetBoolean("bookmarkbarattached", 340 load_time_data.SetBoolean("bookmarkbarattached",
344 prefs->GetBoolean(prefs::kShowBookmarkBar)); 341 prefs->GetBoolean(prefs::kShowBookmarkBar));
345 load_time_data.SetBoolean("hasattribution", 342 load_time_data.SetBoolean("hasattribution",
346 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage( 343 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage(
347 IDR_THEME_NTP_ATTRIBUTION)); 344 IDR_THEME_NTP_ATTRIBUTION));
348 load_time_data.SetBoolean("showMostvisited", should_show_most_visited_page_); 345 load_time_data.SetBoolean("showMostvisited", should_show_most_visited_page_);
349 std::string app_launcher_promo_group_name = 346 load_time_data.SetBoolean("showAppLauncherPromo",
350 base::FieldTrialList::FindFullName(apps::kLauncherPromoTrialName); 347 apps::ShouldShowAppLauncherPromo());
351 bool show_app_launcher_promo =
352 !apps::IsAppLauncherEnabled() &&
353 local_state->GetBoolean(apps::prefs::kShowAppLauncherPromo) &&
354 (app_launcher_promo_group_name == apps::kShowLauncherPromoOnceGroupName ||
355 app_launcher_promo_group_name ==
356 apps::kResetShowLauncherPromoPrefGroupName);
357 load_time_data.SetBoolean("showAppLauncherPromo", show_app_launcher_promo);
358 load_time_data.SetBoolean("showRecentlyClosed", 348 load_time_data.SetBoolean("showRecentlyClosed",
359 should_show_recently_closed_menu_); 349 should_show_recently_closed_menu_);
360 load_time_data.SetString("title", 350 load_time_data.SetString("title",
361 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); 351 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE));
362 load_time_data.SetString("mostvisited", 352 load_time_data.SetString("mostvisited",
363 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); 353 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED));
364 load_time_data.SetString("suggestions", 354 load_time_data.SetString("suggestions",
365 l10n_util::GetStringUTF16(IDS_NEW_TAB_SUGGESTIONS)); 355 l10n_util::GetStringUTF16(IDS_NEW_TAB_SUGGESTIONS));
366 load_time_data.SetString("restoreThumbnailsShort", 356 load_time_data.SetString("restoreThumbnailsShort",
367 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK)); 357 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK));
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 // Get our template. 620 // Get our template.
631 static const base::StringPiece new_tab_theme_css( 621 static const base::StringPiece new_tab_theme_css(
632 ResourceBundle::GetSharedInstance().GetRawDataResource( 622 ResourceBundle::GetSharedInstance().GetRawDataResource(
633 IDR_NEW_TAB_4_THEME_CSS)); 623 IDR_NEW_TAB_4_THEME_CSS));
634 624
635 // Create the string from our template and the replacements. 625 // Create the string from our template and the replacements.
636 std::string css_string; 626 std::string css_string;
637 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 627 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
638 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 628 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
639 } 629 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/app_launcher_handler.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698