| OLD | NEW |
| 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/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 "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/task_runner_util.h" | 10 #include "base/task_runner_util.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 #include "chrome/common/pref_names.h" | 33 #include "chrome/common/pref_names.h" |
| 34 #include "chrome/common/url_constants.h" | 34 #include "chrome/common/url_constants.h" |
| 35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
| 37 #include "content/public/browser/plugin_service.h" | 37 #include "content/public/browser/plugin_service.h" |
| 38 #include "content/public/browser/user_metrics.h" | 38 #include "content/public/browser/user_metrics.h" |
| 39 #include "content/public/browser/web_contents.h" | 39 #include "content/public/browser/web_contents.h" |
| 40 #include "content/public/common/webplugininfo.h" | 40 #include "content/public/common/webplugininfo.h" |
| 41 #include "ipc/ipc_message.h" | 41 #include "ipc/ipc_message.h" |
| 42 #include "net/base/filename_util.h" | 42 #include "net/base/filename_util.h" |
| 43 #include "ui/base/layout.h" | |
| 44 #include "ui/base/models/list_selection_model.h" | 43 #include "ui/base/models/list_selection_model.h" |
| 45 #include "ui/gfx/image/image.h" | 44 #include "ui/gfx/image/image.h" |
| 46 #include "ui/views/controls/menu/menu_item_view.h" | 45 #include "ui/views/controls/menu/menu_item_view.h" |
| 47 #include "ui/views/controls/menu/menu_runner.h" | 46 #include "ui/views/controls/menu/menu_runner.h" |
| 48 #include "ui/views/widget/widget.h" | 47 #include "ui/views/widget/widget.h" |
| 49 | 48 |
| 50 using base::UserMetricsAction; | 49 using base::UserMetricsAction; |
| 51 using content::WebContents; | 50 using content::WebContents; |
| 52 | 51 |
| 53 namespace { | 52 namespace { |
| 54 | 53 |
| 55 TabRendererData::NetworkState TabContentsNetworkState( | 54 TabRendererData::NetworkState TabContentsNetworkState( |
| 56 WebContents* contents) { | 55 WebContents* contents) { |
| 57 if (!contents || !contents->IsLoading()) | 56 if (!contents || !contents->IsLoading()) |
| 58 return TabRendererData::NETWORK_STATE_NONE; | 57 return TabRendererData::NETWORK_STATE_NONE; |
| 59 if (contents->IsWaitingForResponse()) | 58 if (contents->IsWaitingForResponse()) |
| 60 return TabRendererData::NETWORK_STATE_WAITING; | 59 return TabRendererData::NETWORK_STATE_WAITING; |
| 61 return TabRendererData::NETWORK_STATE_LOADING; | 60 return TabRendererData::NETWORK_STATE_LOADING; |
| 62 } | 61 } |
| 63 | 62 |
| 64 TabStripLayoutType DetermineTabStripLayout( | 63 TabStripLayoutType DetermineTabStripLayout( |
| 65 PrefService* prefs, | 64 PrefService* prefs, |
| 66 chrome::HostDesktopType host_desktop_type, | 65 chrome::HostDesktopType host_desktop_type, |
| 67 bool* adjust_layout) { | 66 bool* adjust_layout) { |
| 68 *adjust_layout = false; | 67 *adjust_layout = false; |
| 69 if (CommandLine::ForCurrentProcess()->HasSwitch( | 68 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 70 switches::kEnableStackedTabStrip)) { | 69 switches::kEnableStackedTabStrip)) { |
| 71 return TAB_STRIP_LAYOUT_STACKED; | 70 return TAB_STRIP_LAYOUT_STACKED; |
| 72 } | 71 } |
| 73 // For chromeos always allow entering stacked mode. | 72 // For ash, always allow entering stacked mode. |
| 74 if (host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH) | 73 if (host_desktop_type != chrome::HOST_DESKTOP_TYPE_ASH) |
| 75 return TAB_STRIP_LAYOUT_SHRINK; | 74 return TAB_STRIP_LAYOUT_SHRINK; |
| 76 *adjust_layout = true; | 75 *adjust_layout = true; |
| 77 switch (prefs->GetInteger(prefs::kTabStripLayoutType)) { | 76 switch (prefs->GetInteger(prefs::kTabStripLayoutType)) { |
| 78 case TAB_STRIP_LAYOUT_STACKED: | 77 case TAB_STRIP_LAYOUT_STACKED: |
| 79 return TAB_STRIP_LAYOUT_STACKED; | 78 return TAB_STRIP_LAYOUT_STACKED; |
| 80 default: | 79 default: |
| 81 return TAB_STRIP_LAYOUT_SHRINK; | 80 return TAB_STRIP_LAYOUT_SHRINK; |
| 82 } | 81 } |
| 83 } | 82 } |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 url, | 586 url, |
| 588 mime_type.empty() || | 587 mime_type.empty() || |
| 589 net::IsSupportedMimeType(mime_type) || | 588 net::IsSupportedMimeType(mime_type) || |
| 590 content::PluginService::GetInstance()->GetPluginInfo( | 589 content::PluginService::GetInstance()->GetPluginInfo( |
| 591 -1, // process ID | 590 -1, // process ID |
| 592 MSG_ROUTING_NONE, // routing ID | 591 MSG_ROUTING_NONE, // routing ID |
| 593 model_->profile()->GetResourceContext(), | 592 model_->profile()->GetResourceContext(), |
| 594 url, GURL(), mime_type, false, | 593 url, GURL(), mime_type, false, |
| 595 NULL, &plugin, NULL)); | 594 NULL, &plugin, NULL)); |
| 596 } | 595 } |
| OLD | NEW |