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

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

Issue 2720183002: [Views] Update ink drop for omnibox icons (Closed)
Patch Set: Fixed issues. Also rebased 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/page_info_popup_view.h" 5 #include "chrome/browser/ui/views/page_info/page_info_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 page info popup shown and that it's associated 68 // never more than one page info 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 338
338 //////////////////////////////////////////////////////////////////////////////// 339 ////////////////////////////////////////////////////////////////////////////////
339 // PageInfoPopupView 340 // PageInfoPopupView
340 //////////////////////////////////////////////////////////////////////////////// 341 ////////////////////////////////////////////////////////////////////////////////
341 342
342 PageInfoPopupView::~PageInfoPopupView() {} 343 PageInfoPopupView::~PageInfoPopupView() {}
343 344
344 // static 345 // static
345 void PageInfoPopupView::ShowPopup( 346 void PageInfoPopupView::ShowPopup(
346 views::View* anchor_view, 347 views::View* anchor_view,
348 views::WidgetObserver* widget_observer,
347 const gfx::Rect& anchor_rect, 349 const gfx::Rect& anchor_rect,
348 Profile* profile, 350 Profile* profile,
349 content::WebContents* web_contents, 351 content::WebContents* web_contents,
350 const GURL& url, 352 const GURL& url,
351 const security_state::SecurityInfo& security_info) { 353 const security_state::SecurityInfo& security_info) {
352 gfx::NativeView parent_window = 354 gfx::NativeView parent_window =
353 anchor_view ? nullptr : web_contents->GetNativeView(); 355 anchor_view ? nullptr : web_contents->GetNativeView();
354 if (url.SchemeIs(content::kChromeUIScheme) || 356 if (url.SchemeIs(content::kChromeUIScheme) ||
355 url.SchemeIs(content::kChromeDevToolsScheme) || 357 url.SchemeIs(content::kChromeDevToolsScheme) ||
356 url.SchemeIs(extensions::kExtensionScheme) || 358 url.SchemeIs(extensions::kExtensionScheme) ||
357 url.SchemeIs(content::kViewSourceScheme)) { 359 url.SchemeIs(content::kViewSourceScheme)) {
358 // Use the concrete type so that |SetAnchorRect| can be called as a friend. 360 // Use the concrete type so that |SetAnchorRect| can be called as a friend.
359 InternalPageInfoPopupView* popup = 361 InternalPageInfoPopupView* popup =
360 new InternalPageInfoPopupView(anchor_view, parent_window, url); 362 new InternalPageInfoPopupView(anchor_view, parent_window, url);
361 if (!anchor_view) 363 if (!anchor_view)
362 popup->SetAnchorRect(anchor_rect); 364 popup->SetAnchorRect(anchor_rect);
365 if (widget_observer)
366 popup->GetWidget()->AddObserver(widget_observer);
363 popup->GetWidget()->Show(); 367 popup->GetWidget()->Show();
364 return; 368 return;
365 } 369 }
366 PageInfoPopupView* popup = new PageInfoPopupView( 370 PageInfoPopupView* popup = new PageInfoPopupView(
367 anchor_view, parent_window, profile, web_contents, url, security_info); 371 anchor_view, parent_window, profile, web_contents, url, security_info);
368 if (!anchor_view) 372 if (!anchor_view)
369 popup->SetAnchorRect(anchor_rect); 373 popup->SetAnchorRect(anchor_rect);
374
375 if (widget_observer)
376 popup->GetWidget()->AddObserver(widget_observer);
377
370 popup->GetWidget()->Show(); 378 popup->GetWidget()->Show();
371 } 379 }
372 380
373 // static 381 // static
374 PageInfoPopupView::PopupType PageInfoPopupView::GetShownPopupType() { 382 PageInfoPopupView::PopupType PageInfoPopupView::GetShownPopupType() {
375 return g_shown_popup_type; 383 return g_shown_popup_type;
376 } 384 }
377 385
378 PageInfoPopupView::PageInfoPopupView( 386 PageInfoPopupView::PageInfoPopupView(
379 views::View* anchor_view, 387 views::View* anchor_view,
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
746 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED); 754 PageInfo::PAGE_INFO_CONNECTION_HELP_OPENED);
747 break; 755 break;
748 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS: 756 case STYLED_LABEL_RESET_CERTIFICATE_DECISIONS:
749 presenter_->OnRevokeSSLErrorBypassButtonPressed(); 757 presenter_->OnRevokeSSLErrorBypassButtonPressed();
750 GetWidget()->Close(); 758 GetWidget()->Close();
751 break; 759 break;
752 default: 760 default:
753 NOTREACHED(); 761 NOTREACHED();
754 } 762 }
755 } 763 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698