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

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

Issue 434046: Support for chrome.experimental.popup API in ExternalTabContainer views (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years 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_popup_api.h" 5 #include "chrome/browser/extensions/extension_popup_api.h"
6 6
7 #include "base/gfx/point.h" 7 #include "base/gfx/point.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/common/extensions/extension.h" 10 #include "chrome/common/extensions/extension.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 error_ = kNotAnExtension; 132 error_ = kNotAnExtension;
133 return false; 133 return false;
134 } 134 }
135 gfx::Rect rect(origin.x(), origin.y(), dom_width, dom_height); 135 gfx::Rect rect(origin.x(), origin.y(), dom_width, dom_height);
136 136
137 // Pop-up from extension views (ExtensionShelf, etc.), and drop-down when 137 // Pop-up from extension views (ExtensionShelf, etc.), and drop-down when
138 // in a TabContents view. 138 // in a TabContents view.
139 BubbleBorder::ArrowLocation arrow_location = 139 BubbleBorder::ArrowLocation arrow_location =
140 (NULL != dispatcher()->GetExtensionHost()) ? BubbleBorder::BOTTOM_LEFT : 140 (NULL != dispatcher()->GetExtensionHost()) ? BubbleBorder::BOTTOM_LEFT :
141 BubbleBorder::TOP_LEFT; 141 BubbleBorder::TOP_LEFT;
142 popup_ = ExtensionPopup::Show(url, dispatcher()->GetBrowser(), rect, 142 popup_ = ExtensionPopup::Show(url, dispatcher()->GetBrowser(),
143 arrow_location, give_focus); 143 dispatcher()->profile(),
144 dispatcher()->GetFrameNativeWindow(),
145 rect,
146 arrow_location,
147 give_focus);
144 148
145 ExtensionPopupHost* popup_host = dispatcher()->GetPopupHost(); 149 ExtensionPopupHost* popup_host = dispatcher()->GetPopupHost();
146 DCHECK(popup_host); 150 DCHECK(popup_host);
147 151
148 popup_host->set_child_popup(popup_); 152 popup_host->set_child_popup(popup_);
149 popup_->set_delegate(popup_host); 153 popup_->set_delegate(popup_host);
150 #endif // defined(TOOLKIT_VIEWS) 154 #endif // defined(TOOLKIT_VIEWS)
151 return true; 155 return true;
152 } 156 }
153 157
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 void PopupEventRouter::OnPopupClosed(Profile* profile, 216 void PopupEventRouter::OnPopupClosed(Profile* profile,
213 int routing_id) { 217 int routing_id) {
214 std::string full_event_name = StringPrintf( 218 std::string full_event_name = StringPrintf(
215 extension_popup_module_events::kOnPopupClosed, 219 extension_popup_module_events::kOnPopupClosed,
216 routing_id); 220 routing_id);
217 221
218 profile->GetExtensionMessageService()->DispatchEventToRenderers( 222 profile->GetExtensionMessageService()->DispatchEventToRenderers(
219 full_event_name, 223 full_event_name,
220 base::JSONWriter::kEmptyArray); 224 base::JSONWriter::kEmptyArray);
221 } 225 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698