| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #import <Cocoa/Cocoa.h> | 9 #import <Cocoa/Cocoa.h> |
| 10 #import <QuartzCore/CALayer.h> | 10 #import <QuartzCore/CALayer.h> |
| 11 | 11 |
| 12 #include "base/scoped_nsobject.h" | 12 #include "base/scoped_nsobject.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 #include "base/task.h" | 14 #include "base/task.h" |
| 15 #include "base/time.h" | 15 #include "base/time.h" |
| 16 #include "chrome/browser/accessibility/browser_accessibility_delegate_mac.h" | 16 #include "chrome/browser/accessibility/browser_accessibility_delegate_mac.h" |
| 17 #include "chrome/browser/accessibility/browser_accessibility_manager.h" | 17 #include "chrome/browser/accessibility/browser_accessibility_manager.h" |
| 18 #include "chrome/browser/cocoa/base_view.h" | 18 #include "chrome/browser/cocoa/base_view.h" |
| 19 #include "chrome/browser/renderer_host/accelerated_surface_container_manager_mac
.h" | 19 #include "chrome/browser/renderer_host/accelerated_surface_container_manager_mac
.h" |
| 20 #include "chrome/browser/renderer_host/render_widget_host_view.h" | 20 #include "chrome/browser/renderer_host/render_widget_host_view.h" |
| 21 #include "chrome/common/edit_command.h" | 21 #include "chrome/common/edit_command.h" |
| 22 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" | 22 #include "third_party/WebKit/WebKit/chromium/public/WebCompositionUnderline.h" |
| 23 #include "webkit/glue/webcursor.h" | 23 #include "webkit/glue/webcursor.h" |
| 24 #include "webkit/glue/webmenuitem.h" | |
| 25 | 24 |
| 26 @class AcceleratedPluginView; | 25 @class AcceleratedPluginView; |
| 27 class RenderWidgetHostViewMac; | 26 class RenderWidgetHostViewMac; |
| 28 class RWHVMEditCommandHelper; | 27 class RWHVMEditCommandHelper; |
| 29 @class ToolTip; | 28 @class ToolTip; |
| 30 | 29 |
| 31 @protocol RenderWidgetHostViewMacOwner | 30 @protocol RenderWidgetHostViewMacOwner |
| 32 - (RenderWidgetHostViewMac*)renderWidgetHostViewMac; | 31 - (RenderWidgetHostViewMac*)renderWidgetHostViewMac; |
| 33 @end | 32 @end |
| 34 | 33 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, | 201 const gfx::Rect& scroll_rect, int scroll_dx, int scroll_dy, |
| 203 const std::vector<gfx::Rect>& copy_rects); | 202 const std::vector<gfx::Rect>& copy_rects); |
| 204 virtual void RenderViewGone(); | 203 virtual void RenderViewGone(); |
| 205 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; | 204 virtual void WillDestroyRenderWidget(RenderWidgetHost* rwh) {}; |
| 206 virtual void Destroy(); | 205 virtual void Destroy(); |
| 207 virtual void SetTooltipText(const std::wstring& tooltip_text); | 206 virtual void SetTooltipText(const std::wstring& tooltip_text); |
| 208 virtual void SelectionChanged(const std::string& text); | 207 virtual void SelectionChanged(const std::string& text); |
| 209 virtual BackingStore* AllocBackingStore(const gfx::Size& size); | 208 virtual BackingStore* AllocBackingStore(const gfx::Size& size); |
| 210 virtual VideoLayer* AllocVideoLayer(const gfx::Size& size); | 209 virtual VideoLayer* AllocVideoLayer(const gfx::Size& size); |
| 211 virtual void SetTakesFocusOnlyOnMouseDown(bool flag); | 210 virtual void SetTakesFocusOnlyOnMouseDown(bool flag); |
| 212 virtual void ShowPopupWithItems(gfx::Rect bounds, | |
| 213 int item_height, | |
| 214 double item_font_size, | |
| 215 int selected_item, | |
| 216 const std::vector<WebMenuItem>& items, | |
| 217 bool right_aligned); | |
| 218 virtual gfx::Rect GetWindowRect(); | 211 virtual gfx::Rect GetWindowRect(); |
| 219 virtual gfx::Rect GetRootWindowRect(); | 212 virtual gfx::Rect GetRootWindowRect(); |
| 220 virtual void SetActive(bool active); | 213 virtual void SetActive(bool active); |
| 221 virtual void SetWindowVisibility(bool visible); | 214 virtual void SetWindowVisibility(bool visible); |
| 222 virtual void WindowFrameChanged(); | 215 virtual void WindowFrameChanged(); |
| 223 virtual void SetBackground(const SkBitmap& background); | 216 virtual void SetBackground(const SkBitmap& background); |
| 224 virtual bool ContainsNativeView(gfx::NativeView native_view) const; | 217 virtual bool ContainsNativeView(gfx::NativeView native_view) const; |
| 225 | 218 |
| 226 virtual void OnAccessibilityNotifications( | 219 virtual void OnAccessibilityNotifications( |
| 227 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); | 220 const std::vector<ViewHostMsg_AccessibilityNotification_Params>& params); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 258 gfx::PluginWindowHandle plugin_handle, | 251 gfx::PluginWindowHandle plugin_handle, |
| 259 NSSize size); | 252 NSSize size); |
| 260 // Forces the textures associated with any accelerated plugin instances | 253 // Forces the textures associated with any accelerated plugin instances |
| 261 // to be reloaded. | 254 // to be reloaded. |
| 262 void ForceTextureReload(); | 255 void ForceTextureReload(); |
| 263 | 256 |
| 264 virtual void SetVisuallyDeemphasized(bool deemphasized); | 257 virtual void SetVisuallyDeemphasized(bool deemphasized); |
| 265 | 258 |
| 266 void KillSelf(); | 259 void KillSelf(); |
| 267 | 260 |
| 268 void set_parent_view(NSView* parent_view) { parent_view_ = parent_view; } | |
| 269 | |
| 270 void SetTextInputActive(bool active); | 261 void SetTextInputActive(bool active); |
| 271 | 262 |
| 272 // Sends confirmed plugin IME text back to the renderer. | 263 // Sends confirmed plugin IME text back to the renderer. |
| 273 void PluginImeCompositionConfirmed(const string16& text, int plugin_id); | 264 void PluginImeCompositionConfirmed(const string16& text, int plugin_id); |
| 274 | 265 |
| 275 const std::string& selected_text() const { return selected_text_; } | 266 const std::string& selected_text() const { return selected_text_; } |
| 276 | 267 |
| 277 // These member variables should be private, but the associated ObjC class | 268 // These member variables should be private, but the associated ObjC class |
| 278 // needs access to them and can't be made a friend. | 269 // needs access to them and can't be made a friend. |
| 279 | 270 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 void UpdateCursorIfOverSelf(); | 312 void UpdateCursorIfOverSelf(); |
| 322 | 313 |
| 323 // Shuts down the render_widget_host_. This is a separate function so we can | 314 // Shuts down the render_widget_host_. This is a separate function so we can |
| 324 // invoke it from the message loop. | 315 // invoke it from the message loop. |
| 325 void ShutdownHost(); | 316 void ShutdownHost(); |
| 326 | 317 |
| 327 // Used to determine whether or not to enable accessibility. | 318 // Used to determine whether or not to enable accessibility. |
| 328 bool IsVoiceOverRunning(); | 319 bool IsVoiceOverRunning(); |
| 329 | 320 |
| 330 // The associated view. This is weak and is inserted into the view hierarchy | 321 // The associated view. This is weak and is inserted into the view hierarchy |
| 331 // to own this RenderWidgetHostViewMac object unless is_popup_menu_ is true. | 322 // to own this RenderWidgetHostViewMac object. |
| 332 // In that case, cocoa_view_ is never inserted into the view hierarchy, so | |
| 333 // the RenderWidgetHostViewMac will treat it as a strong reference and will | |
| 334 // release it when told to destroy (for example, because a pop-up menu has | |
| 335 // closed). | |
| 336 RenderWidgetHostViewCocoa* cocoa_view_; | 323 RenderWidgetHostViewCocoa* cocoa_view_; |
| 337 | 324 |
| 338 // The cursor for the page. This is passed up from the renderer. | 325 // The cursor for the page. This is passed up from the renderer. |
| 339 WebCursor current_cursor_; | 326 WebCursor current_cursor_; |
| 340 | 327 |
| 341 // Indicates if the page is loading. | 328 // Indicates if the page is loading. |
| 342 bool is_loading_; | 329 bool is_loading_; |
| 343 | 330 |
| 344 // true if the View is not visible. | 331 // true if the View is not visible. |
| 345 bool is_hidden_; | 332 bool is_hidden_; |
| 346 | 333 |
| 347 // True if the widget is a native popup menu. The renderer code calls this | |
| 348 // an "external popup." | |
| 349 bool is_popup_menu_; | |
| 350 | |
| 351 // The text to be shown in the tooltip, supplied by the renderer. | 334 // The text to be shown in the tooltip, supplied by the renderer. |
| 352 std::wstring tooltip_text_; | 335 std::wstring tooltip_text_; |
| 353 | 336 |
| 354 // Factory used to safely scope delayed calls to ShutdownHost(). | 337 // Factory used to safely scope delayed calls to ShutdownHost(). |
| 355 ScopedRunnableMethodFactory<RenderWidgetHostViewMac> shutdown_factory_; | 338 ScopedRunnableMethodFactory<RenderWidgetHostViewMac> shutdown_factory_; |
| 356 | 339 |
| 357 // Used for positioning a popup menu. | |
| 358 NSView* parent_view_; | |
| 359 | |
| 360 // selected text on the renderer. | 340 // selected text on the renderer. |
| 361 std::string selected_text_; | 341 std::string selected_text_; |
| 362 | 342 |
| 363 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); | 343 DISALLOW_COPY_AND_ASSIGN(RenderWidgetHostViewMac); |
| 364 }; | 344 }; |
| 365 | 345 |
| 366 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ | 346 #endif // CHROME_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_MAC_H_ |
| OLD | NEW |