| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromeos/notifications/balloon_view.h" | 5 #include "chrome/browser/chromeos/notifications/balloon_view.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 BalloonViewImpl::BalloonViewImpl(bool sticky, bool controls) | 38 BalloonViewImpl::BalloonViewImpl(bool sticky, bool controls) |
| 39 : balloon_(NULL), | 39 : balloon_(NULL), |
| 40 html_contents_(NULL), | 40 html_contents_(NULL), |
| 41 method_factory_(this), | 41 method_factory_(this), |
| 42 close_button_(NULL), | 42 close_button_(NULL), |
| 43 options_menu_contents_(NULL), | 43 options_menu_contents_(NULL), |
| 44 options_menu_menu_(NULL), | 44 options_menu_menu_(NULL), |
| 45 options_menu_button_(NULL), | 45 options_menu_button_(NULL), |
| 46 stale_(false), | 46 stale_(false), |
| 47 sticky_(sticky), | 47 sticky_(sticky), |
| 48 controls_(controls), | 48 controls_(controls) { |
| 49 closed_by_user_(false) { | |
| 50 // This object is not to be deleted by the views hierarchy, | 49 // This object is not to be deleted by the views hierarchy, |
| 51 // as it is owned by the balloon. | 50 // as it is owned by the balloon. |
| 52 set_parent_owned(false); | 51 set_parent_owned(false); |
| 53 } | 52 } |
| 54 | 53 |
| 55 BalloonViewImpl::~BalloonViewImpl() { | 54 BalloonViewImpl::~BalloonViewImpl() { |
| 56 if (html_contents_) { | 55 if (html_contents_) { |
| 57 html_contents_->Shutdown(); | 56 html_contents_->Shutdown(); |
| 58 } | 57 } |
| 59 } | 58 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon)); | 107 NotificationType::NOTIFY_BALLOON_DISCONNECTED, Source<Balloon>(balloon)); |
| 109 } | 108 } |
| 110 | 109 |
| 111 void BalloonViewImpl::Update() { | 110 void BalloonViewImpl::Update() { |
| 112 stale_ = false; | 111 stale_ = false; |
| 113 html_contents_->render_view_host()->NavigateToURL( | 112 html_contents_->render_view_host()->NavigateToURL( |
| 114 balloon_->notification().content_url()); | 113 balloon_->notification().content_url()); |
| 115 } | 114 } |
| 116 | 115 |
| 117 void BalloonViewImpl::Close(bool by_user) { | 116 void BalloonViewImpl::Close(bool by_user) { |
| 118 closed_by_user_ = by_user; | |
| 119 MessageLoop::current()->PostTask( | 117 MessageLoop::current()->PostTask( |
| 120 FROM_HERE, | 118 FROM_HERE, |
| 121 method_factory_.NewRunnableMethod( | 119 method_factory_.NewRunnableMethod( |
| 122 &BalloonViewImpl::DelayedClose, by_user)); | 120 &BalloonViewImpl::DelayedClose, by_user)); |
| 123 } | 121 } |
| 124 | 122 |
| 125 gfx::Size BalloonViewImpl::GetSize() const { | 123 gfx::Size BalloonViewImpl::GetSize() const { |
| 126 // Not used. The layout is managed by the Panel. | 124 // Not used. The layout is managed by the Panel. |
| 127 return gfx::Size(0, 0); | 125 return gfx::Size(0, 0); |
| 128 } | 126 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); | 242 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); |
| 245 } | 243 } |
| 246 | 244 |
| 247 void BalloonViewImpl::DelayedClose(bool by_user) { | 245 void BalloonViewImpl::DelayedClose(bool by_user) { |
| 248 html_contents_->Shutdown(); | 246 html_contents_->Shutdown(); |
| 249 html_contents_ = NULL; | 247 html_contents_ = NULL; |
| 250 balloon_->OnClose(by_user); | 248 balloon_->OnClose(by_user); |
| 251 } | 249 } |
| 252 | 250 |
| 253 } // namespace chromeos | 251 } // namespace chromeos |
| OLD | NEW |