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

Side by Side Diff: chrome/browser/gtk/location_bar_view_gtk.cc

Issue 159521: Implementation of the page info dialog on Linux Gtk. (Closed)
Patch Set: Fix build Created 11 years, 4 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
« no previous file with comments | « chrome/browser/gtk/location_bar_view_gtk.h ('k') | chrome/browser/gtk/page_info_window_gtk.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) 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"
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/gfx/gtk_util.h" 12 #include "base/gfx/gtk_util.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "chrome/app/chrome_dll_resource.h" 15 #include "chrome/app/chrome_dll_resource.h"
16 #include "chrome/browser/alternate_nav_url_fetcher.h" 16 #include "chrome/browser/alternate_nav_url_fetcher.h"
17 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" 17 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h"
18 #include "chrome/browser/browser_list.h"
18 #include "chrome/browser/command_updater.h" 19 #include "chrome/browser/command_updater.h"
19 #include "chrome/browser/gtk/first_run_bubble.h" 20 #include "chrome/browser/gtk/first_run_bubble.h"
20 #include "chrome/browser/gtk/gtk_theme_provider.h" 21 #include "chrome/browser/gtk/gtk_theme_provider.h"
21 #include "chrome/browser/profile.h" 22 #include "chrome/browser/profile.h"
22 #include "chrome/browser/search_engines/template_url.h" 23 #include "chrome/browser/search_engines/template_url.h"
23 #include "chrome/browser/search_engines/template_url_model.h" 24 #include "chrome/browser/search_engines/template_url_model.h"
24 #include "chrome/browser/tab_contents/tab_contents.h" 25 #include "chrome/browser/tab_contents/tab_contents.h"
25 #include "chrome/common/gtk_util.h" 26 #include "chrome/common/gtk_util.h"
26 #include "chrome/common/page_transition_types.h" 27 #include "chrome/common/page_transition_types.h"
27 #include "grit/generated_resources.h" 28 #include "grit/generated_resources.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 security_lock_icon_image_, FALSE, FALSE, 0); 230 security_lock_icon_image_, FALSE, FALSE, 0);
230 gtk_box_pack_start(GTK_BOX(security_icon_box), 231 gtk_box_pack_start(GTK_BOX(security_icon_box),
231 security_warning_icon_image_, FALSE, FALSE, 0); 232 security_warning_icon_image_, FALSE, FALSE, 0);
232 233
233 security_icon_align_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0); 234 security_icon_align_ = gtk_alignment_new(0.0, 0.0, 1.0, 1.0);
234 gtk_alignment_set_padding(GTK_ALIGNMENT(security_icon_align_), 235 gtk_alignment_set_padding(GTK_ALIGNMENT(security_icon_align_),
235 kTopMargin + kBorderThickness, 236 kTopMargin + kBorderThickness,
236 kBottomMargin + kBorderThickness, 237 kBottomMargin + kBorderThickness,
237 kSecurityIconPaddingLeft, 238 kSecurityIconPaddingLeft,
238 kSecurityIconPaddingRight); 239 kSecurityIconPaddingRight);
239 gtk_container_add(GTK_CONTAINER(security_icon_align_), security_icon_box); 240 // GtkImage is a "no window" widget and requires a GtkEventBox to receive
241 // events.
242 GtkWidget* event_box = gtk_event_box_new();
243 // Make the event box not visible so it does not paint a background.
244 gtk_event_box_set_visible_window(GTK_EVENT_BOX(event_box), FALSE);
245 g_signal_connect(event_box, "button-press-event",
246 G_CALLBACK(&OnSecurityIconPressed), this);
247
248 gtk_container_add(GTK_CONTAINER(event_box), security_icon_box);
249 gtk_container_add(GTK_CONTAINER(security_icon_align_), event_box);
240 gtk_box_pack_end(GTK_BOX(hbox_.get()), security_icon_align_, FALSE, FALSE, 0); 250 gtk_box_pack_end(GTK_BOX(hbox_.get()), security_icon_align_, FALSE, FALSE, 0);
241 } 251 }
242 252
243 void LocationBarViewGtk::SetProfile(Profile* profile) { 253 void LocationBarViewGtk::SetProfile(Profile* profile) {
244 profile_ = profile; 254 profile_ = profile;
245 } 255 }
246 256
247 void LocationBarViewGtk::Update(const TabContents* contents) { 257 void LocationBarViewGtk::Update(const TabContents* contents) {
248 SetSecurityIcon(toolbar_model_->GetIcon()); 258 SetSecurityIcon(toolbar_model_->GetIcon());
249 SetInfoText(); 259 SetInfoText();
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 x += widget()->allocation.x + kFirstRunBubbleLeftMargin; 557 x += widget()->allocation.x + kFirstRunBubbleLeftMargin;
548 } else { 558 } else {
549 x += widget()->allocation.x + widget()->allocation.width - 559 x += widget()->allocation.x + widget()->allocation.width -
550 kFirstRunBubbleLeftMargin; 560 kFirstRunBubbleLeftMargin;
551 } 561 }
552 562
553 FirstRunBubble::Show(profile_, 563 FirstRunBubble::Show(profile_,
554 GTK_WINDOW(gtk_widget_get_toplevel(widget())), 564 GTK_WINDOW(gtk_widget_get_toplevel(widget())),
555 gfx::Rect(x, y, 0, 0), use_OEM_bubble); 565 gfx::Rect(x, y, 0, 0), use_OEM_bubble);
556 } 566 }
567
568 // static
569 gboolean LocationBarViewGtk::OnSecurityIconPressed(
570 GtkWidget* sender,
571 GdkEventButton* event,
572 LocationBarViewGtk* location_bar) {
573 TabContents* tab = BrowserList::GetLastActive()->GetSelectedTabContents();
574 NavigationEntry* nav_entry = tab->controller().GetActiveEntry();
575 if (!nav_entry) {
576 NOTREACHED();
577 return true;
578 }
579 tab->ShowPageInfo(nav_entry->url(), nav_entry->ssl(), true);
580 return true;
581 }
OLDNEW
« no previous file with comments | « chrome/browser/gtk/location_bar_view_gtk.h ('k') | chrome/browser/gtk/page_info_window_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698