| 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 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/autocomplete/keyword_provider.h" | 25 #include "chrome/browser/autocomplete/keyword_provider.h" |
| 26 #include "chrome/browser/browser_process.h" | 26 #include "chrome/browser/browser_process.h" |
| 27 #include "chrome/browser/command_updater.h" | 27 #include "chrome/browser/command_updater.h" |
| 28 #include "chrome/browser/net/url_fixer_upper.h" | 28 #include "chrome/browser/net/url_fixer_upper.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/ui/browser.h" | 30 #include "chrome/browser/ui/browser.h" |
| 31 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 31 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 32 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" | 32 #include "chrome/browser/ui/views/omnibox/omnibox_view_views.h" |
| 33 #include "chrome/common/chrome_notification_types.h" | 33 #include "chrome/common/chrome_notification_types.h" |
| 34 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
| 35 #include "content/browser/user_metrics.h" | 35 #include "content/public/browser/user_metrics.h" |
| 36 #include "googleurl/src/url_util.h" | 36 #include "googleurl/src/url_util.h" |
| 37 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 38 #include "net/base/escape.h" | 38 #include "net/base/escape.h" |
| 39 #include "skia/ext/skia_utils_win.h" | 39 #include "skia/ext/skia_utils_win.h" |
| 40 #include "ui/base/accessibility/accessible_view_state.h" | 40 #include "ui/base/accessibility/accessible_view_state.h" |
| 41 #include "ui/base/clipboard/clipboard.h" | 41 #include "ui/base/clipboard/clipboard.h" |
| 42 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 42 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| 43 #include "ui/base/dragdrop/drag_drop_types.h" | 43 #include "ui/base/dragdrop/drag_drop_types.h" |
| 44 #include "ui/base/dragdrop/drag_source.h" | 44 #include "ui/base/dragdrop/drag_source.h" |
| 45 #include "ui/base/dragdrop/drop_target.h" | 45 #include "ui/base/dragdrop/drop_target.h" |
| 46 #include "ui/base/dragdrop/os_exchange_data.h" | 46 #include "ui/base/dragdrop/os_exchange_data.h" |
| 47 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" | 47 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" |
| 48 #include "ui/base/events.h" | 48 #include "ui/base/events.h" |
| 49 #include "ui/base/keycodes/keyboard_codes.h" | 49 #include "ui/base/keycodes/keyboard_codes.h" |
| 50 #include "ui/base/l10n/l10n_util.h" | 50 #include "ui/base/l10n/l10n_util.h" |
| 51 #include "ui/base/l10n/l10n_util_win.h" | 51 #include "ui/base/l10n/l10n_util_win.h" |
| 52 #include "ui/base/win/mouse_wheel_util.h" | 52 #include "ui/base/win/mouse_wheel_util.h" |
| 53 #include "ui/gfx/canvas.h" | 53 #include "ui/gfx/canvas.h" |
| 54 #include "ui/gfx/canvas_skia.h" | 54 #include "ui/gfx/canvas_skia.h" |
| 55 #include "ui/views/controls/textfield/native_textfield_win.h" | 55 #include "ui/views/controls/textfield/native_textfield_win.h" |
| 56 #include "ui/views/drag_utils.h" | 56 #include "ui/views/drag_utils.h" |
| 57 #include "ui/views/widget/widget.h" | 57 #include "ui/views/widget/widget.h" |
| 58 | 58 |
| 59 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. | 59 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. |
| 60 #pragma comment(lib, "riched20.lib") // Needed for the richedit control. | 60 #pragma comment(lib, "riched20.lib") // Needed for the richedit control. |
| 61 | 61 |
| 62 using content::UserMetricsAction; |
| 63 |
| 62 /////////////////////////////////////////////////////////////////////////////// | 64 /////////////////////////////////////////////////////////////////////////////// |
| 63 // AutocompleteEditModel | 65 // AutocompleteEditModel |
| 64 | 66 |
| 65 namespace { | 67 namespace { |
| 66 | 68 |
| 67 // A helper method for determining a valid DROPEFFECT given the allowed | 69 // A helper method for determining a valid DROPEFFECT given the allowed |
| 68 // DROPEFFECTS. We prefer copy over link. | 70 // DROPEFFECTS. We prefer copy over link. |
| 69 DWORD CopyOrLinkDropEffect(DWORD effect) { | 71 DWORD CopyOrLinkDropEffect(DWORD effect) { |
| 70 if (effect & DROPEFFECT_COPY) | 72 if (effect & DROPEFFECT_COPY) |
| 71 return DROPEFFECT_COPY; | 73 return DROPEFFECT_COPY; |
| (...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2502 model()->AdjustTextForCopy(std::min(sel.cpMin, sel.cpMax), is_all_selected, | 2504 model()->AdjustTextForCopy(std::min(sel.cpMin, sel.cpMax), is_all_selected, |
| 2503 &text_to_write, &url, &write_url); | 2505 &text_to_write, &url, &write_url); |
| 2504 | 2506 |
| 2505 if (write_url) { | 2507 if (write_url) { |
| 2506 string16 title; | 2508 string16 title; |
| 2507 SkBitmap favicon; | 2509 SkBitmap favicon; |
| 2508 if (is_all_selected) | 2510 if (is_all_selected) |
| 2509 model_->GetDataForURLExport(&url, &title, &favicon); | 2511 model_->GetDataForURLExport(&url, &title, &favicon); |
| 2510 drag_utils::SetURLAndDragImage(url, title, favicon, &data); | 2512 drag_utils::SetURLAndDragImage(url, title, favicon, &data); |
| 2511 supported_modes |= DROPEFFECT_LINK; | 2513 supported_modes |= DROPEFFECT_LINK; |
| 2512 UserMetrics::RecordAction(UserMetricsAction("Omnibox_DragURL")); | 2514 content::RecordAction(UserMetricsAction("Omnibox_DragURL")); |
| 2513 } else { | 2515 } else { |
| 2514 supported_modes |= DROPEFFECT_MOVE; | 2516 supported_modes |= DROPEFFECT_MOVE; |
| 2515 UserMetrics::RecordAction(UserMetricsAction("Omnibox_DragString")); | 2517 content::RecordAction(UserMetricsAction("Omnibox_DragString")); |
| 2516 } | 2518 } |
| 2517 | 2519 |
| 2518 data.SetString(text_to_write); | 2520 data.SetString(text_to_write); |
| 2519 | 2521 |
| 2520 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); | 2522 scoped_refptr<ui::DragSource> drag_source(new ui::DragSource); |
| 2521 DWORD dropped_mode; | 2523 DWORD dropped_mode; |
| 2522 AutoReset<bool> auto_reset_in_drag(&in_drag_, true); | 2524 AutoReset<bool> auto_reset_in_drag(&in_drag_, true); |
| 2523 if (DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), | 2525 if (DoDragDrop(ui::OSExchangeDataProviderWin::GetIDataObject(data), |
| 2524 drag_source, supported_modes, &dropped_mode) == | 2526 drag_source, supported_modes, &dropped_mode) == |
| 2525 DRAGDROP_S_DROP) { | 2527 DRAGDROP_S_DROP) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2684 return omnibox_view; | 2686 return omnibox_view; |
| 2685 } | 2687 } |
| 2686 return new OmniboxViewWin(controller, | 2688 return new OmniboxViewWin(controller, |
| 2687 toolbar_model, | 2689 toolbar_model, |
| 2688 location_bar, | 2690 location_bar, |
| 2689 command_updater, | 2691 command_updater, |
| 2690 popup_window_mode, | 2692 popup_window_mode, |
| 2691 location_bar); | 2693 location_bar); |
| 2692 } | 2694 } |
| 2693 #endif | 2695 #endif |
| OLD | NEW |