| OLD | NEW |
| 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/render_widget_host_view.h" | 9 #include "content/public/browser/render_widget_host_view.h" |
| 10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
| 11 #include "content/public/browser/web_contents_view.h" | 11 #include "content/public/browser/web_contents_view.h" |
| 12 #include "content/public/common/context_menu_params.h" | 12 #include "content/public/common/context_menu_params.h" |
| 13 #include "content/shell/browser/shell_platform_data_aura.h" | 13 #include "content/shell/browser/shell_platform_data_aura.h" |
| 14 #include "ui/aura/client/screen_position_client.h" | 14 #include "ui/aura/client/screen_position_client.h" |
| 15 #include "ui/aura/env.h" | 15 #include "ui/aura/env.h" |
| 16 #include "ui/aura/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
| 18 #include "ui/base/clipboard/clipboard.h" | 18 #include "ui/base/clipboard/clipboard.h" |
| 19 #include "ui/base/models/simple_menu_model.h" | 19 #include "ui/base/models/simple_menu_model.h" |
| 20 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
| 21 #include "ui/events/event.h" | 21 #include "ui/events/event.h" |
| 22 #include "ui/gfx/screen.h" | 22 #include "ui/gfx/screen.h" |
| 23 #include "ui/views/background.h" | 23 #include "ui/views/background.h" |
| 24 #include "ui/views/controls/button/label_button.h" | 24 #include "ui/views/controls/button/label_button.h" |
| 25 #include "ui/views/controls/button/menu_button.h" | 25 #include "ui/views/controls/button/menu_button.h" |
| 26 #include "ui/views/controls/button/menu_button_listener.h" | 26 #include "ui/views/controls/button/menu_button_listener.h" |
| 27 #include "ui/views/controls/menu/menu_item_view.h" | |
| 28 #include "ui/views/controls/menu/menu_runner.h" | 27 #include "ui/views/controls/menu/menu_runner.h" |
| 29 #include "ui/views/controls/textfield/textfield.h" | 28 #include "ui/views/controls/textfield/textfield.h" |
| 30 #include "ui/views/controls/textfield/textfield_controller.h" | 29 #include "ui/views/controls/textfield/textfield_controller.h" |
| 31 #include "ui/views/controls/webview/webview.h" | 30 #include "ui/views/controls/webview/webview.h" |
| 32 #include "ui/views/layout/fill_layout.h" | 31 #include "ui/views/layout/fill_layout.h" |
| 33 #include "ui/views/layout/grid_layout.h" | 32 #include "ui/views/layout/grid_layout.h" |
| 34 #include "ui/views/test/desktop_test_views_delegate.h" | 33 #include "ui/views/test/desktop_test_views_delegate.h" |
| 35 #include "ui/views/view.h" | 34 #include "ui/views/view.h" |
| 36 #include "ui/views/widget/widget.h" | 35 #include "ui/views/widget/widget.h" |
| 37 #include "ui/views/widget/widget_delegate.h" | 36 #include "ui/views/widget/widget_delegate.h" |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 if (screen_position_client) { | 181 if (screen_position_client) { |
| 183 screen_position_client->ConvertPointToScreen(web_contents_window, | 182 screen_position_client->ConvertPointToScreen(web_contents_window, |
| 184 &screen_point); | 183 &screen_point); |
| 185 } | 184 } |
| 186 | 185 |
| 187 context_menu_model_.reset(new ContextMenuModel(shell_, params)); | 186 context_menu_model_.reset(new ContextMenuModel(shell_, params)); |
| 188 context_menu_runner_.reset( | 187 context_menu_runner_.reset( |
| 189 new views::MenuRunner(context_menu_model_.get())); | 188 new views::MenuRunner(context_menu_model_.get())); |
| 190 | 189 |
| 191 if (context_menu_runner_->RunMenuAt(web_view_->GetWidget(), | 190 if (context_menu_runner_->RunMenuAt(web_view_->GetWidget(), |
| 192 NULL, gfx::Rect(screen_point, gfx::Size()), | 191 NULL, |
| 193 views::MenuItemView::TOPRIGHT, ui::MENU_SOURCE_NONE, | 192 gfx::Rect(screen_point, gfx::Size()), |
| 194 views::MenuRunner::CONTEXT_MENU) == | 193 ui::MENU_ANCHOR_TOPRIGHT, |
| 195 views::MenuRunner::MENU_DELETED) | 194 ui::MENU_SOURCE_NONE, |
| 195 views::MenuRunner::CONTEXT_MENU) == |
| 196 views::MenuRunner::MENU_DELETED) |
| 196 return; | 197 return; |
| 197 } | 198 } |
| 198 | 199 |
| 199 void OnWebContentsFocused(content::WebContents* web_contents) { | 200 void OnWebContentsFocused(content::WebContents* web_contents) { |
| 200 if (web_view_->GetWebContents() == web_contents) | 201 if (web_view_->GetWebContents() == web_contents) |
| 201 web_view_->OnWebContentsFocused(web_contents); | 202 web_view_->OnWebContentsFocused(web_contents); |
| 202 } | 203 } |
| 203 | 204 |
| 204 private: | 205 private: |
| 205 // Initialize the UI control contained in shell window | 206 // Initialize the UI control contained in shell window |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 | 562 |
| 562 void Shell::PlatformWebContentsFocused(WebContents* contents) { | 563 void Shell::PlatformWebContentsFocused(WebContents* contents) { |
| 563 if (headless_) | 564 if (headless_) |
| 564 return; | 565 return; |
| 565 ShellWindowDelegateView* delegate_view = | 566 ShellWindowDelegateView* delegate_view = |
| 566 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); | 567 static_cast<ShellWindowDelegateView*>(window_widget_->widget_delegate()); |
| 567 delegate_view->OnWebContentsFocused(contents); | 568 delegate_view->OnWebContentsFocused(contents); |
| 568 } | 569 } |
| 569 | 570 |
| 570 } // namespace content | 571 } // namespace content |
| OLD | NEW |