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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "content/browser/renderer_host/render_view_host.h" | 24 #include "content/browser/renderer_host/render_view_host.h" |
25 #include "content/public/common/url_fetcher.h" | 25 #include "content/public/common/url_fetcher.h" |
26 #include "googleurl/src/gurl.h" | 26 #include "googleurl/src/gurl.h" |
27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
29 #include "unicode/uloc.h" | 29 #include "unicode/uloc.h" |
30 #include "webkit/glue/context_menu.h" | 30 #include "webkit/glue/context_menu.h" |
31 | 31 |
32 #if defined(GOOGLE_CHROME_BUILD) | 32 #if defined(GOOGLE_CHROME_BUILD) |
33 #include "chrome/browser/spellchecker/internal/spellcheck_internal.h" | 33 #include "chrome/browser/spellchecker/internal/spellcheck_internal.h" |
34 #else | 34 #endif |
35 // Use a dummy URL and a key on Chromium to avoid build breaks until the | 35 |
| 36 // Use the default key and URL on Chromium to avoid build breaks until the |
36 // Spelling API is released. These dummy parameters just cause a timeout and | 37 // Spelling API is released. These dummy parameters just cause a timeout and |
37 // show 'no suggestions found'. | 38 // show 'no suggestions from Google'. |
| 39 #ifndef SPELLING_SERVICE_KEY |
38 #define SPELLING_SERVICE_KEY | 40 #define SPELLING_SERVICE_KEY |
39 #define SPELLING_SERVICE_URL "http://127.0.0.1/rpc" | 41 #endif |
| 42 |
| 43 #ifndef SPELLING_SERVICE_URL |
| 44 #define SPELLING_SERVICE_URL "https://www.googleapis.com/rpc" |
40 #endif | 45 #endif |
41 | 46 |
42 using content::BrowserThread; | 47 using content::BrowserThread; |
43 | 48 |
44 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) | 49 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) |
45 : proxy_(proxy), | 50 : proxy_(proxy), |
46 loading_frame_(0), | 51 loading_frame_(0), |
47 succeeded_(false) { | 52 succeeded_(false) { |
48 } | 53 } |
49 | 54 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 loading_frame_ = (loading_frame_ + 1) & 3; | 406 loading_frame_ = (loading_frame_ + 1) & 3; |
402 string16 loading_message = loading_message_; | 407 string16 loading_message = loading_message_; |
403 for (int i = 0; i < loading_frame_; ++i) | 408 for (int i = 0; i < loading_frame_; ++i) |
404 loading_message.push_back('.'); | 409 loading_message.push_back('.'); |
405 | 410 |
406 // Update the menu item with the text. We disable this item to prevent users | 411 // Update the menu item with the text. We disable this item to prevent users |
407 // from selecting it. | 412 // from selecting it. |
408 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 413 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
409 loading_message); | 414 loading_message); |
410 } | 415 } |
OLD | NEW |