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

Side by Side Diff: chrome/browser/ui/views/tabs/browser_tab_strip_controller.cc

Issue 331993009: MacViews: Run native Cocoa context menus to support Services. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add VIEWS_EXPORT for unit test access Created 6 years, 5 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
OLDNEW
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/prefs/pref_service.h" 8 #include "base/prefs/pref_service.h"
9 #include "base/task_runner_util.h" 9 #include "base/task_runner_util.h"
10 #include "base/threading/sequenced_worker_pool.h" 10 #include "base/threading/sequenced_worker_pool.h"
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 : public ui::SimpleMenuModel::Delegate { 89 : public ui::SimpleMenuModel::Delegate {
90 public: 90 public:
91 TabContextMenuContents(Tab* tab, 91 TabContextMenuContents(Tab* tab,
92 BrowserTabStripController* controller) 92 BrowserTabStripController* controller)
93 : tab_(tab), 93 : tab_(tab),
94 controller_(controller), 94 controller_(controller),
95 last_command_(TabStripModel::CommandFirst) { 95 last_command_(TabStripModel::CommandFirst) {
96 model_.reset(new TabMenuModel( 96 model_.reset(new TabMenuModel(
97 this, controller->model_, 97 this, controller->model_,
98 controller->tabstrip_->GetModelIndexOfTab(tab))); 98 controller->tabstrip_->GetModelIndexOfTab(tab)));
99 menu_runner_.reset(new views::MenuRunner(model_.get())); 99 menu_runner_.reset(new views::MenuRunner(
100 model_.get(),
101 views::MenuRunner::HAS_MNEMONICS | views::MenuRunner::CONTEXT_MENU));
100 } 102 }
101 103
102 virtual ~TabContextMenuContents() { 104 virtual ~TabContextMenuContents() {
103 if (controller_) 105 if (controller_)
104 controller_->tabstrip_->StopAllHighlighting(); 106 controller_->tabstrip_->StopAllHighlighting();
105 } 107 }
106 108
107 void Cancel() { 109 void Cancel() {
108 controller_ = NULL; 110 controller_ = NULL;
109 } 111 }
110 112
111 void RunMenuAt(const gfx::Point& point, ui::MenuSourceType source_type) { 113 void RunMenuAt(const gfx::Point& point, ui::MenuSourceType source_type) {
112 if (menu_runner_->RunMenuAt(tab_->GetWidget(), 114 if (menu_runner_->RunMenuAt(tab_->GetWidget(),
113 NULL, 115 NULL,
114 gfx::Rect(point, gfx::Size()), 116 gfx::Rect(point, gfx::Size()),
115 views::MENU_ANCHOR_TOPLEFT, 117 views::MENU_ANCHOR_TOPLEFT,
116 source_type, 118 source_type) ==
117 views::MenuRunner::HAS_MNEMONICS |
118 views::MenuRunner::CONTEXT_MENU) ==
119 views::MenuRunner::MENU_DELETED) { 119 views::MenuRunner::MENU_DELETED) {
120 return; 120 return;
121 } 121 }
122 } 122 }
123 123
124 // Overridden from ui::SimpleMenuModel::Delegate: 124 // Overridden from ui::SimpleMenuModel::Delegate:
125 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE { 125 virtual bool IsCommandIdChecked(int command_id) const OVERRIDE {
126 return false; 126 return false;
127 } 127 }
128 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE { 128 virtual bool IsCommandIdEnabled(int command_id) const OVERRIDE {
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 url, 579 url,
580 mime_type.empty() || 580 mime_type.empty() ||
581 net::IsSupportedMimeType(mime_type) || 581 net::IsSupportedMimeType(mime_type) ||
582 content::PluginService::GetInstance()->GetPluginInfo( 582 content::PluginService::GetInstance()->GetPluginInfo(
583 -1, // process ID 583 -1, // process ID
584 MSG_ROUTING_NONE, // routing ID 584 MSG_ROUTING_NONE, // routing ID
585 model_->profile()->GetResourceContext(), 585 model_->profile()->GetResourceContext(),
586 url, GURL(), mime_type, false, 586 url, GURL(), mime_type, false,
587 NULL, &plugin, NULL)); 587 NULL, &plugin, NULL));
588 } 588 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698