| 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/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 |
| 11 #include <richedit.h> | 11 #include <richedit.h> |
| 12 #include <textserv.h> | 12 #include <textserv.h> |
| 13 | 13 |
| 14 #include "app/win/iat_patch_function.h" |
| 14 #include "base/auto_reset.h" | 15 #include "base/auto_reset.h" |
| 15 #include "base/basictypes.h" | 16 #include "base/basictypes.h" |
| 16 #include "base/i18n/rtl.h" | 17 #include "base/i18n/rtl.h" |
| 17 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
| 18 #include "base/memory/ref_counted.h" | 19 #include "base/memory/ref_counted.h" |
| 19 #include "base/string_util.h" | 20 #include "base/string_util.h" |
| 20 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
| 21 #include "base/win/iat_patch_function.h" | |
| 22 #include "chrome/app/chrome_command_ids.h" | 22 #include "chrome/app/chrome_command_ids.h" |
| 23 #include "chrome/browser/autocomplete/autocomplete_accessibility.h" | 23 #include "chrome/browser/autocomplete/autocomplete_accessibility.h" |
| 24 #include "chrome/browser/autocomplete/autocomplete_match.h" | 24 #include "chrome/browser/autocomplete/autocomplete_match.h" |
| 25 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 25 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 26 #include "chrome/browser/autocomplete/keyword_provider.h" | 26 #include "chrome/browser/autocomplete/keyword_provider.h" |
| 27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/command_updater.h" | 28 #include "chrome/browser/command_updater.h" |
| 29 #include "chrome/browser/net/url_fixer_upper.h" | 29 #include "chrome/browser/net/url_fixer_upper.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/search_engines/template_url.h" | 31 #include "chrome/browser/search_engines/template_url.h" |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 class PaintPatcher { | 341 class PaintPatcher { |
| 342 public: | 342 public: |
| 343 PaintPatcher(); | 343 PaintPatcher(); |
| 344 ~PaintPatcher(); | 344 ~PaintPatcher(); |
| 345 | 345 |
| 346 void RefPatch(); | 346 void RefPatch(); |
| 347 void DerefPatch(); | 347 void DerefPatch(); |
| 348 | 348 |
| 349 private: | 349 private: |
| 350 size_t refcount_; | 350 size_t refcount_; |
| 351 base::win::IATPatchFunction begin_paint_; | 351 app::win::IATPatchFunction begin_paint_; |
| 352 base::win::IATPatchFunction end_paint_; | 352 app::win::IATPatchFunction end_paint_; |
| 353 | 353 |
| 354 DISALLOW_COPY_AND_ASSIGN(PaintPatcher); | 354 DISALLOW_COPY_AND_ASSIGN(PaintPatcher); |
| 355 }; | 355 }; |
| 356 | 356 |
| 357 PaintPatcher::PaintPatcher() : refcount_(0) { | 357 PaintPatcher::PaintPatcher() : refcount_(0) { |
| 358 } | 358 } |
| 359 | 359 |
| 360 PaintPatcher::~PaintPatcher() { | 360 PaintPatcher::~PaintPatcher() { |
| 361 DCHECK_EQ(0U, refcount_); | 361 DCHECK_EQ(0U, refcount_); |
| 362 } | 362 } |
| (...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2596 // PosFromChar(i) might return 0 when i is greater than 1. | 2596 // PosFromChar(i) might return 0 when i is greater than 1. |
| 2597 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2597 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
| 2598 } | 2598 } |
| 2599 | 2599 |
| 2600 bool OmniboxViewWin::IsCaretAtEnd() const { | 2600 bool OmniboxViewWin::IsCaretAtEnd() const { |
| 2601 long length = GetTextLength(); | 2601 long length = GetTextLength(); |
| 2602 CHARRANGE sel; | 2602 CHARRANGE sel; |
| 2603 GetSelection(sel); | 2603 GetSelection(sel); |
| 2604 return sel.cpMin == sel.cpMax && sel.cpMin == length; | 2604 return sel.cpMin == sel.cpMax && sel.cpMin == length; |
| 2605 } | 2605 } |
| OLD | NEW |