OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/location_bar_view_gtk.h" | 5 #include "chrome/browser/gtk/location_bar_view_gtk.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 GdkRectangle inner_rect = { | 382 GdkRectangle inner_rect = { |
383 alloc_rect->x, | 383 alloc_rect->x, |
384 alloc_rect->y + kTopMargin, | 384 alloc_rect->y + kTopMargin, |
385 alloc_rect->width, | 385 alloc_rect->width, |
386 alloc_rect->height - kTopMargin - kBottomMargin}; | 386 alloc_rect->height - kTopMargin - kBottomMargin}; |
387 | 387 |
388 // Some of our calculations are a bit sloppy. Since we draw on our parent | 388 // Some of our calculations are a bit sloppy. Since we draw on our parent |
389 // window, set a clip to make sure that we don't draw outside. | 389 // window, set a clip to make sure that we don't draw outside. |
390 gdk_gc_set_clip_rectangle(gc, &inner_rect); | 390 gdk_gc_set_clip_rectangle(gc, &inner_rect); |
391 | 391 |
392 // Draw our 1px border. TODO(deanm): Maybe this would be cleaner as an | 392 // If we're not using GTK theming, draw our own border. |
393 // overdrawn stroked rect with a clip to the allocation? | 393 if (!profile_ || |
394 gdk_gc_set_rgb_fg_color(gc, &kBorderColor); | 394 !GtkThemeProvider::GetFrom(profile_)->UseGtkTheme()) { |
395 gdk_draw_rectangle(drawable, gc, TRUE, | 395 // Draw our 1px border. TODO(deanm): Maybe this would be cleaner as an |
396 inner_rect.x, | 396 // overdrawn stroked rect with a clip to the allocation? |
397 inner_rect.y, | 397 gdk_gc_set_rgb_fg_color(gc, &kBorderColor); |
398 inner_rect.width, | 398 gdk_draw_rectangle(drawable, gc, TRUE, |
399 kBorderThickness); | 399 inner_rect.x, |
400 gdk_draw_rectangle(drawable, gc, TRUE, | 400 inner_rect.y, |
401 inner_rect.x, | 401 inner_rect.width, |
402 inner_rect.y + inner_rect.height - kBorderThickness, | 402 kBorderThickness); |
403 inner_rect.width, | 403 gdk_draw_rectangle(drawable, gc, TRUE, |
404 kBorderThickness); | 404 inner_rect.x, |
| 405 inner_rect.y + inner_rect.height - kBorderThickness, |
| 406 inner_rect.width, |
| 407 kBorderThickness); |
| 408 } |
405 | 409 |
406 // Draw the background within the border. | 410 // Draw the background within the border. |
407 gdk_gc_set_rgb_fg_color(gc, | 411 gdk_gc_set_rgb_fg_color(gc, |
408 &kBackgroundColorByLevel[toolbar_model_->GetSchemeSecurityLevel()]); | 412 &kBackgroundColorByLevel[toolbar_model_->GetSchemeSecurityLevel()]); |
409 gdk_draw_rectangle(drawable, gc, TRUE, | 413 gdk_draw_rectangle(drawable, gc, TRUE, |
410 inner_rect.x, | 414 inner_rect.x, |
411 inner_rect.y + kBorderThickness, | 415 inner_rect.y + kBorderThickness, |
412 inner_rect.width, | 416 inner_rect.width, |
413 inner_rect.height - (kBorderThickness * 2)); | 417 inner_rect.height - (kBorderThickness * 2)); |
414 | 418 |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 // The bubble needs to be just below the Omnibox and slightly to the right | 517 // The bubble needs to be just below the Omnibox and slightly to the right |
514 // of star button, so shift x and y co-ordinates. | 518 // of star button, so shift x and y co-ordinates. |
515 x += widget()->allocation.x + kFirstRunBubbleLeftMargin; | 519 x += widget()->allocation.x + kFirstRunBubbleLeftMargin; |
516 y += widget()->allocation.y + widget()->allocation.height + | 520 y += widget()->allocation.y + widget()->allocation.height + |
517 kFirstRunBubbleTopMargin; | 521 kFirstRunBubbleTopMargin; |
518 | 522 |
519 FirstRunBubble::Show(profile_, | 523 FirstRunBubble::Show(profile_, |
520 GTK_WINDOW(gtk_widget_get_toplevel(widget())), | 524 GTK_WINDOW(gtk_widget_get_toplevel(widget())), |
521 gfx::Rect(x, y, 0, 0), use_OEM_bubble); | 525 gfx::Rect(x, y, 0, 0), use_OEM_bubble); |
522 } | 526 } |
OLD | NEW |