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

Side by Side Diff: chrome/browser/speech/speech_input_bubble_views.cc

Issue 8870003: Merge BorderContentsView into BubbleFrameView; simplify. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove allow_bubble_offscreen, simplify and update tests. Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/speech/speech_input_bubble.h" 5 #include "chrome/browser/speech/speech_input_bubble.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 void SpeechInputBubbleView::OnWidgetActivationChanged(views::Widget* widget, 104 void SpeechInputBubbleView::OnWidgetActivationChanged(views::Widget* widget,
105 bool active) { 105 bool active) {
106 if (widget == GetWidget() && !active) 106 if (widget == GetWidget() && !active)
107 delegate_->InfoBubbleFocusChanged(); 107 delegate_->InfoBubbleFocusChanged();
108 BubbleDelegateView::OnWidgetActivationChanged(widget, active); 108 BubbleDelegateView::OnWidgetActivationChanged(widget, active);
109 } 109 }
110 110
111 gfx::Rect SpeechInputBubbleView::GetAnchorRect() { 111 gfx::Rect SpeechInputBubbleView::GetAnchorRect() {
112 gfx::Rect container_rect; 112 gfx::Rect container_rect;
113 tab_contents_->GetContainerBounds(&container_rect); 113 tab_contents_->GetContainerBounds(&container_rect);
114 gfx::Point anchor(container_rect.x() + element_rect_.CenterPoint().x(), 114 gfx::Rect anchor(element_rect_);
115 container_rect.y() + element_rect_.bottom()); 115 anchor.Offset(container_rect.origin());
116 if (!container_rect.Contains(anchor)) 116 if (!container_rect.Intersects(anchor))
117 return BubbleDelegateView::GetAnchorRect(); 117 return BubbleDelegateView::GetAnchorRect();
118 return gfx::Rect(anchor, gfx::Size()); 118 return anchor;
119 } 119 }
120 120
121 void SpeechInputBubbleView::Init() { 121 void SpeechInputBubbleView::Init() {
122 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 122 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
123 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont); 123 const gfx::Font& font = rb.GetFont(ResourceBundle::MediumFont);
124 124
125 heading_ = new views::Label( 125 heading_ = new views::Label(
126 l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING)); 126 l10n_util::GetStringUTF16(IDS_SPEECH_INPUT_BUBBLE_HEADING));
127 heading_->set_border(views::Border::CreateEmptyBorder( 127 heading_->set_border(views::Border::CreateEmptyBorder(
128 kBubbleHeadingVertMargin, 0, kBubbleHeadingVertMargin, 0)); 128 kBubbleHeadingVertMargin, 0, kBubbleHeadingVertMargin, 0));
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 } 367 }
368 368
369 } // namespace 369 } // namespace
370 370
371 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( 371 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble(
372 TabContents* tab_contents, 372 TabContents* tab_contents,
373 SpeechInputBubble::Delegate* delegate, 373 SpeechInputBubble::Delegate* delegate,
374 const gfx::Rect& element_rect) { 374 const gfx::Rect& element_rect) {
375 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); 375 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect);
376 } 376 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_bubble_view.cc » ('j') | ui/views/bubble/bubble_frame_view.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698