| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gtk/web_intent_picker_gtk.h" | 5 #include "chrome/browser/ui/gtk/web_intent_picker_gtk.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 WebIntentPickerGtk::WebIntentPickerGtk(Browser* browser, | 85 WebIntentPickerGtk::WebIntentPickerGtk(Browser* browser, |
| 86 TabContentsWrapper* wrapper, | 86 TabContentsWrapper* wrapper, |
| 87 WebIntentPickerDelegate* delegate) | 87 WebIntentPickerDelegate* delegate) |
| 88 : wrapper_(wrapper), | 88 : wrapper_(wrapper), |
| 89 delegate_(delegate), | 89 delegate_(delegate), |
| 90 contents_(NULL), | 90 contents_(NULL), |
| 91 button_hbox_(NULL), | 91 button_hbox_(NULL), |
| 92 bubble_(NULL), | 92 bubble_(NULL), |
| 93 browser_(browser) { | 93 browser_(browser) { |
| 94 DCHECK(delegate_ != NULL); | 94 DCHECK(delegate_ != NULL); |
| 95 DCHECK(browser); |
| 96 DCHECK(browser->window()); |
| 95 BrowserWindowGtk* browser_window = | 97 BrowserWindowGtk* browser_window = |
| 96 BrowserWindowGtk::GetBrowserWindowForNativeWindow( | 98 BrowserWindowGtk::GetBrowserWindowForNativeWindow( |
| 97 browser->window()->GetNativeHandle()); | 99 browser->window()->GetNativeHandle()); |
| 98 | 100 |
| 99 GtkWidget* anchor = browser_window-> | 101 GtkWidget* anchor = browser_window-> |
| 100 GetToolbar()->GetLocationBarView()->location_icon_widget(); | 102 GetToolbar()->GetLocationBarView()->location_icon_widget(); |
| 101 | 103 |
| 102 InitContents(); | 104 InitContents(); |
| 103 | 105 |
| 104 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ? | 106 BubbleGtk::ArrowLocationGtk arrow_location = base::i18n::IsRTL() ? |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 GtkWidget* button = GetServiceButton(index); | 160 GtkWidget* button = GetServiceButton(index); |
| 159 | 161 |
| 160 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 162 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
| 161 GdkPixbuf* icon_pixbuf = rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON); | 163 GdkPixbuf* icon_pixbuf = rb.GetNativeImageNamed(IDR_DEFAULT_FAVICON); |
| 162 SetServiceButtonImage(button, icon_pixbuf); | 164 SetServiceButtonImage(button, icon_pixbuf); |
| 163 } | 165 } |
| 164 | 166 |
| 165 void WebIntentPickerGtk::Close() { | 167 void WebIntentPickerGtk::Close() { |
| 166 bubble_->Close(); | 168 bubble_->Close(); |
| 167 bubble_ = NULL; | 169 bubble_ = NULL; |
| 168 | 170 if (inline_disposition_tab_contents_.get()) |
| 169 inline_disposition_tab_contents_.reset(); | 171 inline_disposition_tab_contents_->tab_contents()->OnCloseStarted(); |
| 170 inline_disposition_delegate_.reset(); | |
| 171 tab_contents_container_.reset(); | |
| 172 } | 172 } |
| 173 | 173 |
| 174 void WebIntentPickerGtk::BubbleClosing(BubbleGtk* bubble, | 174 void WebIntentPickerGtk::BubbleClosing(BubbleGtk* bubble, |
| 175 bool closed_by_escape) { | 175 bool closed_by_escape) { |
| 176 delegate_->OnClosing(); | 176 delegate_->OnClosing(); |
| 177 } | 177 } |
| 178 | 178 |
| 179 void WebIntentPickerGtk::OnCloseButtonClick(GtkWidget* button) { | 179 void WebIntentPickerGtk::OnCloseButtonClick(GtkWidget* button) { |
| 180 delegate_->OnCancelled(); | 180 delegate_->OnCancelled(); |
| 181 delegate_->OnClosing(); | 181 delegate_->OnClosing(); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 const TabContents* source) const { | 321 const TabContents* source) const { |
| 322 return true; | 322 return true; |
| 323 } | 323 } |
| 324 | 324 |
| 325 bool WebIntentPickerGtk::InlineDispositionDelegate:: | 325 bool WebIntentPickerGtk::InlineDispositionDelegate:: |
| 326 ShouldAddNavigationToHistory( | 326 ShouldAddNavigationToHistory( |
| 327 const history::HistoryAddPageArgs& add_page_args, | 327 const history::HistoryAddPageArgs& add_page_args, |
| 328 content::NavigationType navigation_type) { | 328 content::NavigationType navigation_type) { |
| 329 return false; | 329 return false; |
| 330 } | 330 } |
| OLD | NEW |