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

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

Issue 11030017: Add context to gfx::Screen calls in support of simultaneous desktop+ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix some new gfx::Screen additions Created 8 years, 2 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"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 123
124 return CreateNativeBubble(web_contents, delegate, element_rect); 124 return CreateNativeBubble(web_contents, delegate, element_rect);
125 } 125 }
126 126
127 SpeechRecognitionBubbleBase::SpeechRecognitionBubbleBase( 127 SpeechRecognitionBubbleBase::SpeechRecognitionBubbleBase(
128 WebContents* web_contents) 128 WebContents* web_contents)
129 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), 129 : ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)),
130 display_mode_(DISPLAY_MODE_RECORDING), 130 display_mode_(DISPLAY_MODE_RECORDING),
131 web_contents_(web_contents), 131 web_contents_(web_contents),
132 scale_factor_(ui::SCALE_FACTOR_NONE) { 132 scale_factor_(ui::SCALE_FACTOR_NONE) {
133 gfx::Display display = gfx::Screen::GetDisplayNearestWindow( 133 gfx::NativeView view = web_contents_ ? web_contents_->GetNativeView() : NULL;
134 web_contents_ ? web_contents_->GetNativeView() : NULL); 134 gfx::Screen* screen = gfx::Screen::GetScreenFor(view);
135 gfx::Display display = screen->GetDisplayNearestWindow(view);
135 scale_factor_ = ui::GetScaleFactorFromScale( 136 scale_factor_ = ui::GetScaleFactorFromScale(
136 display.device_scale_factor()); 137 display.device_scale_factor());
137 138
138 const gfx::ImageSkiaRep& rep = 139 const gfx::ImageSkiaRep& rep =
139 g_images.Get().mic_empty()->GetRepresentation(scale_factor_); 140 g_images.Get().mic_empty()->GetRepresentation(scale_factor_);
140 mic_image_.reset(new SkBitmap()); 141 mic_image_.reset(new SkBitmap());
141 mic_image_->setConfig(SkBitmap::kARGB_8888_Config, 142 mic_image_->setConfig(SkBitmap::kARGB_8888_Config,
142 rep.pixel_width(), rep.pixel_height()); 143 rep.pixel_width(), rep.pixel_height());
143 mic_image_->allocPixels(); 144 mic_image_->allocPixels();
144 145
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 257 }
257 258
258 void SpeechRecognitionBubbleBase::SetImage(const gfx::ImageSkia& image) { 259 void SpeechRecognitionBubbleBase::SetImage(const gfx::ImageSkia& image) {
259 icon_image_.reset(new gfx::ImageSkia(image)); 260 icon_image_.reset(new gfx::ImageSkia(image));
260 UpdateImage(); 261 UpdateImage();
261 } 262 }
262 263
263 gfx::ImageSkia SpeechRecognitionBubbleBase::icon_image() { 264 gfx::ImageSkia SpeechRecognitionBubbleBase::icon_image() {
264 return (icon_image_ != NULL) ? *icon_image_ : gfx::ImageSkia(); 265 return (icon_image_ != NULL) ? *icon_image_ : gfx::ImageSkia();
265 } 266 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698