OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 9 #include <string> |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 explicit SpellingMenuObserver(RenderViewContextMenuProxy* proxy); | 46 explicit SpellingMenuObserver(RenderViewContextMenuProxy* proxy); |
47 virtual ~SpellingMenuObserver(); | 47 virtual ~SpellingMenuObserver(); |
48 | 48 |
49 // RenderViewContextMenuObserver implementation. | 49 // RenderViewContextMenuObserver implementation. |
50 virtual void InitMenu(const ContextMenuParams& params) OVERRIDE; | 50 virtual void InitMenu(const ContextMenuParams& params) OVERRIDE; |
51 virtual bool IsCommandIdSupported(int command_id) OVERRIDE; | 51 virtual bool IsCommandIdSupported(int command_id) OVERRIDE; |
52 virtual bool IsCommandIdEnabled(int command_id) OVERRIDE; | 52 virtual bool IsCommandIdEnabled(int command_id) OVERRIDE; |
53 virtual void ExecuteCommand(int command_id) OVERRIDE; | 53 virtual void ExecuteCommand(int command_id) OVERRIDE; |
54 | 54 |
55 // content::URLFetcherDelegate implementation. | 55 // content::URLFetcherDelegate implementation. |
56 virtual void OnURLFetchComplete(const URLFetcher* source) OVERRIDE; | 56 virtual void OnURLFetchComplete(const content::URLFetcher* source) OVERRIDE; |
57 | 57 |
58 private: | 58 private: |
59 // Invokes a JSON-RPC call in the background. This function sends a JSON-RPC | 59 // Invokes a JSON-RPC call in the background. This function sends a JSON-RPC |
60 // request to the Spelling service. Chrome will call OnURLFetchComplete() when | 60 // request to the Spelling service. Chrome will call OnURLFetchComplete() when |
61 // it receives a response from the service. | 61 // it receives a response from the service. |
62 bool Invoke(const string16& text, | 62 bool Invoke(const string16& text, |
63 const std::string& locale, | 63 const std::string& locale, |
64 net::URLRequestContextGetter* context); | 64 net::URLRequestContextGetter* context); |
65 | 65 |
66 // Parses the specified response from the Spelling service. | 66 // Parses the specified response from the Spelling service. |
(...skipping 20 matching lines...) Expand all Loading... |
87 | 87 |
88 // The string representing the result of this call. This string is a | 88 // The string representing the result of this call. This string is a |
89 // suggestion when this call finished successfully. Otherwise it is error | 89 // suggestion when this call finished successfully. Otherwise it is error |
90 // text. Until we receive a response from the Spelling service, this string | 90 // text. Until we receive a response from the Spelling service, this string |
91 // stores the input string. (Since the Spelling service sends only misspelled | 91 // stores the input string. (Since the Spelling service sends only misspelled |
92 // words, we replace these misspelled words in the input text with the | 92 // words, we replace these misspelled words in the input text with the |
93 // suggested words to create suggestion text. | 93 // suggested words to create suggestion text. |
94 string16 result_; | 94 string16 result_; |
95 | 95 |
96 // The URLFetcher object used for sending a JSON-RPC request. | 96 // The URLFetcher object used for sending a JSON-RPC request. |
97 scoped_ptr<URLFetcher> fetcher_; | 97 scoped_ptr<content::URLFetcher> fetcher_; |
98 | 98 |
99 // A timer used for loading animation. | 99 // A timer used for loading animation. |
100 base::RepeatingTimer<SpellingMenuObserver> animation_timer_; | 100 base::RepeatingTimer<SpellingMenuObserver> animation_timer_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserver); | 102 DISALLOW_COPY_AND_ASSIGN(SpellingMenuObserver); |
103 }; | 103 }; |
104 | 104 |
105 #endif // CHROME_BROWSER_TAB_CONTENTS_SPELLING_MENU_OBSERVER_H_ | 105 #endif // CHROME_BROWSER_TAB_CONTENTS_SPELLING_MENU_OBSERVER_H_ |
OLD | NEW |