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

Side by Side Diff: chrome/browser/ui/views/notifications/balloon_view_views.cc

Issue 10832107: views: Forward declare more classes in balloon_view_views.h. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/views/notifications/balloon_view_views.h ('k') | no next file » | 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/views/notifications/balloon_view_views.h" 5 #include "chrome/browser/ui/views/notifications/balloon_view_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/notifications/balloon.h"
14 #include "chrome/browser/notifications/balloon_collection.h" 13 #include "chrome/browser/notifications/balloon_collection.h"
15 #include "chrome/browser/notifications/desktop_notification_service.h" 14 #include "chrome/browser/notifications/desktop_notification_service.h"
16 #include "chrome/browser/notifications/notification.h" 15 #include "chrome/browser/notifications/notification.h"
17 #include "chrome/browser/notifications/notification_options_menu_model.h" 16 #include "chrome/browser/notifications/notification_options_menu_model.h"
18 #include "chrome/common/chrome_notification_types.h" 17 #include "chrome/common/chrome_notification_types.h"
19 #include "content/public/browser/notification_details.h" 18 #include "content/public/browser/notification_details.h"
20 #include "content/public/browser/notification_source.h" 19 #include "content/public/browser/notification_source.h"
21 #include "content/public/browser/notification_types.h" 20 #include "content/public/browser/notification_types.h"
22 #include "content/public/browser/render_view_host.h" 21 #include "content/public/browser/render_view_host.h"
23 #include "content/public/browser/render_widget_host_view.h" 22 #include "content/public/browser/render_widget_host_view.h"
24 #include "content/public/browser/web_contents.h" 23 #include "content/public/browser/web_contents.h"
25 #include "grit/generated_resources.h" 24 #include "grit/generated_resources.h"
26 #include "grit/theme_resources.h" 25 #include "grit/theme_resources.h"
27 #include "ui/base/animation/slide_animation.h" 26 #include "ui/base/animation/slide_animation.h"
28 #include "ui/base/l10n/l10n_util.h" 27 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/resource/resource_bundle.h" 28 #include "ui/base/resource/resource_bundle.h"
30 #include "ui/gfx/canvas.h" 29 #include "ui/gfx/canvas.h"
31 #include "ui/gfx/insets.h" 30 #include "ui/gfx/insets.h"
32 #include "ui/gfx/native_widget_types.h" 31 #include "ui/gfx/native_widget_types.h"
32 #include "ui/gfx/path.h"
33 #include "ui/views/bubble/bubble_border.h" 33 #include "ui/views/bubble/bubble_border.h"
34 #include "ui/views/controls/button/button.h"
35 #include "ui/views/controls/button/image_button.h" 34 #include "ui/views/controls/button/image_button.h"
35 #include "ui/views/controls/button/menu_button.h"
36 #include "ui/views/controls/button/text_button.h" 36 #include "ui/views/controls/button/text_button.h"
37 #include "ui/views/controls/label.h"
37 #include "ui/views/controls/menu/menu_item_view.h" 38 #include "ui/views/controls/menu/menu_item_view.h"
38 #include "ui/views/controls/menu/menu_model_adapter.h" 39 #include "ui/views/controls/menu/menu_model_adapter.h"
39 #include "ui/views/controls/menu/menu_runner.h" 40 #include "ui/views/controls/menu/menu_runner.h"
40 #include "ui/views/controls/native/native_view_host.h" 41 #include "ui/views/controls/native/native_view_host.h"
41 #include "ui/views/painter.h" 42 #include "ui/views/painter.h"
42 #include "ui/views/widget/widget.h" 43 #include "ui/views/widget/widget.h"
43 44
44 #if defined(OS_CHROMEOS) 45 #if defined(OS_CHROMEOS)
45 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h" 46 #include "chrome/browser/chromeos/notifications/balloon_view_host_chromeos.h"
46 #else 47 #else
47 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" 48 #include "chrome/browser/ui/views/notifications/balloon_view_host.h"
48 #endif 49 #endif
49 50
50 using views::Widget;
51
52 namespace { 51 namespace {
53 52
54 const int kTopMargin = 2; 53 const int kTopMargin = 2;
55 const int kBottomMargin = 0; 54 const int kBottomMargin = 0;
56 const int kLeftMargin = 4; 55 const int kLeftMargin = 4;
57 const int kRightMargin = 4; 56 const int kRightMargin = 4;
58 const int kShelfBorderTopOverlap = 0; 57 const int kShelfBorderTopOverlap = 0;
59 58
60 // Properties of the dismiss button. 59 // Properties of the dismiss button.
61 const int kDismissButtonWidth = 14; 60 const int kDismissButtonWidth = 14;
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 gfx::Rect contents_rect = GetContentsRectangle(); 350 gfx::Rect contents_rect = GetContentsRectangle();
352 #if defined(OS_CHROMEOS) && defined(USE_AURA) 351 #if defined(OS_CHROMEOS) && defined(USE_AURA)
353 html_contents_.reset(new chromeos::BalloonViewHost(balloon)); 352 html_contents_.reset(new chromeos::BalloonViewHost(balloon));
354 #else 353 #else
355 html_contents_.reset(new BalloonViewHost(balloon)); 354 html_contents_.reset(new BalloonViewHost(balloon));
356 #endif 355 #endif
357 html_contents_->SetPreferredSize(gfx::Size(10000, 10000)); 356 html_contents_->SetPreferredSize(gfx::Size(10000, 10000));
358 if (enable_web_ui_) 357 if (enable_web_ui_)
359 html_contents_->EnableWebUI(); 358 html_contents_->EnableWebUI();
360 359
361 html_container_ = new Widget; 360 html_container_ = new views::Widget;
362 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); 361 views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP);
363 params.bounds = contents_rect; 362 params.bounds = contents_rect;
364 html_container_->Init(params); 363 html_container_->Init(params);
365 html_container_->SetContentsView(html_contents_->view()); 364 html_container_->SetContentsView(html_contents_->view());
366 365
367 gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight()); 366 gfx::Rect balloon_rect(x(), y(), GetTotalWidth(), GetTotalHeight());
368 frame_container_ = new Widget; 367 frame_container_ = new views::Widget;
369 params.delegate = this; 368 params.delegate = this;
370 params.transparent = true; 369 params.transparent = true;
371 params.bounds = balloon_rect; 370 params.bounds = balloon_rect;
372 frame_container_->Init(params); 371 frame_container_->Init(params);
373 frame_container_->SetContentsView(this); 372 frame_container_->SetContentsView(this);
374 frame_container_->StackAboveWidget(html_container_); 373 frame_container_->StackAboveWidget(html_container_);
375 374
376 // SetAlwaysOnTop should be called after StackAboveWidget because otherwise 375 // SetAlwaysOnTop should be called after StackAboveWidget because otherwise
377 // the top-most flag will be removed. 376 // the top-most flag will be removed.
378 html_container_->SetAlwaysOnTop(true); 377 html_container_->SetAlwaysOnTop(true);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 return; 539 return;
541 } 540 }
542 541
543 // If the renderer process attached to this balloon is disconnected 542 // If the renderer process attached to this balloon is disconnected
544 // (e.g., because of a crash), we want to close the balloon. 543 // (e.g., because of a crash), we want to close the balloon.
545 notification_registrar_.Remove( 544 notification_registrar_.Remove(
546 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, 545 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED,
547 content::Source<Balloon>(balloon_)); 546 content::Source<Balloon>(balloon_));
548 Close(false); 547 Close(false);
549 } 548 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/notifications/balloon_view_views.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698