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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view.cc

Issue 1402363013: Update location bar bubble/icon behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/location_bar/location_bar_bubble_delegate_view .h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_bubble_delegate_view .h"
6 6
7 #include "chrome/browser/chrome_notification_types.h" 7 #include "chrome/browser/chrome_notification_types.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_finder.h" 9 #include "chrome/browser/ui/browser_finder.h"
10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" 10 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h"
(...skipping 11 matching lines...) Expand all
22 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 22 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
23 registrar_.Add( 23 registrar_.Add(
24 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, 24 this, chrome::NOTIFICATION_FULLSCREEN_CHANGED,
25 content::Source<FullscreenController>( 25 content::Source<FullscreenController>(
26 browser->exclusive_access_manager()->fullscreen_controller())); 26 browser->exclusive_access_manager()->fullscreen_controller()));
27 } 27 }
28 } 28 }
29 29
30 LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {} 30 LocationBarBubbleDelegateView::~LocationBarBubbleDelegateView() {}
31 31
32 void LocationBarBubbleDelegateView::ShowForReason(DisplayReason reason) {
33 if (reason == USER_ACTION) {
34 SetArrowPaintType(views::BubbleBorder::PAINT_TRANSPARENT);
35 GetWidget()->Show();
36 } else {
37 GetWidget()->ShowInactive();
38 }
39 }
40
32 void LocationBarBubbleDelegateView::Observe( 41 void LocationBarBubbleDelegateView::Observe(
33 int type, 42 int type,
34 const content::NotificationSource& source, 43 const content::NotificationSource& source,
35 const content::NotificationDetails& details) { 44 const content::NotificationDetails& details) {
36 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type); 45 DCHECK_EQ(chrome::NOTIFICATION_FULLSCREEN_CHANGED, type);
37 GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE); 46 GetWidget()->SetVisibilityAnimationTransition(views::Widget::ANIMATE_NONE);
38 Close(); 47 Close();
39 } 48 }
40 49
41 void LocationBarBubbleDelegateView::Close() { 50 void LocationBarBubbleDelegateView::Close() {
42 views::Widget* widget = GetWidget(); 51 views::Widget* widget = GetWidget();
43 if (!widget->IsClosed()) 52 if (!widget->IsClosed())
44 widget->Close(); 53 widget->Close();
45 } 54 }
46 55
47 void LocationBarBubbleDelegateView::AdjustForFullscreen( 56 void LocationBarBubbleDelegateView::AdjustForFullscreen(
48 const gfx::Rect& screen_bounds) { 57 const gfx::Rect& screen_bounds) {
49 if (GetAnchorView()) 58 if (GetAnchorView())
50 return; 59 return;
51 60
52 const int kBubblePaddingFromScreenEdge = 20; 61 const int kBubblePaddingFromScreenEdge = 20;
53 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge; 62 int horizontal_offset = width() / 2 + kBubblePaddingFromScreenEdge;
54 const int x_pos = base::i18n::IsRTL() 63 const int x_pos = base::i18n::IsRTL()
55 ? (screen_bounds.x() + horizontal_offset) 64 ? (screen_bounds.x() + horizontal_offset)
56 : (screen_bounds.right() - horizontal_offset); 65 : (screen_bounds.right() - horizontal_offset);
57 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); 66 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0));
58 } 67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698