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

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

Issue 12334073: Remove WebContents methods that duplicate WebContentsView methods. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
11 #include "content/public/browser/web_contents_view.h"
11 #include "grit/generated_resources.h" 12 #include "grit/generated_resources.h"
12 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
13 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/canvas.h" 15 #include "ui/gfx/canvas.h"
15 #include "ui/gfx/display.h" 16 #include "ui/gfx/display.h"
16 #include "ui/gfx/image/image_skia_operations.h" 17 #include "ui/gfx/image/image_skia_operations.h"
17 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
18 #include "ui/gfx/screen.h" 19 #include "ui/gfx/screen.h"
19 20
20 using content::WebContents; 21 using content::WebContents;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return CreateNativeBubble(web_contents, delegate, element_rect); 134 return CreateNativeBubble(web_contents, delegate, element_rect);
134 } 135 }
135 136
136 SpeechRecognitionBubbleBase::SpeechRecognitionBubbleBase( 137 SpeechRecognitionBubbleBase::SpeechRecognitionBubbleBase(
137 WebContents* web_contents) 138 WebContents* web_contents)
138 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 139 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
139 animation_step_(0), 140 animation_step_(0),
140 display_mode_(DISPLAY_MODE_RECORDING), 141 display_mode_(DISPLAY_MODE_RECORDING),
141 web_contents_(web_contents), 142 web_contents_(web_contents),
142 scale_factor_(ui::SCALE_FACTOR_NONE) { 143 scale_factor_(ui::SCALE_FACTOR_NONE) {
143 gfx::NativeView view = web_contents_ ? web_contents_->GetNativeView() : NULL; 144 gfx::NativeView view =
145 web_contents_ ? web_contents_->GetView()->GetNativeView() : NULL;
144 gfx::Screen* screen = gfx::Screen::GetScreenFor(view); 146 gfx::Screen* screen = gfx::Screen::GetScreenFor(view);
145 gfx::Display display = screen->GetDisplayNearestWindow(view); 147 gfx::Display display = screen->GetDisplayNearestWindow(view);
146 scale_factor_ = ui::GetScaleFactorFromScale( 148 scale_factor_ = ui::GetScaleFactorFromScale(
147 display.device_scale_factor()); 149 display.device_scale_factor());
148 150
149 const gfx::ImageSkiaRep& rep = 151 const gfx::ImageSkiaRep& rep =
150 g_images.Get().mic_empty()->GetRepresentation(scale_factor_); 152 g_images.Get().mic_empty()->GetRepresentation(scale_factor_);
151 mic_image_.reset(new SkBitmap()); 153 mic_image_.reset(new SkBitmap());
152 mic_image_->setConfig(SkBitmap::kARGB_8888_Config, 154 mic_image_->setConfig(SkBitmap::kARGB_8888_Config,
153 rep.pixel_width(), rep.pixel_height()); 155 rep.pixel_width(), rep.pixel_height());
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 269 }
268 270
269 void SpeechRecognitionBubbleBase::SetImage(const gfx::ImageSkia& image) { 271 void SpeechRecognitionBubbleBase::SetImage(const gfx::ImageSkia& image) {
270 icon_image_ = image; 272 icon_image_ = image;
271 UpdateImage(); 273 UpdateImage();
272 } 274 }
273 275
274 gfx::ImageSkia SpeechRecognitionBubbleBase::icon_image() { 276 gfx::ImageSkia SpeechRecognitionBubbleBase::icon_image() {
275 return icon_image_; 277 return icon_image_;
276 } 278 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698