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

Side by Side Diff: chrome/browser/views/browser_bubble.cc

Issue 159202: add mole info to toolstrip definition and enable moles (Closed)
Patch Set: ready for review Created 11 years, 5 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/browser_bubble.h" 5 #include "chrome/browser/views/browser_bubble.h"
6 6
7 #include "app/l10n_util.h" 7 #include "app/l10n_util.h"
8 #include "chrome/browser/views/frame/browser_view.h" 8 #include "chrome/browser/views/frame/browser_view.h"
9 #include "views/widget/root_view.h" 9 #include "views/widget/root_view.h"
10 #include "views/window/window.h" 10 #include "views/window/window.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 browser_view->AttachBrowserBubble(this); 55 browser_view->AttachBrowserBubble(this);
56 attached_ = true; 56 attached_ = true;
57 } 57 }
58 } 58 }
59 59
60 void BrowserBubble::BrowserWindowMoved() { 60 void BrowserBubble::BrowserWindowMoved() {
61 if (delegate_) 61 if (delegate_)
62 delegate_->BubbleBrowserWindowMoved(this); 62 delegate_->BubbleBrowserWindowMoved(this);
63 else 63 else
64 Hide(); 64 Hide();
65 if (visible_)
66 Reposition();
65 } 67 }
66 68
67 void BrowserBubble::BrowserWindowClosed() { 69 void BrowserBubble::BrowserWindowClosing() {
68 if (delegate_) 70 if (delegate_)
69 delegate_->BubbleBrowserWindowClosed(this); 71 delegate_->BubbleBrowserWindowClosing(this);
70 else 72 else
71 Hide(); 73 Hide();
72 } 74 }
73 75
74 void BrowserBubble::SetBounds(int x, int y, int w, int h) { 76 void BrowserBubble::SetBounds(int x, int y, int w, int h) {
75 // If the UI layout is RTL, we don't need to mirror coordinates, since 77 // If the UI layout is RTL, we don't need to mirror coordinates, since
76 // View logic will do that for us. 78 // View logic will do that for us.
77 bounds_.SetRect(x, y, w, h); 79 bounds_.SetRect(x, y, w, h);
78 Reposition(); 80 Reposition();
79 } 81 }
80 82
81 void BrowserBubble::MoveTo(int x, int y) { 83 void BrowserBubble::MoveTo(int x, int y) {
82 SetBounds(x, y, bounds_.width(), bounds_.height()); 84 SetBounds(x, y, bounds_.width(), bounds_.height());
83 } 85 }
84 86
85 void BrowserBubble::Reposition() { 87 void BrowserBubble::Reposition() {
86 gfx::Point top_left; 88 gfx::Point top_left;
87 views::View::ConvertPointToScreen(frame_->GetRootView(), &top_left); 89 views::View::ConvertPointToScreen(frame_->GetRootView(), &top_left);
88 MovePopup(top_left.x() + bounds_.x(), 90 MovePopup(top_left.x() + bounds_.x(),
89 top_left.y() + bounds_.y(), 91 top_left.y() + bounds_.y(),
90 bounds_.width(), 92 bounds_.width(),
91 bounds_.height()); 93 bounds_.height());
92 } 94 }
93 95
94 void BrowserBubble::ResizeToView() { 96 void BrowserBubble::ResizeToView() {
95 gfx::Size size = view_->GetPreferredSize(); 97 gfx::Size size = view_->GetPreferredSize();
96 SetBounds(bounds_.x(), bounds_.y(), size.width(), size.height()); 98 SetBounds(bounds_.x(), bounds_.y(), size.width(), size.height());
97 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698