Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_WIN_H_ | 5 #ifndef CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_WIN_H_ |
| 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_WIN_H_ | 6 #define CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_WIN_H_ |
| 7 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <atlapp.h> | 9 #include <atlapp.h> |
| 10 #include <atlcrack.h> | 10 #include <atlcrack.h> |
| 11 #include <atlctrls.h> | 11 #include <atlctrls.h> |
| 12 #include <atlmisc.h> | 12 #include <atlmisc.h> |
| 13 #include <peninputpanel.h> | 13 #include <peninputpanel.h> |
| 14 #include <tom.h> // For ITextDocument, a COM interface to CRichEditCtrl. | 14 #include <tom.h> // For ITextDocument, a COM interface to CRichEditCtrl. |
| 15 | 15 |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/win/scoped_comptr.h" | 17 #include "base/win/scoped_comptr.h" |
| 18 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 18 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
| 19 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 19 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 20 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" | 20 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" |
| 21 #include "ui/base/ime/win/tsf_event_router.h" | |
| 21 #include "ui/base/models/simple_menu_model.h" | 22 #include "ui/base/models/simple_menu_model.h" |
| 22 #include "ui/base/win/extra_sdk_defines.h" | 23 #include "ui/base/win/extra_sdk_defines.h" |
| 23 #include "ui/gfx/font.h" | 24 #include "ui/gfx/font.h" |
| 24 #include "webkit/glue/window_open_disposition.h" | 25 #include "webkit/glue/window_open_disposition.h" |
| 25 | 26 |
| 26 class LocationBarView; | 27 class LocationBarView; |
| 27 class OmniboxPopupView; | 28 class OmniboxPopupView; |
| 28 | 29 |
| 29 namespace views { | 30 namespace views { |
| 30 class MenuRunner; | 31 class MenuRunner; |
| 31 class NativeViewHost; | 32 class NativeViewHost; |
| 32 class View; | 33 class View; |
| 33 } | 34 } |
| 34 | 35 |
| 35 // Provides the implementation of an edit control with a drop-down | 36 // Provides the implementation of an edit control with a drop-down |
| 36 // autocomplete box. The box itself is implemented in autocomplete_popup.cc | 37 // autocomplete box. The box itself is implemented in autocomplete_popup.cc |
| 37 // This file implements the edit box and management for the popup. | 38 // This file implements the edit box and management for the popup. |
| 38 class OmniboxViewWin | 39 class OmniboxViewWin |
| 39 : public CWindowImpl<OmniboxViewWin, | 40 : public CWindowImpl<OmniboxViewWin, |
| 40 CRichEditCtrl, | 41 CRichEditCtrl, |
| 41 CWinTraits<WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | | 42 CWinTraits<WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL | |
| 42 ES_NOHIDESEL> >, | 43 ES_NOHIDESEL> >, |
| 43 public CRichEditCommands<OmniboxViewWin>, | 44 public CRichEditCommands<OmniboxViewWin>, |
| 44 public ui::SimpleMenuModel::Delegate, | 45 public ui::SimpleMenuModel::Delegate, |
| 46 public ui::TsfEventRouter::Observer, | |
| 45 public OmniboxView { | 47 public OmniboxView { |
| 46 public: | 48 public: |
| 47 struct State { | 49 struct State { |
| 48 State(const CHARRANGE& selection, | 50 State(const CHARRANGE& selection, |
| 49 const CHARRANGE& saved_selection_for_focus_change) | 51 const CHARRANGE& saved_selection_for_focus_change) |
| 50 : selection(selection), | 52 : selection(selection), |
| 51 saved_selection_for_focus_change(saved_selection_for_focus_change) { | 53 saved_selection_for_focus_change(saved_selection_for_focus_change) { |
| 52 } | 54 } |
| 53 | 55 |
| 54 const CHARRANGE selection; | 56 const CHARRANGE selection; |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 322 // click. Sadly, we need to clip slightly differently in this case. | 324 // click. Sadly, we need to clip slightly differently in this case. |
| 323 LONG ClipXCoordToVisibleText(LONG x, bool is_triple_click) const; | 325 LONG ClipXCoordToVisibleText(LONG x, bool is_triple_click) const; |
| 324 | 326 |
| 325 virtual int GetOmniboxTextLength() const OVERRIDE; | 327 virtual int GetOmniboxTextLength() const OVERRIDE; |
| 326 | 328 |
| 327 // Parses the contents of the control for the scheme and the host name. | 329 // Parses the contents of the control for the scheme and the host name. |
| 328 // Highlights the scheme in green or red depending on it security level. | 330 // Highlights the scheme in green or red depending on it security level. |
| 329 // If a host name is found, it makes it visually stronger. | 331 // If a host name is found, it makes it visually stronger. |
| 330 virtual void EmphasizeURLComponents() OVERRIDE; | 332 virtual void EmphasizeURLComponents() OVERRIDE; |
| 331 | 333 |
| 334 // TsfEventRouter::Observer override. | |
|
Peter Kasting
2012/10/19 18:40:57
Nit: If the IMM32 comment is useful, put it in the
Seigo Nonaka
2012/10/22 03:11:04
Done.
| |
| 335 // This callback should not be called when IMM32 is used. | |
| 336 virtual void OnTextUpdated() OVERRIDE; | |
| 337 | |
| 338 // TsfEventRouter::Observer override. | |
| 339 // This callback should not be called when IMM32 is used. | |
| 340 virtual void OnCandidateWindowCountChanged(size_t window_count) OVERRIDE; | |
| 341 | |
| 332 // Erases the portion of the selection in the font's y-adjustment area. For | 342 // Erases the portion of the selection in the font's y-adjustment area. For |
| 333 // some reason the edit draws the selection rect here even though it's not | 343 // some reason the edit draws the selection rect here even though it's not |
| 334 // part of the font. | 344 // part of the font. |
| 335 void EraseTopOfSelection(CDC* dc, | 345 void EraseTopOfSelection(CDC* dc, |
| 336 const CRect& client_rect, | 346 const CRect& client_rect, |
| 337 const CRect& paint_clip_rect); | 347 const CRect& paint_clip_rect); |
| 338 | 348 |
| 339 // Draws a slash across the scheme if desired. | 349 // Draws a slash across the scheme if desired. |
| 340 void DrawSlashForInsecureScheme(HDC hdc, | 350 void DrawSlashForInsecureScheme(HDC hdc, |
| 341 const CRect& client_rect, | 351 const CRect& client_rect, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 // This contains the scheme char start and stop indexes that should be | 514 // This contains the scheme char start and stop indexes that should be |
| 505 // stricken-out when displaying an insecure scheme. | 515 // stricken-out when displaying an insecure scheme. |
| 506 url_parse::Component insecure_scheme_component_; | 516 url_parse::Component insecure_scheme_component_; |
| 507 | 517 |
| 508 // Instance of accessibility information and handling. | 518 // Instance of accessibility information and handling. |
| 509 mutable base::win::ScopedComPtr<IAccessible> autocomplete_accessibility_; | 519 mutable base::win::ScopedComPtr<IAccessible> autocomplete_accessibility_; |
| 510 | 520 |
| 511 // The native view host. | 521 // The native view host. |
| 512 views::NativeViewHost* native_view_host_; | 522 views::NativeViewHost* native_view_host_; |
| 513 | 523 |
| 524 // TSF related event router. | |
| 525 scoped_refptr<ui::TsfEventRouter> tsf_event_router_; | |
| 526 | |
| 514 DISALLOW_COPY_AND_ASSIGN(OmniboxViewWin); | 527 DISALLOW_COPY_AND_ASSIGN(OmniboxViewWin); |
| 515 }; | 528 }; |
| 516 | 529 |
| 517 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_WIN_H_ | 530 #endif // CHROME_BROWSER_UI_VIEWS_OMNIBOX_OMNIBOX_VIEW_WIN_H_ |
| OLD | NEW |