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

Side by Side Diff: chrome/browser/views/tabs/tab_strip.cc

Issue 1145001: Porting the app launcher to Windows, and adding an experimental flag... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/views/tabs/tab_strip.h" 5 #include "chrome/browser/views/tabs/tab_strip.h"
6 6
7 #include "app/drag_drop_types.h" 7 #include "app/drag_drop_types.h"
8 #include "app/gfx/canvas.h" 8 #include "app/gfx/canvas.h"
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/os_exchange_data.h" 10 #include "app/os_exchange_data.h"
11 #include "app/resource_bundle.h" 11 #include "app/resource_bundle.h"
12 #include "app/slide_animation.h" 12 #include "app/slide_animation.h"
13 #include "base/command_line.h"
13 #include "base/stl_util-inl.h" 14 #include "base/stl_util-inl.h"
15 #include "chrome/browser/browser.h"
14 #include "chrome/browser/browser_theme_provider.h" 16 #include "chrome/browser/browser_theme_provider.h"
15 #include "chrome/browser/defaults.h" 17 #include "chrome/browser/defaults.h"
16 #include "chrome/browser/metrics/user_metrics.h" 18 #include "chrome/browser/metrics/user_metrics.h"
17 #include "chrome/browser/profile.h" 19 #include "chrome/browser/profile.h"
18 #include "chrome/browser/renderer_host/render_view_host.h" 20 #include "chrome/browser/renderer_host/render_view_host.h"
19 #include "chrome/browser/tab_contents/tab_contents.h" 21 #include "chrome/browser/tab_contents/tab_contents.h"
20 #include "chrome/browser/tabs/tab_strip_model.h" 22 #include "chrome/browser/tabs/tab_strip_model.h"
21 #include "chrome/browser/view_ids.h" 23 #include "chrome/browser/view_ids.h"
24 #include "chrome/browser/views/app_launcher.h"
22 #include "chrome/browser/views/tabs/dragged_tab_controller.h" 25 #include "chrome/browser/views/tabs/dragged_tab_controller.h"
23 #include "chrome/browser/views/tabs/tab.h" 26 #include "chrome/browser/views/tabs/tab.h"
27 #include "chrome/common/chrome_switches.h"
24 #include "chrome/common/pref_names.h" 28 #include "chrome/common/pref_names.h"
25 #include "gfx/path.h" 29 #include "gfx/path.h"
26 #include "gfx/size.h" 30 #include "gfx/size.h"
27 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
28 #include "grit/theme_resources.h" 32 #include "grit/theme_resources.h"
29 #include "views/controls/image_view.h" 33 #include "views/controls/image_view.h"
30 #include "views/painter.h" 34 #include "views/painter.h"
31 #include "views/widget/default_theme_provider.h" 35 #include "views/widget/default_theme_provider.h"
32 #include "views/window/non_client_view.h" 36 #include "views/window/non_client_view.h"
33 #include "views/window/window.h" 37 #include "views/window/window.h"
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 } 815 }
812 LoadNewTabButtonImage(); 816 LoadNewTabButtonImage();
813 newtab_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEWTAB)); 817 newtab_button_->SetAccessibleName(l10n_util::GetString(IDS_ACCNAME_NEWTAB));
814 AddChildView(newtab_button_); 818 AddChildView(newtab_button_);
815 } 819 }
816 820
817 bool TabStrip::IsCompatibleWith(TabStrip* other) const { 821 bool TabStrip::IsCompatibleWith(TabStrip* other) const {
818 return model_->profile() == other->model()->profile(); 822 return model_->profile() == other->model()->profile();
819 } 823 }
820 824
825 gfx::Rect TabStrip::GetNewTabButtonBounds() {
826 return newtab_button_->bounds();
827 }
828
821 //////////////////////////////////////////////////////////////////////////////// 829 ////////////////////////////////////////////////////////////////////////////////
822 // TabStrip, BaseTabStrip implementation: 830 // TabStrip, BaseTabStrip implementation:
823 831
824 int TabStrip::GetPreferredHeight() { 832 int TabStrip::GetPreferredHeight() {
825 return GetPreferredSize().height(); 833 return GetPreferredSize().height();
826 } 834 }
827 835
828 void TabStrip::SetBackgroundOffset(const gfx::Point& offset) { 836 void TabStrip::SetBackgroundOffset(const gfx::Point& offset) {
829 int tab_count = GetTabCount(); 837 int tab_count = GetTabCount();
830 for (int i = 0; i < tab_count; ++i) 838 for (int i = 0; i < tab_count; ++i)
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 1400
1393 bool TabStrip::HasAvailableDragActions() const { 1401 bool TabStrip::HasAvailableDragActions() const {
1394 return model_->delegate()->GetDragActions() != 0; 1402 return model_->delegate()->GetDragActions() != 0;
1395 } 1403 }
1396 1404
1397 /////////////////////////////////////////////////////////////////////////////// 1405 ///////////////////////////////////////////////////////////////////////////////
1398 // TabStrip, views::BaseButton::ButtonListener implementation: 1406 // TabStrip, views::BaseButton::ButtonListener implementation:
1399 1407
1400 void TabStrip::ButtonPressed(views::Button* sender, const views::Event& event) { 1408 void TabStrip::ButtonPressed(views::Button* sender, const views::Event& event) {
1401 if (sender == newtab_button_) { 1409 if (sender == newtab_button_) {
1410 // TODO(jcampan): if we decide to keep the app launcher as the default
1411 // behavior for the new tab button, we should add a method
1412 // on the TabStripDelegate to do so.
1413 if (CommandLine::ForCurrentProcess()->HasSwitch(
1414 switches::kAppLauncherForNewTab)) {
1415 NavigationController& controller =
1416 model_->GetSelectedTabContents()->controller();
1417 AppLauncher::Show(Browser::GetBrowserForController(&controller, NULL));
1418 return;
1419 }
1402 UserMetrics::RecordAction("NewTab_Button", model_->profile()); 1420 UserMetrics::RecordAction("NewTab_Button", model_->profile());
1403 model_->delegate()->AddBlankTab(true); 1421 model_->delegate()->AddBlankTab(true);
1404 } 1422 }
1405 } 1423 }
1406 1424
1407 /////////////////////////////////////////////////////////////////////////////// 1425 ///////////////////////////////////////////////////////////////////////////////
1408 // TabStrip, MessageLoop::Observer implementation: 1426 // TabStrip, MessageLoop::Observer implementation:
1409 1427
1410 #if defined(OS_WIN) 1428 #if defined(OS_WIN)
1411 void TabStrip::WillProcessMessage(const MSG& msg) { 1429 void TabStrip::WillProcessMessage(const MSG& msg) {
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after
2050 } 2068 }
2051 } 2069 }
2052 2070
2053 bool TabStrip::HasPhantomTabs() const { 2071 bool TabStrip::HasPhantomTabs() const {
2054 for (int i = 0; i < GetTabCount(); ++i) { 2072 for (int i = 0; i < GetTabCount(); ++i) {
2055 if (GetTabAt(i)->phantom()) 2073 if (GetTabAt(i)->phantom())
2056 return true; 2074 return true;
2057 } 2075 }
2058 return false; 2076 return false;
2059 } 2077 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab_strip.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698