| OLD | NEW |
| 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/tab_contents/render_view_context_menu.h" | 5 #include "chrome/browser/tab_contents/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 10 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 10 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 virtual void TearDown() OVERRIDE { | 250 virtual void TearDown() OVERRIDE { |
| 251 registry_.reset(); | 251 registry_.reset(); |
| 252 ChromeRenderViewHostTestHarness::TearDown(); | 252 ChromeRenderViewHostTestHarness::TearDown(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 TestRenderViewContextMenu* CreateContextMenu() { | 255 TestRenderViewContextMenu* CreateContextMenu() { |
| 256 content::ContextMenuParams params = CreateParams(MenuItem::LINK); | 256 content::ContextMenuParams params = CreateParams(MenuItem::LINK); |
| 257 params.unfiltered_link_url = params.link_url; | 257 params.unfiltered_link_url = params.link_url; |
| 258 content::WebContents* wc = web_contents(); | 258 content::WebContents* wc = web_contents(); |
| 259 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( | 259 TestRenderViewContextMenu* menu = new TestRenderViewContextMenu( |
| 260 wc, params); | 260 wc->GetMainFrame(), params); |
| 261 // TestingProfile (returned by profile()) does not provide a protocol | 261 // TestingProfile (returned by profile()) does not provide a protocol |
| 262 // registry. | 262 // registry. |
| 263 menu->protocol_handler_registry_ = registry_.get(); | 263 menu->protocol_handler_registry_ = registry_.get(); |
| 264 menu->Init(); | 264 menu->Init(); |
| 265 return menu; | 265 return menu; |
| 266 } | 266 } |
| 267 | 267 |
| 268 private: | 268 private: |
| 269 scoped_ptr<ProtocolHandlerRegistry> registry_; | 269 scoped_ptr<ProtocolHandlerRegistry> registry_; |
| 270 }; | 270 }; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 282 menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD)); | 282 menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD)); |
| 283 | 283 |
| 284 // Disable Incognito mode. | 284 // Disable Incognito mode. |
| 285 IncognitoModePrefs::SetAvailability(profile()->GetPrefs(), | 285 IncognitoModePrefs::SetAvailability(profile()->GetPrefs(), |
| 286 IncognitoModePrefs::DISABLED); | 286 IncognitoModePrefs::DISABLED); |
| 287 menu.reset(CreateContextMenu()); | 287 menu.reset(CreateContextMenu()); |
| 288 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD)); | 288 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD)); |
| 289 EXPECT_FALSE( | 289 EXPECT_FALSE( |
| 290 menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD)); | 290 menu->IsCommandIdEnabled(IDC_CONTENT_CONTEXT_OPENLINKOFFTHERECORD)); |
| 291 } | 291 } |
| OLD | NEW |