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

Side by Side Diff: chrome/browser/render_view_context_menu_controller.cc

Issue 4088: Move a bunch of stuff out of WebContents. I removed a bunch of render view ho... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/render_view_context_menu_controller.h" 5 #include "chrome/browser/render_view_context_menu_controller.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 // Controller methods 44 // Controller methods
45 45
46 void RenderViewContextMenuController::OpenURL( 46 void RenderViewContextMenuController::OpenURL(
47 const GURL& url, 47 const GURL& url,
48 WindowOpenDisposition disposition, 48 WindowOpenDisposition disposition,
49 PageTransition::Type transition) { 49 PageTransition::Type transition) {
50 source_web_contents_->OpenURL(url, disposition, transition); 50 source_web_contents_->OpenURL(url, disposition, transition);
51 } 51 }
52 52
53 void RenderViewContextMenuController::CopyImageAt(int x, int y) { 53 void RenderViewContextMenuController::CopyImageAt(int x, int y) {
54 source_web_contents_->CopyImageAt(x, y); 54 source_web_contents_->render_view_host()->CopyImageAt(x, y);
55 } 55 }
56 56
57 void RenderViewContextMenuController::Inspect(int x, int y) { 57 void RenderViewContextMenuController::Inspect(int x, int y) {
58 source_web_contents_->InspectElementAt(x, y); 58 source_web_contents_->render_view_host()->InspectElementAt(x, y);
59 } 59 }
60 60
61 void RenderViewContextMenuController::WriteTextToClipboard( 61 void RenderViewContextMenuController::WriteTextToClipboard(
62 const std::wstring& text) { 62 const std::wstring& text) {
63 ClipboardService* clipboard = g_browser_process->clipboard_service(); 63 ClipboardService* clipboard = g_browser_process->clipboard_service();
64 64
65 if (!clipboard) 65 if (!clipboard)
66 return; 66 return;
67 67
68 clipboard->Clear(); 68 clipboard->Clear();
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 } 337 }
338 PageInfoWindow::CreateFrameInfo(source_web_contents_->profile(), 338 PageInfoWindow::CreateFrameInfo(source_web_contents_->profile(),
339 params_.frame_url, 339 params_.frame_url,
340 ssl, 340 ssl,
341 source_web_contents_->GetContentHWND(), 341 source_web_contents_->GetContentHWND(),
342 PageInfoWindow::SECURITY); 342 PageInfoWindow::SECURITY);
343 break; 343 break;
344 } 344 }
345 345
346 case IDS_CONTENT_CONTEXT_UNDO: 346 case IDS_CONTENT_CONTEXT_UNDO:
347 source_web_contents_->Undo(); 347 source_web_contents_->render_view_host()->Undo();
348 break; 348 break;
349 349
350 case IDS_CONTENT_CONTEXT_REDO: 350 case IDS_CONTENT_CONTEXT_REDO:
351 source_web_contents_->Redo(); 351 source_web_contents_->render_view_host()->Redo();
352 break; 352 break;
353 353
354 case IDS_CONTENT_CONTEXT_CUT: 354 case IDS_CONTENT_CONTEXT_CUT:
355 source_web_contents_->Cut(); 355 source_web_contents_->render_view_host()->Cut();
356 break; 356 break;
357 357
358 case IDS_CONTENT_CONTEXT_COPY: 358 case IDS_CONTENT_CONTEXT_COPY:
359 source_web_contents_->Copy(); 359 source_web_contents_->render_view_host()->Copy();
360 break; 360 break;
361 361
362 case IDS_CONTENT_CONTEXT_PASTE: 362 case IDS_CONTENT_CONTEXT_PASTE:
363 source_web_contents_->Paste(); 363 source_web_contents_->render_view_host()->Paste();
364 break; 364 break;
365 365
366 case IDS_CONTENT_CONTEXT_DELETE: 366 case IDS_CONTENT_CONTEXT_DELETE:
367 source_web_contents_->Delete(); 367 source_web_contents_->render_view_host()->Delete();
368 break; 368 break;
369 369
370 case IDS_CONTENT_CONTEXT_SELECTALL: 370 case IDS_CONTENT_CONTEXT_SELECTALL:
371 source_web_contents_->SelectAll(); 371 source_web_contents_->render_view_host()->SelectAll();
372 break; 372 break;
373 373
374 case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: { 374 case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: {
375 const TemplateURL* const default_provider = source_web_contents_-> 375 const TemplateURL* const default_provider = source_web_contents_->
376 profile()->GetTemplateURLModel()->GetDefaultSearchProvider(); 376 profile()->GetTemplateURLModel()->GetDefaultSearchProvider();
377 DCHECK(default_provider); // The context menu should not contain this 377 DCHECK(default_provider); // The context menu should not contain this
378 // item when there is no provider. 378 // item when there is no provider.
379 const TemplateURLRef* const search_url = default_provider->url(); 379 const TemplateURLRef* const search_url = default_provider->url();
380 DCHECK(search_url->SupportsReplacement()); 380 DCHECK(search_url->SupportsReplacement());
381 OpenURL(GURL(search_url->ReplaceSearchTerms(*default_provider, 381 OpenURL(GURL(search_url->ReplaceSearchTerms(*default_provider,
382 params_.selection_text, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE, 382 params_.selection_text, TemplateURLRef::NO_SUGGESTIONS_AVAILABLE,
383 std::wstring())), NEW_FOREGROUND_TAB, PageTransition::GENERATED); 383 std::wstring())), NEW_FOREGROUND_TAB, PageTransition::GENERATED);
384 break; 384 break;
385 } 385 }
386 386
387 case IDC_USESPELLCHECKSUGGESTION_0: 387 case IDC_USESPELLCHECKSUGGESTION_0:
388 case IDC_USESPELLCHECKSUGGESTION_1: 388 case IDC_USESPELLCHECKSUGGESTION_1:
389 case IDC_USESPELLCHECKSUGGESTION_2: 389 case IDC_USESPELLCHECKSUGGESTION_2:
390 case IDC_USESPELLCHECKSUGGESTION_3: 390 case IDC_USESPELLCHECKSUGGESTION_3:
391 case IDC_USESPELLCHECKSUGGESTION_4: 391 case IDC_USESPELLCHECKSUGGESTION_4:
392 source_web_contents_->Replace(params_.dictionary_suggestions[ 392 source_web_contents_->render_view_host()->Replace(
393 id - IDC_USESPELLCHECKSUGGESTION_0]); 393 params_.dictionary_suggestions[id - IDC_USESPELLCHECKSUGGESTION_0]);
394 break; 394 break;
395 395
396 case IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY: 396 case IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY:
397 source_web_contents_->AddToDictionary(params_.misspelled_word); 397 source_web_contents_->render_view_host()->AddToDictionary(
398 params_.misspelled_word);
398 break; 399 break;
399 400
400 case IDS_CONTENT_CONTEXT_ADDSEARCHENGINE: // Not implemented. 401 case IDS_CONTENT_CONTEXT_ADDSEARCHENGINE: // Not implemented.
401 default: 402 default:
402 break; 403 break;
403 } 404 }
404 } 405 }
405 406
406 bool RenderViewContextMenuController::IsDevCommandEnabled(int id) const { 407 bool RenderViewContextMenuController::IsDevCommandEnabled(int id) const {
407 CommandLine command_line; 408 CommandLine command_line;
(...skipping 28 matching lines...) Expand all
436 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) { 437 if (id == IDS_CONTENT_CONTEXT_INSPECTELEMENT) {
437 PrefService* prefs = source_web_contents_->profile()->GetPrefs(); 438 PrefService* prefs = source_web_contents_->profile()->GetPrefs();
438 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) || 439 if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled) ||
439 command_line.HasSwitch(switches::kDisableJavaScript)) 440 command_line.HasSwitch(switches::kDisableJavaScript))
440 return false; 441 return false;
441 } 442 }
442 443
443 return true; 444 return true;
444 } 445 }
445 446
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698