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

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

Issue 2641813004: Convert SessionCrashedBubbleView to use the new navigation callbacks. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « chrome/browser/ui/views/session_crashed_bubble_view.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/session_crashed_bubble_view.h" 5 #include "chrome/browser/ui/views/session_crashed_bubble_view.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/ui/views/toolbar/toolbar_view.h" 26 #include "chrome/browser/ui/views/toolbar/toolbar_view.h"
27 #include "chrome/common/url_constants.h" 27 #include "chrome/common/url_constants.h"
28 #include "chrome/grit/chromium_strings.h" 28 #include "chrome/grit/chromium_strings.h"
29 #include "chrome/grit/generated_resources.h" 29 #include "chrome/grit/generated_resources.h"
30 #include "chrome/installer/util/google_update_settings.h" 30 #include "chrome/installer/util/google_update_settings.h"
31 #include "components/strings/grit/components_chromium_strings.h" 31 #include "components/strings/grit/components_chromium_strings.h"
32 #include "components/strings/grit/components_strings.h" 32 #include "components/strings/grit/components_strings.h"
33 #include "content/public/browser/browser_context.h" 33 #include "content/public/browser/browser_context.h"
34 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
35 #include "content/public/browser/notification_source.h" 35 #include "content/public/browser/notification_source.h"
36 #include "content/public/browser/render_frame_host.h"
36 #include "content/public/browser/web_contents.h" 37 #include "content/public/browser/web_contents.h"
37 #include "ui/base/l10n/l10n_util.h" 38 #include "ui/base/l10n/l10n_util.h"
38 #include "ui/views/bubble/bubble_frame_view.h" 39 #include "ui/views/bubble/bubble_frame_view.h"
39 #include "ui/views/controls/button/checkbox.h" 40 #include "ui/views/controls/button/checkbox.h"
40 #include "ui/views/controls/label.h" 41 #include "ui/views/controls/label.h"
41 #include "ui/views/controls/separator.h" 42 #include "ui/views/controls/separator.h"
42 #include "ui/views/controls/styled_label.h" 43 #include "ui/views/controls/styled_label.h"
43 #include "ui/views/layout/fill_layout.h" 44 #include "ui/views/layout/fill_layout.h"
44 #include "ui/views/layout/grid_layout.h" 45 #include "ui/views/layout/grid_layout.h"
45 #include "ui/views/layout/layout_constants.h" 46 #include "ui/views/layout/layout_constants.h"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 views::View* anchor_view, 194 views::View* anchor_view,
194 Browser* browser, 195 Browser* browser,
195 content::WebContents* web_contents, 196 content::WebContents* web_contents,
196 bool offer_uma_optin) 197 bool offer_uma_optin)
197 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT), 198 : BubbleDialogDelegateView(anchor_view, views::BubbleBorder::TOP_RIGHT),
198 content::WebContentsObserver(web_contents), 199 content::WebContentsObserver(web_contents),
199 browser_(browser), 200 browser_(browser),
200 web_contents_(web_contents), 201 web_contents_(web_contents),
201 uma_option_(NULL), 202 uma_option_(NULL),
202 offer_uma_optin_(offer_uma_optin), 203 offer_uma_optin_(offer_uma_optin),
203 started_navigation_(false), 204 first_navigation_ignored_(false),
204 restored_(false) { 205 restored_(false) {
205 set_close_on_deactivate(false); 206 set_close_on_deactivate(false);
206 registrar_.Add( 207 registrar_.Add(
207 this, 208 this,
208 chrome::NOTIFICATION_TAB_CLOSING, 209 chrome::NOTIFICATION_TAB_CLOSING,
209 content::Source<content::NavigationController>(&( 210 content::Source<content::NavigationController>(&(
210 web_contents->GetController()))); 211 web_contents->GetController())));
211 browser->tab_strip_model()->AddObserver(this); 212 browser->tab_strip_model()->AddObserver(this);
212 } 213 }
213 214
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 void SessionCrashedBubbleView::StyledLabelLinkClicked(views::StyledLabel* label, 328 void SessionCrashedBubbleView::StyledLabelLinkClicked(views::StyledLabel* label,
328 const gfx::Range& range, 329 const gfx::Range& range,
329 int event_flags) { 330 int event_flags) {
330 browser_->OpenURL(content::OpenURLParams( 331 browser_->OpenURL(content::OpenURLParams(
331 GURL("https://support.google.com/chrome/answer/96817"), 332 GURL("https://support.google.com/chrome/answer/96817"),
332 content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, 333 content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB,
333 ui::PAGE_TRANSITION_LINK, false)); 334 ui::PAGE_TRANSITION_LINK, false));
334 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_HELP); 335 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_HELP);
335 } 336 }
336 337
337 void SessionCrashedBubbleView::DidStartNavigationToPendingEntry(
338 const GURL& url,
339 content::ReloadType reload_type) {
340 started_navigation_ = true;
341 }
342
343 void SessionCrashedBubbleView::DidFinishLoad( 338 void SessionCrashedBubbleView::DidFinishLoad(
344 content::RenderFrameHost* render_frame_host, 339 content::RenderFrameHost* render_frame_host,
345 const GURL& validated_url) { 340 const GURL& validated_url) {
346 if (started_navigation_) 341 if (render_frame_host->GetParent())
sky 2017/01/19 00:39:42 How come you early out if there is a parent? Isn't
jam 2017/01/19 01:06:13 It's to maintain the same behavior as before, whic
347 CloseBubble(); 342 return;
343
344 if (!first_navigation_ignored_) {
345 first_navigation_ignored_ = true;
346 return;
347 }
348
349 CloseBubble();
348 } 350 }
349 351
350 void SessionCrashedBubbleView::WasShown() { 352 void SessionCrashedBubbleView::WasShown() {
351 GetWidget()->Show(); 353 GetWidget()->Show();
352 } 354 }
353 355
354 void SessionCrashedBubbleView::WasHidden() { 356 void SessionCrashedBubbleView::WasHidden() {
355 GetWidget()->Hide(); 357 GetWidget()->Hide();
356 } 358 }
357 359
(...skipping 21 matching lines...) Expand all
379 if (uma_option_ && uma_option_->checked()) { 381 if (uma_option_ && uma_option_->checked()) {
380 ChangeMetricsReportingState(true); 382 ChangeMetricsReportingState(true);
381 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN); 383 RecordBubbleHistogramValue(SESSION_CRASHED_BUBBLE_UMA_OPTIN);
382 } 384 }
383 CloseBubble(); 385 CloseBubble();
384 } 386 }
385 387
386 void SessionCrashedBubbleView::CloseBubble() { 388 void SessionCrashedBubbleView::CloseBubble() {
387 GetWidget()->Close(); 389 GetWidget()->Close();
388 } 390 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/session_crashed_bubble_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698