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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 // And then the mouse event is forwarded to WebKit, which dispatches it to the 328 // And then the mouse event is forwarded to WebKit, which dispatches it to the
329 // event target. Potentially a Pepper plugin will receive the event. 329 // event target. Potentially a Pepper plugin will receive the event.
330 // In order to tell whether a plugin gets the last mouse event and which it 330 // In order to tell whether a plugin gets the last mouse event and which it
331 // is, we set |pepper_last_mouse_event_target_| to NULL here. If a plugin gets 331 // is, we set |pepper_last_mouse_event_target_| to NULL here. If a plugin gets
332 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 332 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
333 // |pepper_last_mouse_event_target_|. 333 // |pepper_last_mouse_event_target_|.
334 pepper_last_mouse_event_target_ = NULL; 334 pepper_last_mouse_event_target_ = NULL;
335 } 335 }
336 336
337 void RenderFrameImpl::SimulateImeSetComposition( 337 void RenderFrameImpl::SimulateImeSetComposition(
338 const string16& text, 338 const base::string16& text,
339 const std::vector<blink::WebCompositionUnderline>& underlines, 339 const std::vector<blink::WebCompositionUnderline>& underlines,
340 int selection_start, 340 int selection_start,
341 int selection_end) { 341 int selection_end) {
342 render_view_->OnImeSetComposition( 342 render_view_->OnImeSetComposition(
343 text, underlines, selection_start, selection_end); 343 text, underlines, selection_start, selection_end);
344 } 344 }
345 345
346 void RenderFrameImpl::SimulateImeConfirmComposition( 346 void RenderFrameImpl::SimulateImeConfirmComposition(
347 const string16& text, 347 const base::string16& text,
348 const gfx::Range& replacement_range) { 348 const gfx::Range& replacement_range) {
349 render_view_->OnImeConfirmComposition(text, replacement_range, false); 349 render_view_->OnImeConfirmComposition(text, replacement_range, false);
350 } 350 }
351 351
352 352
353 void RenderFrameImpl::OnImeSetComposition( 353 void RenderFrameImpl::OnImeSetComposition(
354 const string16& text, 354 const base::string16& text,
355 const std::vector<blink::WebCompositionUnderline>& underlines, 355 const std::vector<blink::WebCompositionUnderline>& underlines,
356 int selection_start, 356 int selection_start,
357 int selection_end) { 357 int selection_end) {
358 // When a PPAPI plugin has focus, we bypass WebKit. 358 // When a PPAPI plugin has focus, we bypass WebKit.
359 if (!IsPepperAcceptingCompositionEvents()) { 359 if (!IsPepperAcceptingCompositionEvents()) {
360 pepper_composition_text_ = text; 360 pepper_composition_text_ = text;
361 } else { 361 } else {
362 // TODO(kinaba) currently all composition events are sent directly to 362 // TODO(kinaba) currently all composition events are sent directly to
363 // plugins. Use DOM event mechanism after WebKit is made aware about 363 // plugins. Use DOM event mechanism after WebKit is made aware about
364 // plugins that support composition. 364 // plugins that support composition.
365 // The code below mimics the behavior of WebCore::Editor::setComposition. 365 // The code below mimics the behavior of WebCore::Editor::setComposition.
366 366
367 // Empty -> nonempty: composition started. 367 // Empty -> nonempty: composition started.
368 if (pepper_composition_text_.empty() && !text.empty()) 368 if (pepper_composition_text_.empty() && !text.empty())
369 focused_pepper_plugin_->HandleCompositionStart(string16()); 369 focused_pepper_plugin_->HandleCompositionStart(base::string16());
370 // Nonempty -> empty: composition canceled. 370 // Nonempty -> empty: composition canceled.
371 if (!pepper_composition_text_.empty() && text.empty()) 371 if (!pepper_composition_text_.empty() && text.empty())
372 focused_pepper_plugin_->HandleCompositionEnd(string16()); 372 focused_pepper_plugin_->HandleCompositionEnd(base::string16());
373 pepper_composition_text_ = text; 373 pepper_composition_text_ = text;
374 // Nonempty: composition is ongoing. 374 // Nonempty: composition is ongoing.
375 if (!pepper_composition_text_.empty()) { 375 if (!pepper_composition_text_.empty()) {
376 focused_pepper_plugin_->HandleCompositionUpdate( 376 focused_pepper_plugin_->HandleCompositionUpdate(
377 pepper_composition_text_, underlines, selection_start, 377 pepper_composition_text_, underlines, selection_start,
378 selection_end); 378 selection_end);
379 } 379 }
380 } 380 }
381 } 381 }
382 382
383 void RenderFrameImpl::OnImeConfirmComposition( 383 void RenderFrameImpl::OnImeConfirmComposition(
384 const string16& text, 384 const base::string16& text,
385 const gfx::Range& replacement_range, 385 const gfx::Range& replacement_range,
386 bool keep_selection) { 386 bool keep_selection) {
387 // When a PPAPI plugin has focus, we bypass WebKit. 387 // When a PPAPI plugin has focus, we bypass WebKit.
388 // Here, text.empty() has a special meaning. It means to commit the last 388 // Here, text.empty() has a special meaning. It means to commit the last
389 // update of composition text (see 389 // update of composition text (see
390 // RenderWidgetHost::ImeConfirmComposition()). 390 // RenderWidgetHost::ImeConfirmComposition()).
391 const string16& last_text = text.empty() ? pepper_composition_text_ : text; 391 const base::string16& last_text = text.empty() ? pepper_composition_text_
392 : text;
392 393
393 // last_text is empty only when both text and pepper_composition_text_ is. 394 // last_text is empty only when both text and pepper_composition_text_ is.
394 // Ignore it. 395 // Ignore it.
395 if (last_text.empty()) 396 if (last_text.empty())
396 return; 397 return;
397 398
398 if (!IsPepperAcceptingCompositionEvents()) { 399 if (!IsPepperAcceptingCompositionEvents()) {
399 base::i18n::UTF16CharIterator iterator(&last_text); 400 base::i18n::UTF16CharIterator iterator(&last_text);
400 int32 i = 0; 401 int32 i = 0;
401 while (iterator.Advance()) { 402 while (iterator.Advance()) {
(...skipping 893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1295 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) { 1296 void RenderFrameImpl::AddObserver(RenderFrameObserver* observer) {
1296 observers_.AddObserver(observer); 1297 observers_.AddObserver(observer);
1297 } 1298 }
1298 1299
1299 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) { 1300 void RenderFrameImpl::RemoveObserver(RenderFrameObserver* observer) {
1300 observer->RenderFrameGone(); 1301 observer->RenderFrameGone();
1301 observers_.RemoveObserver(observer); 1302 observers_.RemoveObserver(observer);
1302 } 1303 }
1303 1304
1304 } // namespace content 1305 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.h ('k') | content/renderer/render_thread_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698