| 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/content_setting_bubble_contents.h" | 5 #include "chrome/browser/ui/views/content_setting_bubble_contents.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/stl_util.h" | 14 #include "base/stl_util.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 16 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 17 #include "chrome/browser/plugins/plugin_finder.h" | 17 #include "chrome/browser/plugins/plugin_finder.h" |
| 18 #include "chrome/browser/plugins/plugin_metadata.h" | 18 #include "chrome/browser/plugins/plugin_metadata.h" |
| 19 #include "chrome/browser/ui/browser_dialogs.h" |
| 19 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 20 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 20 #include "chrome/browser/ui/layout_constants.h" | 21 #include "chrome/browser/ui/layout_constants.h" |
| 21 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" | 22 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h" |
| 22 #include "chrome/browser/ui/views/harmony/chrome_typography.h" | 23 #include "chrome/browser/ui/views/harmony/chrome_typography.h" |
| 23 #include "chrome/grit/generated_resources.h" | 24 #include "chrome/grit/generated_resources.h" |
| 24 #include "components/content_settings/core/browser/host_content_settings_map.h" | 25 #include "components/content_settings/core/browser/host_content_settings_map.h" |
| 25 #include "components/strings/grit/components_strings.h" | 26 #include "components/strings/grit/components_strings.h" |
| 26 #include "content/public/browser/navigation_handle.h" | 27 #include "content/public/browser/navigation_handle.h" |
| 27 #include "content/public/browser/plugin_service.h" | 28 #include "content/public/browser/plugin_service.h" |
| 28 #include "content/public/browser/web_contents.h" | 29 #include "content/public/browser/web_contents.h" |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 : content::WebContentsObserver(web_contents), | 169 : content::WebContentsObserver(web_contents), |
| 169 BubbleDialogDelegateView(anchor_view, arrow), | 170 BubbleDialogDelegateView(anchor_view, arrow), |
| 170 content_setting_bubble_model_(content_setting_bubble_model), | 171 content_setting_bubble_model_(content_setting_bubble_model), |
| 171 custom_link_(nullptr), | 172 custom_link_(nullptr), |
| 172 manage_link_(nullptr), | 173 manage_link_(nullptr), |
| 173 manage_checkbox_(nullptr), | 174 manage_checkbox_(nullptr), |
| 174 learn_more_link_(nullptr) { | 175 learn_more_link_(nullptr) { |
| 175 // Compensate for built-in vertical padding in the anchor view's image. | 176 // Compensate for built-in vertical padding in the anchor view's image. |
| 176 set_anchor_view_insets(gfx::Insets( | 177 set_anchor_view_insets(gfx::Insets( |
| 177 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); | 178 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); |
| 179 chrome::RecordDialogCreation( |
| 180 chrome::DialogIdentifier::CONTENT_SETTING_CONTENTS); |
| 178 } | 181 } |
| 179 | 182 |
| 180 ContentSettingBubbleContents::~ContentSettingBubbleContents() { | 183 ContentSettingBubbleContents::~ContentSettingBubbleContents() { |
| 181 // Must remove the children here so the comboboxes get destroyed before | 184 // Must remove the children here so the comboboxes get destroyed before |
| 182 // their associated models. | 185 // their associated models. |
| 183 RemoveAllChildViews(true); | 186 RemoveAllChildViews(true); |
| 184 } | 187 } |
| 185 | 188 |
| 186 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const { | 189 gfx::Size ContentSettingBubbleContents::GetPreferredSize() const { |
| 187 gfx::Size preferred_size(views::View::GetPreferredSize()); | 190 gfx::Size preferred_size(views::View::GetPreferredSize()); |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 506 DCHECK(i != list_item_links_.end()); | 509 DCHECK(i != list_item_links_.end()); |
| 507 content_setting_bubble_model_->OnListItemClicked(i->second); | 510 content_setting_bubble_model_->OnListItemClicked(i->second); |
| 508 } | 511 } |
| 509 | 512 |
| 510 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { | 513 void ContentSettingBubbleContents::OnPerformAction(views::Combobox* combobox) { |
| 511 MediaComboboxModel* model = | 514 MediaComboboxModel* model = |
| 512 static_cast<MediaComboboxModel*>(combobox->model()); | 515 static_cast<MediaComboboxModel*>(combobox->model()); |
| 513 content_setting_bubble_model_->OnMediaMenuClicked( | 516 content_setting_bubble_model_->OnMediaMenuClicked( |
| 514 model->type(), model->GetDevices()[combobox->selected_index()].id); | 517 model->type(), model->GetDevices()[combobox->selected_index()].id); |
| 515 } | 518 } |
| OLD | NEW |