OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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_RENDERER_RENDER_VIEW_H_ | 5 #ifndef CHROME_RENDERER_RENDER_VIEW_H_ |
6 #define CHROME_RENDERER_RENDER_VIEW_H_ | 6 #define CHROME_RENDERER_RENDER_VIEW_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <queue> | 10 #include <queue> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/gfx/point.h" | 15 #include "base/gfx/point.h" |
16 #include "base/gfx/rect.h" | 16 #include "base/gfx/rect.h" |
17 #include "base/id_map.h" | 17 #include "base/id_map.h" |
18 #include "base/shared_memory.h" | 18 #include "base/shared_memory.h" |
19 #include "base/timer.h" | 19 #include "base/timer.h" |
20 #include "base/values.h" | 20 #include "base/values.h" |
21 #include "base/weak_ptr.h" | 21 #include "base/weak_ptr.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
| 23 #include "chrome/common/edit_command.h" |
23 #include "chrome/common/renderer_preferences.h" | 24 #include "chrome/common/renderer_preferences.h" |
24 #include "chrome/common/view_types.h" | 25 #include "chrome/common/view_types.h" |
25 #include "chrome/renderer/automation/dom_automation_controller.h" | 26 #include "chrome/renderer/automation/dom_automation_controller.h" |
26 #include "chrome/renderer/dom_ui_bindings.h" | 27 #include "chrome/renderer/dom_ui_bindings.h" |
27 #include "chrome/renderer/extensions/extension_process_bindings.h" | 28 #include "chrome/renderer/extensions/extension_process_bindings.h" |
28 #include "chrome/renderer/external_host_bindings.h" | 29 #include "chrome/renderer/external_host_bindings.h" |
29 #include "chrome/renderer/render_widget.h" | 30 #include "chrome/renderer/render_widget.h" |
30 #include "third_party/skia/include/core/SkBitmap.h" | 31 #include "third_party/skia/include/core/SkBitmap.h" |
31 #include "testing/gtest/include/gtest/gtest_prod.h" | 32 #include "testing/gtest/include/gtest/gtest_prod.h" |
32 #include "webkit/api/public/WebConsoleMessage.h" | 33 #include "webkit/api/public/WebConsoleMessage.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 int active_match_ordinal, | 321 int active_match_ordinal, |
321 const WebKit::WebRect& selection); | 322 const WebKit::WebRect& selection); |
322 virtual bool WasOpenedByUserGesture() const; | 323 virtual bool WasOpenedByUserGesture() const; |
323 virtual void FocusAccessibilityObject(WebCore::AccessibilityObject* acc_obj); | 324 virtual void FocusAccessibilityObject(WebCore::AccessibilityObject* acc_obj); |
324 virtual void SpellCheck(const std::wstring& word, int* misspell_location, | 325 virtual void SpellCheck(const std::wstring& word, int* misspell_location, |
325 int* misspell_length); | 326 int* misspell_length); |
326 virtual std::wstring GetAutoCorrectWord(const std::wstring& word); | 327 virtual std::wstring GetAutoCorrectWord(const std::wstring& word); |
327 virtual void ScriptedPrint(WebKit::WebFrame* frame); | 328 virtual void ScriptedPrint(WebKit::WebFrame* frame); |
328 virtual void UserMetricsRecordAction(const std::wstring& action); | 329 virtual void UserMetricsRecordAction(const std::wstring& action); |
329 virtual void DnsPrefetch(const std::vector<std::string>& host_names); | 330 virtual void DnsPrefetch(const std::vector<std::string>& host_names); |
| 331 virtual bool HandleCurrentKeyboardEvent(); |
330 | 332 |
331 // WebKit::WebWidgetClient | 333 // WebKit::WebWidgetClient |
332 // Most methods are handled by RenderWidget. | 334 // Most methods are handled by RenderWidget. |
333 virtual void show(WebKit::WebNavigationPolicy policy); | 335 virtual void show(WebKit::WebNavigationPolicy policy); |
334 virtual void closeWidgetSoon(); | 336 virtual void closeWidgetSoon(); |
335 virtual void runModal(); | 337 virtual void runModal(); |
336 | 338 |
337 // WebKit::WebEditingClient | 339 // WebKit::WebEditingClient |
338 virtual bool shouldBeginEditing(const WebKit::WebRange& range); | 340 virtual bool shouldBeginEditing(const WebKit::WebRange& range); |
339 virtual bool shouldEndEditing(const WebKit::WebRange& range); | 341 virtual bool shouldEndEditing(const WebKit::WebRange& range); |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 const WebPreferences& webkit_preferences() const { | 425 const WebPreferences& webkit_preferences() const { |
424 return webkit_preferences_; | 426 return webkit_preferences_; |
425 } | 427 } |
426 | 428 |
427 protected: | 429 protected: |
428 // RenderWidget override. | 430 // RenderWidget override. |
429 virtual void OnResize(const gfx::Size& new_size, | 431 virtual void OnResize(const gfx::Size& new_size, |
430 const gfx::Rect& resizer_rect); | 432 const gfx::Rect& resizer_rect); |
431 // RenderWidget override | 433 // RenderWidget override |
432 virtual void DidPaint(); | 434 virtual void DidPaint(); |
| 435 // RenderWidget override. |
| 436 virtual void DidHandleKeyEvent(); |
433 | 437 |
434 private: | 438 private: |
435 // For unit tests. | 439 // For unit tests. |
436 friend class RenderViewTest; | 440 friend class RenderViewTest; |
437 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText); | 441 FRIEND_TEST(RenderViewTest, OnLoadAlternateHTMLText); |
438 FRIEND_TEST(RenderViewTest, OnNavStateChanged); | 442 FRIEND_TEST(RenderViewTest, OnNavStateChanged); |
439 FRIEND_TEST(RenderViewTest, OnImeStateChanged); | 443 FRIEND_TEST(RenderViewTest, OnImeStateChanged); |
440 FRIEND_TEST(RenderViewTest, ImeComposition); | 444 FRIEND_TEST(RenderViewTest, ImeComposition); |
441 FRIEND_TEST(RenderViewTest, OnSetTextDirection); | 445 FRIEND_TEST(RenderViewTest, OnSetTextDirection); |
442 FRIEND_TEST(RenderViewTest, OnPrintPages); | 446 FRIEND_TEST(RenderViewTest, OnPrintPages); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 void OnRedo(); | 531 void OnRedo(); |
528 void OnCut(); | 532 void OnCut(); |
529 void OnCopy(); | 533 void OnCopy(); |
530 void OnPaste(); | 534 void OnPaste(); |
531 void OnReplace(const std::wstring& text); | 535 void OnReplace(const std::wstring& text); |
532 void OnToggleSpellCheck(); | 536 void OnToggleSpellCheck(); |
533 void OnDelete(); | 537 void OnDelete(); |
534 void OnSelectAll(); | 538 void OnSelectAll(); |
535 void OnCopyImageAt(int x, int y); | 539 void OnCopyImageAt(int x, int y); |
536 void OnExecuteEditCommand(const std::string& name, const std::string& value); | 540 void OnExecuteEditCommand(const std::string& name, const std::string& value); |
| 541 void OnSetEditCommandsForNextKeyEvent(const EditCommands& edit_commands); |
537 void OnSetupDevToolsClient(); | 542 void OnSetupDevToolsClient(); |
538 void OnCancelDownload(int32 download_id); | 543 void OnCancelDownload(int32 download_id); |
539 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&); | 544 void OnFind(int request_id, const string16&, const WebKit::WebFindOptions&); |
540 void OnDeterminePageText(); | 545 void OnDeterminePageText(); |
541 void OnZoom(int function); | 546 void OnZoom(int function); |
542 void OnSetPageEncoding(const std::string& encoding_name); | 547 void OnSetPageEncoding(const std::string& encoding_name); |
543 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url); | 548 void OnGetAllSavableResourceLinksForCurrentPage(const GURL& page_url); |
544 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( | 549 void OnGetSerializedHtmlDataForCurrentPageWithLocalLinks( |
545 const std::vector<GURL>& links, | 550 const std::vector<GURL>& links, |
546 const std::vector<FilePath>& local_paths, | 551 const std::vector<FilePath>& local_paths, |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 | 895 |
891 // Id number of browser window which RenderView is attached to. | 896 // Id number of browser window which RenderView is attached to. |
892 int browser_window_id_; | 897 int browser_window_id_; |
893 | 898 |
894 // page id for the last navigation sent to the browser. | 899 // page id for the last navigation sent to the browser. |
895 int32 last_top_level_navigation_page_id_; | 900 int32 last_top_level_navigation_page_id_; |
896 | 901 |
897 // The settings this render view initialized WebKit with. | 902 // The settings this render view initialized WebKit with. |
898 WebPreferences webkit_preferences_; | 903 WebPreferences webkit_preferences_; |
899 | 904 |
| 905 // Stores edit commands associated to the next key event. |
| 906 // Shall be cleared as soon as the next key event is processed. |
| 907 EditCommands edit_commands_; |
| 908 |
900 DISALLOW_COPY_AND_ASSIGN(RenderView); | 909 DISALLOW_COPY_AND_ASSIGN(RenderView); |
901 }; | 910 }; |
902 | 911 |
903 #endif // CHROME_RENDERER_RENDER_VIEW_H_ | 912 #endif // CHROME_RENDERER_RENDER_VIEW_H_ |
OLD | NEW |