| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/views/domui_menu_widget.h" | 5 #include "chrome/browser/chromeos/views/domui_menu_widget.h" |
| 6 | 6 |
| 7 #include <algorithm> |
| 8 |
| 7 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 8 #include "base/singleton.h" | 10 #include "base/singleton.h" |
| 9 #include "base/task.h" | 11 #include "base/task.h" |
| 10 #include "chrome/browser/browser_thread.h" | |
| 11 #include "chrome/browser/chromeos/views/menu_locator.h" | 12 #include "chrome/browser/chromeos/views/menu_locator.h" |
| 12 #include "chrome/browser/chromeos/views/native_menu_domui.h" | 13 #include "chrome/browser/chromeos/views/native_menu_domui.h" |
| 13 #include "chrome/browser/chromeos/wm_ipc.h" | 14 #include "chrome/browser/chromeos/wm_ipc.h" |
| 14 #include "chrome/browser/renderer_host/render_view_host.h" | 15 #include "chrome/browser/renderer_host/render_view_host.h" |
| 15 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 16 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 16 #include "chrome/browser/tab_contents/tab_contents.h" | 17 #include "chrome/browser/tab_contents/tab_contents.h" |
| 17 #include "chrome/browser/views/dom_view.h" | 18 #include "chrome/browser/views/dom_view.h" |
| 18 #include "chrome/common/notification_service.h" | 19 #include "chrome/common/notification_service.h" |
| 19 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
| 20 #include "cros/chromeos_wm_ipc_enums.h" | 21 #include "cros/chromeos_wm_ipc_enums.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 if (menu_widget) { | 204 if (menu_widget) { |
| 204 // See EnableInput for the meaning of data. | 205 // See EnableInput for the meaning of data. |
| 205 bool select_item = data != NULL; | 206 bool select_item = data != NULL; |
| 206 menu_widget->EnableInput(select_item); | 207 menu_widget->EnableInput(select_item); |
| 207 } | 208 } |
| 208 return true; | 209 return true; |
| 209 } | 210 } |
| 210 | 211 |
| 211 void DOMUIMenuWidget::EnableScroll(bool enable) { | 212 void DOMUIMenuWidget::EnableScroll(bool enable) { |
| 212 ExecuteJavascript(StringPrintf( | 213 ExecuteJavascript(StringPrintf( |
| 213 L"enableScroll(%ls)", enable ? L"true" : L"false" )); | 214 L"enableScroll(%ls)", enable ? L"true" : L"false")); |
| 214 } | 215 } |
| 215 | 216 |
| 216 void DOMUIMenuWidget::EnableInput(bool select_item) { | 217 void DOMUIMenuWidget::EnableInput(bool select_item) { |
| 217 if (!dom_view_) | 218 if (!dom_view_) |
| 218 return; | 219 return; |
| 219 DCHECK(dom_view_->tab_contents()->render_view_host()); | 220 DCHECK(dom_view_->tab_contents()->render_view_host()); |
| 220 DCHECK(dom_view_->tab_contents()->render_view_host()->view()); | 221 DCHECK(dom_view_->tab_contents()->render_view_host()->view()); |
| 221 GtkWidget* target = | 222 GtkWidget* target = |
| 222 dom_view_->tab_contents()->render_view_host()->view()->GetNativeView(); | 223 dom_view_->tab_contents()->render_view_host()->view()->GetNativeView(); |
| 223 DCHECK(target); | 224 DCHECK(target); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 EnableInput(false /* no selection */); | 332 EnableInput(false /* no selection */); |
| 332 } | 333 } |
| 333 | 334 |
| 334 void DOMUIMenuWidget::ClearGrabWidget() { | 335 void DOMUIMenuWidget::ClearGrabWidget() { |
| 335 GtkWidget* grab_widget; | 336 GtkWidget* grab_widget; |
| 336 while ((grab_widget = gtk_grab_get_current())) | 337 while ((grab_widget = gtk_grab_get_current())) |
| 337 gtk_grab_remove(grab_widget); | 338 gtk_grab_remove(grab_widget); |
| 338 } | 339 } |
| 339 | 340 |
| 340 } // namespace chromeos | 341 } // namespace chromeos |
| OLD | NEW |