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" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 gfx::Rect screen_bounds(GetImageBounds()); | 63 gfx::Rect screen_bounds(GetImageBounds()); |
64 gfx::Point origin(screen_bounds.origin()); | 64 gfx::Point origin(screen_bounds.origin()); |
65 views::View::ConvertPointToScreen(this, &origin); | 65 views::View::ConvertPointToScreen(this, &origin); |
66 screen_bounds.set_origin(origin); | 66 screen_bounds.set_origin(origin); |
67 ContentSettingBubbleContents* bubble_contents = | 67 ContentSettingBubbleContents* bubble_contents = |
68 new ContentSettingBubbleContents( | 68 new ContentSettingBubbleContents( |
69 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 69 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
70 tab_contents, profile_, | 70 tab_contents, profile_, |
71 content_setting_image_model_->get_content_settings_type()), | 71 content_setting_image_model_->get_content_settings_type()), |
72 profile_, tab_contents); | 72 profile_, tab_contents); |
73 info_bubble_ = | 73 info_bubble_ = InfoBubble::Show(GetWidget(), screen_bounds, |
74 InfoBubble::Show(GetWidget(), screen_bounds, BubbleBorder::TOP_LEFT, | 74 BubbleBorder::TOP_RIGHT, bubble_contents, this); |
75 bubble_contents, this); | |
76 bubble_contents->set_info_bubble(info_bubble_); | 75 bubble_contents->set_info_bubble(info_bubble_); |
77 } | 76 } |
78 | 77 |
79 void ContentSettingImageView::VisibilityChanged(View* starting_from, | 78 void ContentSettingImageView::VisibilityChanged(View* starting_from, |
80 bool is_visible) { | 79 bool is_visible) { |
81 if (!is_visible && info_bubble_) | 80 if (!is_visible && info_bubble_) |
82 info_bubble_->Close(); | 81 info_bubble_->Close(); |
83 } | 82 } |
84 | 83 |
85 void ContentSettingImageView::InfoBubbleClosing(InfoBubble* info_bubble, | 84 void ContentSettingImageView::InfoBubbleClosing(InfoBubble* info_bubble, |
86 bool closed_by_escape) { | 85 bool closed_by_escape) { |
87 info_bubble_ = NULL; | 86 info_bubble_ = NULL; |
88 } | 87 } |
89 | 88 |
90 bool ContentSettingImageView::CloseOnEscape() { | 89 bool ContentSettingImageView::CloseOnEscape() { |
91 return true; | 90 return true; |
92 } | 91 } |
93 | 92 |
OLD | NEW |