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/spellchecker_submenu_observer.h" | 5 #include "chrome/browser/tab_contents/spellchecker_submenu_observer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
10 #include "chrome/browser/spellchecker/spellchecker_platform_engine.h" | 10 #include "chrome/browser/spellchecker/spellcheck_platform_mac.h" |
11 #include "chrome/browser/tab_contents/render_view_context_menu.h" | 11 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
12 #include "chrome/browser/tab_contents/spelling_bubble_model.h" | 12 #include "chrome/browser/tab_contents/spelling_bubble_model.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "chrome/common/spellcheck_messages.h" | 15 #include "chrome/common/spellcheck_messages.h" |
16 #include "content/browser/renderer_host/render_view_host.h" | 16 #include "content/browser/renderer_host/render_view_host.h" |
17 #include "content/browser/renderer_host/render_widget_host_view.h" | 17 #include "content/browser/renderer_host/render_widget_host_view.h" |
18 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
19 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
20 #include "ui/base/models/simple_menu_model.h" | 20 #include "ui/base/models/simple_menu_model.h" |
(...skipping 15 matching lines...) Expand all Loading... |
36 | 36 |
37 void SpellCheckerSubMenuObserver::InitMenu(const ContextMenuParams& params) { | 37 void SpellCheckerSubMenuObserver::InitMenu(const ContextMenuParams& params) { |
38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 38 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
39 | 39 |
40 check_spelling_while_typing_ = params.spellcheck_enabled; | 40 check_spelling_while_typing_ = params.spellcheck_enabled; |
41 | 41 |
42 // Add an item that toggles the spelling panel. | 42 // Add an item that toggles the spelling panel. |
43 submenu_model_.AddCheckItem( | 43 submenu_model_.AddCheckItem( |
44 IDC_SPELLPANEL_TOGGLE, | 44 IDC_SPELLPANEL_TOGGLE, |
45 l10n_util::GetStringUTF16( | 45 l10n_util::GetStringUTF16( |
46 SpellCheckerPlatform::SpellingPanelVisible() ? | 46 spellcheck_mac::SpellingPanelVisible() ? |
47 IDS_CONTENT_CONTEXT_HIDE_SPELLING_PANEL : | 47 IDS_CONTENT_CONTEXT_HIDE_SPELLING_PANEL : |
48 IDS_CONTENT_CONTEXT_SHOW_SPELLING_PANEL)); | 48 IDS_CONTENT_CONTEXT_SHOW_SPELLING_PANEL)); |
49 submenu_model_.AddSeparator(); | 49 submenu_model_.AddSeparator(); |
50 | 50 |
51 // Add a 'Check Spelling While Typing' item in the sub menu. | 51 // Add a 'Check Spelling While Typing' item in the sub menu. |
52 submenu_model_.AddCheckItem( | 52 submenu_model_.AddCheckItem( |
53 IDC_CHECK_SPELLING_OF_THIS_FIELD, | 53 IDC_CHECK_SPELLING_OF_THIS_FIELD, |
54 l10n_util::GetStringUTF16( | 54 l10n_util::GetStringUTF16( |
55 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); | 55 IDS_CONTENT_CONTEXT_CHECK_SPELLING_WHILE_TYPING)); |
56 | 56 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 DCHECK(IsCommandIdSupported(command_id)); | 117 DCHECK(IsCommandIdSupported(command_id)); |
118 | 118 |
119 RenderViewHost* rvh = proxy_->GetRenderViewHost(); | 119 RenderViewHost* rvh = proxy_->GetRenderViewHost(); |
120 switch (command_id) { | 120 switch (command_id) { |
121 case IDC_CHECK_SPELLING_OF_THIS_FIELD: | 121 case IDC_CHECK_SPELLING_OF_THIS_FIELD: |
122 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); | 122 rvh->Send(new SpellCheckMsg_ToggleSpellCheck(rvh->routing_id())); |
123 break; | 123 break; |
124 | 124 |
125 case IDC_SPELLPANEL_TOGGLE: | 125 case IDC_SPELLPANEL_TOGGLE: |
126 rvh->Send(new SpellCheckMsg_ToggleSpellPanel( | 126 rvh->Send(new SpellCheckMsg_ToggleSpellPanel( |
127 rvh->routing_id(), SpellCheckerPlatform::SpellingPanelVisible())); | 127 rvh->routing_id(), spellcheck_mac::SpellingPanelVisible())); |
128 break; | 128 break; |
129 } | 129 } |
130 } | 130 } |
OLD | NEW |