OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/browser_commands.h" | 5 #include "chrome/browser/ui/browser_commands.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 browser->window()->Close(); | 536 browser->window()->Close(); |
537 } | 537 } |
538 | 538 |
539 void NewTab(Browser* browser) { | 539 void NewTab(Browser* browser) { |
540 content::RecordAction(UserMetricsAction("NewTab")); | 540 content::RecordAction(UserMetricsAction("NewTab")); |
541 // TODO(asvitkine): This is invoked programmatically from several places. | 541 // TODO(asvitkine): This is invoked programmatically from several places. |
542 // Audit the code and change it so that the histogram only gets collected for | 542 // Audit the code and change it so that the histogram only gets collected for |
543 // user-initiated commands. | 543 // user-initiated commands. |
544 UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", TabStripModel::NEW_TAB_COMMAND, | 544 UMA_HISTOGRAM_ENUMERATION("Tab.NewTab", TabStripModel::NEW_TAB_COMMAND, |
545 TabStripModel::NEW_TAB_ENUM_COUNT); | 545 TabStripModel::NEW_TAB_ENUM_COUNT); |
| 546 // TODO(bruthig): |
546 | 547 |
547 if (browser->is_type_tabbed()) { | 548 if (browser->is_type_tabbed()) { |
548 AddTabAt(browser, GURL(), -1, true); | 549 AddTabAt(browser, GURL(), -1, true); |
549 browser->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); | 550 browser->tab_strip_model()->GetActiveWebContents()->RestoreFocus(); |
550 } else { | 551 } else { |
551 ScopedTabbedBrowserDisplayer displayer(browser->profile(), | 552 ScopedTabbedBrowserDisplayer displayer(browser->profile(), |
552 browser->host_desktop_type()); | 553 browser->host_desktop_type()); |
553 Browser* b = displayer.browser(); | 554 Browser* b = displayer.browser(); |
554 AddTabAt(b, GURL(), -1, true); | 555 AddTabAt(b, GURL(), -1, true); |
555 b->window()->Show(); | 556 b->window()->Show(); |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 | 614 |
614 void MoveTabPrevious(Browser* browser) { | 615 void MoveTabPrevious(Browser* browser) { |
615 content::RecordAction(UserMetricsAction("MoveTabPrevious")); | 616 content::RecordAction(UserMetricsAction("MoveTabPrevious")); |
616 browser->tab_strip_model()->MoveTabPrevious(); | 617 browser->tab_strip_model()->MoveTabPrevious(); |
617 } | 618 } |
618 | 619 |
619 void SelectNumberedTab(Browser* browser, int index) { | 620 void SelectNumberedTab(Browser* browser, int index) { |
620 if (index < browser->tab_strip_model()->count()) { | 621 if (index < browser->tab_strip_model()->count()) { |
621 content::RecordAction(UserMetricsAction("SelectNumberedTab")); | 622 content::RecordAction(UserMetricsAction("SelectNumberedTab")); |
622 browser->tab_strip_model()->ActivateTabAt(index, true); | 623 browser->tab_strip_model()->ActivateTabAt(index, true); |
| 624 // TODO(bruthig): |
623 } | 625 } |
624 } | 626 } |
625 | 627 |
626 void SelectLastTab(Browser* browser) { | 628 void SelectLastTab(Browser* browser) { |
627 content::RecordAction(UserMetricsAction("SelectLastTab")); | 629 content::RecordAction(UserMetricsAction("SelectLastTab")); |
628 browser->tab_strip_model()->SelectLastTab(); | 630 browser->tab_strip_model()->SelectLastTab(); |
629 } | 631 } |
630 | 632 |
631 void DuplicateTab(Browser* browser) { | 633 void DuplicateTab(Browser* browser) { |
632 content::RecordAction(UserMetricsAction("Duplicate")); | 634 content::RecordAction(UserMetricsAction("Duplicate")); |
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1275 browser->host_desktop_type())); | 1277 browser->host_desktop_type())); |
1276 app_browser->tab_strip_model()->AppendWebContents(contents, true); | 1278 app_browser->tab_strip_model()->AppendWebContents(contents, true); |
1277 | 1279 |
1278 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; | 1280 contents->GetMutableRendererPrefs()->can_accept_load_drops = false; |
1279 contents->GetRenderViewHost()->SyncRendererPrefs(); | 1281 contents->GetRenderViewHost()->SyncRendererPrefs(); |
1280 app_browser->window()->Show(); | 1282 app_browser->window()->Show(); |
1281 } | 1283 } |
1282 #endif // defined(ENABLE_EXTENSIONS) | 1284 #endif // defined(ENABLE_EXTENSIONS) |
1283 | 1285 |
1284 } // namespace chrome | 1286 } // namespace chrome |
OLD | NEW |