OLD | NEW |
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.h" | 5 #include "chrome/browser/ui/views/notifications/balloon_view.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" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 if (!balloon_) | 147 if (!balloon_) |
148 return gfx::Size(0, 0); | 148 return gfx::Size(0, 0); |
149 | 149 |
150 return gfx::Size(GetTotalWidth(), GetTotalHeight()); | 150 return gfx::Size(GetTotalWidth(), GetTotalHeight()); |
151 } | 151 } |
152 | 152 |
153 BalloonHost* BalloonViewImpl::GetHost() const { | 153 BalloonHost* BalloonViewImpl::GetHost() const { |
154 return html_contents_.get(); | 154 return html_contents_.get(); |
155 } | 155 } |
156 | 156 |
157 void BalloonViewImpl::RunMenu(views::View* source, const gfx::Point& pt) { | 157 void BalloonViewImpl::OnMenuButtonClicked(views::View* source, |
| 158 const gfx::Point& point) { |
158 CreateOptionsMenu(); | 159 CreateOptionsMenu(); |
159 | 160 |
160 views::MenuModelAdapter menu_model_adapter(options_menu_model_.get()); | 161 views::MenuModelAdapter menu_model_adapter(options_menu_model_.get()); |
161 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu())); | 162 menu_runner_.reset(new views::MenuRunner(menu_model_adapter.CreateMenu())); |
162 | 163 |
163 gfx::Point screen_location; | 164 gfx::Point screen_location; |
164 views::View::ConvertPointToScreen(options_menu_button_, &screen_location); | 165 views::View::ConvertPointToScreen(options_menu_button_, &screen_location); |
165 if (menu_runner_->RunMenuAt( | 166 if (menu_runner_->RunMenuAt( |
166 source->GetWidget()->GetTopLevelWidget(), | 167 source->GetWidget()->GetTopLevelWidget(), |
167 options_menu_button_, | 168 options_menu_button_, |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 return; | 533 return; |
533 } | 534 } |
534 | 535 |
535 // If the renderer process attached to this balloon is disconnected | 536 // If the renderer process attached to this balloon is disconnected |
536 // (e.g., because of a crash), we want to close the balloon. | 537 // (e.g., because of a crash), we want to close the balloon. |
537 notification_registrar_.Remove( | 538 notification_registrar_.Remove( |
538 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, | 539 this, chrome::NOTIFICATION_NOTIFY_BALLOON_DISCONNECTED, |
539 content::Source<Balloon>(balloon_)); | 540 content::Source<Balloon>(balloon_)); |
540 Close(false); | 541 Close(false); |
541 } | 542 } |
OLD | NEW |