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

Side by Side Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.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 4
5 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h" 5 #include "chrome/browser/ui/views/tabs/browser_tab_strip_controller.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/browser/extensions/extension_tab_helper.h" 9 #include "chrome/browser/extensions/extension_tab_helper.h"
10 #include "chrome/browser/favicon/favicon_tab_helper.h" 10 #include "chrome/browser/favicon/favicon_tab_helper.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/tabs/tab_strip_model.h" 12 #include "chrome/browser/tabs/tab_strip_model.h"
13 #include "chrome/browser/tabs/tab_strip_selection_model.h" 13 #include "chrome/browser/tabs/tab_strip_selection_model.h"
14 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 15 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
16 #include "chrome/browser/ui/tabs/tab_menu_model.h" 16 #include "chrome/browser/ui/tabs/tab_menu_model.h"
17 #include "chrome/browser/ui/views/tabs/base_tab_strip.h" 17 #include "chrome/browser/ui/views/tabs/base_tab_strip.h"
18 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h" 18 #include "chrome/browser/ui/views/tabs/tab_renderer_data.h"
19 #include "chrome/common/chrome_notification_types.h" 19 #include "chrome/common/chrome_notification_types.h"
20 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
21 #include "content/browser/renderer_host/render_view_host.h" 21 #include "content/browser/renderer_host/render_view_host.h"
22 #include "content/browser/tab_contents/tab_contents.h" 22 #include "content/browser/tab_contents/tab_contents.h"
23 #include "content/browser/user_metrics.h"
24 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
24 #include "content/public/browser/user_metrics.h"
25 #include "ui/views/controls/menu/menu_item_view.h" 25 #include "ui/views/controls/menu/menu_item_view.h"
26 #include "ui/views/controls/menu/menu_model_adapter.h" 26 #include "ui/views/controls/menu/menu_model_adapter.h"
27 #include "ui/views/controls/menu/menu_runner.h" 27 #include "ui/views/controls/menu/menu_runner.h"
28 #include "ui/views/widget/widget.h" 28 #include "ui/views/widget/widget.h"
29 29
30 using content::UserMetricsAction;
31
30 static TabRendererData::NetworkState TabContentsNetworkState( 32 static TabRendererData::NetworkState TabContentsNetworkState(
31 TabContents* contents) { 33 TabContents* contents) {
32 if (!contents || !contents->IsLoading()) 34 if (!contents || !contents->IsLoading())
33 return TabRendererData::NETWORK_STATE_NONE; 35 return TabRendererData::NETWORK_STATE_NONE;
34 if (contents->waiting_for_response()) 36 if (contents->waiting_for_response())
35 return TabRendererData::NETWORK_STATE_WAITING; 37 return TabRendererData::NETWORK_STATE_WAITING;
36 return TabRendererData::NETWORK_STATE_LOADING; 38 return TabRendererData::NETWORK_STATE_LOADING;
37 } 39 }
38 40
39 class BrowserTabStripController::TabContextMenuContents 41 class BrowserTabStripController::TabContextMenuContents
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 280 }
279 281
280 void BrowserTabStripController::PerformDrop(bool drop_before, 282 void BrowserTabStripController::PerformDrop(bool drop_before,
281 int index, 283 int index,
282 const GURL& url) { 284 const GURL& url) {
283 browser::NavigateParams params( 285 browser::NavigateParams params(
284 browser_, url, content::PAGE_TRANSITION_LINK); 286 browser_, url, content::PAGE_TRANSITION_LINK);
285 params.tabstrip_index = index; 287 params.tabstrip_index = index;
286 288
287 if (drop_before) { 289 if (drop_before) {
288 UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLBetweenTabs")); 290 content::RecordAction(UserMetricsAction("Tab_DropURLBetweenTabs"));
289 params.disposition = NEW_FOREGROUND_TAB; 291 params.disposition = NEW_FOREGROUND_TAB;
290 } else { 292 } else {
291 UserMetrics::RecordAction(UserMetricsAction("Tab_DropURLOnTab")); 293 content::RecordAction(UserMetricsAction("Tab_DropURLOnTab"));
292 params.disposition = CURRENT_TAB; 294 params.disposition = CURRENT_TAB;
293 params.source_contents = model_->GetTabContentsAt(index); 295 params.source_contents = model_->GetTabContentsAt(index);
294 } 296 }
295 params.window_action = browser::NavigateParams::SHOW_WINDOW; 297 params.window_action = browser::NavigateParams::SHOW_WINDOW;
296 browser::Navigate(&params); 298 browser::Navigate(&params);
297 } 299 }
298 300
299 bool BrowserTabStripController::IsCompatibleWith(BaseTabStrip* other) const { 301 bool BrowserTabStripController::IsCompatibleWith(BaseTabStrip* other) const {
300 Profile* other_profile = 302 Profile* other_profile =
301 static_cast<BrowserTabStripController*>(other->controller())->profile(); 303 static_cast<BrowserTabStripController*>(other->controller())->profile();
302 return other_profile == profile(); 304 return other_profile == profile();
303 } 305 }
304 306
305 void BrowserTabStripController::CreateNewTab() { 307 void BrowserTabStripController::CreateNewTab() {
306 UserMetrics::RecordAction(UserMetricsAction("NewTab_Button")); 308 content::RecordAction(UserMetricsAction("NewTab_Button"));
307 model_->delegate()->AddBlankTab(true); 309 model_->delegate()->AddBlankTab(true);
308 } 310 }
309 311
310 void BrowserTabStripController::ClickActiveTab(int index) { 312 void BrowserTabStripController::ClickActiveTab(int index) {
311 DCHECK(model_->active_index() == index); 313 DCHECK(model_->active_index() == index);
312 model_->ActiveTabClicked(index); 314 model_->ActiveTabClicked(index);
313 } 315 }
314 316
315 //////////////////////////////////////////////////////////////////////////////// 317 ////////////////////////////////////////////////////////////////////////////////
316 // BrowserTabStripController, TabStripModelObserver implementation: 318 // BrowserTabStripController, TabStripModelObserver implementation:
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 473
472 void BrowserTabStripController::StopHighlightTabsForCommand( 474 void BrowserTabStripController::StopHighlightTabsForCommand(
473 TabStripModel::ContextMenuCommand command_id, 475 TabStripModel::ContextMenuCommand command_id,
474 BaseTab* tab) { 476 BaseTab* tab) {
475 if (command_id == TabStripModel::CommandCloseTabsToRight || 477 if (command_id == TabStripModel::CommandCloseTabsToRight ||
476 command_id == TabStripModel::CommandCloseOtherTabs) { 478 command_id == TabStripModel::CommandCloseOtherTabs) {
477 // Just tell all Tabs to stop pulsing - it's safe. 479 // Just tell all Tabs to stop pulsing - it's safe.
478 tabstrip_->StopAllHighlighting(); 480 tabstrip_->StopAllHighlighting();
479 } 481 }
480 } 482 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.cc ('k') | chrome/browser/ui/views/tabs/default_tab_drag_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698