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

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

Issue 2720183002: [Views] Update ink drop for omnibox icons (Closed)
Patch Set: Nits Created 3 years, 9 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/website_settings_popup_view.h" 5 #include "chrome/browser/ui/views/page_info/website_settings_popup_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>
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "ui/views/controls/button/md_text_button.h" 52 #include "ui/views/controls/button/md_text_button.h"
53 #include "ui/views/controls/image_view.h" 53 #include "ui/views/controls/image_view.h"
54 #include "ui/views/controls/label.h" 54 #include "ui/views/controls/label.h"
55 #include "ui/views/controls/link.h" 55 #include "ui/views/controls/link.h"
56 #include "ui/views/controls/styled_label.h" 56 #include "ui/views/controls/styled_label.h"
57 #include "ui/views/layout/box_layout.h" 57 #include "ui/views/layout/box_layout.h"
58 #include "ui/views/layout/grid_layout.h" 58 #include "ui/views/layout/grid_layout.h"
59 #include "ui/views/layout/layout_manager.h" 59 #include "ui/views/layout/layout_manager.h"
60 #include "ui/views/view.h" 60 #include "ui/views/view.h"
61 #include "ui/views/widget/widget.h" 61 #include "ui/views/widget/widget.h"
62 #include "ui/views/widget/widget_observer.h"
62 #include "url/gurl.h" 63 #include "url/gurl.h"
63 64
64 namespace { 65 namespace {
65 66
66 // NOTE(jdonnelly): This use of this process-wide variable assumes that there's 67 // NOTE(jdonnelly): This use of this process-wide variable assumes that there's
67 // never more than one website settings popup shown and that it's associated 68 // never more than one website settings popup shown and that it's associated
68 // with the current window. If this assumption fails in the future, we'll need 69 // with the current window. If this assumption fails in the future, we'll need
69 // to return a weak pointer from ShowPopup so callers can associate it with the 70 // to return a weak pointer from ShowPopup so callers can associate it with the
70 // current window (or other context) and check if the popup they care about is 71 // current window (or other context) and check if the popup they care about is
71 // showing. 72 // showing.
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 339
339 //////////////////////////////////////////////////////////////////////////////// 340 ////////////////////////////////////////////////////////////////////////////////
340 // WebsiteSettingsPopupView 341 // WebsiteSettingsPopupView
341 //////////////////////////////////////////////////////////////////////////////// 342 ////////////////////////////////////////////////////////////////////////////////
342 343
343 WebsiteSettingsPopupView::~WebsiteSettingsPopupView() {} 344 WebsiteSettingsPopupView::~WebsiteSettingsPopupView() {}
344 345
345 // static 346 // static
346 void WebsiteSettingsPopupView::ShowPopup( 347 void WebsiteSettingsPopupView::ShowPopup(
347 views::View* anchor_view, 348 views::View* anchor_view,
349 views::WidgetObserver* widget_observer,
348 const gfx::Rect& anchor_rect, 350 const gfx::Rect& anchor_rect,
349 Profile* profile, 351 Profile* profile,
350 content::WebContents* web_contents, 352 content::WebContents* web_contents,
351 const GURL& url, 353 const GURL& url,
352 const security_state::SecurityInfo& security_info) { 354 const security_state::SecurityInfo& security_info) {
353 gfx::NativeView parent_window = 355 gfx::NativeView parent_window =
354 anchor_view ? nullptr : web_contents->GetNativeView(); 356 anchor_view ? nullptr : web_contents->GetNativeView();
355 if (url.SchemeIs(content::kChromeUIScheme) || 357 if (url.SchemeIs(content::kChromeUIScheme) ||
356 url.SchemeIs(content::kChromeDevToolsScheme) || 358 url.SchemeIs(content::kChromeDevToolsScheme) ||
357 url.SchemeIs(extensions::kExtensionScheme) || 359 url.SchemeIs(extensions::kExtensionScheme) ||
358 url.SchemeIs(content::kViewSourceScheme)) { 360 url.SchemeIs(content::kViewSourceScheme)) {
359 // Use the concrete type so that |SetAnchorRect| can be called as a friend. 361 // Use the concrete type so that |SetAnchorRect| can be called as a friend.
360 InternalPageInfoPopupView* popup = 362 InternalPageInfoPopupView* popup =
361 new InternalPageInfoPopupView(anchor_view, parent_window, url); 363 new InternalPageInfoPopupView(anchor_view, parent_window, url);
362 if (!anchor_view) 364 if (!anchor_view)
363 popup->SetAnchorRect(anchor_rect); 365 popup->SetAnchorRect(anchor_rect);
364 popup->GetWidget()->Show(); 366 popup->GetWidget()->Show();
365 return; 367 return;
366 } 368 }
367 WebsiteSettingsPopupView* popup = new WebsiteSettingsPopupView( 369 WebsiteSettingsPopupView* popup = new WebsiteSettingsPopupView(
368 anchor_view, parent_window, profile, web_contents, url, security_info); 370 anchor_view, parent_window, profile, web_contents, url, security_info);
369 if (!anchor_view) 371 if (!anchor_view)
370 popup->SetAnchorRect(anchor_rect); 372 popup->SetAnchorRect(anchor_rect);
373
374 if (widget_observer)
375 popup->GetWidget()->AddObserver(widget_observer);
376
371 popup->GetWidget()->Show(); 377 popup->GetWidget()->Show();
372 } 378 }
373 379
374 // static 380 // static
375 WebsiteSettingsPopupView::PopupType 381 WebsiteSettingsPopupView::PopupType
376 WebsiteSettingsPopupView::GetShownPopupType() { 382 WebsiteSettingsPopupView::GetShownPopupType() {
377 return g_shown_popup_type; 383 return g_shown_popup_type;
378 } 384 }
379 385
380 WebsiteSettingsPopupView::WebsiteSettingsPopupView( 386 WebsiteSettingsPopupView::WebsiteSettingsPopupView(
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED); 757 WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_HELP_OPENED);
752 break; 758 break;
753 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: 759 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
754 presenter_->OnRevokeSSLErrorBypassButtonPressed(); 760 presenter_->OnRevokeSSLErrorBypassButtonPressed();
755 GetWidget()->Close(); 761 GetWidget()->Close();
756 break; 762 break;
757 default: 763 default:
758 NOTREACHED(); 764 NOTREACHED();
759 } 765 }
760 } 766 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698