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

Side by Side Diff: chrome/browser/external_tab_container.cc

Issue 1205001: Revert 42366 - Allow TabContentsDelegate classes to specify whether InfoBars ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 9 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
« no previous file with comments | « chrome/browser/external_tab_container.h ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/external_tab_container.h" 5 #include "chrome/browser/external_tab_container.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "app/win_util.h" 9 #include "app/win_util.h"
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 tab_contents_(NULL), 47 tab_contents_(NULL),
48 tab_contents_container_(NULL), 48 tab_contents_container_(NULL),
49 tab_handle_(0), 49 tab_handle_(0),
50 ignore_next_load_notification_(false), 50 ignore_next_load_notification_(false),
51 automation_resource_message_filter_(filter), 51 automation_resource_message_filter_(filter),
52 load_requests_via_automation_(false), 52 load_requests_via_automation_(false),
53 handle_top_level_requests_(false), 53 handle_top_level_requests_(false),
54 external_method_factory_(this), 54 external_method_factory_(this),
55 enabled_extension_automation_(false), 55 enabled_extension_automation_(false),
56 waiting_for_unload_event_(false), 56 waiting_for_unload_event_(false),
57 pending_(false), 57 pending_(false) {
58 infobars_enabled_(true) {
59 } 58 }
60 59
61 ExternalTabContainer::~ExternalTabContainer() { 60 ExternalTabContainer::~ExternalTabContainer() {
62 Uninitialize(); 61 Uninitialize();
63 } 62 }
64 63
65 bool ExternalTabContainer::Init(Profile* profile, 64 bool ExternalTabContainer::Init(Profile* profile,
66 HWND parent, 65 HWND parent,
67 const gfx::Rect& bounds, 66 const gfx::Rect& bounds,
68 DWORD style, 67 DWORD style,
69 bool load_requests_via_automation, 68 bool load_requests_via_automation,
70 bool handle_top_level_requests, 69 bool handle_top_level_requests,
71 TabContents* existing_contents, 70 TabContents* existing_contents,
72 const GURL& initial_url, 71 const GURL& initial_url,
73 const GURL& referrer, 72 const GURL& referrer) {
74 bool infobars_enabled) {
75 if (IsWindow()) { 73 if (IsWindow()) {
76 NOTREACHED(); 74 NOTREACHED();
77 return false; 75 return false;
78 } 76 }
79 77
80 load_requests_via_automation_ = load_requests_via_automation; 78 load_requests_via_automation_ = load_requests_via_automation;
81 handle_top_level_requests_ = handle_top_level_requests; 79 handle_top_level_requests_ = handle_top_level_requests;
82 infobars_enabled_ = infobars_enabled;
83 80
84 set_window_style(WS_POPUP | WS_CLIPCHILDREN); 81 set_window_style(WS_POPUP | WS_CLIPCHILDREN);
85 views::WidgetWin::Init(NULL, bounds); 82 views::WidgetWin::Init(NULL, bounds);
86 if (!IsWindow()) { 83 if (!IsWindow()) {
87 NOTREACHED(); 84 NOTREACHED();
88 return false; 85 return false;
89 } 86 }
90 87
91 // TODO(jcampan): limit focus traversal to contents. 88 // TODO(jcampan): limit focus traversal to contents.
92 89
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // an unwrapped Profile. 344 // an unwrapped Profile.
348 bool result = new_container->Init( 345 bool result = new_container->Init(
349 new_contents->profile()->GetOriginalProfile(), 346 new_contents->profile()->GetOriginalProfile(),
350 NULL, 347 NULL,
351 initial_pos, 348 initial_pos,
352 WS_CHILD, 349 WS_CHILD,
353 load_requests_via_automation_, 350 load_requests_via_automation_,
354 handle_top_level_requests_, 351 handle_top_level_requests_,
355 new_contents, 352 new_contents,
356 GURL(), 353 GURL(),
357 GURL(), 354 GURL());
358 true);
359 355
360 if (result) { 356 if (result) {
361 uintptr_t cookie = reinterpret_cast<uintptr_t>(new_container.get()); 357 uintptr_t cookie = reinterpret_cast<uintptr_t>(new_container.get());
362 pending_tabs_[cookie] = new_container; 358 pending_tabs_[cookie] = new_container;
363 new_container->set_pending(true); 359 new_container->set_pending(true);
364 IPC::AttachExternalTabParams attach_params_; 360 IPC::AttachExternalTabParams attach_params_;
365 attach_params_.cookie = static_cast<uint64>(cookie); 361 attach_params_.cookie = static_cast<uint64>(cookie);
366 attach_params_.dimensions = initial_pos; 362 attach_params_.dimensions = initial_pos;
367 attach_params_.user_gesture = user_gesture; 363 attach_params_.user_gesture = user_gesture;
368 attach_params_.disposition = disposition; 364 attach_params_.disposition = disposition;
369 automation_->Send(new AutomationMsg_AttachExternalTab(0, 365 automation_->Send(new AutomationMsg_AttachExternalTab(0,
370 tab_handle_, attach_params_)); 366 tab_handle_, attach_params_));
371 } else { 367 } else {
372 NOTREACHED(); 368 NOTREACHED();
373 } 369 }
374 } 370 }
375 371
376 void ExternalTabContainer::TabContentsCreated(TabContents* new_contents) { 372 void ExternalTabContainer::TabContentsCreated(TabContents* new_contents) {
377 RenderViewHost* rvh = new_contents->render_view_host(); 373 RenderViewHost* rvh = new_contents->render_view_host();
378 DCHECK(rvh != NULL); 374 DCHECK(rvh != NULL);
379 375
380 // Register this render view as a pending render view, i.e. any network 376 // Register this render view as a pending render view, i.e. any network
381 // requests initiated by this render view would be serviced when the 377 // requests initiated by this render view would be serviced when the
382 // external host connects to the new external tab instance. 378 // external host connects to the new external tab instance.
383 RegisterRenderViewHostForAutomation(rvh, true); 379 RegisterRenderViewHostForAutomation(rvh, true);
384 } 380 }
385 381
386 bool ExternalTabContainer::infobars_enabled() {
387 return infobars_enabled_;
388 }
389
390 void ExternalTabContainer::ActivateContents(TabContents* contents) { 382 void ExternalTabContainer::ActivateContents(TabContents* contents) {
391 } 383 }
392 384
393 void ExternalTabContainer::LoadingStateChanged(TabContents* source) { 385 void ExternalTabContainer::LoadingStateChanged(TabContents* source) {
394 } 386 }
395 387
396 void ExternalTabContainer::CloseContents(TabContents* source) { 388 void ExternalTabContainer::CloseContents(TabContents* source) {
397 static const int kExternalTabCloseContentsDelayMS = 100; 389 static const int kExternalTabCloseContentsDelayMS = 100;
398 390
399 if (waiting_for_unload_event_) { 391 if (waiting_for_unload_event_) {
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 950
959 layout->StartRow(0, 0); 951 layout->StartRow(0, 0);
960 layout->AddView(info_bar_container); 952 layout->AddView(info_bar_container);
961 layout->StartRow(1, 0); 953 layout->StartRow(1, 0);
962 layout->AddView(tab_contents_container_); 954 layout->AddView(tab_contents_container_);
963 SetContentsView(external_tab_view); 955 SetContentsView(external_tab_view);
964 // Note that SetTabContents must be called after AddChildView is called 956 // Note that SetTabContents must be called after AddChildView is called
965 tab_contents_container_->ChangeTabContents(tab_contents_); 957 tab_contents_container_->ChangeTabContents(tab_contents_);
966 } 958 }
967 959
OLDNEW
« no previous file with comments | « chrome/browser/external_tab_container.h ('k') | chrome/browser/tab_contents/tab_contents.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698