summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-18 21:54:39 +0000
committerandybons@chromium.org <andybons@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-18 21:54:39 +0000
commitee2a79e9ed2339cb9548c43ae471b05d6418f2a7 (patch)
tree09a7e15a9dfe21277b8893f7fdb9ee6e71b973f2
parent89fb65a6f0f1b6981c26c9b9d05a02332f6ec6d7 (diff)
downloadchromium_src-ee2a79e9ed2339cb9548c43ae471b05d6418f2a7.zip
chromium_src-ee2a79e9ed2339cb9548c43ae471b05d6418f2a7.tar.gz
chromium_src-ee2a79e9ed2339cb9548c43ae471b05d6418f2a7.tar.bz2
o Update the mapping of action hashes to their appropriate identifiers.
o Update user_metrics.h to be more explicit about how to add metrics. o Update the some BookmarkBar metrics to fit on one line as is required by the script. BUG=59606 TEST=none Review URL: http://codereview.chromium.org/3815011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62982 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/cocoa/bookmarks/bookmark_button.mm82
-rw-r--r--chrome/browser/metrics/user_metrics.h8
-rw-r--r--chrome/tools/chromeactions.txt2
-rwxr-xr-xchrome/tools/extract_actions.py2
4 files changed, 50 insertions, 44 deletions
diff --git a/chrome/browser/cocoa/bookmarks/bookmark_button.mm b/chrome/browser/cocoa/bookmarks/bookmark_button.mm
index 87f4821..9728e67 100644
--- a/chrome/browser/cocoa/bookmarks/bookmark_button.mm
+++ b/chrome/browser/cocoa/bookmarks/bookmark_button.mm
@@ -110,49 +110,49 @@ NSString* const kBookmarkPulseFlagKey = @"BookmarkPulseFlagKey";
if ([self isEmpty])
return;
- if ([self delegate]) {
- // Ask our delegate to fill the pasteboard for us.
- NSPasteboard* pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
- [[self delegate] fillPasteboard:pboard forDragOfButton:self];
-
- // At the moment, moving bookmarks causes their buttons (like me!)
- // to be destroyed and rebuilt. Make sure we don't go away while on
- // the stack.
- [self retain];
-
- // Lock bar visibility, forcing the overlay to stay visible if we are in
- // fullscreen mode.
- if ([[self delegate] dragShouldLockBarVisibility]) {
- DCHECK(!visibilityDelegate_);
- NSWindow* window = [[self delegate] browserWindow];
- visibilityDelegate_ =
- [BrowserWindowController browserWindowControllerForWindow:window];
- [visibilityDelegate_ lockBarVisibilityForOwner:self
- withAnimation:NO
- delay:NO];
- }
- const BookmarkNode* node = [self bookmarkNode];
- const BookmarkNode* parent = node ? node->GetParent() : NULL;
- BOOL isWithinFolder = parent && parent->type() == BookmarkNode::FOLDER;
- UserMetrics::RecordAction(UserMetricsAction(
- isWithinFolder ? "BookmarkBarFolder_DragStart" :
- "BookmarkBar_DragStart"));
-
- dragMouseOffset_ = [self convertPointFromBase:[event locationInWindow]];
- dragPending_ = YES;
-
- CGFloat yAt = [self bounds].size.height;
- NSSize dragOffset = NSMakeSize(0.0, 0.0);
- [self dragImage:[self dragImage] at:NSMakePoint(0, yAt) offset:dragOffset
- event:event pasteboard:pboard source:self slideBack:YES];
-
- // And we're done.
- dragPending_ = NO;
- [self autorelease];
- } else {
- // Avoid blowing up, but we really shouldn't get here.
+ if (![self delegate]) {
NOTREACHED();
+ return;
+ }
+ // Ask our delegate to fill the pasteboard for us.
+ NSPasteboard* pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+ [[self delegate] fillPasteboard:pboard forDragOfButton:self];
+
+ // At the moment, moving bookmarks causes their buttons (like me!)
+ // to be destroyed and rebuilt. Make sure we don't go away while on
+ // the stack.
+ [self retain];
+
+ // Lock bar visibility, forcing the overlay to stay visible if we are in
+ // fullscreen mode.
+ if ([[self delegate] dragShouldLockBarVisibility]) {
+ DCHECK(!visibilityDelegate_);
+ NSWindow* window = [[self delegate] browserWindow];
+ visibilityDelegate_ =
+ [BrowserWindowController browserWindowControllerForWindow:window];
+ [visibilityDelegate_ lockBarVisibilityForOwner:self
+ withAnimation:NO
+ delay:NO];
+ }
+ const BookmarkNode* node = [self bookmarkNode];
+ const BookmarkNode* parent = node ? node->GetParent() : NULL;
+ if (parent && parent->type() == BookmarkNode::FOLDER) {
+ UserMetrics::RecordAction(UserMetricsAction("BookmarkBarFolder_DragStart"));
+ } else {
+ UserMetrics::RecordAction(UserMetricsAction("BookmarkBar_DragStart"));
}
+
+ dragMouseOffset_ = [self convertPointFromBase:[event locationInWindow]];
+ dragPending_ = YES;
+
+ CGFloat yAt = [self bounds].size.height;
+ NSSize dragOffset = NSMakeSize(0.0, 0.0);
+ [self dragImage:[self dragImage] at:NSMakePoint(0, yAt) offset:dragOffset
+ event:event pasteboard:pboard source:self slideBack:YES];
+
+ // And we're done.
+ dragPending_ = NO;
+ [self autorelease];
}
// Overridden to release bar visibility.
diff --git a/chrome/browser/metrics/user_metrics.h b/chrome/browser/metrics/user_metrics.h
index 8fcca7a..e9addb6 100644
--- a/chrome/browser/metrics/user_metrics.h
+++ b/chrome/browser/metrics/user_metrics.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,7 +23,6 @@ struct UserMetricsAction {
};
-
class UserMetrics {
public:
// Record that the user performed an action.
@@ -34,8 +33,13 @@ class UserMetrics {
// interacting with the browser.
// WARNING: Call this function exactly like this:
// UserMetrics::RecordAction(UserMetricsAction("foo bar"));
+ // (all on one line and with the metric string literal [no variables])
// because otherwise our processing scripts won't pick up on new actions.
//
+ // Once a new recorded action is added, run chrome/tools/extract_actions.py
+ // to generate a new mapping of [action hashes -> metric names] and send it
+ // out for review to be updated.
+ //
// For more complicated situations (like when there are many different
// possible actions), see RecordComputedAction.
//
diff --git a/chrome/tools/chromeactions.txt b/chrome/tools/chromeactions.txt
index e7d570a..70bcde6 100644
--- a/chrome/tools/chromeactions.txt
+++ b/chrome/tools/chromeactions.txt
@@ -50,6 +50,7 @@
0xd80cc9291c9c82a9 BlockNonsandboxedPlugins_Enable
0x114c3050111d8b8d Bold
0x3012b56b98c28823 BookmarkBarFolder_DragEnd
+0xe71c0ba72ca2f331 BookmarkBarFolder_DragStart
0x4213d5e4d5da1c0a BookmarkBar_ContextMenu_Add
0x1ce97170a30f2fdd BookmarkBar_ContextMenu_Edit
0xbe267767bb380a0d BookmarkBar_ContextMenu_NewFolder
@@ -66,6 +67,7 @@
0x4b37738130b32b3e BookmarkBar_DragEnd
0x6c0fc567d362960e BookmarkBar_DragFromFolder
0xeec5d4ade759d651 BookmarkBar_DragRecentlyBookmarked
+0xeffa5b8ce7f96fd9 BookmarkBar_DragStart
0x949073bf8996b6c8 BookmarkBar_ShowOtherBookmarks
0xef415d0bbf795b32 BookmarkBar_ShowRecentlyBookmarked
0xd4d041fb05dcaebf BookmarkBubble_ChangeParent
diff --git a/chrome/tools/extract_actions.py b/chrome/tools/extract_actions.py
index 3cb846f..a232449 100755
--- a/chrome/tools/extract_actions.py
+++ b/chrome/tools/extract_actions.py
@@ -160,7 +160,7 @@ def GrepForActions(path, actions):
"""
global number_of_files_total
number_of_files_total = number_of_files_total + 1
- # we look for the UserMetricsAction structur constructor
+ # we look for the UserMetricsAction structure constructor
# this should be on one line
action_re = re.compile(r'UserMetricsAction\("([^"]*)')
computed_action_re = re.compile(r'UserMetrics::RecordComputedAction')