| OLD | NEW |
| 1 // Copyright (c) 2011 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/chromeos/notifications/balloon_view.h" | 5 #include "chrome/browser/chromeos/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" |
| 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/chromeos/notifications/balloon_view_host.h" | 13 #include "chrome/browser/chromeos/notifications/balloon_view_host.h" |
| 14 #include "chrome/browser/chromeos/notifications/notification_panel.h" | 14 #include "chrome/browser/chromeos/notifications/notification_panel.h" |
| 15 #include "chrome/browser/notifications/balloon.h" | 15 #include "chrome/browser/notifications/balloon.h" |
| 16 #include "chrome/browser/notifications/desktop_notification_service.h" | 16 #include "chrome/browser/notifications/desktop_notification_service.h" |
| 17 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 17 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
| 18 #include "chrome/browser/notifications/notification.h" | 18 #include "chrome/browser/notifications/notification.h" |
| 19 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 20 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" | 20 #include "chrome/browser/ui/views/notifications/balloon_view_host.h" |
| 21 #include "chrome/common/chrome_notification_types.h" | 21 #include "chrome/common/chrome_notification_types.h" |
| 22 #include "content/browser/renderer_host/render_view_host.h" | 22 #include "content/browser/renderer_host/render_view_host.h" |
| 23 #include "content/browser/renderer_host/render_widget_host_view.h" | |
| 24 #include "content/public/browser/notification_details.h" | 23 #include "content/public/browser/notification_details.h" |
| 25 #include "content/public/browser/notification_source.h" | 24 #include "content/public/browser/notification_source.h" |
| 25 #include "content/public/browser/render_widget_host_view.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 28 #include "grit/theme_resources.h" | 28 #include "grit/theme_resources.h" |
| 29 #include "grit/theme_resources_standard.h" | 29 #include "grit/theme_resources_standard.h" |
| 30 #include "ui/base/l10n/l10n_util.h" | 30 #include "ui/base/l10n/l10n_util.h" |
| 31 #include "ui/base/models/simple_menu_model.h" | 31 #include "ui/base/models/simple_menu_model.h" |
| 32 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 33 #include "ui/views/background.h" | 33 #include "ui/views/background.h" |
| 34 #include "ui/views/controls/button/button.h" | 34 #include "ui/views/controls/button/button.h" |
| 35 #include "ui/views/controls/button/image_button.h" | 35 #include "ui/views/controls/button/image_button.h" |
| 36 #include "ui/views/controls/button/menu_button.h" | 36 #include "ui/views/controls/button/menu_button.h" |
| 37 #include "ui/views/controls/label.h" | 37 #include "ui/views/controls/label.h" |
| 38 #include "ui/views/controls/menu/menu_item_view.h" | 38 #include "ui/views/controls/menu/menu_item_view.h" |
| 39 #include "ui/views/controls/menu/menu_model_adapter.h" | 39 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 40 #include "ui/views/controls/menu/menu_runner.h" | 40 #include "ui/views/controls/menu/menu_runner.h" |
| 41 #include "ui/views/controls/menu/view_menu_delegate.h" | 41 #include "ui/views/controls/menu/view_menu_delegate.h" |
| 42 #include "ui/views/widget/widget.h" | 42 #include "ui/views/widget/widget.h" |
| 43 | 43 |
| 44 using content::RenderWidgetHostView; |
| 45 |
| 44 namespace { | 46 namespace { |
| 45 // Menu commands | 47 // Menu commands |
| 46 const int kNoopCommand = 0; | 48 const int kNoopCommand = 0; |
| 47 const int kRevokePermissionCommand = 1; | 49 const int kRevokePermissionCommand = 1; |
| 48 | 50 |
| 49 // Vertical margin between close button and menu button. | 51 // Vertical margin between close button and menu button. |
| 50 const int kControlButtonsMargin = 6; | 52 const int kControlButtonsMargin = 6; |
| 51 | 53 |
| 52 // Top, Right margin for notification control view. | 54 // Top, Right margin for notification control view. |
| 53 const int kControlViewTopMargin = 4; | 55 const int kControlViewTopMargin = 4; |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 } | 365 } |
| 364 | 366 |
| 365 gfx::NativeView BalloonViewImpl::GetParentNativeView() { | 367 gfx::NativeView BalloonViewImpl::GetParentNativeView() { |
| 366 RenderWidgetHostView* view = | 368 RenderWidgetHostView* view = |
| 367 html_contents_->web_contents()->GetRenderViewHost()->view(); | 369 html_contents_->web_contents()->GetRenderViewHost()->view(); |
| 368 DCHECK(view); | 370 DCHECK(view); |
| 369 return view->GetNativeView(); | 371 return view->GetNativeView(); |
| 370 } | 372 } |
| 371 | 373 |
| 372 } // namespace chromeos | 374 } // namespace chromeos |
| OLD | NEW |