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

Side by Side Diff: chrome/browser/extensions/extension_dom_ui.cc

Issue 596105: Bookmark Manager Drag and Drop backend.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 10 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) 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/extensions/extension_dom_ui.h" 5 #include "chrome/browser/extensions/extension_dom_ui.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/browser_list.h" 9 #include "chrome/browser/browser_list.h"
10 #include "chrome/browser/extensions/extension_bookmark_manager_api.h"
10 #include "chrome/browser/extensions/extensions_service.h" 11 #include "chrome/browser/extensions/extensions_service.h"
11 #include "chrome/browser/pref_service.h" 12 #include "chrome/browser/pref_service.h"
12 #include "chrome/browser/profile.h" 13 #include "chrome/browser/profile.h"
13 #include "chrome/browser/renderer_host/render_widget_host_view.h" 14 #include "chrome/browser/renderer_host/render_widget_host_view.h"
14 #include "chrome/browser/tab_contents/tab_contents.h" 15 #include "chrome/browser/tab_contents/tab_contents.h"
15 #include "chrome/common/bindings_policy.h" 16 #include "chrome/common/bindings_policy.h"
17 #include "chrome/common/chrome_switches.h"
16 #include "chrome/common/url_constants.h" 18 #include "chrome/common/url_constants.h"
17 19
18 namespace { 20 namespace {
19 const wchar_t kExtensionURLOverrides[] = L"extensions.chrome_url_overrides"; 21 const wchar_t kExtensionURLOverrides[] = L"extensions.chrome_url_overrides";
20 } 22 }
21 23
22 ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents) 24 ExtensionDOMUI::ExtensionDOMUI(TabContents* tab_contents)
23 : DOMUI(tab_contents) { 25 : DOMUI(tab_contents) {
24 // TODO(aa): It would be cool to show the extension's icon in here. 26 // TODO(aa): It would be cool to show the extension's icon in here.
25 hide_favicon_ = true; 27 hide_favicon_ = true;
(...skipping 15 matching lines...) Expand all
41 void ExtensionDOMUI::ResetExtensionFunctionDispatcher( 43 void ExtensionDOMUI::ResetExtensionFunctionDispatcher(
42 RenderViewHost* render_view_host) { 44 RenderViewHost* render_view_host) {
43 // Use the NavigationController to get the URL rather than the TabContents 45 // Use the NavigationController to get the URL rather than the TabContents
44 // since this is the real underlying URL (see HandleChromeURLOverride). 46 // since this is the real underlying URL (see HandleChromeURLOverride).
45 NavigationController& controller = tab_contents()->controller(); 47 NavigationController& controller = tab_contents()->controller();
46 const GURL& url = controller.GetActiveEntry()->url(); 48 const GURL& url = controller.GetActiveEntry()->url();
47 extension_function_dispatcher_.reset( 49 extension_function_dispatcher_.reset(
48 new ExtensionFunctionDispatcher(render_view_host, this, url)); 50 new ExtensionFunctionDispatcher(render_view_host, this, url));
49 } 51 }
50 52
53 void ExtensionDOMUI::ResetExtensionBookmarkManagerEventRouter() {
54 // TODO(arv): Move to ExtensionHost?
Erik does not do reviews 2010/02/19 23:47:17 ExtensionsService - but maybe I misunderstood what
arv (Not doing code reviews) 2010/02/20 00:04:31 Yes, each ExtensionDOMUI tab contents needs its ow
55 if (CommandLine::ForCurrentProcess()->HasSwitch(
56 switches::kEnableExperimentalExtensionApis)) {
57 extension_bookmark_manager_event_router_.reset(
58 new ExtensionBookmarkManagerEventRouter(GetProfile(), tab_contents()));
59 }
60 }
61
51 void ExtensionDOMUI::RenderViewCreated(RenderViewHost* render_view_host) { 62 void ExtensionDOMUI::RenderViewCreated(RenderViewHost* render_view_host) {
52 ResetExtensionFunctionDispatcher(render_view_host); 63 ResetExtensionFunctionDispatcher(render_view_host);
64 ResetExtensionBookmarkManagerEventRouter();
53 } 65 }
54 66
55 void ExtensionDOMUI::RenderViewReused(RenderViewHost* render_view_host) { 67 void ExtensionDOMUI::RenderViewReused(RenderViewHost* render_view_host) {
56 ResetExtensionFunctionDispatcher(render_view_host); 68 ResetExtensionFunctionDispatcher(render_view_host);
69 ResetExtensionBookmarkManagerEventRouter();
57 } 70 }
58 71
59 void ExtensionDOMUI::ProcessDOMUIMessage(const std::string& message, 72 void ExtensionDOMUI::ProcessDOMUIMessage(const std::string& message,
60 const Value* content, 73 const Value* content,
61 int request_id, 74 int request_id,
62 bool has_callback) { 75 bool has_callback) {
63 extension_function_dispatcher_->HandleRequest(message, content, request_id, 76 extension_function_dispatcher_->HandleRequest(message, content, request_id,
64 has_callback); 77 has_callback);
65 } 78 }
66 79
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 // If it's being unregistered, it should already be in the list. 280 // If it's being unregistered, it should already be in the list.
268 NOTREACHED(); 281 NOTREACHED();
269 continue; 282 continue;
270 } else { 283 } else {
271 StringValue override((*iter).second.spec()); 284 StringValue override((*iter).second.spec());
272 UnregisterAndReplaceOverride((*iter).first, profile, 285 UnregisterAndReplaceOverride((*iter).first, profile,
273 page_overrides, &override); 286 page_overrides, &override);
274 } 287 }
275 } 288 }
276 } 289 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_dom_ui.h ('k') | chrome/browser/extensions/extension_function_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698