OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_TAB_CONTENTS_SPELLING_MENU_OBSERVER_H_ | 5 #ifndef CHROME_BROWSER_TAB_CONTENTS_SPELLING_MENU_OBSERVER_H_ |
6 #define CHROME_BROWSER_TAB_CONTENTS_SPELLING_MENU_OBSERVER_H_ | 6 #define CHROME_BROWSER_TAB_CONTENTS_SPELLING_MENU_OBSERVER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 #include "base/timer.h" | 14 #include "base/timer.h" |
15 #include "chrome/browser/tab_contents/render_view_context_menu_observer.h" | 15 #include "chrome/browser/tab_contents/render_view_context_menu_observer.h" |
16 | 16 |
17 class RenderViewContextMenuProxy; | 17 class RenderViewContextMenuProxy; |
18 struct SpellCheckResult; | 18 struct SpellCheckResult; |
19 class SpellingServiceClient; | 19 class SpellingServiceClient; |
20 | 20 |
21 // An observer that listens to events from the RenderViewContextMenu class and | 21 // An observer that listens to events from the RenderViewContextMenu class and |
22 // shows suggestions from the Spelling ("do you mean") service to a context menu | 22 // shows suggestions from the Spelling ("do you mean") service to a context menu |
23 // while we show it. This class implements two interfaces: | 23 // while we show it. This class implements two interfaces: |
24 // * RenderViewContextMenuObserver | 24 // * RenderViewContextMenuObserver |
25 // This interface is used for adding a menu item and update it while showing. | 25 // This interface is used for adding a menu item and update it while showing. |
26 // * content::URLFetcherDelegate | 26 // * net::URLFetcherDelegate |
27 // This interface is used for sending a JSON_RPC request to the Spelling | 27 // This interface is used for sending a JSON_RPC request to the Spelling |
28 // service and retrieving its response. | 28 // service and retrieving its response. |
29 // These interfaces allow this class to make a JSON-RPC call to the Spelling | 29 // These interfaces allow this class to make a JSON-RPC call to the Spelling |
30 // service in the background and update the context menu while showing. The | 30 // service in the background and update the context menu while showing. The |
31 // following snippet describes how to add this class to the observer list of the | 31 // following snippet describes how to add this class to the observer list of the |
32 // RenderViewContextMenu class. | 32 // RenderViewContextMenu class. |
33 // | 33 // |
34 // void RenderViewContextMenu::InitMenu() { | 34 // void RenderViewContextMenu::InitMenu() { |
35 // spelling_menu_observer_.reset(new SpellingMenuObserver(this)); | 35 // spelling_menu_observer_.reset(new SpellingMenuObserver(this)); |
36 // if (spelling_menu_observer_.get()) | 36 // if (spelling_menu_observer_.get()) |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 // Flag indicating whether online spelling correction service is enabled. When | 103 // Flag indicating whether online spelling correction service is enabled. When |
104 // this variable is true and we right-click a misspelled word, we send a | 104 // this variable is true and we right-click a misspelled word, we send a |
105 // JSON-RPC request to the service and retrieve suggestions. | 105 // JSON-RPC request to the service and retrieve suggestions. |
106 bool integrate_spelling_service_; | 106 bool integrate_spelling_service_; |
107 | 107 |
108 DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserver); | 108 DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserver); |
109 }; | 109 }; |
110 | 110 |
111 #endif // CHROME_BROWSER_TAB_CONTENTS_SPELLING_MENU_OBSERVER_H_ | 111 #endif // CHROME_BROWSER_TAB_CONTENTS_SPELLING_MENU_OBSERVER_H_ |
OLD | NEW |