Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/frame/browser_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 2555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2566 const gfx::Rect& rect) { | 2566 const gfx::Rect& rect) { |
| 2567 gfx::Point origin(rect.origin()); | 2567 gfx::Point origin(rect.origin()); |
| 2568 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | 2568 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); |
| 2569 gfx::Rect bounds(origin, rect.size()); | 2569 gfx::Rect bounds(origin, rect.size()); |
| 2570 | 2570 |
| 2571 AvatarMenuBubbleView::ShowBubble(this, views::BubbleBorder::TOP_RIGHT, | 2571 AvatarMenuBubbleView::ShowBubble(this, views::BubbleBorder::TOP_RIGHT, |
| 2572 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); | 2572 views::BubbleBorder::ALIGN_EDGE_TO_ANCHOR_EDGE, bounds, browser_.get()); |
| 2573 } | 2573 } |
| 2574 | 2574 |
| 2575 void BrowserView::ShowAvatarBubbleFromAvatarButton() { | 2575 void BrowserView::ShowAvatarBubbleFromAvatarButton() { |
| 2576 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | 2576 if (CommandLine::ForCurrentProcess()->HasSwitch( |
|
noms (inactive)
2013/11/04 22:03:42
If browser_view can use things from profiles, you
Roger Tawa OOO till Jul 10th
2013/11/04 22:10:50
Done.
| |
| 2577 if (button) | 2577 switches::kNewProfileManagement)) { |
| 2578 button->ShowAvatarBubble(); | 2578 NewAvatarButton* button = frame_->GetNewAvatarMenuButton(); |
| 2579 if (button) { | |
| 2580 ui::MouseEvent mouse_event(ui::ET_MOUSE_RELEASED, gfx::Point(), | |
| 2581 gfx::Point(), ui::EF_LEFT_MOUSE_BUTTON); | |
| 2582 button->OnMouseReleased(mouse_event); | |
|
Roger Tawa OOO till Jul 10th
2013/11/04 22:01:22
Is there a better way to programmatically trigger
| |
| 2583 } | |
| 2584 } else { | |
| 2585 AvatarMenuButton* button = frame_->GetAvatarMenuButton(); | |
| 2586 if (button) | |
| 2587 button->ShowAvatarBubble(); | |
| 2588 } | |
| 2579 } | 2589 } |
| 2580 | 2590 |
| 2581 void BrowserView::ShowPasswordGenerationBubble( | 2591 void BrowserView::ShowPasswordGenerationBubble( |
| 2582 const gfx::Rect& rect, | 2592 const gfx::Rect& rect, |
| 2583 const autofill::PasswordForm& form, | 2593 const autofill::PasswordForm& form, |
| 2584 autofill::PasswordGenerator* password_generator) { | 2594 autofill::PasswordGenerator* password_generator) { |
| 2585 // Create a rect in the content bounds that the bubble will point to. | 2595 // Create a rect in the content bounds that the bubble will point to. |
| 2586 gfx::Point origin(rect.origin()); | 2596 gfx::Point origin(rect.origin()); |
| 2587 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); | 2597 views::View::ConvertPointToScreen(GetTabContentsContainerView(), &origin); |
| 2588 gfx::Rect bounds(origin, rect.size()); | 2598 gfx::Rect bounds(origin, rect.size()); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2707 // The +1 in the next line creates a 1-px gap between icon and arrow tip. | 2717 // The +1 in the next line creates a 1-px gap between icon and arrow tip. |
| 2708 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - | 2718 gfx::Point icon_bottom(0, location_icon_view->GetImageBounds().bottom() - |
| 2709 LocationBarView::kIconInternalPadding + 1); | 2719 LocationBarView::kIconInternalPadding + 1); |
| 2710 ConvertPointToTarget(location_icon_view, this, &icon_bottom); | 2720 ConvertPointToTarget(location_icon_view, this, &icon_bottom); |
| 2711 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); | 2721 gfx::Point infobar_top(0, infobar_container_->GetVerticalOverlap(NULL)); |
| 2712 ConvertPointToTarget(infobar_container_, this, &infobar_top); | 2722 ConvertPointToTarget(infobar_container_, this, &infobar_top); |
| 2713 top_arrow_height = infobar_top.y() - icon_bottom.y(); | 2723 top_arrow_height = infobar_top.y() - icon_bottom.y(); |
| 2714 } | 2724 } |
| 2715 return top_arrow_height; | 2725 return top_arrow_height; |
| 2716 } | 2726 } |
| OLD | NEW |