OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_context_menu/spelling_menu_observer.h" | 5 #include "chrome/browser/renderer_context_menu/spelling_menu_observer.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/i18n/case_conversion.h" | 9 #include "base/i18n/case_conversion.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" | 14 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
15 #include "chrome/browser/renderer_context_menu/spelling_bubble_model.h" | 15 #include "chrome/browser/renderer_context_menu/spelling_bubble_model.h" |
16 #include "chrome/browser/spellchecker/spellcheck_factory.h" | 16 #include "chrome/browser/spellchecker/spellcheck_factory.h" |
17 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" | 17 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" |
18 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" | 18 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" |
19 #include "chrome/browser/spellchecker/spellcheck_service.h" | 19 #include "chrome/browser/spellchecker/spellcheck_service.h" |
20 #include "chrome/browser/spellchecker/spelling_service_client.h" | 20 #include "chrome/browser/spellchecker/spelling_service_client.h" |
21 #include "chrome/browser/ui/confirm_bubble.h" | 21 #include "chrome/browser/ui/confirm_bubble.h" |
22 #include "chrome/common/chrome_switches.h" | 22 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/spellcheck_result.h" | 24 #include "chrome/common/spellcheck_result.h" |
| 25 #include "chrome/grit/generated_resources.h" |
25 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
26 #include "content/public/browser/render_widget_host_view.h" | 27 #include "content/public/browser/render_widget_host_view.h" |
27 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
28 #include "content/public/common/context_menu_params.h" | 29 #include "content/public/common/context_menu_params.h" |
29 #include "extensions/browser/view_type_utils.h" | 30 #include "extensions/browser/view_type_utils.h" |
30 #include "grit/generated_resources.h" | |
31 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
32 #include "ui/gfx/rect.h" | 32 #include "ui/gfx/rect.h" |
33 | 33 |
34 using content::BrowserThread; | 34 using content::BrowserThread; |
35 | 35 |
36 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) | 36 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) |
37 : proxy_(proxy), | 37 : proxy_(proxy), |
38 loading_frame_(0), | 38 loading_frame_(0), |
39 succeeded_(false), | 39 succeeded_(false), |
40 misspelling_hash_(0), | 40 misspelling_hash_(0), |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 // Append '.' characters to the end of "Checking". | 399 // Append '.' characters to the end of "Checking". |
400 loading_frame_ = (loading_frame_ + 1) & 3; | 400 loading_frame_ = (loading_frame_ + 1) & 3; |
401 base::string16 loading_message = | 401 base::string16 loading_message = |
402 loading_message_ + base::string16(loading_frame_,'.'); | 402 loading_message_ + base::string16(loading_frame_,'.'); |
403 | 403 |
404 // Update the menu item with the text. We disable this item to prevent users | 404 // Update the menu item with the text. We disable this item to prevent users |
405 // from selecting it. | 405 // from selecting it. |
406 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 406 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
407 loading_message); | 407 loading_message); |
408 } | 408 } |
OLD | NEW |