Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Side by Side Diff: chrome/browser/tab_contents/spelling_menu_observer.cc

Issue 9382037: Move ContextMenuParams struct from webkit/glue to content/public/common. The reasons are: (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix mac Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/app/chrome_command_ids.h" 9 #include "chrome/app/chrome_command_ids.h"
10 #include "chrome/browser/prefs/pref_service.h" 10 #include "chrome/browser/prefs/pref_service.h"
11 #include "chrome/browser/profiles/profile.h" 11 #include "chrome/browser/profiles/profile.h"
12 #include "chrome/browser/spellchecker/spellcheck_factory.h" 12 #include "chrome/browser/spellchecker/spellcheck_factory.h"
13 #include "chrome/browser/spellchecker/spellcheck_host.h" 13 #include "chrome/browser/spellchecker/spellcheck_host.h"
14 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h" 14 #include "chrome/browser/spellchecker/spellcheck_host_metrics.h"
15 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" 15 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h"
16 #include "chrome/browser/spellchecker/spelling_service_client.h" 16 #include "chrome/browser/spellchecker/spelling_service_client.h"
17 #include "chrome/browser/tab_contents/render_view_context_menu.h" 17 #include "chrome/browser/tab_contents/render_view_context_menu.h"
18 #include "chrome/browser/tab_contents/spelling_bubble_model.h" 18 #include "chrome/browser/tab_contents/spelling_bubble_model.h"
19 #include "chrome/common/chrome_switches.h" 19 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/pref_names.h" 20 #include "chrome/common/pref_names.h"
21 #include "content/browser/renderer_host/render_view_host.h" 21 #include "content/browser/renderer_host/render_view_host.h"
22 #include "content/browser/renderer_host/render_widget_host_view.h" 22 #include "content/browser/renderer_host/render_widget_host_view.h"
23 #include "content/public/common/context_menu_params.h"
23 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult .h" 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebTextCheckingResult .h"
25 #include "ui/base/l10n/l10n_util.h" 26 #include "ui/base/l10n/l10n_util.h"
26 #include "webkit/glue/context_menu.h"
27 27
28 using content::BrowserThread; 28 using content::BrowserThread;
29 29
30 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy) 30 SpellingMenuObserver::SpellingMenuObserver(RenderViewContextMenuProxy* proxy)
31 : proxy_(proxy), 31 : proxy_(proxy),
32 loading_frame_(0), 32 loading_frame_(0),
33 succeeded_(false), 33 succeeded_(false),
34 integrate_spelling_service_(false) { 34 integrate_spelling_service_(false) {
35 } 35 }
36 36
37 SpellingMenuObserver::~SpellingMenuObserver() { 37 SpellingMenuObserver::~SpellingMenuObserver() {
38 } 38 }
39 39
40 void SpellingMenuObserver::InitMenu(const ContextMenuParams& params) { 40 void SpellingMenuObserver::InitMenu(const content::ContextMenuParams& params) {
41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 41 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
42 42
43 // Exit if we are not in an editable element because we add a menu item only 43 // Exit if we are not in an editable element because we add a menu item only
44 // for editable elements. 44 // for editable elements.
45 Profile* profile = proxy_->GetProfile(); 45 Profile* profile = proxy_->GetProfile();
46 if (!params.is_editable || !profile) 46 if (!params.is_editable || !profile)
47 return; 47 return;
48 48
49 // Append Dictionary spell check suggestions. 49 // Append Dictionary spell check suggestions.
50 suggestions_ = params.dictionary_suggestions; 50 suggestions_ = params.dictionary_suggestions;
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 loading_frame_ = (loading_frame_ + 1) & 3; 280 loading_frame_ = (loading_frame_ + 1) & 3;
281 string16 loading_message = loading_message_; 281 string16 loading_message = loading_message_;
282 for (int i = 0; i < loading_frame_; ++i) 282 for (int i = 0; i < loading_frame_; ++i)
283 loading_message.push_back('.'); 283 loading_message.push_back('.');
284 284
285 // Update the menu item with the text. We disable this item to prevent users 285 // Update the menu item with the text. We disable this item to prevent users
286 // from selecting it. 286 // from selecting it.
287 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false, 287 proxy_->UpdateMenuItem(IDC_CONTENT_CONTEXT_SPELLING_SUGGESTION, false, false,
288 loading_message); 288 loading_message);
289 } 289 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698