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

Side by Side Diff: content/shell/browser/shell_views.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/shell/browser/shell.h" 5 #include "content/shell/browser/shell.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "content/public/browser/context_factory.h" 9 #include "content/public/browser/context_factory.h"
10 #include "content/public/browser/render_widget_host_view.h" 10 #include "content/public/browser/render_widget_host_view.h"
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 shell_->web_contents()->GetNativeView(); 177 shell_->web_contents()->GetNativeView();
178 aura::Window* root_window = web_contents_window->GetRootWindow(); 178 aura::Window* root_window = web_contents_window->GetRootWindow();
179 aura::client::ScreenPositionClient* screen_position_client = 179 aura::client::ScreenPositionClient* screen_position_client =
180 aura::client::GetScreenPositionClient(root_window); 180 aura::client::GetScreenPositionClient(root_window);
181 if (screen_position_client) { 181 if (screen_position_client) {
182 screen_position_client->ConvertPointToScreen(web_contents_window, 182 screen_position_client->ConvertPointToScreen(web_contents_window,
183 &screen_point); 183 &screen_point);
184 } 184 }
185 185
186 context_menu_model_.reset(new ContextMenuModel(shell_, params)); 186 context_menu_model_.reset(new ContextMenuModel(shell_, params));
187 context_menu_runner_.reset( 187 context_menu_runner_.reset(new views::MenuRunner(
188 new views::MenuRunner(context_menu_model_.get())); 188 context_menu_model_.get(), views::MenuRunner::CONTEXT_MENU));
189 189
190 if (context_menu_runner_->RunMenuAt(web_view_->GetWidget(), 190 if (context_menu_runner_->RunMenuAt(web_view_->GetWidget(),
191 NULL, 191 NULL,
192 gfx::Rect(screen_point, gfx::Size()), 192 gfx::Rect(screen_point, gfx::Size()),
193 views::MENU_ANCHOR_TOPRIGHT, 193 views::MENU_ANCHOR_TOPRIGHT,
194 ui::MENU_SOURCE_NONE, 194 ui::MENU_SOURCE_NONE) ==
195 views::MenuRunner::CONTEXT_MENU) ==
196 views::MenuRunner::MENU_DELETED) { 195 views::MenuRunner::MENU_DELETED) {
197 return; 196 return;
198 } 197 }
199 } 198 }
200 199
201 void OnWebContentsFocused(content::WebContents* web_contents) { 200 void OnWebContentsFocused(content::WebContents* web_contents) {
202 if (web_view_->GetWebContents() == web_contents) 201 if (web_view_->GetWebContents() == web_contents)
203 web_view_->OnWebContentsFocused(web_contents); 202 web_view_->OnWebContentsFocused(web_contents);
204 } 203 }
205 204
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 566
568 void Shell::PlatformWebContentsFocused(WebContents* contents) { 567 void Shell::PlatformWebContentsFocused(WebContents* contents) {
569 if (headless_) 568 if (headless_)
570 return; 569 return;
571 ShellWindowDelegateView* delegate_view = 570 ShellWindowDelegateView* delegate_view =
572 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); 571 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate());
573 delegate_view->OnWebContentsFocused(contents); 572 delegate_view->OnWebContentsFocused(contents);
574 } 573 }
575 574
576 } // namespace content 575 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698