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

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

Issue 10830140: GTK implementation of the action box button. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forward delare Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.h ('k') | chrome/browser/ui/gtk/view_id_util.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/gtk/location_bar_view_gtk.h" 5 #include "chrome/browser/ui/gtk/location_bar_view_gtk.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 #include "chrome/browser/search_engines/template_url_service_factory.h" 38 #include "chrome/browser/search_engines/template_url_service_factory.h"
39 #include "chrome/browser/ui/browser.h" 39 #include "chrome/browser/ui/browser.h"
40 #include "chrome/browser/ui/browser_command_controller.h" 40 #include "chrome/browser/ui/browser_command_controller.h"
41 #include "chrome/browser/ui/browser_commands.h" 41 #include "chrome/browser/ui/browser_commands.h"
42 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h" 42 #include "chrome/browser/ui/browser_content_setting_bubble_model_delegate.h"
43 #include "chrome/browser/ui/browser_instant_controller.h" 43 #include "chrome/browser/ui/browser_instant_controller.h"
44 #include "chrome/browser/ui/browser_list.h" 44 #include "chrome/browser/ui/browser_list.h"
45 #include "chrome/browser/ui/browser_tabstrip.h" 45 #include "chrome/browser/ui/browser_tabstrip.h"
46 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 46 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
47 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" 47 #include "chrome/browser/ui/content_settings/content_setting_image_model.h"
48 #include "chrome/browser/ui/gtk/action_box_button_gtk.h"
48 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h" 49 #include "chrome/browser/ui/gtk/bookmarks/bookmark_bubble_gtk.h"
49 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h" 50 #include "chrome/browser/ui/gtk/bookmarks/bookmark_utils_gtk.h"
50 #include "chrome/browser/ui/gtk/browser_window_gtk.h" 51 #include "chrome/browser/ui/gtk/browser_window_gtk.h"
51 #include "chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h" 52 #include "chrome/browser/ui/gtk/chrome_to_mobile_bubble_gtk.h"
52 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h" 53 #include "chrome/browser/ui/gtk/content_setting_bubble_gtk.h"
53 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h" 54 #include "chrome/browser/ui/gtk/extensions/extension_popup_gtk.h"
54 #include "chrome/browser/ui/gtk/first_run_bubble.h" 55 #include "chrome/browser/ui/gtk/first_run_bubble.h"
55 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 56 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
56 #include "chrome/browser/ui/gtk/gtk_util.h" 57 #include "chrome/browser/ui/gtk/gtk_util.h"
57 #include "chrome/browser/ui/gtk/nine_box.h" 58 #include "chrome/browser/ui/gtk/nine_box.h"
58 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h" 59 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h"
59 #include "chrome/browser/ui/gtk/rounded_window.h" 60 #include "chrome/browser/ui/gtk/rounded_window.h"
60 #include "chrome/browser/ui/gtk/view_id_util.h" 61 #include "chrome/browser/ui/gtk/view_id_util.h"
61 #include "chrome/browser/ui/gtk/zoom_bubble_gtk.h" 62 #include "chrome/browser/ui/gtk/zoom_bubble_gtk.h"
62 #include "chrome/browser/ui/omnibox/location_bar_util.h" 63 #include "chrome/browser/ui/omnibox/location_bar_util.h"
63 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" 64 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h"
64 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h" 65 #include "chrome/browser/ui/omnibox/omnibox_popup_model.h"
65 #include "chrome/browser/ui/tab_contents/tab_contents.h" 66 #include "chrome/browser/ui/tab_contents/tab_contents.h"
66 #include "chrome/browser/ui/webui/extensions/extension_info_ui.h" 67 #include "chrome/browser/ui/webui/extensions/extension_info_ui.h"
67 #include "chrome/browser/ui/zoom/zoom_controller.h" 68 #include "chrome/browser/ui/zoom/zoom_controller.h"
68 #include "chrome/common/chrome_notification_types.h" 69 #include "chrome/common/chrome_notification_types.h"
69 #include "chrome/common/extensions/extension.h" 70 #include "chrome/common/extensions/extension.h"
70 #include "chrome/common/extensions/extension_action.h" 71 #include "chrome/common/extensions/extension_action.h"
71 #include "chrome/common/extensions/extension_manifest_constants.h" 72 #include "chrome/common/extensions/extension_manifest_constants.h"
72 #include "chrome/common/extensions/extension_resource.h" 73 #include "chrome/common/extensions/extension_resource.h"
74 #include "chrome/common/extensions/extension_switch_utils.h"
73 #include "chrome/common/pref_names.h" 75 #include "chrome/common/pref_names.h"
74 #include "content/public/browser/navigation_entry.h" 76 #include "content/public/browser/navigation_entry.h"
75 #include "content/public/browser/notification_service.h" 77 #include "content/public/browser/notification_service.h"
76 #include "content/public/browser/web_contents.h" 78 #include "content/public/browser/web_contents.h"
77 #include "grit/generated_resources.h" 79 #include "grit/generated_resources.h"
78 #include "grit/theme_resources.h" 80 #include "grit/theme_resources.h"
79 #include "net/base/net_util.h" 81 #include "net/base/net_util.h"
80 #include "ui/base/accelerators/accelerator_gtk.h" 82 #include "ui/base/accelerators/accelerator_gtk.h"
81 #include "ui/base/dragdrop/gtk_dnd_util.h" 83 #include "ui/base/dragdrop/gtk_dnd_util.h"
82 #include "ui/base/gtk/gtk_hig_constants.h" 84 #include "ui/base/gtk/gtk_hig_constants.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_), 464 gtk_box_pack_start(GTK_BOX(tab_to_search_hint_),
463 tab_to_search_hint_trailing_label_, 465 tab_to_search_hint_trailing_label_,
464 FALSE, FALSE, 0); 466 FALSE, FALSE, 0);
465 // Show all children widgets of |tab_to_search_hint_| initially. 467 // Show all children widgets of |tab_to_search_hint_| initially.
466 gtk_widget_show_all(tab_to_search_hint_); 468 gtk_widget_show_all(tab_to_search_hint_);
467 gtk_widget_hide(tab_to_search_hint_); 469 gtk_widget_hide(tab_to_search_hint_);
468 // tab_to_search_hint_ gets hidden initially in OnChanged. Hiding it here 470 // tab_to_search_hint_ gets hidden initially in OnChanged. Hiding it here
469 // doesn't work, someone is probably calling show_all on our parent box. 471 // doesn't work, someone is probably calling show_all on our parent box.
470 gtk_box_pack_end(GTK_BOX(entry_box_), tab_to_search_hint_, FALSE, FALSE, 0); 472 gtk_box_pack_end(GTK_BOX(entry_box_), tab_to_search_hint_, FALSE, FALSE, 0);
471 473
472 // Hide the star and Chrome To Mobile icons in popups, app windows, etc. 474 if (extensions::switch_utils::IsActionBoxEnabled()) {
473 if (browser_defaults::bookmarks_enabled && !ShouldOnlyShowLocation()) { 475 // TODO(mpcomplete): should we hide this if ShouldOnlyShowLocation()==true?
476 action_box_button_.reset(new ActionBoxButtonGtk(browser_));
477
478 // TODO(mpcomplete): Figure out why CustomDrawButton is offset 3 pixels.
479 // This offset corrects the strange offset of CustomDrawButton.
480 const int kMagicActionBoxYOffset = 3;
481 GtkWidget* alignment = gtk_alignment_new(0, 0, 1, 1);
482 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
483 0, kMagicActionBoxYOffset,
484 0, kInnerPadding);
485 gtk_container_add(GTK_CONTAINER(alignment), action_box_button_->widget());
486
487 gtk_box_pack_end(GTK_BOX(hbox_.get()), alignment,
488 FALSE, FALSE, 0);
489 } else if (browser_defaults::bookmarks_enabled && !ShouldOnlyShowLocation()) {
490 // Hide the star and Chrome To Mobile icons in popups, app windows, etc.
474 CreateStarButton(); 491 CreateStarButton();
475 gtk_box_pack_end(GTK_BOX(hbox_.get()), star_.get(), FALSE, FALSE, 0); 492 gtk_box_pack_end(GTK_BOX(hbox_.get()), star_.get(), FALSE, FALSE, 0);
476 493
477 // Also disable Chrome To Mobile for off-the-record and non-synced profiles, 494 // Also disable Chrome To Mobile for off-the-record and non-synced profiles,
478 // or if the feature is disabled by a command line flag or chrome://flags. 495 // or if the feature is disabled by a command line flag or chrome://flags.
479 if (!profile->IsOffTheRecord() && profile->IsSyncAccessible() && 496 if (!profile->IsOffTheRecord() && profile->IsSyncAccessible() &&
480 ChromeToMobileService::IsChromeToMobileEnabled()) { 497 ChromeToMobileService::IsChromeToMobileEnabled()) {
481 CreateChromeToMobileButton(); 498 CreateChromeToMobileButton();
482 gtk_box_pack_end(GTK_BOX(hbox_.get()), chrome_to_mobile_view_.get(), 499 gtk_box_pack_end(GTK_BOX(hbox_.get()), chrome_to_mobile_view_.get(),
483 FALSE, FALSE, 0); 500 FALSE, FALSE, 0);
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 } 2051 }
2035 2052
2036 void LocationBarViewGtk::PageActionViewGtk::InspectPopup( 2053 void LocationBarViewGtk::PageActionViewGtk::InspectPopup(
2037 ExtensionAction* action) { 2054 ExtensionAction* action) {
2038 ExtensionPopupGtk::Show( 2055 ExtensionPopupGtk::Show(
2039 action->GetPopupUrl(current_tab_id_), 2056 action->GetPopupUrl(current_tab_id_),
2040 owner_->browser_, 2057 owner_->browser_,
2041 event_box_.get(), 2058 event_box_.get(),
2042 ExtensionPopupGtk::SHOW_AND_INSPECT); 2059 ExtensionPopupGtk::SHOW_AND_INSPECT);
2043 } 2060 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/location_bar_view_gtk.h ('k') | chrome/browser/ui/gtk/view_id_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698