| 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" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 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 "chrome/grit/generated_resources.h" |
| 26 #include "content/public/browser/render_view_host.h" | 26 #include "content/public/browser/render_view_host.h" |
| 27 #include "content/public/browser/render_widget_host_view.h" | 27 #include "content/public/browser/render_widget_host_view.h" |
| 28 #include "content/public/browser/web_contents.h" | 28 #include "content/public/browser/web_contents.h" |
| 29 #include "content/public/common/context_menu_params.h" | 29 #include "content/public/common/context_menu_params.h" |
| 30 #include "extensions/browser/view_type_utils.h" | 30 #include "extensions/browser/view_type_utils.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/geometry/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), |
| 41 client_(new SpellingServiceClient) { | 41 client_(new SpellingServiceClient) { |
| 42 if (proxy_ && proxy_->GetBrowserContext()) { | 42 if (proxy_ && proxy_->GetBrowserContext()) { |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 // Append '.' characters to the end of "Checking". | 404 // Append '.' characters to the end of "Checking". |
| 405 loading_frame_ = (loading_frame_ + 1) & 3; | 405 loading_frame_ = (loading_frame_ + 1) & 3; |
| 406 base::string16 loading_message = | 406 base::string16 loading_message = |
| 407 loading_message_ + base::string16(loading_frame_,'.'); | 407 loading_message_ + base::string16(loading_frame_,'.'); |
| 408 | 408 |
| 409 // Update the menu item with the text. We disable this item to prevent users | 409 // Update the menu item with the text. We disable this item to prevent users |
| 410 // from selecting it. | 410 // from selecting it. |
| 411 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, | 411 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, |
| 412 loading_message); | 412 loading_message); |
| 413 } | 413 } |
| OLD | NEW |