Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/renderer_context_menu/render_view_context_menu.h" | 5 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_registry_simple.h" | 7 #include "base/prefs/pref_registry_simple.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
| 13 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 13 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
| 14 #include "chrome/browser/extensions/menu_manager.h" | 14 #include "chrome/browser/extensions/menu_manager.h" |
| 15 #include "chrome/browser/extensions/menu_manager_factory.h" | 15 #include "chrome/browser/extensions/menu_manager_factory.h" |
| 16 #include "chrome/browser/extensions/test_extension_environment.h" | 16 #include "chrome/browser/extensions/test_extension_environment.h" |
| 17 #include "chrome/browser/extensions/test_extension_prefs.h" | 17 #include "chrome/browser/extensions/test_extension_prefs.h" |
| 18 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" | 18 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings.h" |
| 19 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" | 19 #include "chrome/browser/net/spdyproxy/data_reduction_proxy_chrome_settings_fact ory.h" |
| 20 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 20 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 21 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h" | 21 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h" |
| 22 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
| 23 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 23 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 24 #include "chrome/test/base/testing_profile.h" | 24 #include "chrome/test/base/testing_profile.h" |
| 25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h" | 25 #include "components/data_reduction_proxy/core/browser/data_reduction_proxy_test _utils.h" |
| 26 #include "components/data_reduction_proxy/core/browser/data_store.h" | |
| 26 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h" | 27 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_heade rs.h" |
| 27 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" | 28 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_param s.h" |
| 28 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" | 29 #include "components/data_reduction_proxy/core/common/data_reduction_proxy_pref_ names.h" |
| 29 #include "content/public/browser/web_contents.h" | 30 #include "content/public/browser/web_contents.h" |
| 30 #include "content/public/test/web_contents_tester.h" | 31 #include "content/public/test/web_contents_tester.h" |
| 31 | 32 |
| 32 #include "extensions/browser/extension_prefs.h" | 33 #include "extensions/browser/extension_prefs.h" |
| 33 #include "extensions/common/url_pattern.h" | 34 #include "extensions/common/url_pattern.h" |
| 34 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 35 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 36 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 registry->RegisterDictionaryPref(prefs::kProxy); | 384 registry->RegisterDictionaryPref(prefs::kProxy); |
| 384 | 385 |
| 385 drp_test_context_->pref_service()->SetBoolean( | 386 drp_test_context_->pref_service()->SetBoolean( |
| 386 data_reduction_proxy::prefs::kDataReductionProxyEnabled, | 387 data_reduction_proxy::prefs::kDataReductionProxyEnabled, |
| 387 enable_data_reduction_proxy); | 388 enable_data_reduction_proxy); |
| 388 drp_test_context_->InitSettings(); | 389 drp_test_context_->InitSettings(); |
| 389 | 390 |
| 390 settings->InitDataReductionProxySettings( | 391 settings->InitDataReductionProxySettings( |
| 391 drp_test_context_->io_data(), drp_test_context_->pref_service(), | 392 drp_test_context_->io_data(), drp_test_context_->pref_service(), |
| 392 drp_test_context_->request_context_getter(), | 393 drp_test_context_->request_context_getter(), |
| 394 make_scoped_ptr(new data_reduction_proxy::DataStore()).Pass(), | |
| 395 base::ThreadTaskRunnerHandle::Get(), | |
| 393 base::ThreadTaskRunnerHandle::Get()); | 396 base::ThreadTaskRunnerHandle::Get()); |
|
jeremyim
2015/07/13 20:19:40
It would be nice (but not necessary) if more of th
Not at Google. Contact bengr
2015/07/14 16:41:30
It seems confusing to have 2 settings objects, so
jeremyim
2015/07/14 22:39:54
I'm not looking for reduction in total code lines;
Not at Google. Contact bengr
2015/07/15 00:08:17
Sounds good. I'll do this in a separate cl.
Not at Google. Contact bengr
2015/07/15 22:34:09
Jeremy: I investigated this further. Moving initia
| |
| 394 } | 397 } |
| 395 | 398 |
| 396 protected: | 399 protected: |
| 397 scoped_ptr<data_reduction_proxy::DataReductionProxyTestContext> | 400 scoped_ptr<data_reduction_proxy::DataReductionProxyTestContext> |
| 398 drp_test_context_; | 401 drp_test_context_; |
| 399 | 402 |
| 400 private: | 403 private: |
| 401 scoped_ptr<ProtocolHandlerRegistry> registry_; | 404 scoped_ptr<ProtocolHandlerRegistry> registry_; |
| 402 }; | 405 }; |
| 403 | 406 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 params.properties[data_reduction_proxy::chrome_proxy_header()] = | 481 params.properties[data_reduction_proxy::chrome_proxy_header()] = |
| 479 data_reduction_proxy::chrome_proxy_lo_fi_directive(); | 482 data_reduction_proxy::chrome_proxy_lo_fi_directive(); |
| 480 params.unfiltered_link_url = params.link_url; | 483 params.unfiltered_link_url = params.link_url; |
| 481 content::WebContents* wc = web_contents(); | 484 content::WebContents* wc = web_contents(); |
| 482 scoped_ptr<TestRenderViewContextMenu> menu( | 485 scoped_ptr<TestRenderViewContextMenu> menu( |
| 483 new TestRenderViewContextMenu(wc->GetMainFrame(), params)); | 486 new TestRenderViewContextMenu(wc->GetMainFrame(), params)); |
| 484 AppendImageItems(menu.get()); | 487 AppendImageItems(menu.get()); |
| 485 | 488 |
| 486 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_LOAD_ORIGINAL_IMAGE)); | 489 ASSERT_TRUE(menu->IsItemPresent(IDC_CONTENT_CONTEXT_LOAD_ORIGINAL_IMAGE)); |
| 487 } | 490 } |
| OLD | NEW |