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

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

Issue 10391158: Moves methods for finding browsers to browser_finder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Include fixs Created 8 years, 7 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 | Annotate | Revision Log
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/speech/speech_recognition_bubble.h" 5 #include "chrome/browser/speech/speech_recognition_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"
11 #include "chrome/browser/ui/browser_finder.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h" 12 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 13 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
13 #include "chrome/browser/ui/views/toolbar_view.h" 14 #include "chrome/browser/ui/views/toolbar_view.h"
14 #include "content/public/browser/resource_context.h" 15 #include "content/public/browser/resource_context.h"
15 #include "content/public/browser/speech_recognition_manager.h" 16 #include "content/public/browser/speech_recognition_manager.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
17 #include "content/public/browser/web_contents_view.h" 18 #include "content/public/browser/web_contents_view.h"
18 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
19 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
20 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() { 352 SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() {
352 if (bubble_) { 353 if (bubble_) {
353 bubble_->set_notify_delegate_on_activation_change(false); 354 bubble_->set_notify_delegate_on_activation_change(false);
354 bubble_->GetWidget()->Close(); 355 bubble_->GetWidget()->Close();
355 } 356 }
356 } 357 }
357 358
358 void SpeechRecognitionBubbleImpl::Show() { 359 void SpeechRecognitionBubbleImpl::Show() {
359 if (!bubble_) { 360 if (!bubble_) {
360 // Anchor to the location icon view, in case |element_rect| is offscreen. 361 // Anchor to the location icon view, in case |element_rect| is offscreen.
361 Browser* browser = Browser::GetOrCreateTabbedBrowser( 362 Browser* browser = browser::FindOrCreateTabbedBrowser(
362 Profile::FromBrowserContext(GetWebContents()->GetBrowserContext())); 363 Profile::FromBrowserContext(GetWebContents()->GetBrowserContext()));
363 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); 364 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser);
364 views::View* icon = browser_view->GetLocationBarView() ? 365 views::View* icon = browser_view->GetLocationBarView() ?
365 browser_view->GetLocationBarView()->location_icon_view() : NULL; 366 browser_view->GetLocationBarView()->location_icon_view() : NULL;
366 bubble_ = new SpeechRecognitionBubbleView(delegate_, icon, element_rect_, 367 bubble_ = new SpeechRecognitionBubbleView(delegate_, icon, element_rect_,
367 GetWebContents()); 368 GetWebContents());
368 views::BubbleDelegateView::CreateBubble(bubble_); 369 views::BubbleDelegateView::CreateBubble(bubble_);
369 UpdateLayout(); 370 UpdateLayout();
370 } 371 }
371 bubble_->Show(); 372 bubble_->Show();
(...skipping 15 matching lines...) Expand all
387 } 388 }
388 389
389 } // namespace 390 } // namespace
390 391
391 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( 392 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble(
392 WebContents* web_contents, 393 WebContents* web_contents,
393 SpeechRecognitionBubble::Delegate* delegate, 394 SpeechRecognitionBubble::Delegate* delegate,
394 const gfx::Rect& element_rect) { 395 const gfx::Rect& element_rect) {
395 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); 396 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect);
396 } 397 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698