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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 11235023: Redesign: Remove TsfEventRouter interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@ominifix
Patch Set: Use ATL for COM object management Created 8 years, 2 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
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/ui/views/omnibox/omnibox_view_win.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <locale> 8 #include <locale>
9 #include <string> 9 #include <string>
10 10
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 font_(parent_view->font()), 473 font_(parent_view->font()),
474 possible_drag_(false), 474 possible_drag_(false),
475 in_drag_(false), 475 in_drag_(false),
476 initiated_drag_(false), 476 initiated_drag_(false),
477 drop_highlight_position_(-1), 477 drop_highlight_position_(-1),
478 ime_candidate_window_open_(false), 478 ime_candidate_window_open_(false),
479 background_color_(skia::SkColorToCOLORREF(LocationBarView::GetColor( 479 background_color_(skia::SkColorToCOLORREF(LocationBarView::GetColor(
480 chrome::search::IsInstantExtendedAPIEnabled(parent_view_->profile()), 480 chrome::search::IsInstantExtendedAPIEnabled(parent_view_->profile()),
481 ToolbarModel::NONE, LocationBarView::BACKGROUND))), 481 ToolbarModel::NONE, LocationBarView::BACKGROUND))),
482 security_level_(ToolbarModel::NONE), 482 security_level_(ToolbarModel::NONE),
483 text_object_model_(NULL) { 483 text_object_model_(NULL),
484 tsf_event_router_(base::win::IsTsfAwareRequired()
485 ? new ui::TsfEventRouter() : NULL) {
Peter Kasting 2012/10/24 20:48:11 Nit: '?' goes on previous line
Seigo Nonaka 2012/10/25 14:37:16 Done.
484 if (!loaded_library_module_) 486 if (!loaded_library_module_)
485 loaded_library_module_ = LoadLibrary(kRichEditDLLName); 487 loaded_library_module_ = LoadLibrary(kRichEditDLLName);
486 488
487 saved_selection_for_focus_change_.cpMin = -1; 489 saved_selection_for_focus_change_.cpMin = -1;
488 490
489 g_paint_patcher.Pointer()->RefPatch(); 491 g_paint_patcher.Pointer()->RefPatch();
490 492
491 Create(location_bar->GetWidget()->GetNativeView(), 0, 0, 0, 493 Create(location_bar->GetWidget()->GetNativeView(), 0, 0, 0,
492 l10n_util::GetExtendedStyles()); 494 l10n_util::GetExtendedStyles());
493 SetReadOnly(popup_window_mode_); 495 SetReadOnly(popup_window_mode_);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 // Non-read-only edit controls have a drop target. Revoke it so that we can 536 // Non-read-only edit controls have a drop target. Revoke it so that we can
535 // install our own. Revoking automatically deletes the existing one. 537 // install our own. Revoking automatically deletes the existing one.
536 HRESULT hr = RevokeDragDrop(m_hWnd); 538 HRESULT hr = RevokeDragDrop(m_hWnd);
537 DCHECK_EQ(S_OK, hr); 539 DCHECK_EQ(S_OK, hr);
538 540
539 // Register our drop target. The scoped_refptr here will delete the drop 541 // Register our drop target. The scoped_refptr here will delete the drop
540 // target if it fails to register itself correctly on |m_hWnd|. Otherwise, 542 // target if it fails to register itself correctly on |m_hWnd|. Otherwise,
541 // the edit control will invoke RevokeDragDrop when it's being destroyed, so 543 // the edit control will invoke RevokeDragDrop when it's being destroyed, so
542 // we don't have to do so. 544 // we don't have to do so.
543 scoped_refptr<EditDropTarget> drop_target(new EditDropTarget(this)); 545 scoped_refptr<EditDropTarget> drop_target(new EditDropTarget(this));
544
545 if (base::win::IsTsfAwareRequired())
546 tsf_event_router_ = ui::TsfEventRouter::Create();
547 } 546 }
548 } 547 }
549 548
550 OmniboxViewWin::~OmniboxViewWin() { 549 OmniboxViewWin::~OmniboxViewWin() {
551 // Explicitly release the text object model now that we're done with it, and 550 // Explicitly release the text object model now that we're done with it, and
552 // before we free the library. If the library gets unloaded before this 551 // before we free the library. If the library gets unloaded before this
553 // released, it becomes garbage. Note that since text_object_model_ is lazy 552 // released, it becomes garbage. Note that since text_object_model_ is lazy
554 // initialized, it may still be null. 553 // initialized, it may still be null.
555 if (text_object_model_) 554 if (text_object_model_)
556 text_object_model_->Release(); 555 text_object_model_->Release();
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2756 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2758 } 2757 }
2759 2758
2760 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2759 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2761 // Use font_.GetStringWidth() instead of 2760 // Use font_.GetStringWidth() instead of
2762 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is 2761 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
2763 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, 2762 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
2764 // PosFromChar(i) might return 0 when i is greater than 1. 2763 // PosFromChar(i) might return 0 when i is greater than 1.
2765 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2764 return font_.GetStringWidth(text) + GetHorizontalMargin();
2766 } 2765 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698