| 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 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/win/iat_patch_function.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/ui/browser.h" |
| 31 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 32 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 32 #include "chrome/common/chrome_notification_types.h" | 33 #include "chrome/common/chrome_notification_types.h" |
| 33 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
| 34 #include "content/browser/user_metrics.h" | 35 #include "content/browser/user_metrics.h" |
| 35 #include "content/common/notification_service.h" | 36 #include "content/common/notification_service.h" |
| 36 #include "googleurl/src/url_util.h" | 37 #include "googleurl/src/url_util.h" |
| 37 #include "grit/generated_resources.h" | 38 #include "grit/generated_resources.h" |
| 38 #include "net/base/escape.h" | 39 #include "net/base/escape.h" |
| 39 #include "skia/ext/skia_utils_win.h" | 40 #include "skia/ext/skia_utils_win.h" |
| 40 #include "ui/base/clipboard/clipboard.h" | 41 #include "ui/base/clipboard/clipboard.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 // to set offsets. | 389 // to set offsets. |
| 389 const int kTwipsPerInch = 1440; | 390 const int kTwipsPerInch = 1440; |
| 390 | 391 |
| 391 } // namespace | 392 } // namespace |
| 392 | 393 |
| 393 OmniboxViewWin::OmniboxViewWin(const gfx::Font& font, | 394 OmniboxViewWin::OmniboxViewWin(const gfx::Font& font, |
| 394 AutocompleteEditController* controller, | 395 AutocompleteEditController* controller, |
| 395 ToolbarModel* toolbar_model, | 396 ToolbarModel* toolbar_model, |
| 396 LocationBarView* parent_view, | 397 LocationBarView* parent_view, |
| 397 HWND hwnd, | 398 HWND hwnd, |
| 398 Profile* profile, | |
| 399 CommandUpdater* command_updater, | 399 CommandUpdater* command_updater, |
| 400 bool popup_window_mode, | 400 bool popup_window_mode, |
| 401 const views::View* location_bar) | 401 const views::View* location_bar) |
| 402 : model_(new AutocompleteEditModel(this, controller, profile)), | 402 : model_(new AutocompleteEditModel(this, controller, |
| 403 parent_view->browser()->profile())), |
| 403 popup_view_(new AutocompletePopupContentsView(font, this, model_.get(), | 404 popup_view_(new AutocompletePopupContentsView(font, this, model_.get(), |
| 404 profile, location_bar)), | 405 location_bar)), |
| 405 controller_(controller), | 406 controller_(controller), |
| 406 parent_view_(parent_view), | 407 parent_view_(parent_view), |
| 407 toolbar_model_(toolbar_model), | 408 toolbar_model_(toolbar_model), |
| 408 command_updater_(command_updater), | 409 command_updater_(command_updater), |
| 409 popup_window_mode_(popup_window_mode), | 410 popup_window_mode_(popup_window_mode), |
| 410 force_hidden_(false), | 411 force_hidden_(false), |
| 411 tracking_click_(), | 412 tracking_click_(), |
| 412 tracking_double_click_(false), | 413 tracking_double_click_(false), |
| 413 double_click_time_(0), | 414 double_click_time_(0), |
| 414 can_discard_mousemove_(false), | 415 can_discard_mousemove_(false), |
| (...skipping 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2598 // PosFromChar(i) might return 0 when i is greater than 1. | 2599 // PosFromChar(i) might return 0 when i is greater than 1. |
| 2599 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2600 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
| 2600 } | 2601 } |
| 2601 | 2602 |
| 2602 bool OmniboxViewWin::IsCaretAtEnd() const { | 2603 bool OmniboxViewWin::IsCaretAtEnd() const { |
| 2603 long length = GetTextLength(); | 2604 long length = GetTextLength(); |
| 2604 CHARRANGE sel; | 2605 CHARRANGE sel; |
| 2605 GetSelection(sel); | 2606 GetSelection(sel); |
| 2606 return sel.cpMin == sel.cpMax && sel.cpMin == length; | 2607 return sel.cpMin == sel.cpMax && sel.cpMin == length; |
| 2607 } | 2608 } |
| OLD | NEW |