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

Side by Side Diff: chrome/browser/ui/views/dropdown_bar_host.cc

Issue 10965042: Use new find in page resource on Windows too. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use same separator color on windows. 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/themes/theme_service.cc ('k') | chrome/browser/ui/views/find_bar_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/dropdown_bar_host.h" 5 #include "chrome/browser/ui/views/dropdown_bar_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/ui/view_ids.h" 9 #include "chrome/browser/ui/view_ids.h"
10 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h" 10 #include "chrome/browser/ui/views/dropdown_bar_host_delegate.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 // TODO(finnur): Let the view tell us how to draw the curves or convert 230 // TODO(finnur): Let the view tell us how to draw the curves or convert
231 // this to a CustomFrameWindow. 231 // this to a CustomFrameWindow.
232 int w = new_pos.width() - 6; // -6 positions us at the left edge of the 232 int w = new_pos.width() - 6; // -6 positions us at the left edge of the
233 // rightmost background image of the view. 233 // rightmost background image of the view.
234 int h = new_pos.height(); 234 int h = new_pos.height();
235 235
236 // This polygon array represents the outline of the background image for the 236 // This polygon array represents the outline of the background image for the
237 // window. Basically, it encompasses only the visible pixels of the 237 // window. Basically, it encompasses only the visible pixels of the
238 // concatenated find_dlg_LMR_bg images (where LMR = [left | middle | right]). 238 // concatenated find_dlg_LMR_bg images (where LMR = [left | middle | right]).
239 const Path::Point polygon[] = { 239 const Path::Point polygon[] = {
240 {0, 0}, {0, 1}, {2, 3}, {2, h - 3}, {4, h - 1}, 240 {1, 0}, {3, 2}, {3, h - 2}, {4, h - 1},
241 {4, h}, {w+0, h}, 241 {4, h}, {w+0, h},
242 {w+0, h - 1}, {w+1, h - 1}, {w+3, h - 3}, {w+3, 3}, {w+6, 0} 242 {w+2, h - 1}, {w+3, h - 2}, {w+3, 2}, {w+5, 0}
243 }; 243 };
244 244
245 // Find the largest x and y value in the polygon. 245 // Find the largest x and y value in the polygon.
246 int max_x = 0, max_y = 0; 246 int max_x = 0, max_y = 0;
247 for (size_t i = 0; i < arraysize(polygon); i++) { 247 for (size_t i = 0; i < arraysize(polygon); i++) {
248 max_x = std::max(max_x, static_cast<int>(polygon[i].x)); 248 max_x = std::max(max_x, static_cast<int>(polygon[i].x));
249 max_y = std::max(max_y, static_cast<int>(polygon[i].y)); 249 max_y = std::max(max_y, static_cast<int>(polygon[i].y));
250 } 250 }
251 251
252 // We then create the polygon and use SetWindowRgn to force the window to draw 252 // We then create the polygon and use SetWindowRgn to force the window to draw
(...skipping 18 matching lines...) Expand all
271 SkIntToScalar(max_x), SkIntToScalar(max_y) }; 271 SkIntToScalar(max_x), SkIntToScalar(max_y) };
272 animation_path.addRect(animation_rect); 272 animation_path.addRect(animation_rect);
273 ScopedPlatformRegion animation_region( 273 ScopedPlatformRegion animation_region(
274 animation_path.CreateNativeRegion()); 274 animation_path.CreateNativeRegion());
275 region.Set(Path::IntersectRegions(animation_region.Get(), region.Get())); 275 region.Set(Path::IntersectRegions(animation_region.Get(), region.Get()));
276 276
277 // Next, we need to increase the region a little bit to account for the 277 // Next, we need to increase the region a little bit to account for the
278 // curved edges that the view will draw to make it look like grows out of 278 // curved edges that the view will draw to make it look like grows out of
279 // the toolbar. 279 // the toolbar.
280 Path::Point left_curve[] = { 280 Path::Point left_curve[] = {
281 {0, y+0}, {0, y+1}, {2, y+3}, {2, y+0}, {0, y+0} 281 {1, y+0}, {3, y+2}, {3, y+0}, {1, y+0}
282 }; 282 };
283 Path::Point right_curve[] = { 283 Path::Point right_curve[] = {
284 {w+3, y+3}, {w+6, y+0}, {w+3, y+0}, {w+3, y+3} 284 {w+3, y+2}, {w+5, y+0}, {w+3, y+0}, {w+3, y+2}
285 }; 285 };
286 286
287 // Combine the region for the curve on the left with our main region. 287 // Combine the region for the curve on the left with our main region.
288 Path left_path(left_curve, arraysize(left_curve)); 288 Path left_path(left_curve, arraysize(left_curve));
289 ScopedPlatformRegion r(left_path.CreateNativeRegion()); 289 ScopedPlatformRegion r(left_path.CreateNativeRegion());
290 region.Set(Path::CombineRegions(r.Get(), region.Get())); 290 region.Set(Path::CombineRegions(r.Get(), region.Get()));
291 291
292 // Combine the region for the curve on the right with our main region. 292 // Combine the region for the curve on the right with our main region.
293 Path right_path(right_curve, arraysize(right_curve)); 293 Path right_path(right_curve, arraysize(right_curve));
294 region.Set(Path::CombineRegions(r.Get(), region.Get())); 294 region.Set(Path::CombineRegions(r.Get(), region.Get()));
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 escape, ui::AcceleratorManager::kNormalPriority, this); 339 escape, ui::AcceleratorManager::kNormalPriority, this);
340 esc_accel_target_registered_ = true; 340 esc_accel_target_registered_ = true;
341 } 341 }
342 342
343 void DropdownBarHost::UnregisterAccelerators() { 343 void DropdownBarHost::UnregisterAccelerators() {
344 DCHECK(esc_accel_target_registered_); 344 DCHECK(esc_accel_target_registered_);
345 ui::Accelerator escape(ui::VKEY_ESCAPE, ui::EF_NONE); 345 ui::Accelerator escape(ui::VKEY_ESCAPE, ui::EF_NONE);
346 focus_manager_->UnregisterAccelerator(escape, this); 346 focus_manager_->UnregisterAccelerator(escape, this);
347 esc_accel_target_registered_ = false; 347 esc_accel_target_registered_ = false;
348 } 348 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_service.cc ('k') | chrome/browser/ui/views/find_bar_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698