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

Side by Side Diff: chrome/browser/ui/views/external_tab_container_win.cc

Issue 14307023: chrome: Use base::MessageLoop. (Part 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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) 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/ui/views/external_tab_container_win.h" 5 #include "chrome/browser/ui/views/external_tab_container_win.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlapp.h> 8 #include <atlapp.h>
9 #include <atlconv.h> 9 #include <atlconv.h>
10 #include <atlmisc.h> 10 #include <atlmisc.h>
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 263
264 if (!infobars_enabled) { 264 if (!infobars_enabled) {
265 InfoBarService* infobar_service = 265 InfoBarService* infobar_service =
266 InfoBarService::FromWebContents(existing_contents); 266 InfoBarService::FromWebContents(existing_contents);
267 infobar_service->set_infobars_enabled(false); 267 infobar_service->set_infobars_enabled(false);
268 } 268 }
269 269
270 // Start loading initial URL 270 // Start loading initial URL
271 if (!initial_url.is_empty()) { 271 if (!initial_url.is_empty()) {
272 // Navigate out of context since we don't have a 'tab_handle_' yet. 272 // Navigate out of context since we don't have a 'tab_handle_' yet.
273 MessageLoop::current()->PostTask( 273 base::MessageLoop::current()->PostTask(
274 FROM_HERE, 274 FROM_HERE,
275 base::Bind(&ExternalTabContainerWin::Navigate, 275 base::Bind(&ExternalTabContainerWin::Navigate,
276 weak_factory_.GetWeakPtr(), 276 weak_factory_.GetWeakPtr(),
277 initial_url, referrer)); 277 initial_url,
278 referrer));
278 } 279 }
279 280
280 // We need WS_POPUP to be on the window during initialization, but 281 // We need WS_POPUP to be on the window during initialization, but
281 // once initialized we apply the requested style which may or may not 282 // once initialized we apply the requested style which may or may not
282 // include the popup bit. 283 // include the popup bit.
283 // Note that it's important to do this before we call SetParent since 284 // Note that it's important to do this before we call SetParent since
284 // during the SetParent call we will otherwise get a WA_ACTIVATE call 285 // during the SetParent call we will otherwise get a WA_ACTIVATE call
285 // that causes us to steal the current focus. 286 // that causes us to steal the current focus.
286 SetWindowLong(window, GWL_STYLE, 287 SetWindowLong(window, GWL_STYLE,
287 (GetWindowLong(window, GWL_STYLE) & ~WS_POPUP) | style); 288 (GetWindowLong(window, GWL_STYLE) & ~WS_POPUP) | style);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 HWND parent_window) { 354 HWND parent_window) {
354 if (!automation_provider || !filter) { 355 if (!automation_provider || !filter) {
355 NOTREACHED(); 356 NOTREACHED();
356 return false; 357 return false;
357 } 358 }
358 359
359 automation_ = automation_provider; 360 automation_ = automation_provider;
360 automation_resource_message_filter_ = filter; 361 automation_resource_message_filter_ = filter;
361 // Wait for the automation channel to be initialized before resuming pending 362 // Wait for the automation channel to be initialized before resuming pending
362 // render views and sending in the navigation state. 363 // render views and sending in the navigation state.
363 MessageLoop::current()->PostTask( 364 base::MessageLoop::current()->PostTask(
364 FROM_HERE, base::Bind(&ExternalTabContainerWin::OnReinitialize, 365 FROM_HERE,
365 weak_factory_.GetWeakPtr())); 366 base::Bind(&ExternalTabContainerWin::OnReinitialize,
367 weak_factory_.GetWeakPtr()));
366 368
367 if (parent_window) 369 if (parent_window)
368 SetParent(views::HWNDForWidget(widget_), parent_window); 370 SetParent(views::HWNDForWidget(widget_), parent_window);
369 return true; 371 return true;
370 } 372 }
371 373
372 WebContents* ExternalTabContainerWin::GetWebContents() const { 374 WebContents* ExternalTabContainerWin::GetWebContents() const {
373 return web_contents_.get(); 375 return web_contents_.get();
374 } 376 }
375 377
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after
1306 if (params.disposition == CURRENT_TAB) { 1308 if (params.disposition == CURRENT_TAB) {
1307 DCHECK(route_all_top_level_navigations_); 1309 DCHECK(route_all_top_level_navigations_);
1308 forward_params.disposition = NEW_FOREGROUND_TAB; 1310 forward_params.disposition = NEW_FOREGROUND_TAB;
1309 } 1311 }
1310 WebContents* new_contents = 1312 WebContents* new_contents =
1311 ExternalTabContainerWin::OpenURLFromTab(source, forward_params); 1313 ExternalTabContainerWin::OpenURLFromTab(source, forward_params);
1312 // support only one navigation for a dummy tab before it is killed. 1314 // support only one navigation for a dummy tab before it is killed.
1313 widget_->CloseNow(); 1315 widget_->CloseNow();
1314 return new_contents; 1316 return new_contents;
1315 } 1317 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/extensions/extension_installed_bubble.cc ('k') | chrome/browser/ui/views/frame/browser_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698