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/page_info/permission_selector_row.h" | 5 #include "chrome/browser/ui/views/page_info/permission_selector_row.h" |
6 | 6 |
7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/ui/page_info/page_info_ui.h" | 10 #include "chrome/browser/ui/page_info/page_info_ui.h" |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 // Change the permission icon to reflect the selected setting. | 324 // Change the permission icon to reflect the selected setting. |
325 const gfx::Image& image = PageInfoUI::GetPermissionIcon(permission); | 325 const gfx::Image& image = PageInfoUI::GetPermissionIcon(permission); |
326 icon_->SetImage(image.ToImageSkia()); | 326 icon_->SetImage(image.ToImageSkia()); |
327 | 327 |
328 // Update the menu button text to reflect the new setting. | 328 // Update the menu button text to reflect the new setting. |
329 if (menu_button_) { | 329 if (menu_button_) { |
330 menu_button_->SetText(PageInfoUI::PermissionActionToUIString( | 330 menu_button_->SetText(PageInfoUI::PermissionActionToUIString( |
331 profile_, permission.type, permission.setting, | 331 profile_, permission.type, permission.setting, |
332 permission.default_setting, content_settings::SETTING_SOURCE_USER)); | 332 permission.default_setting, content_settings::SETTING_SOURCE_USER)); |
333 menu_button_->SizeToPreferredSize(); | 333 menu_button_->SizeToPreferredSize(); |
334 // Re-layout will be done at the |PageInfoPopupView| level, since | 334 // Re-layout will be done at the |PageInfoBubbleView| level, since |
335 // that view may need to resize itself to accomodate the new sizes of its | 335 // that view may need to resize itself to accomodate the new sizes of its |
336 // contents. | 336 // contents. |
337 menu_button_->InvalidateLayout(); | 337 menu_button_->InvalidateLayout(); |
338 } else if (combobox_) { | 338 } else if (combobox_) { |
339 bool use_default = permission.setting == CONTENT_SETTING_DEFAULT; | 339 bool use_default = permission.setting == CONTENT_SETTING_DEFAULT; |
340 combobox_->UpdateSelectedIndex(use_default); | 340 combobox_->UpdateSelectedIndex(use_default); |
341 } | 341 } |
342 | 342 |
343 for (PermissionSelectorRowObserver& observer : observer_list_) | 343 for (PermissionSelectorRowObserver& observer : observer_list_) |
344 observer.OnPermissionChanged(permission); | 344 observer.OnPermissionChanged(permission); |
345 } | 345 } |
346 | 346 |
347 views::View* PermissionSelectorRow::button() { | 347 views::View* PermissionSelectorRow::button() { |
348 // These casts are required because the two arms of a ?: cannot have different | 348 // These casts are required because the two arms of a ?: cannot have different |
349 // types T1 and T2, even if the resulting value of the ?: is about to be a T | 349 // types T1 and T2, even if the resulting value of the ?: is about to be a T |
350 // and T1 and T2 are both subtypes of T. | 350 // and T1 and T2 are both subtypes of T. |
351 return menu_button_ ? static_cast<views::View*>(menu_button_) | 351 return menu_button_ ? static_cast<views::View*>(menu_button_) |
352 : static_cast<views::View*>(combobox_); | 352 : static_cast<views::View*>(combobox_); |
353 } | 353 } |
OLD | NEW |