| 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 24 matching lines...) Expand all Loading... |
| 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/models/list_selection_model.h" | 43 #include "ui/base/models/list_selection_model.h" |
| 44 #include "ui/gfx/image/image.h" | 44 #include "ui/gfx/image/image.h" |
| 45 #include "ui/views/controls/menu/menu_item_view.h" | |
| 46 #include "ui/views/controls/menu/menu_runner.h" | 45 #include "ui/views/controls/menu/menu_runner.h" |
| 47 #include "ui/views/widget/widget.h" | 46 #include "ui/views/widget/widget.h" |
| 48 | 47 |
| 49 using base::UserMetricsAction; | 48 using base::UserMetricsAction; |
| 50 using content::WebContents; | 49 using content::WebContents; |
| 51 | 50 |
| 52 namespace { | 51 namespace { |
| 53 | 52 |
| 54 TabRendererData::NetworkState TabContentsNetworkState( | 53 TabRendererData::NetworkState TabContentsNetworkState( |
| 55 WebContents* contents) { | 54 WebContents* contents) { |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 virtual ~TabContextMenuContents() { | 113 virtual ~TabContextMenuContents() { |
| 115 if (controller_) | 114 if (controller_) |
| 116 controller_->tabstrip_->StopAllHighlighting(); | 115 controller_->tabstrip_->StopAllHighlighting(); |
| 117 } | 116 } |
| 118 | 117 |
| 119 void Cancel() { | 118 void Cancel() { |
| 120 controller_ = NULL; | 119 controller_ = NULL; |
| 121 } | 120 } |
| 122 | 121 |
| 123 void RunMenuAt(const gfx::Point& point, ui::MenuSourceType source_type) { | 122 void RunMenuAt(const gfx::Point& point, ui::MenuSourceType source_type) { |
| 124 if (menu_runner_->RunMenuAt( | 123 if (menu_runner_->RunMenuAt(tab_->GetWidget(), |
| 125 tab_->GetWidget(), NULL, gfx::Rect(point, gfx::Size()), | 124 NULL, |
| 126 views::MenuItemView::TOPLEFT, source_type, | 125 gfx::Rect(point, gfx::Size()), |
| 127 views::MenuRunner::HAS_MNEMONICS | | 126 ui::MENU_ANCHOR_TOPLEFT, |
| 128 views::MenuRunner::CONTEXT_MENU) == | 127 source_type, |
| 129 views::MenuRunner::MENU_DELETED) | 128 views::MenuRunner::HAS_MNEMONICS | |
| 129 views::MenuRunner::CONTEXT_MENU) == |
| 130 views::MenuRunner::MENU_DELETED) { |
| 130 return; | 131 return; |
| 132 } |
| 131 } | 133 } |
| 132 | 134 |
| 133 // Overridden from ui::SimpleMenuModel::Delegate: | 135 // Overridden from ui::SimpleMenuModel::Delegate: |
| 134 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { | 136 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { |
| 135 return false; | 137 return false; |
| 136 } | 138 } |
| 137 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { | 139 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { |
| 138 return controller_->IsCommandEnabledForTab( | 140 return controller_->IsCommandEnabledForTab( |
| 139 static_cast<TabStripModel::ContextMenuCommand>(command_id), | 141 static_cast<TabStripModel::ContextMenuCommand>(command_id), |
| 140 tab_); | 142 tab_); |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 url, | 588 url, |
| 587 mime_type.empty() || | 589 mime_type.empty() || |
| 588 net::IsSupportedMimeType(mime_type) || | 590 net::IsSupportedMimeType(mime_type) || |
| 589 content::PluginService::GetInstance()->GetPluginInfo( | 591 content::PluginService::GetInstance()->GetPluginInfo( |
| 590 -1, // process ID | 592 -1, // process ID |
| 591 MSG_ROUTING_NONE, // routing ID | 593 MSG_ROUTING_NONE, // routing ID |
| 592 model_->profile()->GetResourceContext(), | 594 model_->profile()->GetResourceContext(), |
| 593 url, GURL(), mime_type, false, | 595 url, GURL(), mime_type, false, |
| 594 NULL, &plugin, NULL)); | 596 NULL, &plugin, NULL)); |
| 595 } | 597 } |
| OLD | NEW |