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

Side by Side Diff: chrome/browser/ui/panels/panel_browser_window_gtk.cc

Issue 8342048: Make NotificationService an interface in the content namespace, and switch callers to use it. Mov... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/panels/panel_browser_window_gtk.h" 5 #include "chrome/browser/ui/panels/panel_browser_window_gtk.h"
6 6
7 #include "chrome/browser/ui/browser_list.h" 7 #include "chrome/browser/ui/browser_list.h"
8 #include "chrome/browser/ui/panels/panel.h" 8 #include "chrome/browser/ui/panels/panel.h"
9 #include "chrome/browser/ui/panels/panel_manager.h" 9 #include "chrome/browser/ui/panels/panel_manager.h"
10 #include "chrome/browser/ui/panels/panel_settings_menu_model.h" 10 #include "chrome/browser/ui/panels/panel_settings_menu_model.h"
11 #include "chrome/common/chrome_notification_types.h" 11 #include "chrome/common/chrome_notification_types.h"
12 #include "content/common/notification_service.h" 12 #include "content/public/browser/notification_service.h"
13 #include "ui/base/animation/slide_animation.h" 13 #include "ui/base/animation/slide_animation.h"
14 #include "ui/base/dragdrop/gtk_dnd_util.h" 14 #include "ui/base/dragdrop/gtk_dnd_util.h"
15 15
16 namespace { 16 namespace {
17 17
18 // This value is experimental and subjective. 18 // This value is experimental and subjective.
19 const int kSetBoundsAnimationMs = 180; 19 const int kSetBoundsAnimationMs = 180;
20 20
21 // RGB values for titlebar in draw attention state. A shade of orange. 21 // RGB values for titlebar in draw attention state. A shade of orange.
22 const int kDrawAttentionR = 0xfa; 22 const int kDrawAttentionR = 0xfa;
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 window_size_known_ = true; 142 window_size_known_ = true;
143 int bottom = panel_->manager()->GetBottomPositionForExpansionState( 143 int bottom = panel_->manager()->GetBottomPositionForExpansionState(
144 panel_->expansion_state()); 144 panel_->expansion_state());
145 int top = bottom - height; 145 int top = bottom - height;
146 146
147 gtk_window_move(window_, bounds_.x(), top); 147 gtk_window_move(window_, bounds_.x(), top);
148 StartBoundsAnimation(gfx::Rect(bounds_.x(), top, width, height)); 148 StartBoundsAnimation(gfx::Rect(bounds_.x(), top, width, height));
149 panel_->OnWindowSizeAvailable(); 149 panel_->OnWindowSizeAvailable();
150 150
151 NotificationService::current()->Notify( 151 content::NotificationService::current()->Notify(
152 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN, 152 chrome::NOTIFICATION_PANEL_WINDOW_SIZE_KNOWN,
153 content::Source<Panel>(panel_.get()), 153 content::Source<Panel>(panel_.get()),
154 NotificationService::NoDetails()); 154 content::NotificationService::NoDetails());
155 } 155 }
156 156
157 bool PanelBrowserWindowGtk::UseCustomFrame() { 157 bool PanelBrowserWindowGtk::UseCustomFrame() {
158 // We always use custom frame for panels. 158 // We always use custom frame for panels.
159 return TRUE; 159 return TRUE;
160 } 160 }
161 161
162 void PanelBrowserWindowGtk::ShowSettingsMenu(GtkWidget* widget, 162 void PanelBrowserWindowGtk::ShowSettingsMenu(GtkWidget* widget,
163 GdkEventButton* event) { 163 GdkEventButton* event) {
164 if (!settings_menu_.get()) { 164 if (!settings_menu_.get()) {
(...skipping 24 matching lines...) Expand all
189 gdk_region_destroy(dest_region); 189 gdk_region_destroy(dest_region);
190 } 190 }
191 } 191 }
192 192
193 void PanelBrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) { 193 void PanelBrowserWindowGtk::ActiveWindowChanged(GdkWindow* active_window) {
194 bool was_active = IsActive(); 194 bool was_active = IsActive();
195 BrowserWindowGtk::ActiveWindowChanged(active_window); 195 BrowserWindowGtk::ActiveWindowChanged(active_window);
196 if (was_active == IsActive()) // State didn't change. 196 if (was_active == IsActive()) // State didn't change.
197 return; 197 return;
198 198
199 NotificationService::current()->Notify( 199 content::NotificationService::current()->Notify(
200 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS, 200 chrome::NOTIFICATION_PANEL_CHANGED_ACTIVE_STATUS,
201 content::Source<Panel>(panel_.get()), 201 content::Source<Panel>(panel_.get()),
202 NotificationService::NoDetails()); 202 content::NotificationService::NoDetails());
203 } 203 }
204 204
205 BrowserWindowGtk::TitleDecoration PanelBrowserWindowGtk::GetWindowTitle( 205 BrowserWindowGtk::TitleDecoration PanelBrowserWindowGtk::GetWindowTitle(
206 std::string* title) const { 206 std::string* title) const {
207 if (is_drawing_attention_) { 207 if (is_drawing_attention_) {
208 std::string title_original; 208 std::string title_original;
209 BrowserWindowGtk::TitleDecoration title_decoration = 209 BrowserWindowGtk::TitleDecoration title_decoration =
210 BrowserWindowGtk::GetWindowTitle(&title_original); 210 BrowserWindowGtk::GetWindowTitle(&title_original);
211 DCHECK_EQ(BrowserWindowGtk::PLAIN_TEXT, title_decoration); 211 DCHECK_EQ(BrowserWindowGtk::PLAIN_TEXT, title_decoration);
212 gchar* title_escaped = g_markup_escape_text(title_original.c_str(), -1); 212 gchar* title_escaped = g_markup_escape_text(title_original.c_str(), -1);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 GtkTargetList* list = ui::GetTargetListFromCodeMask(ui::CHROME_TAB); 421 GtkTargetList* list = ui::GetTargetListFromCodeMask(ui::CHROME_TAB);
422 gtk_drag_begin(drag_widget_, list, GDK_ACTION_MOVE, 1, last_mouse_down_); 422 gtk_drag_begin(drag_widget_, list, GDK_ACTION_MOVE, 1, last_mouse_down_);
423 // gtk_drag_begin increments reference count for GtkTargetList. So unref 423 // gtk_drag_begin increments reference count for GtkTargetList. So unref
424 // it here to reduce the reference count. 424 // it here to reduce the reference count.
425 gtk_target_list_unref(list); 425 gtk_target_list_unref(list);
426 panel_->manager()->StartDragging(panel_.get()); 426 panel_->manager()->StartDragging(panel_.get());
427 } 427 }
428 } 428 }
429 429
430 void PanelBrowserWindowGtk::AnimationEnded(const ui::Animation* animation) { 430 void PanelBrowserWindowGtk::AnimationEnded(const ui::Animation* animation) {
431 NotificationService::current()->Notify( 431 content::NotificationService::current()->Notify(
432 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED, 432 chrome::NOTIFICATION_PANEL_BOUNDS_ANIMATIONS_FINISHED,
433 content::Source<Panel>(panel_.get()), 433 content::Source<Panel>(panel_.get()),
434 NotificationService::NoDetails()); 434 content::NotificationService::NoDetails());
435 } 435 }
436 436
437 void PanelBrowserWindowGtk::AnimationProgressed( 437 void PanelBrowserWindowGtk::AnimationProgressed(
438 const ui::Animation* animation) { 438 const ui::Animation* animation) {
439 DCHECK(!drag_widget_); 439 DCHECK(!drag_widget_);
440 DCHECK(window_size_known_); 440 DCHECK(window_size_known_);
441 441
442 gfx::Rect new_bounds = bounds_animator_->CurrentValueBetween( 442 gfx::Rect new_bounds = bounds_animator_->CurrentValueBetween(
443 animation_start_bounds_, bounds_); 443 animation_start_bounds_, bounds_);
444 444
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 } 718 }
719 } 719 }
720 720
721 bool NativePanelTestingGtk::IsWindowSizeKnown() const { 721 bool NativePanelTestingGtk::IsWindowSizeKnown() const {
722 return panel_browser_window_gtk_->window_size_known_; 722 return panel_browser_window_gtk_->window_size_known_;
723 } 723 }
724 724
725 bool NativePanelTestingGtk::IsAnimatingBounds() const { 725 bool NativePanelTestingGtk::IsAnimatingBounds() const {
726 return panel_browser_window_gtk_->IsAnimatingBounds(); 726 return panel_browser_window_gtk_->IsAnimatingBounds();
727 } 727 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/panels/panel_browser_view.cc ('k') | chrome/browser/ui/panels/panel_window_controller_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698