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

Unified Diff: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/Connect.cs

Issue 10758009: Native Client Visual Studio Add-in (Closed) Base URL: https://nativeclient-sdk.googlecode.com/svn/trunk/src
Patch Set: Style Fixed Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/Connect.cs
diff --git a/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/Connect.cs b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/Connect.cs
new file mode 100644
index 0000000000000000000000000000000000000000..ae4c615d12c9ef428cb27cb40c7159dec3906f95
--- /dev/null
+++ b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/Connect.cs
@@ -0,0 +1,129 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+using System;
elijahtaylor1 2012/07/11 20:56:18 ABC order
noelallen1 2012/07/11 22:16:46 Should using be in alphabetical like includes?
tysand 2012/07/12 23:56:15 Done.
tysand 2012/07/12 23:56:15 Done.
+using Extensibility;
+using EnvDTE;
+using EnvDTE80;
elijahtaylor1 2012/07/11 20:56:18 add newline
tysand 2012/07/12 23:56:15 Done.
+namespace NativeClientVSAddIn
noelallen1 2012/07/11 22:16:46 LF?
tysand 2012/07/12 23:56:15 Done.
+{
+ /// <summary>The object for implementing an Add-in</summary>
+ /// <seealso class='IDTExtensibility2' />
+ public class Connect : IDTExtensibility2
+ {
+ /// <summary>
+ /// Implements the OnConnection method of the IDTExtensibility2 interface.
+ /// Receives notification that the Add-in is being loaded.
+ /// </summary>
+ /// <param term='application'>Root object of the host application.</param>
+ /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
+ /// <param term='addInInst'>Object representing this Add-in.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnConnection(object application, ext_ConnectMode connectMode,
elijahtaylor1 2012/07/11 20:56:18 is connectMode unused intentionally? If so maybe
tysand 2012/07/12 23:56:15 Done.
+ object addInInst, ref Array custom)
elijahtaylor1 2012/07/11 20:56:18 You have no <param> for 'custom'... what is this?
tysand 2012/07/12 23:56:15 Done.
+ {
+ applicationObject_ = (DTE2)application;
+ addInInstance_ = (AddIn)addInInst;
+
+ DebuggerHelper = new PluginDebuggerHelper(applicationObject_);
+
+ debuggerEvents_ = applicationObject_.Events.DebuggerEvents;
+ debuggerEvents_.OnEnterDesignMode += Connect.DebuggerOnEnterDesignMode;
+ debuggerEvents_.OnEnterRunMode += Connect.DebuggerOnEnterRunMode;
+ }
+
+ /// <summary>
+ /// Called when Visual Studio ends a debugging session
noelallen1 2012/07/11 22:16:46 session. All sentences end with '.'.
tysand 2012/07/12 23:56:15 Done.
+ /// </summary>
+ /// <param name="reason">Unused</param>
+ public static void DebuggerOnEnterDesignMode(dbgEventReason reason)
+ {
+ DebuggerHelper.StopDebugging();
+ }
+
+ /// <summary>
+ /// Called when Visual Studio starts a debugging session
noelallen1 2012/07/11 22:16:46 session. Check your comments.
tysand 2012/07/12 23:56:15 Done.
+ /// </summary>
+ /// <param name="reason"></param>
elijahtaylor1 2012/07/11 20:56:18 Unused
tysand 2012/07/12 23:56:15 Done.
+ public static void DebuggerOnEnterRunMode(dbgEventReason reason)
+ {
+ // If we are starting debugging (not re-entering from a breakpoint)
+ // then create our debug helper
noelallen1 2012/07/11 22:16:46 Your comment suggests that you are determining if
tysand 2012/07/12 23:56:15 You're right about using reason. Also, I will chan
+ if (!DebuggerHelper.IsDebuggerRunning)
+ {
+ DebuggerHelper.InitializeFromProjectSettings();
noelallen1 2012/07/11 22:16:46 InitializeFromProjectSettings returns bool. You a
tysand 2012/07/12 23:56:15 Done.
+ DebuggerHelper.StartDebugging();
+ }
+ }
+
+ /// <summary>
+ /// Implements the OnDisconnection method of the IDTExtensibility2
+ /// interface. Receives notification that the Add-in is being unloaded.
+ /// </summary>
+ /// <param term='disconnectMode'>Describes how the Add-in is being unloaded.</param>
+ /// <param term='custom'>Array of parameters that are host application specific.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnDisconnection(ext_DisconnectMode disconnectMode, ref Array custom)
elijahtaylor1 2012/07/11 20:56:18 Can you add comments as to why we don't care about
tysand 2012/07/12 23:56:15 Is this necessary? We are required to implement th
+ {
+ }
+
+ /// <summary>
+ /// Implements the OnAddInsUpdate method of the IDTExtensibility2 interface.
+ /// Receives notification when the collection of Add-ins has changed.
+ /// </summary>
+ /// <param term='custom'>Array of parameters that are host application specific.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnAddInsUpdate(ref Array custom)
+ {
+ }
+
+ /// <summary>
+ /// Implements the OnStartupComplete method of the IDTExtensibility2
+ /// interface. Receives notification that the host application has completed loading.
+ /// </summary>
+ /// <param term='custom'>Array of parameters that are host application specific.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnStartupComplete(ref Array custom)
+ {
+ }
+
+ /// <summary>
+ /// Implements the OnBeginShutdown method of the IDTExtensibility2 interface.
+ /// Receives notification that the host application is being unloaded.
+ /// </summary>
+ /// <param term='custom'>Array of parameters that are host application specific.</param>
+ /// <seealso class='IDTExtensibility2' />
+ public void OnBeginShutdown(ref Array custom)
+ {
+ }
+
+ /// <summary>
+ /// Tells us if this add-in is applicable within this solution
+ /// </summary>
+ /// <returns>True if this add-in is applicable to this solution</returns>
noelallen1 2012/07/11 22:16:46 Applicable to this solution, or to the current con
tysand 2012/07/12 23:56:15 I've removed this function as it was outdated/unus
+ private bool IsNativeClientSolution()
+ {
+ bool result = false;
+ foreach (Project proj in applicationObject_.Solution.Projects)
+ {
+ String activePlatformName = proj.ConfigurationManager.ActiveConfiguration.PlatformName;
+ if (String.Compare(activePlatformName, Strings.NaClPlatformName, true) == 0)
+ {
+ result = true;
elijahtaylor1 2012/07/11 20:56:18 break?
noelallen1 2012/07/11 22:16:46 If any true is true, why not return true instead o
tysand 2012/07/12 23:56:15 Done.
tysand 2012/07/12 23:56:15 Done.
+ }
+ }
+
+ return result;
+ }
+
+ private DTE2 applicationObject_;
noelallen1 2012/07/11 22:16:46 Private? Where are they used?
tysand 2012/07/12 23:56:15 The debuggerEvents_ object needs to not be GCed so
+ private AddIn addInInstance_;
+ private DebuggerEvents debuggerEvents_;
+
+ /// <summary>
+ /// Holds methods related to running the plug-in and debugging
+ /// </summary>
+ private static PluginDebuggerHelper DebuggerHelper;
elijahtaylor1 2012/07/11 20:56:18 s/DebuggerHelper/debuggerHelper_/ throughout this
noelallen1 2012/07/11 22:16:46 Why is this static? Your OnConnection function cr
tysand 2012/07/12 23:56:15 Supposedly there should only be one add-in instanc
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698