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

Side by Side Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/omnibox/omnibox_view_gtk.h" 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/string_util.h" 13 #include "base/string_util.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.h"
15 #include "chrome/app/chrome_command_ids.h" 15 #include "chrome/app/chrome_command_ids.h"
16 #include "chrome/browser/autocomplete/autocomplete_edit.h" 16 #include "chrome/browser/autocomplete/autocomplete_edit.h"
17 #include "chrome/browser/autocomplete/autocomplete_match.h" 17 #include "chrome/browser/autocomplete/autocomplete_match.h"
18 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" 18 #include "chrome/browser/autocomplete/autocomplete_popup_model.h"
19 #include "chrome/browser/bookmarks/bookmark_node_data.h" 19 #include "chrome/browser/bookmarks/bookmark_node_data.h"
20 #include "chrome/browser/command_updater.h" 20 #include "chrome/browser/command_updater.h"
21 #include "chrome/browser/defaults.h" 21 #include "chrome/browser/defaults.h"
22 #include "chrome/browser/instant/instant_controller.h" 22 #include "chrome/browser/instant/instant_controller.h"
23 #include "chrome/browser/platform_util.h" 23 #include "chrome/browser/platform_util.h"
24 #include "chrome/browser/ui/gtk/gtk_util.h" 24 #include "chrome/browser/ui/gtk/gtk_util.h"
25 #include "chrome/browser/ui/gtk/view_id_util.h" 25 #include "chrome/browser/ui/gtk/view_id_util.h"
26 #include "chrome/browser/ui/toolbar/toolbar_model.h" 26 #include "chrome/browser/ui/toolbar/toolbar_model.h"
27 #include "chrome/common/chrome_notification_types.h"
27 #include "content/browser/tab_contents/tab_contents.h" 28 #include "content/browser/tab_contents/tab_contents.h"
28 #include "content/common/notification_service.h" 29 #include "content/common/notification_service.h"
29 #include "googleurl/src/gurl.h" 30 #include "googleurl/src/gurl.h"
30 #include "grit/generated_resources.h" 31 #include "grit/generated_resources.h"
31 #include "net/base/escape.h" 32 #include "net/base/escape.h"
32 #include "third_party/undoview/undo_view.h" 33 #include "third_party/undoview/undo_view.h"
33 #include "ui/base/animation/multi_animation.h" 34 #include "ui/base/animation/multi_animation.h"
34 #include "ui/base/dragdrop/drag_drop_types.h" 35 #include "ui/base/dragdrop/drag_drop_types.h"
35 #include "ui/base/l10n/l10n_util.h" 36 #include "ui/base/l10n/l10n_util.h"
36 #include "ui/base/resource/resource_bundle.h" 37 #include "ui/base/resource/resource_bundle.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 popup_view_.reset( 206 popup_view_.reset(
206 #if defined(TOOLKIT_VIEWS) 207 #if defined(TOOLKIT_VIEWS)
207 new AutocompletePopupContentsView 208 new AutocompletePopupContentsView
208 #else 209 #else
209 new OmniboxPopupViewGtk 210 new OmniboxPopupViewGtk
210 #endif 211 #endif
211 (GetFont(), this, model_.get(), profile, location_bar)); 212 (GetFont(), this, model_.get(), profile, location_bar));
212 } 213 }
213 214
214 OmniboxViewGtk::~OmniboxViewGtk() { 215 OmniboxViewGtk::~OmniboxViewGtk() {
215 NotificationService::current()->Notify(NotificationType::OMNIBOX_DESTROYED, 216 NotificationService::current()->Notify(chrome::OMNIBOX_DESTROYED,
216 Source<OmniboxViewGtk>(this), 217 Source<OmniboxViewGtk>(this),
217 NotificationService::NoDetails()); 218 NotificationService::NoDetails());
218 219
219 // Explicitly teardown members which have a reference to us. Just to be safe 220 // Explicitly teardown members which have a reference to us. Just to be safe
220 // we want them to be destroyed before destroying any other internal state. 221 // we want them to be destroyed before destroying any other internal state.
221 popup_view_.reset(); 222 popup_view_.reset();
222 model_.reset(); 223 model_.reset();
223 224
224 // We own our widget and TextView related objects. 225 // We own our widget and TextView related objects.
225 if (alignment_.get()) { // Init() has been called. 226 if (alignment_.get()) { // Init() has been called.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 ui::MultiAnimation::Parts parts; 402 ui::MultiAnimation::Parts parts;
402 parts.push_back(ui::MultiAnimation::Part( 403 parts.push_back(ui::MultiAnimation::Part(
403 InstantController::kAutoCommitPauseTimeMS, ui::Tween::ZERO)); 404 InstantController::kAutoCommitPauseTimeMS, ui::Tween::ZERO));
404 parts.push_back(ui::MultiAnimation::Part( 405 parts.push_back(ui::MultiAnimation::Part(
405 InstantController::kAutoCommitFadeInTimeMS, ui::Tween::EASE_IN)); 406 InstantController::kAutoCommitFadeInTimeMS, ui::Tween::EASE_IN));
406 instant_animation_.reset(new ui::MultiAnimation(parts)); 407 instant_animation_.reset(new ui::MultiAnimation(parts));
407 instant_animation_->set_continuous(false); 408 instant_animation_->set_continuous(false);
408 409
409 #if !defined(TOOLKIT_VIEWS) 410 #if !defined(TOOLKIT_VIEWS)
410 registrar_.Add(this, 411 registrar_.Add(this,
411 NotificationType::BROWSER_THEME_CHANGED, 412 chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
412 NotificationService::AllSources()); 413 NotificationService::AllSources());
413 theme_service_->InitThemesFor(this); 414 theme_service_->InitThemesFor(this);
414 #else 415 #else
415 // Manually invoke SetBaseColor() because TOOLKIT_VIEWS doesn't observe 416 // Manually invoke SetBaseColor() because TOOLKIT_VIEWS doesn't observe
416 // themes. 417 // themes.
417 SetBaseColor(); 418 SetBaseColor();
418 #endif 419 #endif
419 420
420 ViewIDUtil::SetID(GetNativeView(), VIEW_ID_AUTOCOMPLETE); 421 ViewIDUtil::SetID(GetNativeView(), VIEW_ID_AUTOCOMPLETE);
421 } 422 }
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 // Make all the children of the widget visible. NOTE: this won't display 904 // Make all the children of the widget visible. NOTE: this won't display
904 // anything, it just toggles the visible flag. 905 // anything, it just toggles the visible flag.
905 gtk_widget_show_all(omnibox_view->GetNativeView()); 906 gtk_widget_show_all(omnibox_view->GetNativeView());
906 // Hide the widget. NativeViewHostGtk will make it visible again as necessary. 907 // Hide the widget. NativeViewHostGtk will make it visible again as necessary.
907 gtk_widget_hide(omnibox_view->GetNativeView()); 908 gtk_widget_hide(omnibox_view->GetNativeView());
908 909
909 return omnibox_view; 910 return omnibox_view;
910 } 911 }
911 #endif 912 #endif
912 913
913 void OmniboxViewGtk::Observe(NotificationType type, 914 void OmniboxViewGtk::Observe(int type,
914 const NotificationSource& source, 915 const NotificationSource& source,
915 const NotificationDetails& details) { 916 const NotificationDetails& details) {
916 DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); 917 DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED);
917 918
918 SetBaseColor(); 919 SetBaseColor();
919 } 920 }
920 921
921 void OmniboxViewGtk::AnimationEnded(const ui::Animation* animation) { 922 void OmniboxViewGtk::AnimationEnded(const ui::Animation* animation) {
922 model_->CommitSuggestedText(false); 923 model_->CommitSuggestedText(false);
923 } 924 }
924 925
925 void OmniboxViewGtk::AnimationProgressed(const ui::Animation* animation) { 926 void OmniboxViewGtk::AnimationProgressed(const ui::Animation* animation) {
926 UpdateInstantViewColors(); 927 UpdateInstantViewColors();
(...skipping 1405 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 // baseline, so we need to move the |instant_view_| down to make sure it 2333 // baseline, so we need to move the |instant_view_| down to make sure it
2333 // has the same baseline as the |text_view_|. 2334 // has the same baseline as the |text_view_|.
2334 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); 2335 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_));
2335 int height; 2336 int height;
2336 pango_layout_get_size(layout, NULL, &height); 2337 pango_layout_get_size(layout, NULL, &height);
2337 PangoLayoutIter* iter = pango_layout_get_iter(layout); 2338 PangoLayoutIter* iter = pango_layout_get_iter(layout);
2338 int baseline = pango_layout_iter_get_baseline(iter); 2339 int baseline = pango_layout_iter_get_baseline(iter);
2339 pango_layout_iter_free(iter); 2340 pango_layout_iter_free(iter);
2340 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); 2341 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL);
2341 } 2342 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.h ('k') | chrome/browser/ui/gtk/overflow_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698