Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(517)

Side by Side Diff: chrome/browser/ui/views/page_info/page_info_bubble_view.cc

Issue 2758323002: Broke out layout metric information from ViewsDelegate to LayoutProvider (Closed)
Patch Set: Final feedback addressed Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/page_info_bubble_view.h" 5 #include "chrome/browser/ui/views/page_info/page_info_bubble_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/i18n/rtl.h" 12 #include "base/i18n/rtl.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/strings/string16.h" 15 #include "base/strings/string16.h"
16 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
17 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
18 #include "chrome/browser/certificate_viewer.h" 18 #include "chrome/browser/certificate_viewer.h"
19 #include "chrome/browser/infobars/infobar_service.h" 19 #include "chrome/browser/infobars/infobar_service.h"
20 #include "chrome/browser/profiles/profile.h" 20 #include "chrome/browser/profiles/profile.h"
21 #include "chrome/browser/ui/browser.h" 21 #include "chrome/browser/ui/browser.h"
22 #include "chrome/browser/ui/browser_dialogs.h" 22 #include "chrome/browser/ui/browser_dialogs.h"
23 #include "chrome/browser/ui/layout_constants.h" 23 #include "chrome/browser/ui/layout_constants.h"
24 #include "chrome/browser/ui/page_info/page_info.h" 24 #include "chrome/browser/ui/page_info/page_info.h"
25 #include "chrome/browser/ui/views/collected_cookies_views.h" 25 #include "chrome/browser/ui/views/collected_cookies_views.h"
26 #include "chrome/browser/ui/views/harmony/chrome_layout_provider.h"
26 #include "chrome/browser/ui/views/harmony/chrome_typography.h" 27 #include "chrome/browser/ui/views/harmony/chrome_typography.h"
27 #include "chrome/browser/ui/views/harmony/layout_delegate.h"
28 #include "chrome/browser/ui/views/page_info/chosen_object_row.h" 28 #include "chrome/browser/ui/views/page_info/chosen_object_row.h"
29 #include "chrome/browser/ui/views/page_info/non_accessible_image_view.h" 29 #include "chrome/browser/ui/views/page_info/non_accessible_image_view.h"
30 #include "chrome/browser/ui/views/page_info/permission_selector_row.h" 30 #include "chrome/browser/ui/views/page_info/permission_selector_row.h"
31 #include "chrome/common/url_constants.h" 31 #include "chrome/common/url_constants.h"
32 #include "chrome/grit/chromium_strings.h" 32 #include "chrome/grit/chromium_strings.h"
33 #include "chrome/grit/generated_resources.h" 33 #include "chrome/grit/generated_resources.h"
34 #include "chrome/grit/theme_resources.h" 34 #include "chrome/grit/theme_resources.h"
35 #include "components/content_settings/core/common/content_settings_types.h" 35 #include "components/content_settings/core/common/content_settings_types.h"
36 #include "components/strings/grit/components_chromium_strings.h" 36 #include "components/strings/grit/components_chromium_strings.h"
37 #include "components/strings/grit/components_strings.h" 37 #include "components/strings/grit/components_strings.h"
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 NOTREACHED(); 303 NOTREACHED();
304 } 304 }
305 305
306 // Compensate for built-in vertical padding in the anchor view's image. 306 // Compensate for built-in vertical padding in the anchor view's image.
307 set_anchor_view_insets(gfx::Insets( 307 set_anchor_view_insets(gfx::Insets(
308 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0)); 308 GetLayoutConstant(LOCATION_BAR_BUBBLE_ANCHOR_VERTICAL_INSET), 0));
309 309
310 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing, 310 SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal, kSpacing,
311 kSpacing, kSpacing)); 311 kSpacing, kSpacing));
312 set_margins(gfx::Insets()); 312 set_margins(gfx::Insets());
313 if (LayoutDelegate::Get()->ShouldShowWindowIcon()) { 313 if (ChromeLayoutProvider::Get()->ShouldShowWindowIcon()) {
314 views::ImageView* icon_view = new NonAccessibleImageView(); 314 views::ImageView* icon_view = new NonAccessibleImageView();
315 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); 315 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
316 icon_view->SetImage(rb.GetImageSkiaNamed(icon)); 316 icon_view->SetImage(rb.GetImageSkiaNamed(icon));
317 AddChildView(icon_view); 317 AddChildView(icon_view);
318 } 318 }
319 319
320 views::Label* label = new views::Label(l10n_util::GetStringUTF16(text)); 320 views::Label* label = new views::Label(l10n_util::GetStringUTF16(text));
321 label->SetMultiLine(true); 321 label->SetMultiLine(true);
322 label->SetAllowCharacterBreak(true); 322 label->SetAllowCharacterBreak(true);
323 label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 323 label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 layout->AddPaddingRow(1, kHeaderMarginBottom); 431 layout->AddPaddingRow(1, kHeaderMarginBottom);
432 layout->StartRow(1, content_column); 432 layout->StartRow(1, content_column);
433 433
434 site_settings_view_ = CreateSiteSettingsView(side_margin); 434 site_settings_view_ = CreateSiteSettingsView(side_margin);
435 layout->AddView(site_settings_view_); 435 layout->AddView(site_settings_view_);
436 436
437 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) { 437 if (!ui::MaterialDesignController::IsSecondaryUiMaterial()) {
438 // In non-material, titles are inset from the dialog margin. Ensure the 438 // In non-material, titles are inset from the dialog margin. Ensure the
439 // horizontal insets match. 439 // horizontal insets match.
440 set_title_margins( 440 set_title_margins(
441 gfx::Insets(LayoutDelegate::Get()->GetMetric( 441 gfx::Insets(ChromeLayoutProvider::Get()->GetDistanceMetric(
442 LayoutDelegate::Metric::PANEL_CONTENT_MARGIN), 442 DISTANCE_PANEL_CONTENT_MARGIN),
443 side_margin, 0, side_margin)); 443 side_margin, 0, side_margin));
444 } 444 }
445 views::BubbleDialogDelegateView::CreateBubble(this); 445 views::BubbleDialogDelegateView::CreateBubble(this);
446 446
447 presenter_.reset(new PageInfo( 447 presenter_.reset(new PageInfo(
448 this, profile, TabSpecificContentSettings::FromWebContents(web_contents), 448 this, profile, TabSpecificContentSettings::FromWebContents(web_contents),
449 web_contents, url, security_info)); 449 web_contents, url, security_info));
450 } 450 }
451 451
452 void PageInfoBubbleView::RenderFrameDeleted( 452 void PageInfoBubbleView::RenderFrameDeleted(
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); 747 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED);
748 break; 748 break;
749 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: 749 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
750 presenter_->OnRevokeSSLErrorBypassButtonPressed(); 750 presenter_->OnRevokeSSLErrorBypassButtonPressed();
751 GetWidget()->Close(); 751 GetWidget()->Close();
752 break; 752 break;
753 default: 753 default:
754 NOTREACHED(); 754 NOTREACHED();
755 } 755 }
756 } 756 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/login_view.cc ('k') | chrome/browser/ui/views/page_info/page_info_bubble_view_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698