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

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>
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 popup_view_.reset( 205 popup_view_.reset(
206 #if defined(TOOLKIT_VIEWS) 206 #if defined(TOOLKIT_VIEWS)
207 new AutocompletePopupContentsView 207 new AutocompletePopupContentsView
208 #else 208 #else
209 new OmniboxPopupViewGtk 209 new OmniboxPopupViewGtk
210 #endif 210 #endif
211 (GetFont(), this, model_.get(), profile, location_bar)); 211 (GetFont(), this, model_.get(), profile, location_bar));
212 } 212 }
213 213
214 OmniboxViewGtk::~OmniboxViewGtk() { 214 OmniboxViewGtk::~OmniboxViewGtk() {
215 NotificationService::current()->Notify(NotificationType::OMNIBOX_DESTROYED, 215 NotificationService::current()->Notify(chrome::OMNIBOX_DESTROYED,
216 Source<OmniboxViewGtk>(this), 216 Source<OmniboxViewGtk>(this),
217 NotificationService::NoDetails()); 217 NotificationService::NoDetails());
218 218
219 // Explicitly teardown members which have a reference to us. Just to be safe 219 // 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. 220 // we want them to be destroyed before destroying any other internal state.
221 popup_view_.reset(); 221 popup_view_.reset();
222 model_.reset(); 222 model_.reset();
223 223
224 // We own our widget and TextView related objects. 224 // We own our widget and TextView related objects.
225 if (alignment_.get()) { // Init() has been called. 225 if (alignment_.get()) { // Init() has been called.
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 ui::MultiAnimation::Parts parts; 401 ui::MultiAnimation::Parts parts;
402 parts.push_back(ui::MultiAnimation::Part( 402 parts.push_back(ui::MultiAnimation::Part(
403 InstantController::kAutoCommitPauseTimeMS, ui::Tween::ZERO)); 403 InstantController::kAutoCommitPauseTimeMS, ui::Tween::ZERO));
404 parts.push_back(ui::MultiAnimation::Part( 404 parts.push_back(ui::MultiAnimation::Part(
405 InstantController::kAutoCommitFadeInTimeMS, ui::Tween::EASE_IN)); 405 InstantController::kAutoCommitFadeInTimeMS, ui::Tween::EASE_IN));
406 instant_animation_.reset(new ui::MultiAnimation(parts)); 406 instant_animation_.reset(new ui::MultiAnimation(parts));
407 instant_animation_->set_continuous(false); 407 instant_animation_->set_continuous(false);
408 408
409 #if !defined(TOOLKIT_VIEWS) 409 #if !defined(TOOLKIT_VIEWS)
410 registrar_.Add(this, 410 registrar_.Add(this,
411 NotificationType::BROWSER_THEME_CHANGED, 411 chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
412 NotificationService::AllSources()); 412 NotificationService::AllSources());
413 theme_service_->InitThemesFor(this); 413 theme_service_->InitThemesFor(this);
414 #else 414 #else
415 // Manually invoke SetBaseColor() because TOOLKIT_VIEWS doesn't observe 415 // Manually invoke SetBaseColor() because TOOLKIT_VIEWS doesn't observe
416 // themes. 416 // themes.
417 SetBaseColor(); 417 SetBaseColor();
418 #endif 418 #endif
419 419
420 ViewIDUtil::SetID(GetNativeView(), VIEW_ID_AUTOCOMPLETE); 420 ViewIDUtil::SetID(GetNativeView(), VIEW_ID_AUTOCOMPLETE);
421 } 421 }
(...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 903 // Make all the children of the widget visible. NOTE: this won't display
904 // anything, it just toggles the visible flag. 904 // anything, it just toggles the visible flag.
905 gtk_widget_show_all(omnibox_view->GetNativeView()); 905 gtk_widget_show_all(omnibox_view->GetNativeView());
906 // Hide the widget. NativeViewHostGtk will make it visible again as necessary. 906 // Hide the widget. NativeViewHostGtk will make it visible again as necessary.
907 gtk_widget_hide(omnibox_view->GetNativeView()); 907 gtk_widget_hide(omnibox_view->GetNativeView());
908 908
909 return omnibox_view; 909 return omnibox_view;
910 } 910 }
911 #endif 911 #endif
912 912
913 void OmniboxViewGtk::Observe(NotificationType type, 913 void OmniboxViewGtk::Observe(int type,
914 const NotificationSource& source, 914 const NotificationSource& source,
915 const NotificationDetails& details) { 915 const NotificationDetails& details) {
916 DCHECK(type == NotificationType::BROWSER_THEME_CHANGED); 916 DCHECK(type == chrome::NOTIFICATION_BROWSER_THEME_CHANGED);
917 917
918 SetBaseColor(); 918 SetBaseColor();
919 } 919 }
920 920
921 void OmniboxViewGtk::AnimationEnded(const ui::Animation* animation) { 921 void OmniboxViewGtk::AnimationEnded(const ui::Animation* animation) {
922 model_->CommitSuggestedText(false); 922 model_->CommitSuggestedText(false);
923 } 923 }
924 924
925 void OmniboxViewGtk::AnimationProgressed(const ui::Animation* animation) { 925 void OmniboxViewGtk::AnimationProgressed(const ui::Animation* animation) {
926 UpdateInstantViewColors(); 926 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 2332 // baseline, so we need to move the |instant_view_| down to make sure it
2333 // has the same baseline as the |text_view_|. 2333 // has the same baseline as the |text_view_|.
2334 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); 2334 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_));
2335 int height; 2335 int height;
2336 pango_layout_get_size(layout, NULL, &height); 2336 pango_layout_get_size(layout, NULL, &height);
2337 PangoLayoutIter* iter = pango_layout_get_iter(layout); 2337 PangoLayoutIter* iter = pango_layout_get_iter(layout);
2338 int baseline = pango_layout_iter_get_baseline(iter); 2338 int baseline = pango_layout_iter_get_baseline(iter);
2339 pango_layout_iter_free(iter); 2339 pango_layout_iter_free(iter);
2340 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); 2340 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL);
2341 } 2341 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698