| 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/views/location_bar/content_setting_image_view.h" | 5 #include "chrome/browser/views/location_bar/content_setting_image_view.h" |
| 6 | 6 |
| 7 #include "app/resource_bundle.h" | 7 #include "app/resource_bundle.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/content_setting_bubble_model.h" | 9 #include "chrome/browser/content_setting_bubble_model.h" |
| 10 #include "chrome/browser/content_setting_image_model.h" | 10 #include "chrome/browser/content_setting_image_model.h" |
| 11 #include "chrome/browser/tab_contents/tab_contents.h" | 11 #include "chrome/browser/tab_contents/tab_contents.h" |
| 12 #include "chrome/browser/tab_contents_wrapper.h" |
| 12 #include "chrome/browser/views/content_setting_bubble_contents.h" | 13 #include "chrome/browser/views/content_setting_bubble_contents.h" |
| 13 #include "chrome/browser/views/location_bar/location_bar_view.h" | 14 #include "chrome/browser/views/location_bar/location_bar_view.h" |
| 14 | 15 |
| 15 ContentSettingImageView::ContentSettingImageView( | 16 ContentSettingImageView::ContentSettingImageView( |
| 16 ContentSettingsType content_type, | 17 ContentSettingsType content_type, |
| 17 const LocationBarView* parent, | 18 const LocationBarView* parent, |
| 18 Profile* profile) | 19 Profile* profile) |
| 19 : content_setting_image_model_( | 20 : content_setting_image_model_( |
| 20 ContentSettingImageModel::CreateContentSettingImageModel( | 21 ContentSettingImageModel::CreateContentSettingImageModel( |
| 21 content_type)), | 22 content_type)), |
| (...skipping 27 matching lines...) Expand all Loading... |
| 49 // We want to show the bubble on mouse release; that is the standard behavior | 50 // We want to show the bubble on mouse release; that is the standard behavior |
| 50 // for buttons. | 51 // for buttons. |
| 51 return true; | 52 return true; |
| 52 } | 53 } |
| 53 | 54 |
| 54 void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event, | 55 void ContentSettingImageView::OnMouseReleased(const views::MouseEvent& event, |
| 55 bool canceled) { | 56 bool canceled) { |
| 56 if (canceled || !HitTest(event.location())) | 57 if (canceled || !HitTest(event.location())) |
| 57 return; | 58 return; |
| 58 | 59 |
| 59 TabContents* tab_contents = parent_->GetTabContents(); | 60 TabContents* tab_contents = parent_->GetTabContentsWrapper()->tab_contents(); |
| 60 if (!tab_contents) | 61 if (!tab_contents) |
| 61 return; | 62 return; |
| 62 | 63 |
| 63 gfx::Rect screen_bounds(GetImageBounds()); | 64 gfx::Rect screen_bounds(GetImageBounds()); |
| 64 gfx::Point origin(screen_bounds.origin()); | 65 gfx::Point origin(screen_bounds.origin()); |
| 65 views::View::ConvertPointToScreen(this, &origin); | 66 views::View::ConvertPointToScreen(this, &origin); |
| 66 screen_bounds.set_origin(origin); | 67 screen_bounds.set_origin(origin); |
| 67 ContentSettingBubbleContents* bubble_contents = | 68 ContentSettingBubbleContents* bubble_contents = |
| 68 new ContentSettingBubbleContents( | 69 new ContentSettingBubbleContents( |
| 69 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 70 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 83 | 84 |
| 84 void ContentSettingImageView::InfoBubbleClosing(InfoBubble* info_bubble, | 85 void ContentSettingImageView::InfoBubbleClosing(InfoBubble* info_bubble, |
| 85 bool closed_by_escape) { | 86 bool closed_by_escape) { |
| 86 info_bubble_ = NULL; | 87 info_bubble_ = NULL; |
| 87 } | 88 } |
| 88 | 89 |
| 89 bool ContentSettingImageView::CloseOnEscape() { | 90 bool ContentSettingImageView::CloseOnEscape() { |
| 90 return true; | 91 return true; |
| 91 } | 92 } |
| 92 | 93 |
| OLD | NEW |