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

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

Issue 173506: Fix crash in Linux extension shelf. (Closed)
Patch Set: Created 11 years, 3 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
OLDNEW
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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_host.h" 5 #include "chrome/browser/extensions/extension_host.h"
6 6
7 #include "app/resource_bundle.h" 7 #include "app/resource_bundle.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 render_view_host_->Shutdown(); // deletes render_view_host 56 render_view_host_->Shutdown(); // deletes render_view_host
57 } 57 }
58 58
59 void ExtensionHost::CreateView(Browser* browser) { 59 void ExtensionHost::CreateView(Browser* browser) {
60 #if defined(TOOLKIT_VIEWS) 60 #if defined(TOOLKIT_VIEWS)
61 view_.reset(new ExtensionView(this, browser)); 61 view_.reset(new ExtensionView(this, browser));
62 // We own |view_|, so don't auto delete when it's removed from the view 62 // We own |view_|, so don't auto delete when it's removed from the view
63 // hierarchy. 63 // hierarchy.
64 view_->SetParentOwned(false); 64 view_->SetParentOwned(false);
65 #elif defined(OS_LINUX) 65 #elif defined(OS_LINUX)
66 view_.reset(new ExtensionViewGtk(this)); 66 view_.reset(new ExtensionViewGtk(this, browser));
67 view_->Init();
67 #else 68 #else
68 // TODO(port) 69 // TODO(port)
69 NOTREACHED(); 70 NOTREACHED();
70 #endif 71 #endif
71 } 72 }
72 73
73 RenderProcessHost* ExtensionHost::render_process_host() const { 74 RenderProcessHost* ExtensionHost::render_process_host() const {
74 return render_view_host_->process(); 75 return render_view_host_->process();
75 } 76 }
76 77
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 } 292 }
292 293
293 void ExtensionHost::HandleMouseLeave() { 294 void ExtensionHost::HandleMouseLeave() {
294 #if defined(OS_WIN) 295 #if defined(OS_WIN)
295 if (view_.get()) 296 if (view_.get())
296 view_->HandleMouseLeave(); 297 view_->HandleMouseLeave();
297 #endif 298 #endif
298 } 299 }
299 300
300 Browser* ExtensionHost::GetBrowser() { 301 Browser* ExtensionHost::GetBrowser() {
301 #if defined(OS_WIN) 302 #if defined(OS_WIN) || defined(OS_LINUX)
302 if (view_.get()) 303 if (view_.get())
303 return view_->browser(); 304 return view_->browser();
304 #endif 305 #endif
305 Browser* browser = BrowserList::GetLastActiveWithProfile( 306 Browser* browser = BrowserList::GetLastActiveWithProfile(
306 render_view_host()->process()->profile()); 307 render_view_host()->process()->profile());
307 // NOTE(rafaelw): This can return NULL in some circumstances. In particular, 308 // NOTE(rafaelw): This can return NULL in some circumstances. In particular,
308 // a toolstrip or background_page onload chrome.tabs api call can make it 309 // a toolstrip or background_page onload chrome.tabs api call can make it
309 // into here before the browser is sufficiently initialized to return here. 310 // into here before the browser is sufficiently initialized to return here.
310 // A similar situation may arise during shutdown. 311 // A similar situation may arise during shutdown.
311 // TODO(rafaelw): Delay creation of background_page until the browser 312 // TODO(rafaelw): Delay creation of background_page until the browser
(...skipping 20 matching lines...) Expand all
332 window_id = ExtensionTabUtil::GetWindowId( 333 window_id = ExtensionTabUtil::GetWindowId(
333 const_cast<ExtensionHost* >(this)->GetBrowser()); 334 const_cast<ExtensionHost* >(this)->GetBrowser());
334 } else if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) { 335 } else if (extension_host_type_ == ViewType::EXTENSION_BACKGROUND_PAGE) {
335 // Background page is not attached to any browser window, so pass -1. 336 // Background page is not attached to any browser window, so pass -1.
336 window_id = -1; 337 window_id = -1;
337 } else { 338 } else {
338 NOTREACHED(); 339 NOTREACHED();
339 } 340 }
340 return window_id; 341 return window_id;
341 } 342 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gtk/extension_view_gtk.h » ('j') | chrome/browser/gtk/extension_view_gtk.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698