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

Side by Side Diff: chrome/browser/tab_contents/render_view_context_menu.cc

Issue 391036: Forbid reloading the Inspector window (Closed)
Patch Set: Follow codereview Created 10 years, 12 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/tab_contents/render_view_context_menu.h" 5 #include "chrome/browser/tab_contents/render_view_context_menu.h"
6 6
7 #include "app/clipboard/clipboard.h" 7 #include "app/clipboard/clipboard.h"
8 #include "app/clipboard/scoped_clipboard_writer.h" 8 #include "app/clipboard/scoped_clipboard_writer.h"
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "chrome/app/chrome_dll_resource.h" 12 #include "chrome/app/chrome_dll_resource.h"
13 #include "chrome/browser/browser.h"
pfeldman 2009/12/25 15:22:59 Why new import? Context menu should not be browser
13 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/debugger/devtools_manager.h" 15 #include "chrome/browser/debugger/devtools_manager.h"
16 #include "chrome/browser/debugger/devtools_window.h"
15 #include "chrome/browser/download/download_manager.h" 17 #include "chrome/browser/download/download_manager.h"
16 #include "chrome/browser/fonts_languages_window.h" 18 #include "chrome/browser/fonts_languages_window.h"
17 #include "chrome/browser/metrics/user_metrics.h" 19 #include "chrome/browser/metrics/user_metrics.h"
18 #include "chrome/browser/net/browser_url_util.h" 20 #include "chrome/browser/net/browser_url_util.h"
19 #include "chrome/browser/page_info_window.h" 21 #include "chrome/browser/page_info_window.h"
20 #include "chrome/browser/profile.h" 22 #include "chrome/browser/profile.h"
21 #include "chrome/browser/search_versus_navigate_classifier.h" 23 #include "chrome/browser/search_versus_navigate_classifier.h"
22 #include "chrome/browser/search_engines/template_url_model.h" 24 #include "chrome/browser/search_engines/template_url_model.h"
23 #include "chrome/browser/spellcheck_host.h" 25 #include "chrome/browser/spellcheck_host.h"
24 #include "chrome/browser/spellchecker_platform_engine.h" 26 #include "chrome/browser/spellchecker_platform_engine.h"
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 return false; 348 return false;
347 } 349 }
348 350
349 switch (id) { 351 switch (id) {
350 case IDS_CONTENT_CONTEXT_BACK: 352 case IDS_CONTENT_CONTEXT_BACK:
351 return source_tab_contents_->controller().CanGoBack(); 353 return source_tab_contents_->controller().CanGoBack();
352 354
353 case IDS_CONTENT_CONTEXT_FORWARD: 355 case IDS_CONTENT_CONTEXT_FORWARD:
354 return source_tab_contents_->controller().CanGoForward(); 356 return source_tab_contents_->controller().CanGoForward();
355 357
358 case IDS_CONTENT_CONTEXT_RELOAD:
359 return source_tab_contents_->delegate()->CanReloadContents(
360 source_tab_contents_);
361
356 case IDS_CONTENT_CONTEXT_VIEWPAGESOURCE: 362 case IDS_CONTENT_CONTEXT_VIEWPAGESOURCE:
357 case IDS_CONTENT_CONTEXT_VIEWFRAMESOURCE: 363 case IDS_CONTENT_CONTEXT_VIEWFRAMESOURCE:
358 case IDS_CONTENT_CONTEXT_INSPECTELEMENT: 364 case IDS_CONTENT_CONTEXT_INSPECTELEMENT:
359 // Viewing page info is not a delveloper command but is meaningful for the 365 // Viewing page info is not a developer command but is meaningful for the
360 // same set of pages which developer commands are meaningful for. 366 // same set of pages which developer commands are meaningful for.
361 case IDS_CONTENT_CONTEXT_VIEWPAGEINFO: 367 case IDS_CONTENT_CONTEXT_VIEWPAGEINFO:
362 return IsDevCommandEnabled(id); 368 return IsDevCommandEnabled(id);
363 369
364 case IDS_CONTENT_CONTEXT_OPENLINKNEWTAB: 370 case IDS_CONTENT_CONTEXT_OPENLINKNEWTAB:
365 case IDS_CONTENT_CONTEXT_OPENLINKNEWWINDOW: 371 case IDS_CONTENT_CONTEXT_OPENLINKNEWWINDOW:
366 return params_.link_url.is_valid(); 372 return params_.link_url.is_valid();
367 373
368 case IDS_CONTENT_CONTEXT_COPYLINKLOCATION: 374 case IDS_CONTENT_CONTEXT_COPYLINKLOCATION:
369 return params_.unfiltered_link_url.is_valid(); 375 return params_.unfiltered_link_url.is_valid();
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 471
466 case IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD: 472 case IDS_CONTENT_CONTEXT_OPENLINKOFFTHERECORD:
467 return !profile_->IsOffTheRecord() && params_.link_url.is_valid(); 473 return !profile_->IsOffTheRecord() && params_.link_url.is_valid();
468 474
469 case IDS_CONTENT_CONTEXT_OPENFRAMEOFFTHERECORD: 475 case IDS_CONTENT_CONTEXT_OPENFRAMEOFFTHERECORD:
470 return !profile_->IsOffTheRecord() && params_.frame_url.is_valid(); 476 return !profile_->IsOffTheRecord() && params_.frame_url.is_valid();
471 477
472 case IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY: 478 case IDS_CONTENT_CONTEXT_ADD_TO_DICTIONARY:
473 return !params_.misspelled_word.empty(); 479 return !params_.misspelled_word.empty();
474 480
475 case IDS_CONTENT_CONTEXT_RELOAD:
476 case IDS_CONTENT_CONTEXT_COPYIMAGE: 481 case IDS_CONTENT_CONTEXT_COPYIMAGE:
477 case IDS_CONTENT_CONTEXT_PRINT: 482 case IDS_CONTENT_CONTEXT_PRINT:
478 case IDS_CONTENT_CONTEXT_SEARCHWEBFOR: 483 case IDS_CONTENT_CONTEXT_SEARCHWEBFOR:
479 case IDS_CONTENT_CONTEXT_GOTOURL: 484 case IDS_CONTENT_CONTEXT_GOTOURL:
480 case IDC_SPELLCHECK_SUGGESTION_0: 485 case IDC_SPELLCHECK_SUGGESTION_0:
481 case IDC_SPELLCHECK_SUGGESTION_1: 486 case IDC_SPELLCHECK_SUGGESTION_1:
482 case IDC_SPELLCHECK_SUGGESTION_2: 487 case IDC_SPELLCHECK_SUGGESTION_2:
483 case IDC_SPELLCHECK_SUGGESTION_3: 488 case IDC_SPELLCHECK_SUGGESTION_3:
484 case IDC_SPELLCHECK_SUGGESTION_4: 489 case IDC_SPELLCHECK_SUGGESTION_4:
485 case IDC_SPELLCHECK_MENU: 490 case IDC_SPELLCHECK_MENU:
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), 869 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages),
865 g_browser_process->clipboard()); 870 g_browser_process->clipboard());
866 } 871 }
867 872
868 void RenderViewContextMenu::MediaPlayerActionAt( 873 void RenderViewContextMenu::MediaPlayerActionAt(
869 const gfx::Point& location, 874 const gfx::Point& location,
870 const WebMediaPlayerAction& action) { 875 const WebMediaPlayerAction& action) {
871 source_tab_contents_->render_view_host()->MediaPlayerActionAt( 876 source_tab_contents_->render_view_host()->MediaPlayerActionAt(
872 location, action); 877 location, action);
873 } 878 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698