OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/autocomplete/autocomplete_edit_view_win.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_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 26 matching lines...) Expand all Loading... |
37 #include "chrome/browser/metrics/user_metrics.h" | 37 #include "chrome/browser/metrics/user_metrics.h" |
38 #include "chrome/browser/net/url_fixer_upper.h" | 38 #include "chrome/browser/net/url_fixer_upper.h" |
39 #include "chrome/browser/profile.h" | 39 #include "chrome/browser/profile.h" |
40 #include "chrome/browser/search_engines/template_url.h" | 40 #include "chrome/browser/search_engines/template_url.h" |
41 #include "chrome/browser/search_engines/template_url_model.h" | 41 #include "chrome/browser/search_engines/template_url_model.h" |
42 #include "chrome/browser/tab_contents/tab_contents.h" | 42 #include "chrome/browser/tab_contents/tab_contents.h" |
43 #include "chrome/browser/views/location_bar/location_bar_view.h" | 43 #include "chrome/browser/views/location_bar/location_bar_view.h" |
44 #include "chrome/common/notification_service.h" | 44 #include "chrome/common/notification_service.h" |
45 #include "googleurl/src/url_util.h" | 45 #include "googleurl/src/url_util.h" |
46 #include "gfx/canvas.h" | 46 #include "gfx/canvas.h" |
| 47 #include "gfx/canvas_skia.h" |
47 #include "grit/generated_resources.h" | 48 #include "grit/generated_resources.h" |
48 #include "net/base/escape.h" | 49 #include "net/base/escape.h" |
49 #include "skia/ext/skia_utils_win.h" | 50 #include "skia/ext/skia_utils_win.h" |
50 #include "views/drag_utils.h" | 51 #include "views/drag_utils.h" |
51 #include "views/focus/focus_util_win.h" | 52 #include "views/focus/focus_util_win.h" |
52 #include "views/widget/widget.h" | 53 #include "views/widget/widget.h" |
53 | 54 |
54 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. | 55 #pragma comment(lib, "oleacc.lib") // Needed for accessibility support. |
55 #pragma comment(lib, "riched20.lib") // Needed for the richedit control. | 56 #pragma comment(lib, "riched20.lib") // Needed for the richedit control. |
56 | 57 |
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2169 | 2170 |
2170 // Create a paint context for drawing the antialiased stroke. | 2171 // Create a paint context for drawing the antialiased stroke. |
2171 SkPaint paint; | 2172 SkPaint paint; |
2172 paint.setAntiAlias(true); | 2173 paint.setAntiAlias(true); |
2173 paint.setStrokeWidth(kStrokeWidthPixels); | 2174 paint.setStrokeWidth(kStrokeWidthPixels); |
2174 paint.setStrokeCap(SkPaint::kRound_Cap); | 2175 paint.setStrokeCap(SkPaint::kRound_Cap); |
2175 | 2176 |
2176 // Create a canvas as large as |scheme_rect| to do our drawing, and initialize | 2177 // Create a canvas as large as |scheme_rect| to do our drawing, and initialize |
2177 // it to fully transparent so any antialiasing will look nice when painted | 2178 // it to fully transparent so any antialiasing will look nice when painted |
2178 // atop the edit. | 2179 // atop the edit. |
2179 gfx::Canvas canvas(scheme_rect.Width(), scheme_rect.Height(), false); | 2180 gfx::CanvasSkia canvas(scheme_rect.Width(), scheme_rect.Height(), false); |
2180 canvas.getDevice()->accessBitmap(true).eraseARGB(0, 0, 0, 0); | 2181 canvas.getDevice()->accessBitmap(true).eraseARGB(0, 0, 0, 0); |
2181 | 2182 |
2182 // Calculate the start and end of the stroke, which are just the lower left | 2183 // Calculate the start and end of the stroke, which are just the lower left |
2183 // and upper right corners of the canvas, inset by the radius of the endcap | 2184 // and upper right corners of the canvas, inset by the radius of the endcap |
2184 // so we don't clip the endcap off. | 2185 // so we don't clip the endcap off. |
2185 const SkScalar kEndCapRadiusPixels = kStrokeWidthPixels / SkIntToScalar(2); | 2186 const SkScalar kEndCapRadiusPixels = kStrokeWidthPixels / SkIntToScalar(2); |
2186 const SkPoint start_point = { | 2187 const SkPoint start_point = { |
2187 kEndCapRadiusPixels, | 2188 kEndCapRadiusPixels, |
2188 SkIntToScalar(scheme_rect.Height()) - kEndCapRadiusPixels }; | 2189 SkIntToScalar(scheme_rect.Height()) - kEndCapRadiusPixels }; |
2189 const SkPoint end_point = { | 2190 const SkPoint end_point = { |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 void AutocompleteEditViewWin::TrackMousePosition(MouseButton button, | 2472 void AutocompleteEditViewWin::TrackMousePosition(MouseButton button, |
2472 const CPoint& point) { | 2473 const CPoint& point) { |
2473 if (gaining_focus_.get()) { | 2474 if (gaining_focus_.get()) { |
2474 // This click is giving us focus, so we need to track how much the mouse | 2475 // This click is giving us focus, so we need to track how much the mouse |
2475 // moves to see if it's a drag or just a click. Clicks should select all | 2476 // moves to see if it's a drag or just a click. Clicks should select all |
2476 // the text. | 2477 // the text. |
2477 tracking_click_[button] = true; | 2478 tracking_click_[button] = true; |
2478 click_point_[button] = point; | 2479 click_point_[button] = point; |
2479 } | 2480 } |
2480 } | 2481 } |
OLD | NEW |