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/location_bar/content_setting_image_view.h" | 5 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 9 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 10 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
252 content::WebContents* web_contents = parent_->GetWebContents(); | 252 content::WebContents* web_contents = parent_->GetWebContents(); |
253 if (web_contents && !bubble_view_) { | 253 if (web_contents && !bubble_view_) { |
254 bubble_view_ = new ContentSettingBubbleContents( | 254 bubble_view_ = new ContentSettingBubbleContents( |
255 content_setting_image_model_->CreateBubbleModel( | 255 content_setting_image_model_->CreateBubbleModel( |
256 parent_->delegate()->GetContentSettingBubbleModelDelegate(), | 256 parent_->delegate()->GetContentSettingBubbleModelDelegate(), |
257 web_contents, parent_->profile()), | 257 web_contents, parent_->profile()), |
258 web_contents, this, views::BubbleBorder::TOP_RIGHT); | 258 web_contents, this, views::BubbleBorder::TOP_RIGHT); |
259 views::Widget* bubble_widget = | 259 views::Widget* bubble_widget = |
260 parent_->delegate()->CreateViewsBubble(bubble_view_); | 260 parent_->delegate()->CreateViewsBubble(bubble_view_); |
261 bubble_widget->AddObserver(this); | 261 bubble_widget->AddObserver(this); |
262 // This is triggered by an input event, the icon will be in an active state | |
263 // so the bubble doesn't need an arrow. | |
264 if (ui::MaterialDesignController::IsModeMaterial()) | |
265 bubble_view_->SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT); | |
Evan Stade
2016/03/04 04:25:14
you can put this in ContentSettingBubbleContents
| |
262 bubble_widget->Show(); | 266 bubble_widget->Show(); |
263 } | 267 } |
264 } | 268 } |
265 | 269 |
266 void ContentSettingImageView::UpdateImage() { | 270 void ContentSettingImageView::UpdateImage() { |
267 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); | 271 SetImage(content_setting_image_model_->GetIcon(GetTextColor()).AsImageSkia()); |
268 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); | 272 image()->SetTooltipText(content_setting_image_model_->get_tooltip()); |
269 } | 273 } |
270 | 274 |
271 bool ContentSettingImageView::IsBubbleShowing() const { | 275 bool ContentSettingImageView::IsBubbleShowing() const { |
272 return bubble_view_ != nullptr; | 276 return bubble_view_ != nullptr; |
273 } | 277 } |
OLD | NEW |