| 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 #include "chrome/browser/tab_contents/spelling_menu_observer.h" | 5 #include "chrome/browser/tab_contents/spelling_menu_observer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 #if defined(GOOGLE_CHROME_BUILD) | 27 #if defined(GOOGLE_CHROME_BUILD) |
| 28 #include "chrome/browser/spellchecker/internal/spellcheck_internal.h" | 28 #include "chrome/browser/spellchecker/internal/spellcheck_internal.h" |
| 29 #else | 29 #else |
| 30 // Use a dummy URL and a key on Chromium to avoid build breaks until the | 30 // Use a dummy URL and a key on Chromium to avoid build breaks until the |
| 31 // Spelling API is released. These dummy parameters just cause a timeout and | 31 // Spelling API is released. These dummy parameters just cause a timeout and |
| 32 // show 'no suggestions found'. | 32 // show 'no suggestions found'. |
| 33 #define SPELLING_SERVICE_KEY | 33 #define SPELLING_SERVICE_KEY |
| 34 #define SPELLING_SERVICE_URL "http://127.0.0.1/rpc" | 34 #define SPELLING_SERVICE_URL "http://127.0.0.1/rpc" |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 using content::BrowserThread; |
| 38 |
| 37 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) | 39 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) |
| 38 : proxy_(proxy), | 40 : proxy_(proxy), |
| 39 loading_frame_(0), | 41 loading_frame_(0), |
| 40 succeeded_(false) { | 42 succeeded_(false) { |
| 41 } | 43 } |
| 42 | 44 |
| 43 SpellingMenuObserver::~SpellingMenuObserver() { | 45 SpellingMenuObserver::~SpellingMenuObserver() { |
| 44 } | 46 } |
| 45 | 47 |
| 46 void SpellingMenuObserver::InitMenu(const ContextMenuParams& params) { | 48 void SpellingMenuObserver::InitMenu(const ContextMenuParams& params) { |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 loading_frame_ = (loading_frame_ + 1) & 3; | 268 loading_frame_ = (loading_frame_ + 1) & 3; |
| 267 string16 loading_message = loading_message_; | 269 string16 loading_message = loading_message_; |
| 268 for (int i = 0; i < loading_frame_; ++i) | 270 for (int i = 0; i < loading_frame_; ++i) |
| 269 loading_message.push_back('.'); | 271 loading_message.push_back('.'); |
| 270 | 272 |
| 271 // Update the menu item with the text. We disable this item to prevent users | 273 // Update the menu item with the text. We disable this item to prevent users |
| 272 // from selecting it. | 274 // from selecting it. |
| 273 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 275 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
| 274 loading_message); | 276 loading_message); |
| 275 } | 277 } |
| OLD | NEW |